diff --git a/internal/datanode/collection_replica.go b/internal/datanode/collection_replica.go index 740afb781748f68c367d324b2b04a22289964a3d..d283140761fbc58dc0bd63d723d162f2d8b78385 100644 --- a/internal/datanode/collection_replica.go +++ b/internal/datanode/collection_replica.go @@ -151,10 +151,11 @@ func (replica *ReplicaImpl) getSegmentStatisticsUpdates(segmentID UniqueID) (*in for _, ele := range replica.segments { if ele.segmentID == segmentID { updates := &internalpb2.SegmentStatisticsUpdates{ - SegmentID: segmentID, - MemorySize: ele.memorySize, - NumRows: ele.numRows, - IsNewSegment: ele.isNew, + SegmentID: segmentID, + MemorySize: ele.memorySize, + NumRows: ele.numRows, + IsNewSegment: ele.isNew, + StartPosition: new(internalpb2.MsgPosition), } if ele.isNew { diff --git a/internal/datanode/collection_replica_test.go b/internal/datanode/collection_replica_test.go index 2cb20b96c9ff8e28b6c244f93665f2c86cab6827..1c14c7b54857d421e62c275fcde2d741ce6b8069 100644 --- a/internal/datanode/collection_replica_test.go +++ b/internal/datanode/collection_replica_test.go @@ -124,6 +124,15 @@ func TestReplica_Segment(t *testing.T) { assert.Equal(t, UniqueID(0), update.SegmentID) assert.Equal(t, int64(100), update.NumRows) assert.True(t, update.IsNewSegment) + + update, err = replica.getSegmentStatisticsUpdates(0) + assert.NoError(t, err) + assert.False(t, update.IsNewSegment) + assert.NotNil(t, update.StartPosition) + assert.Equal(t, UniqueID(0), update.SegmentID) + assert.Equal(t, int64(100), update.NumRows) + assert.Zero(t, update.StartPosition.Timestamp) + assert.Zero(t, update.StartPosition.MsgID) }) t.Run("Test errors", func(t *testing.T) {