-
Notifications
You must be signed in to change notification settings - Fork 38.7k
validation: log CChainState::CheckBlockIndex() consistency checks #22956
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
Conversation
|
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. |
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.
Code review and tested ACK 572cf0dd547b69580b7796d2192617ab4a318a5f
2021-09-13T07:01:58Z CheckBlockIndex: consistency checks started
2021-09-13T07:01:58Z CheckBlockIndex: consistency checks completed (63.12ms)
2021-09-13T07:01:58Z CheckBlockIndex: consistency checks started
2021-09-13T07:01:58Z Enter: lock contention ::cs_main, validation.cpp:4876 started
2021-09-13T07:01:58Z CheckBlockIndex: consistency checks completed (57.97ms)
src/logging.cpp
Outdated
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.
Is there a guideline on which log category to use within validation? There is BENCH used for benchmarking validation. There is VALIDATION used for storage and validation. Now there is BLOCK used for CheckBlockIndex.
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.
Not that I know of. I published a doc at https://github.com/jonatack/bitcoin-development/blob/master/logging.md#log-categories that is an updated version of this Bitcoin Stack Exchange answer in 2017 by @achow101 and am considering adding it to the RPC logging help.
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.
Is there a reason to not re-use the BENCH or VALIDATION category? Seems overkill to introduce a new category for a single log line that is mostly only enabled for devs/debugging.
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.
We did that for instance with MEMPOOLREJ (1 line), QT (1 line), LOCK (1 line), PROXY (1 line), RAND (2 lines), COINDB (3 lines) and CMPCTBLOCK (3 lines), among others.
My thought was that VALIDATION is too busy and BENCH would be ok but seems not directly related to consistency checks (rename it?) We could also rename CMPCTBLOCK to BLOCK and add it to that group.
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.
I think a BLOCK category makes sense in the sense that "block storage" is separate from "validation". We have a separate label for it too. If it is planned to be used for other messages too.
On the other hand this particular functionality is already enabled with a special option (-checkblockindex), so for this specifically I'm not sure also adding a separate category makes sense.
RAND (2 lines)
I think this one should go into a more general UTIL category at some point.
QT (1 line)
One line that captures everything from Qt's internal logging system 😄
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.
I think a BLOCK category makes sense in the sense that "block storage" is separate from "validation". We have a separate label for it too. If it is planned to be used for other messages too.
On the other hand this particular functionality is already enabled with a special option (
-checkblockindex), so for this specifically I'm not sure also adding a separate category makes sense.
Right. It doesn't seem ideal to use BCLog::VALIDATION or BCLog::BENCH, and LogPrintf would require bitcoind to be restarted to turn off the -checkblockindex config option. Maybe rename the low-frequency BCLog::CMPCTBLOCK category to BCLog::BLOCK and use that, but it would be a bit more disruptive than the current proposal.
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.
Looks like #23235 did some of the clean-ups here?
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.
Looks like #23235 did some of the clean-ups here?
Looked at it, but that change looks like it needs cleaning up and given how this simple change couldn't go through, I didn't attempt it.
572cf0d to
dfca02e
Compare
|
Rebased following the merge of #20487, which added the |
|
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
|
Code review ACK (but unfortunately needs rebase again) |
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
|
What is the status of this? |
|
Closing due to several months of inactivity for a "simple" logging change. Feel free to reopen this or open a new pull request. |
|
Indeed, I thought it would be simple but no agreement on which logging category to use. |
The
-checkblockindexconfiguration option performs occasional consistency checks of the block tree, chainstate, and other validation data structures.There is currently no logging of the checks to see when they happen and their duration.
This patch:
BLOCKlogging category, as the validation category is high-frequencyCChainState::CheckBlockIndex()consistency checks and durationExample (on signet, while catching up to chain tip):
To test:
$ ./src/bitcoind -debug=block