mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 17:48:29 +08:00
fix: add segment lock in LoadTextIndex and LoadJSONKeyIndex (#43811)
fix: add segment lock in LoadTextIndex and LoadJSONKeyIndex issue:https://github.com/milvus-io/milvus/issues/43572 Signed-off-by: Xianhui.Lin <xianhui.lin@zilliz.com>
This commit is contained in:
parent
084f777552
commit
c7d8dc100a
@ -1091,6 +1091,11 @@ func (s *LocalSegment) innerLoadIndex(ctx context.Context,
|
||||
func (s *LocalSegment) LoadTextIndex(ctx context.Context, textLogs *datapb.TextIndexStats, schemaHelper *typeutil.SchemaHelper) error {
|
||||
log.Ctx(ctx).Info("load text index", zap.Int64("field id", textLogs.GetFieldID()), zap.Any("text logs", textLogs))
|
||||
|
||||
if !s.ptrLock.PinIf(state.IsNotReleased) {
|
||||
return merr.WrapErrSegmentNotLoaded(s.ID(), "segment released")
|
||||
}
|
||||
defer s.ptrLock.Unpin()
|
||||
|
||||
f, err := schemaHelper.GetFieldFromID(textLogs.GetFieldID())
|
||||
if err != nil {
|
||||
return err
|
||||
@ -1125,6 +1130,11 @@ func (s *LocalSegment) LoadTextIndex(ctx context.Context, textLogs *datapb.TextI
|
||||
}
|
||||
|
||||
func (s *LocalSegment) LoadJSONKeyIndex(ctx context.Context, jsonKeyStats *datapb.JsonKeyStats, schemaHelper *typeutil.SchemaHelper) error {
|
||||
if !s.ptrLock.PinIf(state.IsNotReleased) {
|
||||
return merr.WrapErrSegmentNotLoaded(s.ID(), "segment released")
|
||||
}
|
||||
defer s.ptrLock.Unpin()
|
||||
|
||||
if jsonKeyStats.GetJsonKeyStatsDataFormat() == 0 {
|
||||
log.Ctx(ctx).Info("load json key index failed dataformat invalid", zap.Int64("dataformat", jsonKeyStats.GetJsonKeyStatsDataFormat()), zap.Int64("field id", jsonKeyStats.GetFieldID()), zap.Any("json key logs", jsonKeyStats))
|
||||
return nil
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user