mirror of https://github.com/milvus-io/milvus.git
Fix datanode update segment statistics bug
Signed-off-by: XuanYang-cn <xuan.yang@zilliz.com>pull/4973/head^2
parent
795cb74c85
commit
c0edffc63f
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue