-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HDFS-17556. Avoid adding block to neededReconstruction repeatedly in decommission #6896
base: trunk
Are you sure you want to change the base?
Conversation
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@lfxy Thanks for your report and PR. It looks good to me. Please check the failed unit test and if related to this PR. It's better to add another test to cover this case if possible. Thanks again. |
@Hexiaoqiao Thanks for your review! The failed unit test is org.apache.hadoop.hdfs.server.datanode.TestDirectoryScanner |
💔 -1 overall
This message was automatically generated. |
5526269
to
2bd848d
Compare
🎊 +1 overall
This message was automatically generated. |
@Hexiaoqiao I have add new UT to cover this case, and please review again. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. +1.
Well work, Leave some comments inline, Thanks~ |
...adoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java
Show resolved
Hide resolved
@haiyang1987 Thank you for your suggestion. I have update the UT. |
🎊 +1 overall
This message was automatically generated. |
01c9c84
to
d9edab0
Compare
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. +1.
I think you may mean that add block to pendingReconstruction in two place is duplicated.
I think in (2), when we add timed out block to pendingReconstruction, we will use isNeededReconstruction to check. Will it really be repeated? |
@zhengchenyu I think it's wrong you described about pendingReconstruction. |
@lfxy |
@zhengchenyu We should check (1) -> (2), but not (4) -> (5), because (4)->(5) is not only used in decommission flow. |
@Hexiaoqiao @haiyang1987 Hi, Could this commit be merged? |
HDFS-17556
In decommission and maintenance process, before added to BlockManager::neededReconstruction block will be check if it has been added. The check contains if block is in BlockManager::neededReconstruction or in PendingReconstructionBlocks::pendingReconstructions as below code.
But it also need to check if it is in PendingReconstructionBlocks::timedOutItems. Or else DatanodeAdminDefaultMonitor will add block to BlockManager::neededReconstruction repeatedly if block time out in PendingReconstructionBlocks::pendingReconstructions.
if (!blockManager.neededReconstruction.contains(block) && blockManager.pendingReconstruction.getNumReplicas(block) == 0 && blockManager.isPopulatingReplQueues()) { // Process these blocks only when active NN is out of safe mode. blockManager.neededReconstruction.add(block, liveReplicas, num.readOnlyReplicas(), num.outOfServiceReplicas(), blockManager.getExpectedRedundancyNum(block)); }