mirror of https://github.com/milvus-io/milvus.git
enhance: add index after load succeeded (#30015)
this avoids a corner case: after load index failed, this index can be never loaded as it has been added into the segment's index map Signed-off-by: yah01 <yang.cen@zilliz.com>pull/30066/head
parent
8f083e45cb
commit
9a3837212c
|
@ -374,7 +374,7 @@ func (s *LocalSegment) LastDeltaTimestamp() uint64 {
|
|||
return s.lastDeltaTimestamp.Load()
|
||||
}
|
||||
|
||||
func (s *LocalSegment) AddIndex(fieldID int64, info *IndexedFieldInfo) {
|
||||
func (s *LocalSegment) addIndex(fieldID int64, info *IndexedFieldInfo) {
|
||||
s.fieldIndexes.Insert(fieldID, info)
|
||||
}
|
||||
|
||||
|
@ -1145,6 +1145,13 @@ func (s *LocalSegment) LoadIndexInfo(ctx context.Context, indexInfo *querypb.Fie
|
|||
zap.Int64("fieldID", indexInfo.FieldID)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
s.addIndex(indexInfo.GetFieldID(), &IndexedFieldInfo{
|
||||
FieldBinlog: &datapb.FieldBinlog{
|
||||
FieldID: indexInfo.GetFieldID(),
|
||||
},
|
||||
IndexInfo: indexInfo,
|
||||
})
|
||||
log.Info("updateSegmentIndex done")
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1093,8 +1093,6 @@ func (loader *segmentLoader) loadFieldsIndex(ctx context.Context,
|
|||
zap.Int32("current_index_version", fieldInfo.IndexInfo.GetCurrentIndexVersion()),
|
||||
)
|
||||
|
||||
segment.AddIndex(fieldID, fieldInfo)
|
||||
|
||||
// set average row data size of variable field
|
||||
field, err := schemaHelper.GetFieldFromID(fieldID)
|
||||
if err != nil {
|
||||
|
@ -1519,10 +1517,6 @@ func (loader *segmentLoader) LoadIndex(ctx context.Context, segment *LocalSegmen
|
|||
log.Warn("failed to load index for segment", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
segment.AddIndex(info.FieldID, &IndexedFieldInfo{
|
||||
IndexInfo: info,
|
||||
FieldBinlog: fieldInfo,
|
||||
})
|
||||
}
|
||||
loader.notifyLoadFinish(loadInfo)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue