Issue 4855: fail closed on entry log flush failure - #4860
Open
yangxianjungree wants to merge 9 commits into
Open
Issue 4855: fail closed on entry log flush failure#4860yangxianjungree wants to merge 9 commits into
yangxianjungree wants to merge 9 commits into
Conversation
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:
This PR makes entry-log write/flush failures fail closed instead of allowing a bookie to continue after the entry-log write position becomes uncertain. The issue was reproduced on the 4.16.7 line with DefaultEntryLogger + BufferedChannel + DbLedgerStorage, and this PR targets branch-4.16. This is the backport of #4863.
Motivation
A partial entry-log write/flush/force failure can leave the physical log file behind the logical BufferedChannel position. If the bookie continues accepting writes after that point, ledger storage may persist locations that point past the bytes actually written to the entry log, making entries unreadable after restart or recovery.
Changes
EntryLogWriteExceptionas the fatal boundary for entry-log-level write failures.BufferedChannelafter entry-log write, flush, or force-write failure so later writes cannot continue on an uncertain channel.DefaultEntryLogger,EntryLogManager,SyncThread,BookieImpl,DbLedgerStorage, andSingleDirectoryDbLedgerStorage.requestFlush()fail on fatal entry-log flush failure instead of racing with asynchronous shutdown.InterleavedLedgerStorageandSortedLedgerStorageentry-log write failures while keepingNoWritableLedgerDirExceptionbehavior unchanged.entryLogPerLedgerEnabledeviction path soappendLedgersMap()failure triggers fatal shutdown and the failed channel is not treated as a normal rotated log.Scope notes:
DirectEntryLogger/ direct I/O path is not changed in this PR.Master Issue: #4855
Tests:
mvn -pl bookkeeper-server -am -Dtest=DbLedgerStorageEntryLogFlushFailureE2ETest -Dsurefire.failIfNoSpecifiedTests=false testmvn -pl bookkeeper-server -am -Dtest=BufferedChannelTest,SyncThreadTest,BookieImplTest,DefaultEntryLogTest,DbLedgerStorageWriteCacheTest,DbLedgerStorageEntryLogFlushFailureE2ETest -Dsurefire.failIfNoSpecifiedTests=false test