Skip to content
Snippets Groups Projects
Commit c0edffc6 authored by XuanYang-cn's avatar XuanYang-cn Committed by yefu.chen
Browse files

Fix datanode update segment statistics bug


Signed-off-by: default avatarXuanYang-cn <xuan.yang@zilliz.com>
parent 795cb74c
No related branches found
No related tags found
No related merge requests found
......@@ -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 {
......
......@@ -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) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment