-
Notifications
You must be signed in to change notification settings - Fork 37.7k
doc: BaseIndex sync behavior with empty datadir #22485
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
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.
.
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. |
|
||
// Note: this will latch to true immediately if the user starts up with an empty | ||
// datadir and an index enabled. If this is the case, indexation will happen solely | ||
// via `BlockConnected` signals until, possibly, the next restart. |
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.
What do you mean with "until the next restart"? Once the index is in sync with the active chain tip, it will stay that way, regardless of restarts. The only way it could get out of sync is when you disable the index on a restart, advance the tip, then enable it again. Am I missing something?
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.
This is contingent on how fast the particular indexing process is; you can imagine that if a given index takes (for the sake of argument) a minute per block to build, if we get 1000 blocks connected and then the user shuts down immediately, the validationinterface queue may not clear* and we will start up out of sync after having been "synced" in the degenerate way. Does this make sense?
*I know we wait for this queue to clear during a graceful shutdown, but we can't assume this.
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.
In commit "index: doc/log BaseIndex sync behavior with empty datadir" (2b48b03)
I also found this confusing and would suggest just saying "the index will get updated and stay in sync through BlockConnected notifications"
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.
My issue with your suggested comment is that that isn't a complete picture of what's going on - as described above, indexation will only happen via BlockConnectected notifications until the next restart. If we have a hard shutoff that doesn't clear the validation queue, the index will sync sequentially in ThreadSync()
, which makes that comment somewhat misleading.
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.
This is fine. I think I'm just agreeing with Marco that the comment seemed a little strange because I didn't know what it might be implying. It seems obvious there will be no BlockConnected signals if the process is dead.
Concept ACK Any easy way to confirm this behavior, regarding BlockConnected signals vs. |
Worth merging? Anything left to do here? Should I close? |
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 ACK 2b48b03. Concept ~0. I'd be curious to know more about what is confusing without this log message. It seems pretty straightforward that if there are no blocks, then there is nothing for the sync thread to do, and the index is in sync. Like if pieces_of_popcorn == 0
then popcorn_eaten == true
. So I'm not sure why this is confusing or degenerate, etc.
I guess I like the new comments, but I'm just unsure what the log message adds.
|
||
// Note: this will latch to true immediately if the user starts up with an empty | ||
// datadir and an index enabled. If this is the case, indexation will happen solely | ||
// via `BlockConnected` signals until, possibly, the next restart. |
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.
In commit "index: doc/log BaseIndex sync behavior with empty datadir" (2b48b03)
I also found this confusing and would suggest just saying "the index will get updated and stay in sync through BlockConnected notifications"
Reopening as I think this is still a useful clarification when trying to remind myself of how indexation works. |
It is recommended to address the feedback comments in some way before merge |
It's obviously not mandatory, but I found the whole indexation process a little confusing and so I figured the more hints the better? |
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 to the comment, I think that the additional log message would be redundant (see below).
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 ACK 2b48b03. This seems fine and generally better, despite confusion and nitpicking
|
||
// Note: this will latch to true immediately if the user starts up with an empty | ||
// datadir and an index enabled. If this is the case, indexation will happen solely | ||
// via `BlockConnected` signals until, possibly, the next restart. |
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.
This is fine. I think I'm just agreeing with Marco that the comment seemed a little strange because I didn't know what it might be implying. It seems obvious there will be no BlockConnected signals if the process is dead.
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.
utACK 2b48b03
I think this can be merged as is but I would prefer it without the log message (see my comment).
I think one more place where a note on this could be helpful for users is in the getindexinfo
RPC, something like this: fjahr@255f094. Feel free to add this in here but I can also open a follow-up.
2b48b03
to
59c8765
Compare
59c8765
to
4ba81ca
Compare
Make a note about a potentially confusing behavior with `BaseIndex::m_synced`; if the user starts bitcoind with an empty datadir and an index enabled, BaseIndex will consider itself synced (as a degenerate case). This affects how indices are built during IBD (relying solely on BlockConnected signals vs. using ThreadSync()).
4ba81ca
to
11780f2
Compare
ACK 11780f2 |
11780f2 doc: BaseIndex sync behavior with empty datadir (James O'Beirne) Pull request description: Make a note about a potentially confusing behavior with `BaseIndex::m_synced`; if the user starts bitcoind with an empty datadir and an index enabled, BaseIndex will consider itself synced (as a degenerate case). This affects how indices are built during IBD (relying solely on BlockConnected signals vs. using ThreadSync()). ACKs for top commit: mzumsande: ACK 11780f2 Tree-SHA512: 0b530379e57c62e05d2ddca7bb8e2c936786fa00678f9eaa1bb3742d957c48f141d46f936734b03f6673d964abc7eb72c1769f1784b9d3563d218e96296b7afd
Make a note about a potentially confusing behavior with
BaseIndex::m_synced
;if the user starts bitcoind with an empty datadir and an index enabled,
BaseIndex will consider itself synced (as a degenerate case). This affects
how indices are built during IBD (relying solely on BlockConnected signals vs.
using ThreadSync()).