HDFS-16776 Erasure Coding: The length of targets should be checked when DN gets a reconstruction task (#4901)

This commit is contained in:
Kidd5368 2022-09-23 11:27:56 +08:00 committed by GitHub
parent e526f48fa4
commit 9a29075f91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -288,6 +288,10 @@ RawErasureDecoder getDecoder() {
return decoder;
}
int getNumLiveBlocks(){
return liveBitSet.cardinality();
}
void cleanup() {
if (decoder != null) {
decoder.release();

View File

@ -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();