test(index): stabilize simple index nearest centroid test#7723
Merged
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughChangesVector index test execution
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
BubbleCal
marked this pull request as ready for review
July 10, 2026 11:34
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
westonpace
approved these changes
Jul 10, 2026
westonpace
left a comment
Member
There was a problem hiding this comment.
I did not realize we were still using rayon!
Contributor
Author
lol we should remove it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fix
What is the bug?
test_simple_index_nearest_centroidbuilds a small HNSW index in parallel and then requires an exact nearest-centroid result. HNSW node insertion mutates the shared graph concurrently, so Rayon scheduling can produce different graph topologies even though node-level RNG is seeded.What incorrect behavior does the bug cause?
The approximate search occasionally fails the strict
id == 42assertion and returns a nearby centroid such as 43 or 44. This makes the test flaky, especially under CPU contention, without indicating a production regression.How does this PR fix the problem?
Build the test's 100-point HNSW index inside a dedicated single-thread Rayon pool. This preserves the exact assertions while making graph construction deterministic. Production index construction and the binary nearest-centroid test are unchanged.
Validation
cargo test -p lance-index test_simple_index_nearest_centroid -- --nocaptureRAYON_NUM_THREADS=8: 0 failurescargo fmt --all -- --checkcargo clippy -p lance-index --tests -- -D warningsSummary by CodeRabbit