do not block ToC on in-collection operations by arc-ing collections#7999
Merged
do not block ToC on in-collection operations by arc-ing collections#7999
Conversation
timvisee
approved these changes
Jan 27, 2026
| use std::sync::Arc; | ||
| use std::time::{Duration, Instant}; | ||
|
|
||
| pub async fn try_unwrap_with_timeout_async<T>( |
Member
There was a problem hiding this comment.
We only spin lock on:
- collection deletion
- collection creation, while collection already existed (unlikely)
No concerns there 👍
|
|
||
| existing_collection.stop_gracefully().await; | ||
|
|
||
| let removed_collection_res = try_unwrap_with_timeout_async( |
Member
There was a problem hiding this comment.
Note: concurrent collection creation calls are not a concern here. They are serialized by a 'creation' lock and consensus.
IvanPleshkov
pushed a commit
that referenced
this pull request
Jan 27, 2026
…7999) * do not block ToC on in-collection operations by arc-ing collections * review suggestion fix
generall
added a commit
that referenced
this pull request
Feb 9, 2026
…7999) * do not block ToC on in-collection operations by arc-ing collections * review suggestion fix
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.
This PR attempts to address the following observed behavoir:
Why it might happen?
When we perform any operation like search, upsert, snapshots ... we lock
TableOfContentfor read.When we want to create new collection, we need to lock
TableOfContentfor writes.Lock for write works like this:
(unconfirmed, but it might be, that queue of operations might also cause exhaustion of the threads)
This PR removes requirement to hold
TableOfContentlock for collection ops, making critical section significantly smaller.As a result: write doesn't wait for queue => operations don't have time to queue up.
Downside: we have a bit less strict guarantees about collection ownership during deletion of the collection, so we need to spinlock there.