Skip to content

Replace has_deferred_points with deferred_points_count in SegmentEntry - #8391

Merged
IvanPleshkov merged 2 commits into
devfrom
feature/deferred-points-count
Mar 13, 2026
Merged

IvanPleshkov merged 2 commits into
devfrom
feature/deferred-points-count

Conversation

@qdrant-cloud-bot

Copy link
Copy Markdown
Contributor

Summary

  • Replaces has_deferred_points(&self) -> bool with deferred_points_count(&self) -> usize in the SegmentEntry trait, so callers can see the number of deferred points rather than just a boolean.
  • All existing call sites that only need a boolean check now compare against > 0.
  • Tests updated to assert on exact counts where applicable.

Test plan

  • cargo check passes
  • cargo +nightly fmt --all -- --check passes
  • CI passes all existing tests (including test_deferred_points)

Made with Cursor

…Entry

Change the `SegmentEntry` trait method from returning a boolean to
returning the actual count of deferred points (`usize`). This gives
callers more information without needing a separate method, while
existing boolean checks simply compare against zero.

Made-with: Cursor
@coderabbitai

coderabbitai Bot commented Mar 13, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 016294e9-7848-488c-be7a-04939217d812

📥 Commits

Reviewing files that changed from the base of the PR and between d75dbd7 and c26d504.

📒 Files selected for processing (1)
  • lib/segment/src/segment/entry.rs

📝 Walkthrough

Walkthrough

The PR replaces the boolean deferred-points predicate with a numeric counter across the codebase: has_deferred_points() is removed and replaced by deferred_points_count() -> usize in the NonAppendableSegmentEntry trait and its implementations (segment and proxy). Call sites now test deferred_points_count() > 0 (update worker, indexing optimizer, tests). The segment implementation computes the count based on deferred_internal_id and appendability; tests and optimizers were updated to use the count-based check.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • IvanPleshkov
  • timvisee
  • agourlay
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: replacing the has_deferred_points boolean method with deferred_points_count returning a usize count across the SegmentEntry trait and implementations.
Description check ✅ Passed The description is directly related to the changeset, explaining the rationale for replacing the boolean method with a count-based API, how call sites are updated, and what testing has been performed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/deferred-points-count
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.

OpenGrep is compatible with Semgrep configurations. Add an opengrep.yml or semgrep.yml configuration file to your project to enable OpenGrep analysis.

@generall
generall requested a review from agourlay March 13, 2026 15:05
@IvanPleshkov
IvanPleshkov merged commit f08d9cd into dev Mar 13, 2026
15 checks passed
@IvanPleshkov
IvanPleshkov deleted the feature/deferred-points-count branch March 13, 2026 16:06
@IvanPleshkov IvanPleshkov added this to the deferred updates milestone Mar 13, 2026
generall pushed a commit that referenced this pull request Mar 26, 2026
…Entry (#8391)

* Replace `has_deferred_points` with `deferred_points_count` in SegmentEntry

Change the `SegmentEntry` trait method from returning a boolean to
returning the actual count of deferred points (`usize`). This gives
callers more information without needing a separate method, while
existing boolean checks simply compare against zero.

Made-with: Cursor

* Fix clippy collapsible_if warning in deferred_points_count

Made-with: Cursor

---------

Co-authored-by: Cursor Agent <[email protected]>
KShivendu pushed a commit that referenced this pull request Mar 30, 2026
…Entry (#8391)

* Replace `has_deferred_points` with `deferred_points_count` in SegmentEntry

Change the `SegmentEntry` trait method from returning a boolean to
returning the actual count of deferred points (`usize`). This gives
callers more information without needing a separate method, while
existing boolean checks simply compare against zero.

Made-with: Cursor

* Fix clippy collapsible_if warning in deferred_points_count

Made-with: Cursor

---------

Co-authored-by: Cursor Agent <[email protected]>
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.

5 participants