HDFS-11152. Start erasure coding policy ID number from 1 instead of 0 to void potential unexpected errors. Contributed by SammiChen.

This commit is contained in:
Andrew Wang 2017-03-08 08:47:38 -08:00 committed by Anu Engineer
parent 05ebf508c8
commit 6b6c61ee74
2 changed files with 8 additions and 5 deletions

View File

@ -144,11 +144,11 @@ public final class HdfsConstants {
ALL, LIVE, DEAD, DECOMMISSIONING, ENTERING_MAINTENANCE
}
public static final byte RS_6_3_POLICY_ID = 0;
public static final byte RS_3_2_POLICY_ID = 1;
public static final byte RS_6_3_LEGACY_POLICY_ID = 2;
public static final byte XOR_2_1_POLICY_ID = 3;
public static final byte RS_10_4_POLICY_ID = 4;
public static final byte RS_6_3_POLICY_ID = 1;
public static final byte RS_3_2_POLICY_ID = 2;
public static final byte RS_6_3_LEGACY_POLICY_ID = 3;
public static final byte XOR_2_1_POLICY_ID = 4;
public static final byte RS_10_4_POLICY_ID = 5;
/* Hidden constructor */
protected HdfsConstants() {

View File

@ -342,6 +342,9 @@ public final class FSImageFormatPBINode {
for (int i = 0; i < bp.size(); ++i) {
BlockProto b = bp.get(i);
if (isStriped) {
Preconditions.checkState(ecPolicy.getId() > 0,
"File with ID " + n.getId() +
" has an invalid erasure coding policy ID " + ecPolicy.getId());
blocks[i] = new BlockInfoStriped(PBHelperClient.convert(b), ecPolicy);
} else {
blocks[i] = new BlockInfoContiguous(PBHelperClient.convert(b),