mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
fix: Fix invalid pre-allocated segment IDs (#44350)
Mark the task as failed when PreAllocatedSegmentIDs is nil. issue: https://github.com/milvus-io/milvus/issues/44349 Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
parent
baa84e0b2b
commit
c15290c125
@ -18,6 +18,7 @@ package datacoord
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
@ -86,12 +87,16 @@ func (csm *compactionTaskMeta) reloadFromKV() error {
|
||||
return err
|
||||
}
|
||||
for _, task := range compactionTasks {
|
||||
// To maintain compatibility with versions ≤v2.4.12, which use `ResultSegments` as preallocate segment IDs.
|
||||
if task.PreAllocatedSegmentIDs == nil && len(task.GetResultSegments()) == 2 {
|
||||
task.PreAllocatedSegmentIDs = &datapb.IDRange{
|
||||
Begin: task.GetResultSegments()[0],
|
||||
End: task.GetResultSegments()[1],
|
||||
}
|
||||
// Compatibility handling: for milvus ≤v2.4, since compaction task has no PreAllocatedSegmentIDs field,
|
||||
// here we just mark the task as failed and wait for the compaction trigger to generate a new one.
|
||||
if task.PreAllocatedSegmentIDs == nil {
|
||||
log.Warn("PreAllocatedSegmentIDs is nil, mark the task as failed",
|
||||
zap.Int64("taskID", task.GetPlanID()),
|
||||
zap.String("type", task.GetType().String()),
|
||||
zap.String("originalState", task.State.String()),
|
||||
)
|
||||
task.State = datapb.CompactionTaskState_failed
|
||||
task.FailReason = fmt.Sprintf("PreAllocatedSegmentIDs is nil, taskID: %v", task.GetPlanID())
|
||||
}
|
||||
csm.saveCompactionTaskMemory(task)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user