Repository navigation
HDDS-17445. Short-circuit GetBlock parks the opened block file in a map shared by all requests instead of handing it to the request's own context - #11745
Draft
smengcl wants to merge 1 commit into
Conversation
…ap shared by all requests instead of handing it to the request's own context Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
@smengcl , thanks for the change. Overall it looks good to me. "A GetBlock with the flag from GRPC" is possible under an attacker's case, but "Requests with the same key share one entry" seems not easy even for an attacker if it's not DN service which is been compromised. |
Gargi-jais11
self-requested a review
October 26, 2026 08:58
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.
Generated-by: Claude Code (Opus 5.5)
What changes were proposed in this pull request?
For a GetBlock with
requestShortCircuitAccessset,KeyValueHandler.handleGetBlockopens the block file, parks it inblockFileMapunder a key built from request fields (clientId,callId, local ID, container ID) and setsshortCircuitAccessGrantedin the response. The handler does this for any GetBlock that carries the flag, because it does not know which path dispatched the request, and the map is shared by all requests. Only the domain socketReceivertakes the file out again (throughHandler.getBlockFile) and closes it after sending the descriptor. So:GrpcXceiverService,ContainerStateMachine.query) parks a file that nothing takes out, and its response reportsshortCircuitAccessGranted=truealthough that path passes no descriptor.Receivertask that looks second finds no entry.This change hands the opened file to the request's own context instead of a shared map.
Receiverdispatches each request with its ownDispatcherContextof a new op,HANDLE_SHORT_CIRCUIT_READ;handleGetBlockopens the file only for such a context and stores it there, andReceivertakes it from that context. A GetBlock with the flag dispatched without that context gets the block data andshortCircuitAccessGranted=false, which the read path already treats as "read normally".blockFileMap,KeyValueHandler.getBlockFileand the abstractHandler.getBlockFileare removed. The block token is still verified for the new op, and there is no wire or protocol change.Overlap with other open changes: this and HDDS-17443 change adjacent lines in
Receiver.ProcessRequestTask.run; whichever lands second needs a trivial rebase.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-17445
How was this patch tested?
TestKeyValueHandler.testShortCircuitGetBlockHandsFileToOwnContext: a GetBlock with the flag dispatched without the domain socket context getsshortCircuitAccessGranted=falseand counts no local bytes, a domain socket context without the flag gets no file, and two dispatches of the same request with their own contexts each get their own open file. Without the change the first part fails with "Expecting value to be false but was true".TestKeyValueHandler,TestKeyValueHandlerWithUnhealthyContainerandTestHddsDispatcher(129 tests), andTestXceiverServerDomainSocket,TestXceiverClientManagerSC,TestLocalChunkInputStreamandTestDomainSocketFactorypass locally on macOS; checkstyle is clean.