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:
parent
4ebe8a6a23
commit
5addacb1e3
|
@ -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() {
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue