Skip to content

Notify optimization handles to stop on shard drop#7765

Merged
agourlay merged 1 commit intodevfrom
fix-notify-optimization-to-stop-on-drop
Dec 16, 2025
Merged

Notify optimization handles to stop on shard drop#7765
agourlay merged 1 commit intodevfrom
fix-notify-optimization-to-stop-on-drop

Conversation

@agourlay
Copy link
Member

@agourlay agourlay commented Dec 15, 2025

This PR is a fix to restore a proper shutdown on ctr+c.

Currently the running optimizations are preventing the Qdrant process to shutdown.

The fix is to notify the optimization handles to flip the cancellation flag internally.

No need to wait for an acknowledgement, the optimization loops will eventually stop.

Manually tested with

bfb -n 10M -d 256 --keywords 100  --float-payloads true --int-payloads 2 --uuid-payloads --bool-payloads --geo-payloads --text-payloads

@agourlay agourlay force-pushed the fix-notify-optimization-to-stop-on-drop branch from d741627 to 55d984d Compare December 15, 2025 15:54
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e91702 and d741627.

📒 Files selected for processing (2)
  • lib/collection/src/shards/local_shard/drop.rs (1 hunks)
  • lib/collection/src/update_handler.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (.github/review-rules.md)

**/*.rs: Prefer explicit SomeType::from(x) over implicit x.into() in Rust
In new code, don't use transmute_from_u8, transmute_to_u8, transmute_from_u8_to_slice, transmute_from_u8_to_mut_slice, transmute_to_u8_slice - use bytemuck or zerocopy crates instead
Prefer explicit exhaustive matches over catch-all _ arm in Rust match expressions, so we don't miss handling new enum variants when they are added later (exceptions: tests and benchmarks, or when sure new variants won't affect logic)
Prefer explicit field ignoring using : _ over using .. in Rust struct destructuring (exceptions: tests and benchmarks, or when sure new fields won't affect logic)

Files:

  • lib/collection/src/shards/local_shard/drop.rs
  • lib/collection/src/update_handler.rs
🪛 GitHub Actions: Codespell
lib/collection/src/update_handler.rs

[error] 238-238: codespell: misspelling detected. 'hanldes' should be 'handles'.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: rust-tests (ubuntu-latest)
  • GitHub Check: test-consensus-compose
  • GitHub Check: e2e-tests
  • GitHub Check: rust-tests (macos-latest)
  • GitHub Check: rust-tests (windows-latest)
  • GitHub Check: test-consistency
  • GitHub Check: test-shard-snapshot-api-s3-minio
  • GitHub Check: integration-tests-consensus
  • GitHub Check: integration-tests
  • GitHub Check: Build Qdrant Edge Python bindings
  • GitHub Check: lint
🔇 Additional comments (2)
lib/collection/src/shards/local_shard/drop.rs (1)

50-50: LGTM! Proper placement in shutdown sequence.

The call to notify_optimization_handles_to_stop() is correctly positioned after stopping the flush worker and before sending the Stop signal. This non-blocking notification aligns with the drop context constraints where awaiting is not possible.

lib/collection/src/update_handler.rs (1)

241-246: LGTM! Clean implementation of non-blocking stop notification.

The method correctly acquires a blocking lock and iterates through all optimization handles to signal them to stop. The blocking lock usage is appropriate for this synchronous context, and the approach aligns with the fire-and-forget requirement of the drop routine.

@qdrant qdrant deleted a comment from coderabbitai bot Dec 15, 2025
@agourlay agourlay merged commit c01813f into dev Dec 16, 2025
15 checks passed
@agourlay agourlay deleted the fix-notify-optimization-to-stop-on-drop branch December 16, 2025 10:13
@qdrant qdrant deleted a comment from coderabbitai bot Dec 19, 2025
@timvisee timvisee mentioned this pull request Dec 19, 2025
@coderabbitai coderabbitai bot mentioned this pull request Feb 4, 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