Fix batch reads hanging after digest mismatch retries are ignored#4789
Open
void-ptr974 wants to merge 1 commit intoapache:masterfrom
Open
Fix batch reads hanging after digest mismatch retries are ignored#4789void-ptr974 wants to merge 1 commit intoapache:masterfrom
void-ptr974 wants to merge 1 commit intoapache:masterfrom
Conversation
Batch reads marked the request as complete before verifying the digest of each returned entry. If one entry in the response failed digest verification, the operation attempted to retry on another replica, but the request had already been completed, so the retry response could be ignored and the batch read could hang or fail. Verify all entries in the batch before completing the request. On digest mismatch, leave the request incomplete, discard the whole response, and retry the same batch on the next replica. Only create LedgerEntryImpl instances after the full batch has passed digest verification, so no partially verified entries are retained. Add tests for retrying after a corrupt batch response and for the case where an earlier entry verifies successfully but a later entry fails digest verification.
Contributor
Author
|
@hangc0276 @horizonzy PTAL. |
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.
Motivation
Batch reads could hang or fail after receiving a corrupt response from a bookie. The request was marked complete before digest verification, so although a digest mismatch triggered a retry
on another replica, the retry response could be ignored because the request was already completed.
Changes
ByteBufListownership and release paths with comments.Tests
Added coverage for the batch-read digest mismatch retry path:
testDigestMismatchRetriesNextReplicaAndCompletestestDigestMismatchAfterPartialVerificationDoesNotRetainEntriesAlso ran the full
TestBatchedReadsuite to ensure existing batch-read behavior remains unchanged, including normal reads, partial batch responses, missing entries, and failed bookiescenarios.