Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify some code paths further and use lock/defer unlock in more places #3818

Conversation

robskillington
Copy link
Collaborator

What this PR does / why we need it:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:


Does this PR require updating code package or user-facing documentation?:


@codecov
Copy link

codecov bot commented Oct 6, 2021

Codecov Report

❗ No coverage uploaded for pull request base (linasn/bootstrap-after-fileops-wait@1886a24). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@                          Coverage Diff                          @@
##             linasn/bootstrap-after-fileops-wait   #3818   +/-   ##
=====================================================================
  Coverage                                       ?   56.8%           
=====================================================================
  Files                                          ?     552           
  Lines                                          ?   63100           
  Branches                                       ?       0           
=====================================================================
  Hits                                           ?   35897           
  Misses                                         ?   24004           
  Partials                                       ?    3199           
Flag Coverage Δ
aggregator 63.3% <0.0%> (?)
cluster ∅ <0.0%> (?)
collector 58.4% <0.0%> (?)
dbnode 60.5% <0.0%> (?)
m3em 46.4% <0.0%> (?)
metrics 19.7% <0.0%> (?)
msg 74.2% <0.0%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1886a24...2e6f7ad. Read the comment docs.

@soundvibe soundvibe merged commit 5b5978a into linasn/bootstrap-after-fileops-wait Oct 6, 2021
@soundvibe soundvibe deleted the r/bootstrap-after-fileops-wait-simplify branch October 6, 2021 06:35
soundvibe added a commit that referenced this pull request Oct 6, 2021
* 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>
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