mirror of https://github.com/milvus-io/milvus.git
add more log for create collection (#6478)
Signed-off-by: yefu.chen <yefu.chen@zilliz.com>pull/6489/head
parent
32d6ae053b
commit
b66157358c
|
@ -105,7 +105,6 @@ func (c *GrpcClient) connect(retryOptions ...retry.Option) error {
|
|||
grpc_middleware.ChainUnaryClient(
|
||||
grpc_retry.UnaryClientInterceptor(
|
||||
grpc_retry.WithMax(3),
|
||||
grpc_retry.WithPerRetryTimeout(time.Second*3),
|
||||
grpc_retry.WithCodes(codes.Aborted, codes.Unavailable),
|
||||
),
|
||||
grpc_opentracing.UnaryClientInterceptor(opts...),
|
||||
|
@ -113,7 +112,6 @@ func (c *GrpcClient) connect(retryOptions ...retry.Option) error {
|
|||
grpc.WithStreamInterceptor(
|
||||
grpc_middleware.ChainStreamClient(
|
||||
grpc_retry.StreamClientInterceptor(grpc_retry.WithMax(3),
|
||||
grpc_retry.WithPerRetryTimeout(time.Second*3),
|
||||
grpc_retry.WithCodes(codes.Aborted, codes.Unavailable),
|
||||
),
|
||||
grpc_opentracing.StreamClientInterceptor(opts...),
|
||||
|
|
|
@ -1178,7 +1178,7 @@ func (c *Core) CreateCollection(ctx context.Context, in *milvuspb.CreateCollecti
|
|||
}
|
||||
err := executeTask(t)
|
||||
if err != nil {
|
||||
log.Debug("CreateCollection failed", zap.String("name", in.CollectionName), zap.Int64("msgID", in.Base.MsgID))
|
||||
log.Debug("CreateCollection failed", zap.String("name", in.CollectionName), zap.Int64("msgID", in.Base.MsgID), zap.Error(err))
|
||||
return &commonpb.Status{
|
||||
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
||||
Reason: "Create collection failed: " + err.Error(),
|
||||
|
|
|
@ -82,7 +82,7 @@ func (t *CreateCollectionReqTask) Execute(ctx context.Context) error {
|
|||
var schema schemapb.CollectionSchema
|
||||
err := proto.Unmarshal(t.Req.Schema, &schema)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("unmarshal schema error= %w", err)
|
||||
}
|
||||
|
||||
if t.Req.CollectionName != schema.Name {
|
||||
|
@ -116,12 +116,12 @@ func (t *CreateCollectionReqTask) Execute(ctx context.Context) error {
|
|||
|
||||
collID, _, err := t.core.IDAllocator(1)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("alloc collection id error = %w", err)
|
||||
}
|
||||
collTs := t.Req.Base.Timestamp
|
||||
partID, _, err := t.core.IDAllocator(1)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("alloc partition id error = %w", err)
|
||||
}
|
||||
|
||||
log.Debug("collection name -> id",
|
||||
|
@ -153,7 +153,7 @@ func (t *CreateCollectionReqTask) Execute(ctx context.Context) error {
|
|||
// so need Marshal again
|
||||
schemaBytes, err := proto.Marshal(&schema)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("marshal schema error = %w", err)
|
||||
}
|
||||
|
||||
ddCollReq := internalpb.CreateCollectionRequest{
|
||||
|
@ -178,7 +178,7 @@ func (t *CreateCollectionReqTask) Execute(ctx context.Context) error {
|
|||
|
||||
ts, err := t.core.MetaTable.AddCollection(&collInfo, idxInfo, ddOp)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("meta table add collection failed,error = %w", err)
|
||||
}
|
||||
|
||||
// add dml channel before send dd msg
|
||||
|
@ -186,13 +186,17 @@ func (t *CreateCollectionReqTask) Execute(ctx context.Context) error {
|
|||
|
||||
err = t.core.SendDdCreateCollectionReq(ctx, &ddCollReq, chanNames)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("send dd create collection req failed, error = %w", err)
|
||||
}
|
||||
|
||||
t.core.SendTimeTick(ts)
|
||||
|
||||
// Update DDOperation in etcd
|
||||
return t.core.setDdMsgSendFlag(true)
|
||||
err = t.core.setDdMsgSendFlag(true)
|
||||
if err != nil {
|
||||
return fmt.Errorf("send dd msg send flag failed,error = %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type DropCollectionReqTask struct {
|
||||
|
|
|
@ -88,7 +88,7 @@ class TestCreateCollection:
|
|||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "Create collection failed: collection %s exist" % collection
|
||||
assert message == "Create collection failed: meta table add collection failed,error = collection %s exist" % collection
|
||||
|
||||
@pytest.mark.tags(CaseLabel.tags_smoke)
|
||||
def test_create_collection_after_insert_flush(self, connect, collection):
|
||||
|
@ -105,7 +105,7 @@ class TestCreateCollection:
|
|||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "Create collection failed: collection %s exist" % collection
|
||||
assert message == "Create collection failed: meta table add collection failed,error = collection %s exist" % collection
|
||||
|
||||
# TODO: assert exception
|
||||
def test_create_collection_without_connection(self, dis_connect):
|
||||
|
@ -133,7 +133,7 @@ class TestCreateCollection:
|
|||
code = getattr(e, 'code', "The exception does not contain the field of code.")
|
||||
assert code == 1
|
||||
message = getattr(e, 'message', "The exception does not contain the field of message.")
|
||||
assert message == "Create collection failed: collection %s exist" % collection_name
|
||||
assert message == "Create collection failed: meta table add collection failed,error = collection %s exist" % collection_name
|
||||
|
||||
@pytest.mark.tags(CaseLabel.tags_smoke)
|
||||
def test_create_after_drop_collection(self, connect, collection):
|
||||
|
|
Loading…
Reference in New Issue