Skip to content

Disable deferred point filtering in resharding - #8310

Merged
JojiiOfficial merged 12 commits into
devfrom
deferred-points-ignore-flag-in-scroll
Mar 11, 2026
Merged

JojiiOfficial merged 12 commits into
devfrom
deferred-points-ignore-flag-in-scroll

Conversation

@JojiiOfficial

@JojiiOfficial JojiiOfficial commented Mar 6, 2026 •

Copy link
Copy Markdown
Member

This PR adds a flag to internal scroll functions, which allows us to disable filtering deferred points in resharding.

@JojiiOfficial JojiiOfficial added this to the deferred updates milestone Mar 6, 2026
&runtime_handle,
hw_measurement_acc.clone(),
None, // no timeout on update path
// Ignoring deferred points here since they could be part of the update operation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I suggest to ignore deferred points here as well for the commented reason.
Please let me know if this is not preferred!

&self.search_runtime,
None,
hw_measurement_acc.clone(),
true,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This function is only used in resharding. More precisely, when aborting. Therefore it could make sense to include deferred points when cleaning up partial transfers.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It should include deferred points.

The operation must be able to get rid of all point IDs that don't belong in the shard, including deferred points.

@JojiiOfficial JojiiOfficial changed the title [WIP] Disable deferred point filtering in resharding Disable deferred point filtering in resharding Mar 9, 2026
@JojiiOfficial
JojiiOfficial marked this pull request as ready for review March 9, 2026 14:43

@timvisee timvisee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In a call we agreed to change the ignore_deferred parameter. It's ambiguous and may have two very different meanings.

I'll do another review pass once it's updated.

@JojiiOfficial
JojiiOfficial force-pushed the deferred-points-ignore-flag-in-scroll branch from fc408e7 to e0cedd9 Compare March 9, 2026 16:52
@timvisee
timvisee force-pushed the deferred-points-ignore-flag-in-scroll branch from 380666e to 08f9187 Compare March 10, 2026 10:56
timvisee

This comment was marked as resolved.

@JojiiOfficial
JojiiOfficial force-pushed the filter-deferred-points-sparse-search branch from 13eeb9e to 8bfe14a Compare March 10, 2026 14:09
@JojiiOfficial
JojiiOfficial force-pushed the deferred-points-ignore-flag-in-scroll branch 3 times, most recently from b27dfdd to 5146cdf Compare March 10, 2026 16:01
@timvisee timvisee mentioned this pull request Mar 10, 2026
2 tasks done
@JojiiOfficial
JojiiOfficial force-pushed the deferred-points-ignore-flag-in-scroll branch from 5146cdf to a5152f9 Compare March 11, 2026 08:09
@JojiiOfficial
JojiiOfficial changed the base branch from filter-deferred-points-sparse-search to filter-deferred-points-retrieve March 11, 2026 08:10
@JojiiOfficial
JojiiOfficial force-pushed the deferred-points-ignore-flag-in-scroll branch from a5152f9 to af2ebee Compare March 11, 2026 08:18
@JojiiOfficial
JojiiOfficial force-pushed the filter-deferred-points-retrieve branch from 985d964 to 4361791 Compare March 11, 2026 08:23
@JojiiOfficial
JojiiOfficial force-pushed the deferred-points-ignore-flag-in-scroll branch from af2ebee to 6c60488 Compare March 11, 2026 08:27
@JojiiOfficial
JojiiOfficial requested a review from timvisee March 11, 2026 08:58
@JojiiOfficial
JojiiOfficial force-pushed the filter-deferred-points-retrieve branch from 4361791 to 8aa0995 Compare March 11, 2026 09:11
@JojiiOfficial
JojiiOfficial force-pushed the deferred-points-ignore-flag-in-scroll branch from 6c60488 to 9c3e181 Compare March 11, 2026 09:12

@timvisee timvisee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In some read operations we do two or more internal read operations. I believe it's important to use the same deferred behavior for everything.

Currently a mix is used. This would allow the first stage to respect deferred points, while the second stage still returns point states that are too new (and still deferred). Using the same deferred variant everywhere should resolve that.

I'm quite sure that's important for data consistency.

search_runtime_handle,
timeout,
hw_measurement_acc,
DeferredBehavior::IncludeAll, // Points are already filtered in `point_ids`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This isn't sound.

Even though we've collected point IDs, including deferred points may still gives us a newer version of the point. That is not desired.

I'd recommend to simply use the same behavior here.

Do you have any specific reason for ignoring the user provided behavior here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Do you have any specific reason for ignoring the user provided behavior here?

