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;
|
return decoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getNumLiveBlocks(){
|
||||||
|
return liveBitSet.cardinality();
|
||||||
|
}
|
||||||
|
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
if (decoder != null) {
|
if (decoder != null) {
|
||||||
decoder.release();
|
decoder.release();
|
||||||
|
@ -82,8 +82,10 @@ class StripedWriter {
|
|||||||
assert targetStorageIds != null;
|
assert targetStorageIds != null;
|
||||||
|
|
||||||
writers = new StripedBlockWriter[targets.length];
|
writers = new StripedBlockWriter[targets.length];
|
||||||
|
|
||||||
targetIndices = new short[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,
|
Preconditions.checkArgument(targetIndices.length <= parityBlkNum,
|
||||||
"Too much missed striped blocks.");
|
"Too much missed striped blocks.");
|
||||||
initTargetIndices();
|
initTargetIndices();
|
||||||
|
Loading…
Reference in New Issue
Block a user