diff --git a/internal/datacoord/segment_info.go b/internal/datacoord/segment_info.go index a9ac2dc671a7c..8d9f6d08bdd13 100644 --- a/internal/datacoord/segment_info.go +++ b/internal/datacoord/segment_info.go @@ -508,9 +508,10 @@ func (s *SegmentInfo) getSegmentSize() int64 { return s.size.Load() } -// getDeltaCount use cached value when segment is immutable +// L1 segment deltaCount changes in any state +// L0 segment deltaCount won't change func (s *SegmentInfo) getDeltaCount() int64 { - if s.deltaRowcount.Load() < 0 || s.State != commonpb.SegmentState_Flushed { + if s.deltaRowcount.Load() <= 0 || s.GetLevel() != datapb.SegmentLevel_L0 { var rc int64 for _, deltaLogs := range s.GetDeltalogs() { for _, l := range deltaLogs.GetBinlogs() {