Fix print ddl binlog bug

Signed-off-by: XuanYang-cn <xuan.yang@zilliz.com>
pull/4973/head^2
XuanYang-cn 2021-01-05 12:20:30 +08:00 committed by yefu.chen
parent 9f339ef8ce
commit fa77783ad7
2 changed files with 13 additions and 18 deletions

View File

@ -88,7 +88,6 @@ func (it *IndexAddTask) Execute() error {
t.table = it.table
t.indexID = it.indexID
t.kv = it.kv
t.req = it.req
var cancel func()
t.ctx, cancel = context.WithTimeout(it.ctx, reqTimeoutInterval)
defer cancel()
@ -122,7 +121,7 @@ type IndexBuildTask struct {
indexID UniqueID
kv kv.Base
savePaths []string
req *indexbuilderpb.BuildIndexRequest
indexMeta *indexbuilderpb.IndexMeta
}
func newIndexBuildTask() *IndexBuildTask {
@ -152,7 +151,7 @@ func (it *IndexBuildTask) Execute() error {
}
typeParams := make(map[string]string)
for _, kvPair := range it.req.GetTypeParams() {
for _, kvPair := range it.indexMeta.Req.GetTypeParams() {
key, value := kvPair.GetKey(), kvPair.GetValue()
_, ok := typeParams[key]
if ok {
@ -162,7 +161,7 @@ func (it *IndexBuildTask) Execute() error {
}
indexParams := make(map[string]string)
for _, kvPair := range it.req.GetIndexParams() {
for _, kvPair := range it.indexMeta.Req.GetIndexParams() {
key, value := kvPair.GetKey(), kvPair.GetValue()
_, ok := indexParams[key]
if ok {
@ -202,7 +201,7 @@ func (it *IndexBuildTask) Execute() error {
return blobs
}
toLoadDataPaths := it.req.GetDataPaths()
toLoadDataPaths := it.indexMeta.Req.GetDataPaths()
keys := make([]string, 0)
blobs := make([]*Blob, 0)
for _, path := range toLoadDataPaths {

View File

@ -310,32 +310,28 @@ func printDDLPayloadValues(eventType EventTypeCode, colType schemapb.DataType, r
switch eventType {
case CreateCollectionEventType:
var req internalpb.CreateCollectionRequest
if err := proto.Unmarshal(([]byte)(val), &req); err != nil {
if err := proto.UnmarshalText(val, &req); err != nil {
return err
}
msg := proto.MarshalTextString(&req)
fmt.Printf("\t\t%d : create collection: %s\n", i, msg)
fmt.Printf("\t\t%d : create collection: %v\n", i, req)
case DropCollectionEventType:
var req internalpb.DropPartitionRequest
if err := proto.Unmarshal(([]byte)(val), &req); err != nil {
var req internalpb.DropCollectionRequest
if err := proto.UnmarshalText(val, &req); err != nil {
return err
}
msg := proto.MarshalTextString(&req)
fmt.Printf("\t\t%d : drop collection: %s\n", i, msg)
fmt.Printf("\t\t%d : drop collection: %v\n", i, req)
case CreatePartitionEventType:
var req internalpb.CreatePartitionRequest
if err := proto.Unmarshal(([]byte)(val), &req); err != nil {
if err := proto.UnmarshalText(val, &req); err != nil {
return err
}
msg := proto.MarshalTextString(&req)
fmt.Printf("\t\t%d : create partition: %s\n", i, msg)
fmt.Printf("\t\t%d : create partition: %v\n", i, req)
case DropPartitionEventType:
var req internalpb.DropPartitionRequest
if err := proto.Unmarshal(([]byte)(val), &req); err != nil {
if err := proto.UnmarshalText(val, &req); err != nil {
return err
}
msg := proto.MarshalTextString(&req)
fmt.Printf("\t\t%d : drop partition: %s\n", i, msg)
fmt.Printf("\t\t%d : drop partition: %v\n", i, req)
default:
return errors.Errorf("undefined ddl event type %d", eventType)
}