Skip to content

Numeric index hardening - #8912

Merged
agourlay merged 1 commit into
devfrom
numeric-index-hardening
May 5, 2026
Merged

agourlay merged 1 commit into
devfrom
numeric-index-hardening

Conversation

@agourlay

@agourlay agourlay commented May 5, 2026

Copy link
Copy Markdown
Member

Extra hardening for the immutable numeric index.

  • Saturating_sub for points_count decrement in remove_point.
  • Lock the NumericKeySortedVec length invariant.
  • Simplify get_values. Same behavior, easier to read.
  • Document cached_ram_usage_bytes snapshot semantics.
  • Document the signature inconsistency for open_mmap.
  • New test_remove_reopen.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/segment/src/index/field_index/numeric_index/immutable_numeric_index.rs`:
- Line 77: The expression uses size_of::<Point<T>>() but size_of is not
imported; fix by either adding an import `use std::mem::size_of;` at the top of
the module or by replacing the call with the fully-qualified form
`std::mem::size_of::<Point<T>>()` in the expression that computes memory:
`data.capacity() * size_of::<Point<T>>() + deleted.capacity().div_ceil(u8::BITS
as usize)` so the code compiles.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5daa1891-1982-4bea-966d-99557608d2a9

📥 Commits

Reviewing files that changed from the base of the PR and between 49134ec and 339d24d.

📒 Files selected for processing (2)
  • lib/segment/src/index/field_index/numeric_index/immutable_numeric_index.rs
  • lib/segment/src/index/field_index/numeric_index/tests.rs

@qdrant qdrant deleted a comment from coderabbitai Bot May 5, 2026
@agourlay
agourlay merged commit b9be572 into dev May 5, 2026
15 checks passed
@agourlay
agourlay deleted the numeric-index-hardening branch May 5, 2026 12:16
timvisee pushed a commit that referenced this pull request May 8, 2026
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.

2 participants