Refine log of DropPartition (#12822)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
pull/12918/head
dragondriver 2021-12-07 21:11:04 +08:00 committed by GitHub
parent 0be72e1c1c
commit 2b22986e53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 56 additions and 22 deletions

View File

@ -875,6 +875,11 @@ func (node *Proxy) DropPartition(ctx context.Context, request *milvuspb.DropPart
if !node.checkHealthy() {
return unhealthyStatus(), nil
}
sp, ctx := trace.StartSpanFromContextWithOperationName(ctx, "Proxy-Insert")
defer sp.Finish()
traceID, _, _ := trace.InfoFromSpan(sp)
dpt := &dropPartitionTask{
ctx: ctx,
Condition: NewTaskCondition(ctx),
@ -883,44 +888,73 @@ func (node *Proxy) DropPartition(ctx context.Context, request *milvuspb.DropPart
result: nil,
}
log.Debug("DropPartition enqueue",
zap.String("role", Params.RoleName),
zap.String("db", request.DbName),
zap.String("collection", request.CollectionName),
zap.String("partition", request.PartitionName))
err := node.sched.ddQueue.Enqueue(dpt)
if err != nil {
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: err.Error(),
}, nil
}
method := "DropPartition"
log.Debug("DropPartition",
log.Debug(
rpcReceived(method),
zap.String("traceID", traceID),
zap.String("role", Params.RoleName),
zap.Int64("msgID", request.Base.MsgID),
zap.Uint64("timestamp", request.Base.Timestamp),
zap.String("db", request.DbName),
zap.String("collection", request.CollectionName),
zap.String("partition", request.PartitionName))
defer func() {
log.Debug("DropPartition Done",
if err := node.sched.ddQueue.Enqueue(dpt); err != nil {
log.Warn(
rpcFailedToEnqueue(method),
zap.Error(err),
zap.String("traceID", traceID),
zap.String("role", Params.RoleName),
zap.Int64("msgID", request.Base.MsgID),
zap.Uint64("timestamp", request.Base.Timestamp),
zap.String("db", request.DbName),
zap.String("collection", request.CollectionName),
zap.String("partition", request.PartitionName))
}()
err = dpt.WaitToFinish()
if err != nil {
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: err.Error(),
}, nil
}
log.Debug(
rpcEnqueued(method),
zap.String("traceID", traceID),
zap.String("role", Params.RoleName),
zap.Int64("MsgID", dpt.ID()),
zap.Uint64("BeginTS", dpt.BeginTs()),
zap.Uint64("EndTS", dpt.EndTs()),
zap.String("db", request.DbName),
zap.String("collection", request.CollectionName),
zap.String("partition", request.PartitionName))
if err := dpt.WaitToFinish(); err != nil {
log.Warn(
rpcFailedToWaitToFinish(method),
zap.Error(err),
zap.String("traceID", traceID),
zap.String("role", Params.RoleName),
zap.Int64("MsgID", dpt.ID()),
zap.Uint64("BeginTS", dpt.BeginTs()),
zap.Uint64("EndTS", dpt.EndTs()),
zap.String("db", request.DbName),
zap.String("collection", request.CollectionName),
zap.String("partition", request.PartitionName))
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: err.Error(),
}, nil
}
log.Debug(
rpcDone(method),
zap.String("traceID", traceID),
zap.String("role", Params.RoleName),
zap.Int64("MsgID", dpt.ID()),
zap.Uint64("BeginTS", dpt.BeginTs()),
zap.Uint64("EndTS", dpt.EndTs()),
zap.String("db", request.DbName),
zap.String("collection", request.CollectionName),
zap.String("partition", request.PartitionName))
return dpt.result, nil
}