-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HDFS-16776 Erasure Coding: The length of targets should be checked when DN gets a reconstruction task #4901
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
Conversation
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
int getIndicesNum(){ | ||
return liveIndiceNum; | ||
} | ||
|
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.
@kidd53685368 Thanks for your PR.
How about using BitSet#cardinality
instead of calculating liveIndiceNum
?
int getIndicesNum(){ | |
return liveIndiceNum; | |
} | |
int getNumLiveBlocks(){ | |
return liveBitSet.cardinality(); | |
} | |
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.
Thanks, this is absolutely a better substitution.
@@ -84,6 +84,8 @@ class StripedWriter { | |||
writers = new StripedBlockWriter[targets.length]; | |||
|
|||
targetIndices = new short[targets.length]; | |||
Preconditions.checkArgument(targetIndices.length <= dataBlkNum + parityBlkNum - reconstructor.getIndicesNum(), |
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.
Could you fix the checkstyle error?
Line is longer than 100 characters (found 114)
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.
Fixed
💔 -1 overall
This message was automatically generated. |
targetIndices = new short[targets.length]; | ||
Preconditions.checkArgument( | ||
targetIndices.length <= dataBlkNum + parityBlkNum - reconstructor.getNumLiveBlocks(), | ||
"Reconstrutcion work gets too much targets."); |
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.
@kidd53685368 Sorry, I have one more request. Reconstrutcion
is a typo of Reconstruction
.
💔 -1 overall
This message was automatically generated. |
Merged. Thanks for your contribution, @kidd53685368. |
…en DN gets a reconstruction task (apache#4901)
As mentioned in HDFS-16739, in order to satisfy the storage policy, the length of This change may cause the reconstruction task to never succeed to satisfy the storage policy (unless the mover is manually triggered to make the block satisfy the storage policy). |
Description of PR
JIRA: HDFS-16776
The length of targets should be checked when DN gets a EC reconstruction task.For some reason (HDFS-14768, HDFS-16739) , the length of targets will be larger than additionalReplRequired which causes some elements in targets get the default value 0. It may trigger the bug which leads to the data corrupttion just like HDFS-14768.