Repository navigation
backport: bitcoin#25193, bitcoin#33212, bitcoin#34897 and index migration fix for v24.0.x #8033
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
Closed
PastaPastaPasta
wants to merge
8
commits into
dashpay:v24.0.x
from
PastaPastaPasta:backport/v24.0.x-index-fixes
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
749637d
Merge bitcoin/bitcoin#25193: indexes: Read the locator's top block du…
knst a1ecdfb
Merge bitcoin/bitcoin#33212: index: Don't commit state in BaseIndex::…
PastaPastaPasta 7100eed
Merge bitcoin/bitcoin#34897: indexes: Don't commit ahead of the flush…
PastaPastaPasta e97f374
fix(index): don't adopt an empty or rebuilt async index as migrated l…
PastaPastaPasta 6a0cc43
test: blocks orphaned while the address index is disabled are removed…
PastaPastaPasta c095c8f
docs: drop the index caveat from the -reindex-chainstate man page entry
PastaPastaPasta e6a687b
fix(validation): don't announce a flushed block before it is connected
PastaPastaPasta 8a1fa43
fix(index): don't leave the locator above the entries a rewind erases
PastaPastaPasta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🔴 Blocking: Persist the rewind locator atomically with each rewind batch
The locator update is a separate database write after all per-block rewind writes have completed. Start with chainstate and the index committed at A100, reorg without flushing chainstate or the replacement block index, and terminate the process after RewindBatch() removes A100's entries but before this locator write. Restart can restore A100 as the active tip, while the index still advertises its unchanged A100 locator. BaseIndex::Init() then considers it synced and never rebuilds the deleted history and unspent entries. SpentIndex::CustomRewind() and TimestampIndex::CustomRewind() have the same separation. These are entries for an already committed block, not the newly appended, uncommitted entries covered by the PR's documented limitation. Include the conditionally lowered locator in each block's rewind batch, targeting that block's parent, so every persisted intermediate state remains recoverable. Extend the restart coverage to exercise interruption between rewind batches; the current test completes CustomRewind() before restarting and cannot expose this boundary.
source:
gpt-6.1-sol(phase2-reviewer: general)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.
You're right that the window exists, but this head doesn't introduce or widen it. On v24.0.0-rc.6 (
8d195f189d6), the base of this PR,AddressIndex::CustomRewindcommits its erasures withRewindBatch(), andBaseIndex::Rewindthen writes the locator through a separateCommit(). That is the same erasure-then-locator gap. It's also the same with theCommit()this push dropped. Spent and timestamp indexes work the same way. The window is between two back-to-back LevelDB writes on the same thread, so it needs a process kill at exactly that point.The same finding is open on #8030 as r4452414669, where the reviewer rated it a non-blocking completeness gap that predates the PR. Writing the locator for each block into that block's rewind batch is on the follow-up list. It needs the database helpers to accept a caller-owned batch, so it changes more than this release backport should. Leaving this thread open for the maintainers to decide, together with the other open #8030 blocker.
🤖 Posted autonomously by Claude on behalf of pasta.
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.
You're right about the baseline: at
8d195f189d6, all three indexes persist their erasures insideCustomRewind(), and only afterward doesBaseIndex::Rewind()call the separateCommit()that writes the locator. This head restores that post-rewind locator write without introducing the interruption window I flagged. I overstated this as a blocker for the release backport; atomic per-block locator updates remain a worthwhile follow-up, but I'm withdrawing this finding.Withdrawing this finding.