triedb/pathdb: fix async node buffer diskroot mismatches when journaling#2083
Merged
triedb/pathdb: fix async node buffer diskroot mismatches when journaling#2083
Conversation
1ed7fef to
e718c73
Compare
joey0612
reviewed
Dec 18, 2023
| mux sync.RWMutex | ||
| current *nodecache | ||
| background *nodecache | ||
| isFlushing atomic.Bool |
Contributor
There was a problem hiding this comment.
I think need a stop flag to stop flush when call waitAndStopFlush
e718c73 to
96cc4e7
Compare
joey0612
reviewed
Dec 20, 2023
| a.stopFlushing.Store(true) | ||
| if a.isFlushing.Load() { | ||
| time.Sleep(time.Second) | ||
| log.Info("waiting background memory table flushed into disk") |
4be0fce to
87d4e02
Compare
87d4e02 to
d4f4db1
Compare
5c1ff4a to
34f34f6
Compare
joey0612
approved these changes
Dec 26, 2023
buddh0
approved these changes
Dec 26, 2023
This was referenced Jan 22, 2024
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
When running
TestJournalUT intrie/triedb/pathdb, there is a certain probability that this error will occur:Invalid state, err: state 0xdda0214f6c0c6ea546cdbf3db74a31f8337a01b41908b3b8ea27a8fde0011294 is not available.The reason of this error is that the journal loaded from disk is wrong, the error message of
loadJournalfunction:unmatched journal want c3bd21026750db0009399463f5947e1663c7057cb4aaabeb0b39ed68dedd4d0b got 6d574af1033459ae676316a1262a5d89edb7bbd515ecd253b4319a3161093153.Rationale
When geth calls
Journalfunction to commit entire diff hierarchy to disk into a single journal entry, the flush process ofasyncnodebuffermaybe doesn't end, so we should stop, wait it and journal.Example
N/A
Changes
Notable changes: