Issue 4900: Read LAC from EntryMemTable in SortedLedgerStorage if it is missing from the Ledger Cache - #4902
Open
djsweet wants to merge 3 commits into
Conversation
The internals of getLastAddConfirmed for EntryMemTable are similar to the implementation in InterleavedLedgerStorage. This will eventually be consulted in SortedLedgerStorage to retrieve the LAC.
This method will eventually be used within SortedLedgerStorage as a last-try attempt to read the LAC, with additional logic between checking the ledger cache and reading an entry from the filesystem.
SortedLedgerStorage.getLastAddConfirmed now falls back to the EntryMemTable for LAC if it is not present in the ledger cache of its internal InterleavedLedgerStorage. This fixes an issue where accumulating low-data or empty ledgers can cause ledgers to fall out of the ledger cache, but still be present in the memtable and therefore not flushed, to report the ledger as missing when acquiring the LAC for the ledger.
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.
Descriptions of the changes in this PR:
Main Issue: #4900
Note that there is a separate issue, #4895, that must be addressed for this to function correctly when ledger metadata is in use.
Motivation
The root cause of #4900 is that
SortedLedgerStorageignoresEntryMemTablewhen getting the LAC. This PR updatesSortedLedgerStorageso that the LAC is read fromEntryMemTableif it is missing in theLedgerCache.Changes
EntryMemTable, expose agetLastAddConfirmedthat functions similar toInterleavedLedgerStorage.getLastAddConfirmed.InterleavedLedgerStorage.getLastAddConfirmedto exposegetLastAddConfirmedFromLedgerEntry, the LAC reading case where the LAC is not present in the Ledger CacheSortedLedgerStorage.getLastAddConfirmed, first explicitly try to read the LAC fromInterleavedLedgerStorage'sLedgerCache. If the LAC isn't present in the ledger cache, read it from theEntryMemTable. If the LAC isn't present in theEntryMemTable, read it fromInterleavedLedgerStoragedirectly, bypassing theLedgerCache.