mirror of https://github.com/milvus-io/milvus.git
fix: Report offline info in `GetDataDistribition` (#31347)
See also #31345 Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/31363/head
parent
26539a1b6d
commit
243e311515
|
@ -236,10 +236,15 @@ func (d *distribution) AddOfflines(segmentIDs ...int64) {
|
|||
|
||||
updated := false
|
||||
for _, segmentID := range segmentIDs {
|
||||
_, ok := d.sealedSegments[segmentID]
|
||||
entry, ok := d.sealedSegments[segmentID]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
// FIXME: remove offlie logic later
|
||||
// mark segment distribution as offline, set verion to unreadable
|
||||
entry.NodeID = wildcardNodeID
|
||||
entry.Version = unreadableTargetVersion
|
||||
d.sealedSegments[segmentID] = entry
|
||||
updated = true
|
||||
d.offlines.Insert(segmentID)
|
||||
}
|
||||
|
|
|
@ -640,6 +640,7 @@ func (s *DistributionSuite) TestAddOfflines() {
|
|||
SegmentID: 3,
|
||||
},
|
||||
},
|
||||
offlines: []int64{4},
|
||||
serviceable: true,
|
||||
},
|
||||
}
|
||||
|
@ -652,6 +653,18 @@ func (s *DistributionSuite) TestAddOfflines() {
|
|||
s.dist.AddDistributions(tc.input...)
|
||||
s.dist.AddOfflines(tc.offlines...)
|
||||
s.Equal(tc.serviceable, s.dist.Serviceable())
|
||||
|
||||
// current := s.dist.current.Load()
|
||||
for _, offline := range tc.offlines {
|
||||
// current.
|
||||
s.dist.mut.RLock()
|
||||
entry, ok := s.dist.sealedSegments[offline]
|
||||
s.dist.mut.RUnlock()
|
||||
if ok {
|
||||
s.EqualValues(-1, entry.NodeID)
|
||||
s.EqualValues(unreadableTargetVersion, entry.Version)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue