Repository navigation
Conversation
|
🎊 +1 overall
This message was automatically generated. |
slfan1989
reviewed
Nov 23, 2026
| boolean isInPipeline = false; | ||
| do { | ||
| try (AutoCloseableLock lock = lockManager.writeLock(LockLevel.BLOCK_POOl, | ||
| try (AutoCloseableLock lock = lockManager.readLock(LockLevel.BLOCK_POOl, |
Contributor
There was a problem hiding this comment.
Could we protect the generation-stamp check with the existing replica’s DIR lock?
recoverRbw() can update the stamp in place under that lock and roll it back if the metadata rename fails.
With a shared block-pool lock, createTemporary() can see the intermediate value and reject the request.
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
This branch has not been deployed
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-18034. FsDatasetImpl#createTemporary should use the block pool read lock instead of the write lock
FsDatasetImpl#createTemporarytakes the block pool write lock only to look up the existing replica in the replica map. Nothing is modified under it.After HDFS-17496, the DIR level operations (
createRbw,finalizeBlock,removeReplicaFromMem, ...) hold the block pool read lock while doing disk IO. The write lock increateTemporaryhas to wait for all of them, and sincedfs.datanode.lock.fairistrueby default, the readers arriving later queue behind the waiting writer. One slow disk operation plus one incoming replica transfer (re-replication, Balancer, Mover, EC reconstruction) therefore stalls the whole block pool.This PR changes it to the block pool read lock. This is safe because:
ReplicaMap#addandReplicaMap#removealready run under the block pool read lock, andLightWeightResizableGSetis synchronized.createRbwalready does the same existence check under the block pool read lock.stopWriter()and before the DIR lock is taken, and the loop re-checks the replica, so the method does not rely on the exclusion of the write lock.The creation of the temporary file and
volumeMap.addare still done under the DIR write lock and are not changed.How was this patch tested?
Added
TestFsDatasetImpl#testCreateTemporaryNotBlockedByBlockPoolReadLock: the test thread holds the block pool read lock while another thread callscreateTemporary, which must return. The test times out without the fix and passes with it.Ran
TestFsDatasetImplandTestWriteToReplicalocally.For code changes:
declared according to the connector-specific documentation? Note: Automated CI
testing doesn't cover all cases so manual testing with cloud storage is still
required.
LICENSE,LICENSE-binary,NOTICE-binaryfiles?AI Tooling
If an AI tool was used:
where is the name of the AI tool used.
https://www.apache.org/legal/generative-tooling.html