HDFS-16776 Erasure Coding: The length of targets should be checked when DN gets a reconstruction task (#4901)
(cherry picked from commit 9a29075f91
)
This commit is contained in:
parent
d66dea300e
commit
ceec19e61a
|
@ -277,6 +277,10 @@ abstract class StripedReconstructor {
|
|||
return decoder;
|
||||
}
|
||||
|
||||
int getNumLiveBlocks(){
|
||||
return liveBitSet.cardinality();
|
||||
}
|
||||
|
||||
void cleanup() {
|
||||
if (decoder != null) {
|
||||
decoder.release();
|
||||
|
|
|
@ -82,8 +82,10 @@ class StripedWriter {
|
|||
assert targetStorageIds != null;
|
||||
|
||||
writers = new StripedBlockWriter[targets.length];
|
||||
|
||||
targetIndices = new short[targets.length];
|
||||
Preconditions.checkArgument(
|
||||
targetIndices.length <= dataBlkNum + parityBlkNum - reconstructor.getNumLiveBlocks(),
|
||||
"Reconstruction work gets too much targets.");
|
||||
Preconditions.checkArgument(targetIndices.length <= parityBlkNum,
|
||||
"Too much missed striped blocks.");
|
||||
initTargetIndices();
|
||||
|
|
Loading…
Reference in New Issue