Issue 4900: Read an unflushed ledger LAC from the memtable - #4901
Open
kalayciburak wants to merge 1 commit into
Open
kalayciburak wants to merge 1 commit into
kalayciburak wants to merge 1 commit into
Conversation
getLastAddConfirmed only asked the index. After the FileInfo cache evicted an unflushed ledger, the read failed even though the entry was still in the memtable.
|
Thinking a bit more on this, I'm not sure this is a fully correct fix. Consider the scenario posed by #4900, but where the first ledger already exists, and is committed into InterleavedLedgerStorage. If you write to over 20,000 ledgers with small payloads below the #4902 always reads from the |
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:
Fix #4900
Motivation
SortedLedgerStorage.getLastAddConfirmeddelegated entirely to the index. Until the memtable is flushed, that LAC lives only in aFileInfocache entry. Once the cache evicts the ledger, the index file still does not exist, so a later read fails withNoLedgerException/NoEntryExceptioneven though the entry is still in the memtable. The bookie turns that intoENOLEDGER.Changes
On those misses, read the LAC from the last memtable entry (the same offset
addEntrystores). If the entry was flushed between the miss and the lookup, ask the index again. A ledger that is in neither place still fails.Tests
mvn -pl bookkeeper-server -am test -Dtest=SortedLedgerStorageTest -Dsurefire.failIfNoSpecifiedTests=falseSortedLedgerStorageTest6 tests, 0 failures. The new case expects LAC 3 and gotNoEntryException: Entry 0 not found in 0before the change.mvn -pl bookkeeper-server checkstyle:check— 0 violations.