validation, refactor: UnloadBlockIndex and ChainstateManager::Reset thread safety cleanups#24299
Conversation
acb92c4 to
b63e704
Compare
src/validation.cpp
Outdated
There was a problem hiding this comment.
Ok, reverted to the original version in 686d35de6 that keeps Reset() and replaces the lock with annotation+assertion.
There was a problem hiding this comment.
Generally I am not a fan of putting test-only code in the "real" source code. Especially if it is validation. Longer term this may be used in non-test code accidentally, after which changes to it (and changes unrelated to it) become almost impossible to review. (See for example: #24145 (comment))
I think this should be removed from validation and added back in the test code where needed. Either src/test/util or elsewhere.
There was a problem hiding this comment.
Un-reverted back to removing Reset() and will review #24232.
There was a problem hiding this comment.
(not saying what this pull should do, just saying what the long term goal should be)
There was a problem hiding this comment.
This was not just "test-only code" - the Reset() was used to detect snapshot dirs that needed to be cleaned up. The merge here isn't now just a matter of copy/pasting some code.
There was a problem hiding this comment.
(Already replied out-of-band) The code that isn't test-only (validatedSnapshotShutdownCleanup) can be called in the destructor (where Reset used to be called). The test-only code (if there is any) can be inlined, put in a test utility class, or a method. (The new method may even be called Reset)
b63e704 to
7edab1e
Compare
Co-authored-by: Vasil Dimov <[email protected]> Co-authored-by: laanwj <[email protected]>
7edab1e to
ae9ceed
Compare
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Code review ACK ae9ceed |
Summary: This is a partial backport of [[bitcoin/bitcoin#24299 | core#24299]] bitcoin/bitcoin@daad009 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D12988
Summary: remove ChainstateManager::Reset(), as it is currently unused (can be reintroduced in the test utilities if needed for unit testing) Co-authored-by: Vasil Dimov <[email protected]> Co-authored-by: laanwj <[email protected]> This concludes backport of [[bitcoin/bitcoin#24299 | core#24299]] bitcoin/bitcoin@ae9ceed Depends on D12988 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D12989
Thread safety refactoring seen in #24177: