-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dbnode] Get rid of excessive locking when adding new namespaces (#3765)
* Set `Bootstrapping` state when waiting for fileOps to be disabled completed, because it can take a while. * Release database lock before enqueueing bootstrap because it could take a while. * Rollback bootstrapping state change. * disable/enable fileOps when adding a new namespace. * removed comments added for testing. * fixed linter issues. * fixed potential issue when competing bootstraps could be started and `onCompleteFn` might be invoked for the second bootstrap while another bootstrap is still in progress. This is bad because bootstrap should work when fileOps are disabled and `onCompleteFn` might be enabling fileOps. * fixed typo in comment. * implemented similar enqueue bootstrap logics to `assignShardSet` as well. * Disable both file ops first and then wait for them to stop (should reduce waiting times) * New namespace adds can now be enqueued and be non-blocking. If db was not yet bootstrapped and new shardSet is assigned, do this immediately (no need to enqueue). New test for add new namespace using enqueue. * small cleanup * reverse commit * We can enqueue bootstrap with lock to avoid potential race now because enqueueing and waiting is fully async. * unlock right after `namespaceDeltaWithLock()` * Simplify callback logic by having the mediator own the lifecycle of the callback functions (#3810) * Simplify callback logic by having the mediator own the lifecycle of the callback functions * Remove no longer required BootstrapAsyncResult * Remove unused require.NoError * Fix lint * Added test when bootstrap is enqueued in case new namespaces are added. Fixed possible race in `context.StartSampledTraceSpan()`. Use zap error logging where needed. Make sure fileOps are disabled/enabled only when really needed (bootstraps > 0 and mediator is opened), otherwise just use simpler logics. * Simplify some code paths further and use lock/defer unlock in more places (#3818) * Simplify some code paths further and use lock/defer unlock in more places * Fix test * More test coverage. * Fixed possible race in unit test assertion. Co-authored-by: Rob Skillington <rob.skillington@gmail.com>
- Loading branch information
1 parent
8dd5622
commit 5f351fb
Showing
8 changed files
with
433 additions
and
141 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.