Skip to content

Commit

Permalink
Fixup for VisitedListHandle::check_and_update_visited (#5427)
Browse files Browse the repository at this point in the history
  • Loading branch information
xzfc authored and timvisee committed Nov 12, 2024
1 parent 17bce6e commit 157d556
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/segment/src/index/visited_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ impl<'a> VisitedListHandle<'a> {
/// Updates visited list
/// return `true` if point was visited before
pub fn check_and_update_visited(&mut self, point_id: PointOffsetType) -> bool {
let idx = point_id as usize;
if idx >= self.visited_list.visit_counters.len() {
self.visited_list.visit_counters.resize(idx + 1, 0);
}
std::mem::replace(
&mut self.visited_list.visit_counters[point_id as usize],
&mut self.visited_list.visit_counters[idx],
self.visited_list.current_iter,
) == self.visited_list.current_iter
}
Expand Down

0 comments on commit 157d556

Please sign in to comment.