Skip to content

Add UpdatesGuard type wrapper for updates_guard#8031

Merged
generall merged 5 commits intofaster-segment-holder-locksfrom
copilot/sub-pr-8007
Feb 3, 2026
Merged

Add UpdatesGuard type wrapper for updates_guard#8031
generall merged 5 commits intofaster-segment-holder-locksfrom
copilot/sub-pr-8007

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

  • Create a newtype wrapper UpdatesGuard for parking_lot::MutexGuard<'_, ()>
  • Update function signatures in segment_holder/snapshot.rs to use the new type
  • Update the acquire_updates_lock method to return the new type
  • Verify all usages compile correctly
  • Fix linter issue (trailing space in doc comment)
  • Remove unnecessary new() method, use tuple constructor directly

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@generall
Copy link
Member

generall commented Feb 3, 2026

@copilot this doesn't change anything

Co-authored-by: generall <1935623+generall@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 3, 2026

@copilot this doesn't change anything

I've now implemented the type wrapper. Created a newtype UpdatesGuard<'a> that wraps parking_lot::MutexGuard<'a, ()> to make its purpose clearer - guaranteeing no update operations are happening during critical sections. The type is used in try_unproxy_segment and unproxy_all_segments functions. Changes in commit 306c16c.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https /tmp/apt.data.dxPTNe -O3 -Wall .rli�� -1949cf8c6b5b557f/ring-0.17.13/i--gdwarf-4 472.rlib bin/rustc 189213.rlib 44.rlib stup/toolchains/build_script_build bin/rustc (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Address feedback on type wrapper for updates_guard Add UpdatesGuard type wrapper for updates_guard Feb 3, 2026
@generall
Copy link
Member

generall commented Feb 3, 2026

@copilot fix linter issues

Co-authored-by: generall <1935623+generall@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 3, 2026

@copilot fix linter issues

Fixed the linter issue - removed trailing space in the doc comment. The formatter now passes. Changes in commit 78d1eb8.


impl<'a> UpdatesGuard<'a> {
/// Create a new UpdatesGuard from a MutexGuard.
fn new(guard: parking_lot::MutexGuard<'a, ()>) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think new is needed. Tuple struct constructor is enough the single usage, and new is not public (and shouldn't be).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the unnecessary new() method. Now using the tuple constructor directly: UpdatesGuard(self.updates_mutex.lock()). Changes in commit 74f5353.

@generall
Copy link
Member

generall commented Feb 3, 2026

@copilot fix linter and comments

Co-authored-by: generall <1935623+generall@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 3, 2026

@copilot fix linter and comments

Fixed - removed unnecessary new() method and verified formatter passes. Changes in commit 74f5353.

@generall generall marked this pull request as ready for review February 3, 2026 11:35
@generall generall merged commit d7039ce into faster-segment-holder-locks Feb 3, 2026
11 checks passed
@generall generall deleted the copilot/sub-pr-8007 branch February 3, 2026 11:36
generall added a commit that referenced this pull request Feb 3, 2026
* non-locking retrieve

* optimization & write exclusive lock via upgradable_read

* faster segment holder locks debug (#8024)

* fix deadlock

* move LockedSegmentHolder into a dedicated file

* reorder locks for snapshot

* fmt

* upd comments

* Update lib/collection/src/collection_manager/optimizers/segment_optimizer.rs

Co-authored-by: Ivan Boldyrev <ivan.boldyrev@qdrant.com>

* Add UpdatesGuard type wrapper for updates_guard (#8031)

* Initial plan

* Add UpdatesGuard newtype wrapper for updates_guard

Co-authored-by: generall <1935623+generall@users.noreply.github.com>

* Fix linter issue - remove trailing space in doc comment

Co-authored-by: generall <1935623+generall@users.noreply.github.com>

* Remove unnecessary new() method, use tuple constructor directly

Co-authored-by: generall <1935623+generall@users.noreply.github.com>

* fix clippy

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: generall <1935623+generall@users.noreply.github.com>
Co-authored-by: generall <andrey@vasnetsov.com>

* Remove aliassed lifetime

Co-authored-by: Jojii <15957865+JojiiOfficial@users.noreply.github.com>

---------

Co-authored-by: Ivan Boldyrev <ivan.boldyrev@qdrant.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: generall <1935623+generall@users.noreply.github.com>
Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: Jojii <15957865+JojiiOfficial@users.noreply.github.com>
generall added a commit that referenced this pull request Feb 9, 2026
* non-locking retrieve

* optimization & write exclusive lock via upgradable_read

* faster segment holder locks debug (#8024)

* fix deadlock

* move LockedSegmentHolder into a dedicated file

* reorder locks for snapshot

* fmt

* upd comments

* Update lib/collection/src/collection_manager/optimizers/segment_optimizer.rs

Co-authored-by: Ivan Boldyrev <ivan.boldyrev@qdrant.com>

* Add UpdatesGuard type wrapper for updates_guard (#8031)

* Initial plan

* Add UpdatesGuard newtype wrapper for updates_guard

Co-authored-by: generall <1935623+generall@users.noreply.github.com>

* Fix linter issue - remove trailing space in doc comment

Co-authored-by: generall <1935623+generall@users.noreply.github.com>

* Remove unnecessary new() method, use tuple constructor directly

Co-authored-by: generall <1935623+generall@users.noreply.github.com>

* fix clippy

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: generall <1935623+generall@users.noreply.github.com>
Co-authored-by: generall <andrey@vasnetsov.com>

* Remove aliassed lifetime

Co-authored-by: Jojii <15957865+JojiiOfficial@users.noreply.github.com>

---------

Co-authored-by: Ivan Boldyrev <ivan.boldyrev@qdrant.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: generall <1935623+generall@users.noreply.github.com>
Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: Jojii <15957865+JojiiOfficial@users.noreply.github.com>
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.

3 participants