enhance: modify log to avoid ambiguity and improve readability (#28331)

Signed-off-by: yah01 <yah2er0ne@outlook.com>
pull/28233/head
yah01 2023-11-10 14:32:20 +08:00 committed by GitHub
parent 3920bbc55f
commit 70995383bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 15 deletions

View File

@ -551,10 +551,10 @@ func (scheduler *taskScheduler) schedule(node int64) {
// The scheduler doesn't limit the number of tasks,
// to commit tasks to executors as soon as possible, to reach higher merge possibility
failCount := atomic.NewInt32(0)
commmittedNum := atomic.NewInt32(0)
funcutil.ProcessFuncParallel(len(toProcess), hardware.GetCPUNum(), func(idx int) error {
if !scheduler.process(toProcess[idx]) {
failCount.Inc()
if scheduler.process(toProcess[idx]) {
commmittedNum.Inc()
}
return nil
}, "process")
@ -565,7 +565,7 @@ func (scheduler *taskScheduler) schedule(node int64) {
log.Info("processed tasks",
zap.Int("toProcessNum", len(toProcess)),
zap.Int32("failCount", failCount.Load()),
zap.Int32("committedNum", commmittedNum.Load()),
zap.Int("toRemoveNum", len(toRemove)),
)
@ -689,7 +689,7 @@ func (scheduler *taskScheduler) recordSegmentTaskError(task *SegmentTask) {
zap.Int64("collectionID", task.CollectionID()),
zap.Int64("replicaID", task.ReplicaID()),
zap.Int64("segmentID", task.SegmentID()),
zap.Int32("taskStatus", task.Status()),
zap.String("status", task.Status()),
zap.Error(task.err),
)
meta.GlobalFailedLoadCache.Put(task.collectionID, task.Err())
@ -700,7 +700,7 @@ func (scheduler *taskScheduler) remove(task Task) {
zap.Int64("taskID", task.ID()),
zap.Int64("collectionID", task.CollectionID()),
zap.Int64("replicaID", task.ReplicaID()),
zap.Int32("taskStatus", task.Status()),
zap.String("status", task.Status()),
)
task.Cancel(nil)
scheduler.tasks.Remove(task.ID())
@ -725,7 +725,7 @@ func (scheduler *taskScheduler) remove(task Task) {
}
scheduler.updateTaskMetrics()
log.Debug("task removed", zap.Stack("stack"))
log.Info("task removed")
}
func (scheduler *taskScheduler) checkStale(task Task) error {

View File

@ -33,16 +33,16 @@ import (
)
type (
Status = int32
Status = string
Priority int32
)
const (
TaskStatusCreated Status = iota + 1
TaskStatusStarted
TaskStatusSucceeded
TaskStatusCanceled
TaskStatusFailed
TaskStatusCreated = "created"
TaskStatusStarted = "started"
TaskStatusSucceeded = "succeeded"
TaskStatusCanceled = "canceled"
TaskStatusFailed = "failed"
)
const (
@ -107,7 +107,7 @@ type baseTask struct {
loadType querypb.LoadType
source Source
status *atomic.Int32
status *atomic.String
priority Priority
err error
actions []Action
@ -128,7 +128,7 @@ func newBaseTask(ctx context.Context, source Source, collectionID, replicaID Uni
replicaID: replicaID,
shard: shard,
status: atomic.NewInt32(TaskStatusStarted),
status: atomic.NewString(TaskStatusStarted),
priority: TaskPriorityNormal,
ctx: ctx,
cancel: cancel,