[HDFS-17897] Handle InvalidEncryptionKeyException during striped file checksum#8364
Open
JHSUYU wants to merge 1 commit intoapache:trunkfrom
Open
[HDFS-17897] Handle InvalidEncryptionKeyException during striped file checksum#8364JHSUYU wants to merge 1 commit intoapache:trunkfrom
JHSUYU wants to merge 1 commit intoapache:trunkfrom
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.
Description of PR
Jira: HDFS-17897
HDFS-12931 added handling for
InvalidEncryptionKeyExceptioninReplicatedFileChecksumComputer.checksumBlock()but missed the parallel striped file pathStripedFileNonStripedChecksumComputer.checksumBlockGroup().Both paths call
DFSClient.connectToDN(), which performs a SASL handshake using a cachedDataEncryptionKey(DEK). When the DEK references aBlockKeythat has been removed from the DataNode (there isa time gap when the DataNode isn't updated with the new keys after key rotation, as described in HDFS-12931), the handshake fails with
InvalidEncryptionKeyException.In the replicated path, this exception is caught,
clearDataEncryptionKey()is called to invalidate the cached DEK, and the block is retried. In the striped path, the exception falls through to thegeneric
catch (IOException)block, which only logs a warning. The stale DEK is never cleared, so every DataNode in the block group fails with the same error. The operation fails permanently — evenuser-level retries will reuse the same stale cached DEK.
Fix: Add
catch (InvalidEncryptionKeyException)inchecksumBlockGroup(), mirroring the existing handling inchecksumBlock().How was this patch tested?
testStripedFileChecksumWithInvalidEncryptionKeyinTestEncryptedTransfer, which creates an EC file, invalidates the encryption key on all DataNodes, and verifies thatgetFileChecksum()succeeds by catching the exception and refreshing the key.