Skip to content

Conversation

@ibhati
Copy link
Member

@ibhati ibhati commented Nov 5, 2025

Summary:
This PR fixes a bug in the Vamana index search buffer logic by adding a sort operation before inserting nodes. The change ensures that buffer invariants are maintained during the search process.

Changes:

  • Added search_buffer.sort() call in check_and_supplement_search_buffer() function
  • Ensures proper ordering before inserting new nodes into the search buffer

Impact:

  • Fixes potential correctness issues in Vamana index search operations
  • Maintains data structure invariants that were previously being violated
  • Performance impact is minimal as this code path is only executed in rare corner cases when:
    • The search buffer has fewer valid entries than the target window size
    • AND there are still unused nodes available in the index
    • This typically occurs when the graph becomes sparsely connected

This is a targeted bug fix that addresses a specific issue where the search buffer wasn't properly sorted before node insertions in edge cases, which could lead to incorrect search results or violated invariants in the Vamana graph search algorithm.

@ibhati ibhati merged commit 764e012 into main Nov 5, 2025
14 checks passed
@ibhati ibhati deleted the ib/sort_buffer branch November 5, 2025 19:42
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.

4 participants