HDFS-17850. Reject append when new generation stamp equals or is less…#8334
Open
deepujain wants to merge 1 commit intoapache:trunkfrom
Open
HDFS-17850. Reject append when new generation stamp equals or is less…#8334deepujain wants to merge 1 commit intoapache:trunkfrom
deepujain wants to merge 1 commit intoapache:trunkfrom
Conversation
|
🎊 +1 overall
This message was automatically generated. |
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.
Summary
When using a third-party HDFS client, if the client does not update the generation stamp (GS) correctly on append, the DataNode previously accepted
newGS == currentGS, which can lead to corrupted replica state. This change requires the new generation stamp to be strictly greater than the replica's current generation stamp: append now rejects bothnewGS < currentGS(existing) andnewGS == currentGS(new), so misbehaving clients cannot silently corrupt replica state.Change
append(ExtendedBlock b, long newGS, long expectedBlockLen), change the validity check fromnewGS < b.getGenerationStamp()tonewGS <= b.getGenerationStamp(), so that equal generation stamps are also rejected with the same IOException message.testAppendRejectsSameOrLowerGenerationStamp(): create a file, get the finalized block, then assert thatappend(block, block.getGenerationStamp(), blockLen)andappend(block, block.getGenerationStamp() - 1, blockLen)throw IOException with "should be greater than the replica", and thatappend(block, block.getGenerationStamp() + 1, blockLen)succeeds (HDFS-17850).JIRA
Fixes HDFS-17850