Repository navigation
Add deferred point count to UpdateQueueInfo - #8414
Conversation
| let (status, optimizer_status) = self.local_shard_status().await; | ||
|
|
||
| let update_queue = self.local_update_queue_info(); | ||
| let update_queue = self.local_update_queue_info().await; |
There was a problem hiding this comment.
It seems local_update_queue_info is also re-iterating over all segments.
Can't we merge the deferred_point_count accumulation into the previous segments traversal?
Was it done this way for re-usability?
There was a problem hiding this comment.
Was it done this way for re-usability?
Exactly. We also use this function for telemetry here. So it's duplicate code vs iterating twice. To have a single source of truth, I went with the iterating twice approach but I don't have a strong preference here.
There was a problem hiding this comment.
On a second thought, we could add a segments: Option<&[LockedSegment]> parameter to local_shard_status() and don't lock if Some(..). It's a bit hacky but his way we can reuse this function and keep code-duplication low. Wdyt?
13d93a9 to
b42848c
Compare
| } | ||
|
|
||
| pub async fn local_update_queue_info(&self) -> ShardUpdateQueueInfo { | ||
| let deferred_point_count = self |
There was a problem hiding this comment.
why not computing this only if prevent_unoptimized is on?
6964a86 to
3df439e
Compare
96c65ee to
0428cfa
Compare
0428cfa to
781ac69
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds an optional Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
lib/collection/src/tests/wal_recovery_test.rs (1)
539-539: Assertdeferred_pointshere too.This test now awaits
local_update_queue_info(), but it still only exerciseslength. Since the PR’s user-visible behavior is the newdeferred_pointsfield, add an assertion here (or a dedicated test) so regressions in its visibility/count do not go unnoticed.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/collection/src/tests/wal_recovery_test.rs` at line 539, After calling local_update_queue_info() and binding it to post_load_info, add an assertion that verifies post_load_info.deferred_points matches the expected deferred count (similar to the existing length assertion). For example, mirror the existing length check by asserting post_load_info.deferred_points == <expected_deferred_value> (or assert!(post_load_info.deferred_points > 0) if the test only requires non-zero), using the same expected value/source used for the previous length assertion so regressions in deferred_points visibility/count are caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/collection/src/operations/types.rs`:
- Around line 158-161: CollectionInfo currently drops deferred_points because
CollectionInfo::empty() returns UpdateQueueInfo::default() and collection-level
builders only aggregate length; fix this by wiring deferred_points through all
builders: change CollectionInfo::empty() to construct an UpdateQueueInfo that
sets deferred_points (e.g., Some(0) when prevent_unoptimized is true) instead of
UpdateQueueInfo::default(), update the collection-level aggregation in
lib/collection/src/collection/collection_ops.rs to sum shard
UpdateQueueInfo.deferred_points into CollectionInfo.update_queue.deferred_points
(analogous to length aggregation), and ensure any shard-to-collection
builder/merge logic propagates Option<usize> deferred_points (handling None
appropriately) so multi-shard collections reflect the correct total
deferred_points.
In `@lib/collection/src/shards/local_shard/mod.rs`:
- Around line 1026-1028: Typo in the log message: change the warn call that
references deferred_point_count (log::warn!("Failed to get deferred ponit
counts: {err:?}")) to use the correct spelling "point" (e.g., "Failed to get
deferred point counts: {err:?}"), updating the log::warn invocation in mod.rs
near the deferred_point_count handling to fix codespell CI failure.
- Around line 1015-1023: The deferred point counting currently calls
do_with_segments(..., true) which limits to appendable segments and misses
deferred points behind non-appendable ProxySegment instances; update the call in
do_with_segments (used to compute update_queue.deferred_points) to pass false
for the appendable_only flag so that segment.get().read().deferred_point_count()
aggregates across all segments (including non-appendable proxies) ensuring
deferred points aren't dropped during optimization.
---
Nitpick comments:
In `@lib/collection/src/tests/wal_recovery_test.rs`:
- Line 539: After calling local_update_queue_info() and binding it to
post_load_info, add an assertion that verifies post_load_info.deferred_points
matches the expected deferred count (similar to the existing length assertion).
For example, mirror the existing length check by asserting
post_load_info.deferred_points == <expected_deferred_value> (or
assert!(post_load_info.deferred_points > 0) if the test only requires non-zero),
using the same expected value/source used for the previous length assertion so
regressions in deferred_points visibility/count are caught.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6f716b66-7c2c-40b6-9601-c1ea99d5281d
📒 Files selected for processing (13)
docs/redoc/master/openapi.jsonlib/api/src/grpc/proto/collections.protolib/api/src/grpc/qdrant.rslib/collection/src/operations/conversions.rslib/collection/src/operations/types.rslib/collection/src/shards/local_shard/mod.rslib/collection/src/shards/local_shard/telemetry.rslib/collection/src/tests/wal_recovery_test.rslib/segment/src/entry/entry_point.rslib/segment/src/segment/entry.rslib/segment/src/segment/segment_ops.rslib/shard/src/proxy_segment/segment_entry.rslib/shard/src/segment_holder/mod.rs
💤 Files with no reviewable changes (1)
- lib/segment/src/segment/segment_ops.rs
| /// Number of points that are deferred (i.e hidden from search as they're not yet optimized). | ||
| #[anonymize(false)] | ||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||
| pub deferred_points: Option<usize>, |
There was a problem hiding this comment.
Finish wiring deferred_points through the remaining collection-level builders.
Adding the field here is only part of the plumbing: CollectionInfo::empty() still emits UpdateQueueInfo::default(), so empty collections hide the field even when prevent_unoptimized = true, and lib/collection/src/collection/collection_ops.rs still aggregates only length. Multi-shard CollectionInfo.update_queue.deferred_points will therefore be wrong or missing.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@lib/collection/src/operations/types.rs` around lines 158 - 161,
CollectionInfo currently drops deferred_points because CollectionInfo::empty()
returns UpdateQueueInfo::default() and collection-level builders only aggregate
length; fix this by wiring deferred_points through all builders: change
CollectionInfo::empty() to construct an UpdateQueueInfo that sets
deferred_points (e.g., Some(0) when prevent_unoptimized is true) instead of
UpdateQueueInfo::default(), update the collection-level aggregation in
lib/collection/src/collection/collection_ops.rs to sum shard
UpdateQueueInfo.deferred_points into CollectionInfo.update_queue.deferred_points
(analogous to length aggregation), and ensure any shard-to-collection
builder/merge logic propagates Option<usize> deferred_points (handling None
appropriately) so multi-shard collections reflect the correct total
deferred_points.
* Add deferred point count to UpdateQueueInfo * Hide if prevent_unoptimized is false * Clippy * Openapi * Iterate over appendable segments only * Only calculate deferred point count if prevent_unoptimized is true * Rebase fixes * Codespell
* Add deferred point count to UpdateQueueInfo * Hide if prevent_unoptimized is false * Clippy * Openapi * Iterate over appendable segments only * Only calculate deferred point count if prevent_unoptimized is true * Rebase fixes * Codespell
Depends on #8366
Adds the amount of deferred points to the
UpdateQueueInfoto make it public viaCollectionInfo.