fix: the insert count is zero after set the pointer to nil (#29870)

this leads to the EntitiesNum metric would be never reduced

fix: #29766

Signed-off-by: yah01 <yang.cen@zilliz.com>
pull/29890/head
yah01 2024-01-11 14:56:50 +08:00 committed by GitHub
parent a4f15f4f43
commit 26e900180e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 5 deletions

View File

@ -250,10 +250,6 @@ func (s *LocalSegment) InsertCount() int64 {
s.ptrLock.RLock()
defer s.ptrLock.RUnlock()
if !s.isValid() {
return 0
}
return s.insertCount.Load()
}
@ -1012,5 +1008,6 @@ func (s *LocalSegment) Release() {
zap.Int64("partitionID", s.partitionID),
zap.Int64("segmentID", s.ID()),
zap.String("segmentType", s.typ.String()),
zap.Int64("insertCount", s.InsertCount()),
)
}

View File

@ -171,7 +171,6 @@ func (suite *SegmentSuite) TestSegmentReleased() {
sealed.ptrLock.RLock()
suite.False(sealed.isValid())
sealed.ptrLock.RUnlock()
suite.EqualValues(0, sealed.InsertCount())
suite.EqualValues(0, sealed.RowNum())
suite.EqualValues(0, sealed.MemSize())
suite.False(sealed.HasRawData(101))