mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 20:09:57 +08:00
fix: Set & Return correct SegmentLevel in querynode segment manager (#29740)
See also #27349 The segment level label in querynode used `Legacy` before segment level was correctly passed in Load request. Now this attribute is still using legacy so the metrics does not look right. This PR add paramter for `NewSegment` and passes corrent values for each invocation. Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
cd34de7de5
commit
fe47deebf3
@ -98,7 +98,7 @@ func (sd *shardDelegator) ProcessInsert(insertRecords map[int64]*InsertData) {
|
|||||||
0,
|
0,
|
||||||
insertData.StartPosition,
|
insertData.StartPosition,
|
||||||
insertData.StartPosition,
|
insertData.StartPosition,
|
||||||
datapb.SegmentLevel_Legacy,
|
datapb.SegmentLevel_L1,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("failed to create new segment",
|
log.Error("failed to create new segment",
|
||||||
|
@ -74,18 +74,20 @@ type baseSegment struct {
|
|||||||
shard string
|
shard string
|
||||||
collectionID int64
|
collectionID int64
|
||||||
typ SegmentType
|
typ SegmentType
|
||||||
|
level datapb.SegmentLevel
|
||||||
version *atomic.Int64
|
version *atomic.Int64
|
||||||
startPosition *msgpb.MsgPosition // for growing segment release
|
startPosition *msgpb.MsgPosition // for growing segment release
|
||||||
bloomFilterSet *pkoracle.BloomFilterSet
|
bloomFilterSet *pkoracle.BloomFilterSet
|
||||||
}
|
}
|
||||||
|
|
||||||
func newBaseSegment(id, partitionID, collectionID int64, shard string, typ SegmentType, version int64, startPosition *msgpb.MsgPosition) baseSegment {
|
func newBaseSegment(id, partitionID, collectionID int64, shard string, typ SegmentType, level datapb.SegmentLevel, version int64, startPosition *msgpb.MsgPosition) baseSegment {
|
||||||
return baseSegment{
|
return baseSegment{
|
||||||
segmentID: id,
|
segmentID: id,
|
||||||
partitionID: partitionID,
|
partitionID: partitionID,
|
||||||
collectionID: collectionID,
|
collectionID: collectionID,
|
||||||
shard: shard,
|
shard: shard,
|
||||||
typ: typ,
|
typ: typ,
|
||||||
|
level: level,
|
||||||
version: atomic.NewInt64(version),
|
version: atomic.NewInt64(version),
|
||||||
startPosition: startPosition,
|
startPosition: startPosition,
|
||||||
bloomFilterSet: pkoracle.NewBloomFilterSet(id, partitionID, typ),
|
bloomFilterSet: pkoracle.NewBloomFilterSet(id, partitionID, typ),
|
||||||
@ -114,7 +116,7 @@ func (s *baseSegment) Type() SegmentType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *baseSegment) Level() datapb.SegmentLevel {
|
func (s *baseSegment) Level() datapb.SegmentLevel {
|
||||||
return datapb.SegmentLevel_Legacy
|
return s.level
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *baseSegment) StartPosition() *msgpb.MsgPosition {
|
func (s *baseSegment) StartPosition() *msgpb.MsgPosition {
|
||||||
@ -205,10 +207,12 @@ func NewSegment(ctx context.Context,
|
|||||||
zap.Int64("collectionID", collectionID),
|
zap.Int64("collectionID", collectionID),
|
||||||
zap.Int64("partitionID", partitionID),
|
zap.Int64("partitionID", partitionID),
|
||||||
zap.Int64("segmentID", segmentID),
|
zap.Int64("segmentID", segmentID),
|
||||||
zap.String("segmentType", segmentType.String()))
|
zap.String("segmentType", segmentType.String()),
|
||||||
|
zap.String("level", level.String()),
|
||||||
|
)
|
||||||
|
|
||||||
segment := &LocalSegment{
|
segment := &LocalSegment{
|
||||||
baseSegment: newBaseSegment(segmentID, partitionID, collectionID, shard, segmentType, version, startPosition),
|
baseSegment: newBaseSegment(segmentID, partitionID, collectionID, shard, segmentType, level, version, startPosition),
|
||||||
ptr: newPtr,
|
ptr: newPtr,
|
||||||
lastDeltaTimestamp: atomic.NewUint64(0),
|
lastDeltaTimestamp: atomic.NewUint64(0),
|
||||||
fieldIndexes: typeutil.NewConcurrentMap[int64, *IndexedFieldInfo](),
|
fieldIndexes: typeutil.NewConcurrentMap[int64, *IndexedFieldInfo](),
|
||||||
|
@ -62,7 +62,7 @@ func NewL0Segment(collection *Collection,
|
|||||||
zap.String("segmentType", segmentType.String()))
|
zap.String("segmentType", segmentType.String()))
|
||||||
|
|
||||||
segment := &L0Segment{
|
segment := &L0Segment{
|
||||||
baseSegment: newBaseSegment(segmentID, partitionID, collectionID, shard, segmentType, version, startPosition),
|
baseSegment: newBaseSegment(segmentID, partitionID, collectionID, shard, segmentType, datapb.SegmentLevel_L0, version, startPosition),
|
||||||
}
|
}
|
||||||
|
|
||||||
return segment, nil
|
return segment, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user