fix: propagate flush cancellation through payload index flushers#8651
Merged
timvisee merged 2 commits intoApr 13, 2026
Conversation
When a payload index is deleted, the gridstore backing it is dropped. A concurrent background flush detects this (weak Arc refs fail to upgrade) and returns GridstoreError::FlushCancelled. The From<GridstoreError> impl correctly maps this to OperationError::Cancelled, and entry.rs gracefully handles Cancelled by skipping the flush. However, two intermediate layers unconditionally wrapped all errors as ServiceError, destroying the Cancelled variant before it reached the handler in entry.rs: 1. All 4 mutable index flushers (map, text, numeric, geo) used OperationError::service_error(format!(...)) instead of converting via Into<OperationError> first. 2. struct_payload_index flusher also unconditionally wrapped sub-flusher errors as service_error. This caused the benign FlushCancelled to surface as a fatal "last background flush failed" ServiceError. Fix both layers to propagate Cancelled errors as-is, matching the pattern already used for vector storage, quantization, and id tracker flushers in entry.rs. Made-with: Cursor
generall
approved these changes
Apr 13, 2026
timvisee
reviewed
Apr 13, 2026
timvisee
approved these changes
Apr 13, 2026
timvisee
pushed a commit
that referenced
this pull request
May 8, 2026
* fix: propagate flush cancellation through payload index flushers When a payload index is deleted, the gridstore backing it is dropped. A concurrent background flush detects this (weak Arc refs fail to upgrade) and returns GridstoreError::FlushCancelled. The From<GridstoreError> impl correctly maps this to OperationError::Cancelled, and entry.rs gracefully handles Cancelled by skipping the flush. However, two intermediate layers unconditionally wrapped all errors as ServiceError, destroying the Cancelled variant before it reached the handler in entry.rs: 1. All 4 mutable index flushers (map, text, numeric, geo) used OperationError::service_error(format!(...)) instead of converting via Into<OperationError> first. 2. struct_payload_index flusher also unconditionally wrapped sub-flusher errors as service_error. This caused the benign FlushCancelled to surface as a fatal "last background flush failed" ServiceError. Fix both layers to propagate Cancelled errors as-is, matching the pattern already used for vector storage, quantization, and id tracker flushers in entry.rs. Made-with: Cursor * simplify error conversion --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: generall <[email protected]>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GridstoreError::FlushCancelled(a benign condition during payload index deletion) was converted into a fatalServiceErrorinstead of being propagated asOperationError::CancelledCancelledvariant was lost at two intermediate layers that unconditionally wrapped errors withservice_error(format!(...)): all 4 mutable index flushers (map, text, numeric, geo) and thestruct_payload_indexflusherentry.rswhich gracefully skips the flush with a debug logRoot cause
When a payload index is deleted, the gridstore backing it is dropped. A concurrent background flush detects this (weak
Arcrefs fail to upgrade) and returnsGridstoreError::FlushCancelled. There is already:From<GridstoreError> for OperationErrorimpl that mapsFlushCancelled→OperationError::Cancelledentry.rsthat gracefully handlesCancelledby skipping the flushBut the
Cancelledvariant was destroyed before reaching the handler because:OperationError::service_error(format!(...))to convert the gridstore error, instead of using theInto<OperationError>conversionstruct_payload_indexflusher also unconditionally wrapped sub-flusher errors asservice_errorThis caused the error:
"last background flush failed: ... Failed to flush mutable map index gridstore: Flush was cancelled"Fix
GridstoreErrorviaInto<OperationError>first, then only re-wrap non-Cancelledvariantsstruct_payload_indexflusher: propagateCancellederrors as-is, matching the pattern already used for vector storage, quantization, and id tracker flushers inentry.rsTest plan
cargo check -p segmentpassesMade with Cursor