HDFS-16776 Erasure Coding: The length of targets should be checked when DN gets a reconstruction task (#4901)
This commit is contained in:
parent
e526f48fa4
commit
9a29075f91
@ -288,6 +288,10 @@ RawErasureDecoder getDecoder() {
|
||||
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
Block a user