HDFS-17780. IBR retry bypasses configured interval on RPC failure#8312
Open
balodesecurity wants to merge 3 commits intoapache:trunkfrom
Open
HDFS-17780. IBR retry bypasses configured interval on RPC failure#8312balodesecurity wants to merge 3 commits intoapache:trunkfrom
balodesecurity wants to merge 3 commits intoapache:trunkfrom
Conversation
When blockReceivedAndDeleted RPC fails, lastIBR was only updated on success. This left lastIBR stale so sendImmediately() returned true on every subsequent heartbeat, creating a retry storm that amplifies NameNode contention instead of backing off. Fix: update lastIBR = startTime unconditionally in the finally block, regardless of whether the RPC succeeded or failed, so the configured dfs.blockreport.incremental.intervalMsec is always respected between attempts. Adds TestIncrementalBlockReports#testFailedIBRRespectsInterval: a pure-mock unit test that injects a failing NN RPC and asserts that sendImmediately() returns false immediately after the failure.
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +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.
Problem
When
blockReceivedAndDeletedRPC fails inIncrementalBlockReportManager.sendIBRs(), thelastIBRtimestamp was only updated on success. A failed RPC leftlastIBRstale, sosendImmediately()returnedtrueon every subsequent heartbeat — the DataNode retried the IBR on every heartbeat cycle instead of waiting for the configureddfs.blockreport.incremental.intervalMsec.Under high NameNode load this creates a positive feedback loop: failures trigger immediate retries, which increase NameNode contention, which causes more failures.
Fix
Move
lastIBR = startTimeout of theif (success)branch into the unconditionalfinallyblock. Whether the RPC succeeds or fails,lastIBRis updated so the interval is always respected between attempts.Testing
TestIncrementalBlockReports#testFailedIBRRespectsInterval: creates anIncrementalBlockReportManagerwith a 60-second interval, injects a pending block, mocks the NameNode to throwIOException, callssendIBRs(), and assertssendImmediately()returnsfalseimmediately after the failure.