I was trying to avoid the additional allocation that comes with filtering in retrieve(). I didn't think of the special case where a single segment has a point deferred and non-deferred.

Comment thread lib/edge/src/scroll.rs Resolved
Comment thread lib/edge/src/scroll.rs Resolved
Comment thread lib/edge/src/scroll.rs Resolved
Comment thread lib/segment/src/segment/search.rs Resolved
Comment on lines 1128 to +1285
@@ -1226,6 +1227,7 @@ impl ShardOperation for RemoteShard {
_search_runtime_handle: &Handle,
timeout: Option<Duration>,
hw_measurement_acc: HwMeasurementAcc,
_deferred_behavior: DeferredBehavior,
) -> CollectionResult<CountResult> {
let processed_timeout = Self::process_read_timeout(timeout, "count")?;
let count_points = CountPoints {
@@ -1280,6 +1282,7 @@ impl ShardOperation for RemoteShard {
_search_runtime_handle: &Handle,
timeout: Option<Duration>,
hw_measurement_acc: HwMeasurementAcc,
_deferred_behavior: DeferredBehavior,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see the deferred behavior is simply ignored here. I'm not sure it's good enough, and it's a potential foot gun. At the caller, we might not know what kind of shard we're working with.

Just stating it here, because I don't see an obvious solution right away. I have to think about it for a second.

In case of count in transfers, maybe we've to get the local shard explicitly and call count directly on it so we don't have the expose deferred logic in the shared trait.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I added a TODO: 3a0ae79
I'll handle it later in a separate PR as discussed.

Comment thread lib/segment/src/segment/search.rs Resolved
Comment thread lib/edge/src/query.rs Resolved
Base automatically changed from filter-deferred-points-retrieve to dev March 11, 2026 10:35
@JojiiOfficial
JojiiOfficial force-pushed the deferred-points-ignore-flag-in-scroll branch from 5d5bd77 to 9dbc133 Compare March 11, 2026 10:37
Comment on lines +24 to +25
///
/// Doesn't filter deferred points.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe this comment must be updated

coderabbitai[bot]

This comment was marked as resolved.

@qdrant qdrant deleted a comment from coderabbitai Bot Mar 11, 2026
@JojiiOfficial
JojiiOfficial requested a review from timvisee March 11, 2026 12:47
coderabbitai[bot]

This comment was marked as resolved.

@JojiiOfficial
JojiiOfficial force-pushed the deferred-points-ignore-flag-in-scroll branch from 3a0ae79 to e6961a7 Compare March 11, 2026 14:33
@JojiiOfficial JojiiOfficial mentioned this pull request Mar 11, 2026
2 tasks done
@qdrant qdrant deleted a comment from coderabbitai Bot Mar 11, 2026

@timvisee timvisee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm quite confident this is correct. As extra measure I'd like a bit of testing because it's hard to validate all of this in context of resharding with static analysis.

I did do basic testing locally in which did not show any clear problems. But I'd like to see it run on chaos testing for some time to be sure.

@JojiiOfficial
JojiiOfficial merged commit f91e217 into dev Mar 11, 2026
16 checks passed
@JojiiOfficial
JojiiOfficial deleted the deferred-points-ignore-flag-in-scroll branch March 11, 2026 15:13
generall pushed a commit that referenced this pull request Mar 26, 2026
* Add ignore_deferred flag for internal scroll API

* Ignore deferred points in ProxyShard::update

* Use enum instead of bool as type in function parameters

* Use consistent parameter name

* fmt

* Apply suggestions from code review

Co-authored-by: Tim Visée <[email protected]>

* More explicit naming

* Add DeferredBehavior to `count()` and disable filtering in stream_records

* Don't filter `retrieve()` everywhere

* Use consistent filter behavior in read operations

* Add TODO for ignored parameter in remote_shard

* Rebase fixes

---------

Co-authored-by: timvisee <[email protected]>
Co-authored-by: Tim Visée <[email protected]>
KShivendu pushed a commit that referenced this pull request Mar 30, 2026
* Add ignore_deferred flag for internal scroll API

* Ignore deferred points in ProxyShard::update

* Use enum instead of bool as type in function parameters

* Use consistent parameter name

* fmt

* Apply suggestions from code review

Co-authored-by: Tim Visée <[email protected]>

* More explicit naming

* Add DeferredBehavior to `count()` and disable filtering in stream_records

* Don't filter `retrieve()` everywhere

* Use consistent filter behavior in read operations

* Add TODO for ignored parameter in remote_shard

* Rebase fixes

---------

Co-authored-by: timvisee <[email protected]>
Co-authored-by: Tim Visée <[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.

2 participants