HDFS-17899. Handle InvalidEncryptionKeyException in Balancer Dispatcher, SPS BlockDispatcher and DataNode DataTransfer#8383
Open
JHSUYU wants to merge 1 commit intoapache:trunkfrom
Open
Conversation
…er, SPS BlockDispatcher and DataNode DataTransfer
Contributor
Author
|
Hi @jojochuang, I have 7 places to fix in total, and I've grouped 3 of them into this PR. Please let me know if these fixes make sense to you. |
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.
JIRA: HDFS-17899
Summary
This is a follow-up of HDFS-17897.
HDFS-17897 fixed
InvalidEncryptionKeyExceptionhandling inDFSClient read/write and striped file checksum paths. However, three other
code paths that establish SASL-encrypted connections still lack this handling:
Dispatcher.PendingMove.dispatch()— Balancer block movesBlockDispatcher.moveBlock()— SPS block movesDataNode.DataTransfer.run()— DataNode block replicationWhen
dfs.encrypt.data.transfer=trueand block keys rotate, these paths failwith
InvalidEncryptionKeyExceptionand the stale key stays cached, causingall subsequent transfers to fail until process restart.
Fix: Add the same retry pattern to all three paths — catch the exception,
clear the cached encryption key via a new
clearDataEncryptionKey()defaultmethod on
DataEncryptionKeyFactory, and retry once with a fresh key.Test
TestKeyManager#testClearDataEncryptionKey— verifiesKeyManager.clearDataEncryptionKey()clears cached keyTestDispatcherEncryptionKey#testClearEncryptionKeyOnRetry— verifiesBalancer Dispatcher retry
TestBlockDispatcher#testClearEncryptionKeyOnRetry— verifies SPSBlockDispatcher retry
TestDataTransferEncryptionKey#testClearEncryptionKeyOnRetry— verifiesDataNode DataTransfer retry