Details
-
Task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.0.0-alpha1
-
None
-
Incompatible change
-
Description
For Erasure Coded files, replication field in INodeFile message is re-used to store the EC Policy ID.
FSDirWriteFileOp#addFile
private static INodesInPath addFile( FSDirectory fsd, INodesInPath existing, byte[] localName, PermissionStatus permissions, short replication, long preferredBlockSize, String clientName, String clientMachine) throws IOException { .. .. .. try { ErasureCodingPolicy ecPolicy = FSDirErasureCodingOp. getErasureCodingPolicy(fsd.getFSNamesystem(), existing); if (ecPolicy != null) { replication = ecPolicy.getId(); <=== } final BlockType blockType = ecPolicy != null? BlockType.STRIPED : BlockType.CONTIGUOUS; INodeFile newNode = newINodeFile(fsd.allocateNewInodeId(), permissions, modTime, modTime, replication, preferredBlockSize, blockType); newNode.setLocalName(localName); newNode.toUnderConstruction(clientName, clientMachine); newiip = fsd.addINode(existing, newNode, permissions.getPermission());
With HDFS-11268 fix, FSImageFormatPBINode#Loader#loadInodeFile is rightly getting the EC ID from the replication field and then uses the right Policy to construct the blocks.
FSImageFormatPBINode#Loader#loadInodeFile
ErasureCodingPolicy ecPolicy = (blockType == BlockType.STRIPED) ? ErasureCodingPolicyManager.getPolicyByPolicyID((byte) replication) : null;
The original intention was to re-use the replication field so the in-memory representation would be compact. But, this isn't necessary for the on-disk representation. replication is an optional field, and if we add another optional field for the EC policy, it won't be any extra space.
Also, we need to make sure to have the appropriate asserts in place to make sure both fields aren't set for the same INodeField.
Attachments
Attachments
Issue Links
- is related to
-
HDFS-10867 [PROVIDED Phase 2] Block Bit Field Allocation of Provided Storage
- Resolved
-
HDFS-11465 Rename BlockType#CONTIGUOUS to BlockType#REPLICATED
- Resolved