Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup for VisitedListHandle::check_and_update_visited #5427

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

xzfc
Copy link
Contributor

@xzfc xzfc commented Nov 12, 2024

Fixup for #5336. In #5336, I made an assumption that the num_points provided to VisitedPool::get() is always accurate and removed bounds check from VisitedListHandle::check_and_update_visited.

let mut visited_list = visited_pool.get(num_points);
visited_list.check_and_update_visited(point_id); // assumption: point_id < num_points

But it seems that it's not true. Chaos testing shows that it crashes in the following code:

let mut visited_list = self.visited_pool.get(id_tracker.total_point_count());
let iter = query_cardinality
.primary_clauses
.iter()
.flat_map(|clause| {
match clause {
PrimaryCondition::Condition(field_condition) => {
self.query_field(field_condition).unwrap_or_else(
|| id_tracker.iter_ids(), /* index is not built */
)
}
PrimaryCondition::Ids(ids) => Box::new(ids.iter().copied()),
PrimaryCondition::IsEmpty(_) => id_tracker.iter_ids(), /* there are no fast index for IsEmpty */
PrimaryCondition::IsNull(_) => id_tracker.iter_ids(), /* no fast index for IsNull too */
PrimaryCondition::HasVector(_) => id_tracker.iter_ids(), /* no fast index for HasVector */
}
})
.filter(move |&id| !visited_list.check_and_update_visited(id))

Perhaps the offending ids could come from PrimaryCondition::Ids/WAL/field_index? This PR restores the check.

@xzfc xzfc requested review from timvisee and generall November 12, 2024 10:55
@generall generall merged commit 2958049 into dev Nov 12, 2024
17 checks passed
@generall generall deleted the opt-visited-u8-fixup branch November 12, 2024 11:39
@timvisee timvisee mentioned this pull request Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants