-
Notifications
You must be signed in to change notification settings - Fork 38.7k
validation: Skip VerifyDB checks of level >=3 if dbcache is too small #27009
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
validation: Skip VerifyDB checks of level >=3 if dbcache is too small #27009
Conversation
The previous behavior, skipping some L3 DisconnectBlock calls, but still attempting to reconnect these blocks at L4, makes ConnectBlock assert. The variable skipped_l3_checks is introduced because even with an insufficient cache for the L3 checks, the L1/L2 checks in the same loop should still be completed. Fixes bitcoin#25563.
This allows to log a timestamp for each entry, and avoids potential interference with other threads that could log concurrently.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
|
This removes a crashing check and turns it into a logprint to explain why it was skipped. Given that no one reported an issue about this in the past, it seems unlikely to affect anyone. However, in the future the log can be displayed more verbosely, for example as an review ACK fe683f3 🗄 Show signatureSignature: |
john-moffett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK fe683f3
I'm definitely uncomfortable with:
src/bitcoin-cli -signet verifychain 4 10000
truewhen it didn't fully verify at the requested level. However, I think it's preferable to a SIGABRT, especially given that we're already potentially silently failing with level 3, so I won't stand in the way of an improvement. If this needs to be a two-PR process, I'm in favor of that over no action.
To be clear, I prefer #25574 in its current form, despite the RPC behavior change.
|
|
||
| LogPrintf("[DONE].\n"); | ||
| LogPrintf("No coin database inconsistencies in last %i blocks (%i transactions)\n", block_count, nGoodTransactions); | ||
| LogPrintf("Verification: No coin database inconsistencies in last %i blocks (%i transactions)\n", block_count, nGoodTransactions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nano-Nit: Would prefer "Verification complete: "
How is logging a warning for the not-enough-memory case different from logging a warning for the not-enough-storage case (pruning)? I think the warning can be displayed more prominently in a follow-up, but I think doing the same for similar cases seems fine.
That pull changes the not-enough-memory case to an error and leaves the not-enough-storage case (pruning) a silent pass with log warning. I have no objection to merging 25574, but I think it may not be the ideal solution either. |
I agree that they're not different, but my main concern isn't about the warning log. It's about the output from the RPC.
True, it's not ideal, because I think that the latter case should also change the RPC behavior to return |
|
Let's continue this discussion in #25574. |
… finish successfully 0af16e7 doc: add release note for #25574 (Martin Zumsande) 57ef2a4 validation: report if pruning prevents completion of verification (Martin Zumsande) 0c7785b init, validation: Improve handling if VerifyDB() fails due to insufficient dbcache (Martin Zumsande) d6f781f validation: return VerifyDBResult::INTERRUPTED if verification was interrupted (Martin Zumsande) 6360b53 validation: Change return value of VerifyDB to enum type (Martin Zumsande) Pull request description: `VerifyDB()` can fail to complete due to insufficient dbcache at the level 3 checks. This PR improves the error handling in this case in the following ways: - The rpc `-verifychain` now returns false if the check can't be completed due to insufficient cache - During init, we only log a warning if the default values for `-checkblocks` and `-checklevel` are taken and the check doesn't complete. However, if the user actively specifies one of these args, we return with an InitError if we can't complete the check. This PR also changes `-verifychain` RPC to return `false` if the verification didn't finish due to missing block data (pruning) or due to being interrupted by the node being shutdown. Previously, this PR also included a fix for a possible assert during verification - this was done in #27009 (now merged). ACKs for top commit: achow101: ACK 0af16e7 ryanofsky: Code review ACK 0af16e7. Only small suggested changes since the last review, like renaming some of the enum values. I did leave more suggestions, but they are not very important and could be followups john-moffett: ACK 0af16e7 MarcoFalke: lgtm re-ACK 0af16e7 🎚 Tree-SHA512: 84b4f767cf9bfbafef362312757c9bf765b41ae3977f4ece840e40c52a2266b1457832df0cdf70440be0aac2168d9b58fc817238630b0b6812f3836ca950bc0e
Summary: The previous behavior, skipping some L3 DisconnectBlock calls, but still attempting to reconnect these blocks at L4, makes ConnectBlock assert. The variable skipped_l3_checks is introduced because even with an insufficient cache for the L3 checks, the L1/L2 checks in the same loop should still be completed. This is a partial backport of [[bitcoin/bitcoin#27009 | core#27009]] bitcoin/bitcoin@61431e3 Fixes [[bitcoin/bitcoin#25563 | core#25563]]. Test Plan: `src/bitcoind -dbcache=10` `src/bitcoin-cli verifychain 4 10000` This produces the following output in the bitcoind terminal: ``` 2023-12-06T12:57:54Z Verifying last 10000 blocks at level 4 2023-12-06T12:57:54Z [0%]...[10%]...[20%]...[30%]...[40%]...[50%]...Skipped verification of level >=3 (insufficient database cache size). Consider increasing -dbcache. 2023-12-06T12:57:57Z [DONE]. 2023-12-06T12:57:57Z No coin database inconsistencies in last 10000 blocks (9992 transactions) ``` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D14921
Summary: This allows to log a timestamp for each entry, and avoids potential interference with other threads that could log concurrently. This concludes backport of [[bitcoin/bitcoin#27009 | core#27009]] bitcoin/bitcoin@fe683f3 Depends on D14921 Test Plan: `ninja && src/bitcoind` `src/bitcoin-cli verifychain 4 10000` Check the output of the `bitcoind` process. Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D14922
This is the first two commits from #25574, leaving out all changes to
-verifychainerror-handling :DisconnectBlock()calls), we would still attempt the level 4 checks, attempting to reconnect a block that was never disconnected, leading to an assert inConnectBlock().Fix this by not attempting level 4 checks in this case.
This can be tested with a small
dbcachevalue, for example:bitcoind -signet -dbcache=10bitcoin-cli -signet verifychain 4 1000Fixes #25563