mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
Should set index task retry not failed when task canceled (#26878)
Signed-off-by: cai.zhang <cai.zhang@zilliz.com>
This commit is contained in:
parent
0844e19505
commit
8b5b137207
@ -220,9 +220,9 @@ func (sched *TaskScheduler) processTask(t task, q TaskQueue) {
|
||||
pipelines := []func(context.Context) error{t.Prepare, t.BuildIndex, t.SaveIndexFiles}
|
||||
for _, fn := range pipelines {
|
||||
if err := wrap(fn); err != nil {
|
||||
if err == errCancel {
|
||||
log.Ctx(t.Ctx()).Warn("index build task canceled", zap.String("task", t.Name()))
|
||||
t.SetState(commonpb.IndexState_Failed, err.Error())
|
||||
if errors.Is(err, errCancel) {
|
||||
log.Ctx(t.Ctx()).Warn("index build task canceled, retry it", zap.String("task", t.Name()))
|
||||
t.SetState(commonpb.IndexState_Retry, err.Error())
|
||||
} else if errors.Is(err, ErrNoSuchKey) {
|
||||
t.SetState(commonpb.IndexState_Failed, err.Error())
|
||||
} else {
|
||||
|
||||
@ -164,9 +164,9 @@ func TestIndexTaskScheduler(t *testing.T) {
|
||||
tasks := make([]task, 0)
|
||||
|
||||
tasks = append(tasks,
|
||||
newTask(fakeTaskEnqueued, nil, commonpb.IndexState_Failed),
|
||||
newTask(fakeTaskPrepared, nil, commonpb.IndexState_Failed),
|
||||
newTask(fakeTaskBuiltIndex, nil, commonpb.IndexState_Failed),
|
||||
newTask(fakeTaskEnqueued, nil, commonpb.IndexState_Retry),
|
||||
newTask(fakeTaskPrepared, nil, commonpb.IndexState_Retry),
|
||||
newTask(fakeTaskBuiltIndex, nil, commonpb.IndexState_Retry),
|
||||
newTask(fakeTaskSavedIndexes, nil, commonpb.IndexState_Finished),
|
||||
newTask(fakeTaskSavedIndexes, map[fakeTaskState]error{fakeTaskSavedIndexes: fmt.Errorf("auth failed")}, commonpb.IndexState_Retry))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user