Add some debug log to explore ocassionally channel name mismatch issue in create collection (#18414)

Signed-off-by: wayblink <anyang.wang@zilliz.com>
pull/18430/head
wayblink 2022-07-26 22:06:30 -07:00 committed by GitHub
parent 1e1c18fbab
commit c198e6c2d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 0 deletions

View File

@ -166,6 +166,16 @@ func (t *CreateCollectionReqTask) Execute(ctx context.Context) error {
deltaChanNames[i] = t.core.chanTimeTick.getDeltaChannelName()
deltaChanName, err1 := funcutil.ConvertChannelName(chanNames[i], Params.CommonCfg.RootCoordDml, Params.CommonCfg.RootCoordDelta)
if err1 != nil || deltaChanName != deltaChanNames[i] {
err1Msg := ""
if err1 != nil {
err1Msg = err1.Error()
}
log.Debug("dmlChanName deltaChanName mismatch detail", zap.Int32("i", i),
zap.String("vchanName", vchanNames[i]),
zap.String("phsicalChanName", chanNames[i]),
zap.String("deltaChanName", deltaChanNames[i]),
zap.String("converted_deltaChanName", deltaChanName),
zap.String("err", err1Msg))
return fmt.Errorf("dmlChanName %s and deltaChanName %s mis-match", chanNames[i], deltaChanNames[i])
}
}

View File

@ -12,9 +12,11 @@ import (
"github.com/milvus-io/milvus/internal/metastore/model"
"github.com/milvus-io/milvus/internal/proto/commonpb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/milvuspb"
"github.com/milvus-io/milvus/internal/proto/rootcoordpb"
"github.com/milvus-io/milvus/internal/proto/schemapb"
"github.com/milvus-io/milvus/internal/util/dependency"
)
func TestDescribeSegmentReqTask_Type(t *testing.T) {
@ -153,3 +155,41 @@ func TestCreateCollectionReqTask_Execute_hasSystemFields(t *testing.T) {
err = task.Execute(context.Background())
assert.Error(t, err)
}
func TestCreateCollectionReqTask_ChannelMismatch(t *testing.T) {
schema := &schemapb.CollectionSchema{Name: "test", Fields: []*schemapb.FieldSchema{{Name: "f1"}}}
marshaledSchema, err := proto.Marshal(schema)
assert.NoError(t, err)
msFactory := dependency.NewDefaultFactory(true)
Params.Init()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
core, err := NewCore(ctx, msFactory)
assert.NoError(t, err)
core.IDAllocator = func(count uint32) (typeutil.UniqueID, typeutil.UniqueID, error) {
return 0, 0, nil
}
core.chanTimeTick = newTimeTickSync(core.ctx, 1, core.factory, nil)
core.TSOAllocator = func(count uint32) (typeutil.Timestamp, error) {
return 0, nil
}
core.SendDdCreateCollectionReq = func(context.Context, *internalpb.CreateCollectionRequest, []string) (map[string][]byte, error) {
return map[string][]byte{}, nil
}
// set RootCoordDml="" to trigger a error for code coverage
Params.CommonCfg.RootCoordDml = ""
task := &CreateCollectionReqTask{
baseReqTask: baseReqTask{
core: core,
},
Req: &milvuspb.CreateCollectionRequest{
Base: &commonpb.MsgBase{MsgType: commonpb.MsgType_CreateCollection},
CollectionName: "test",
Schema: marshaledSchema,
},
}
err = task.Execute(context.Background())
assert.Error(t, err)
}