HDFS-8479. Erasure coding: fix striping related logic in FSDirWriteFileOp to sync with HDFS-8421. Contributed by Zhe Zhang.
This commit is contained in:
parent
c9e0268216
commit
1299357a05
@ -259,3 +259,6 @@
|
||||
HDFS-8382. Remove chunkSize and initialize from erasure coder. (Kai Zheng)
|
||||
|
||||
HDFS-8408. Revisit and refactor ErasureCodingInfo (vinayakumarb)
|
||||
|
||||
HDFS-8479. Erasure coding: fix striping related logic in FSDirWriteFileOp to
|
||||
sync with HDFS-8421. (Zhe Zhang via jing9)
|
||||
|
@ -494,6 +494,10 @@ static INodeFile addFileForEditLog(
|
||||
try {
|
||||
INodesInPath iip = fsd.addINode(existing, newNode);
|
||||
if (iip != null) {
|
||||
// check if the file is in an EC zone
|
||||
if (fsd.isInECZone(iip)) {
|
||||
newNode.addStripedBlocksFeature();
|
||||
}
|
||||
if (aclEntries != null) {
|
||||
AclStorage.updateINodeAcl(newNode, aclEntries, CURRENT_STATE_ID);
|
||||
}
|
||||
@ -582,6 +586,9 @@ private static INodesInPath addFile(
|
||||
fsd.writeLock();
|
||||
try {
|
||||
newiip = fsd.addINode(existing, newNode);
|
||||
if (newiip != null && fsd.isInECZone(newiip)) {
|
||||
newNode.addStripedBlocksFeature();
|
||||
}
|
||||
} finally {
|
||||
fsd.writeUnlock();
|
||||
}
|
||||
|
@ -33,10 +33,8 @@
|
||||
import org.apache.hadoop.fs.UnresolvedLinkException;
|
||||
import org.apache.hadoop.fs.XAttr;
|
||||
import org.apache.hadoop.fs.XAttrSetFlag;
|
||||
import org.apache.hadoop.fs.permission.AclEntry;
|
||||
import org.apache.hadoop.fs.permission.FsAction;
|
||||
import org.apache.hadoop.fs.permission.FsPermission;
|
||||
import org.apache.hadoop.fs.permission.PermissionStatus;
|
||||
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
||||
import org.apache.hadoop.hdfs.DFSUtil;
|
||||
import org.apache.hadoop.hdfs.XAttrHelper;
|
||||
@ -54,9 +52,6 @@
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoContiguous;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoContiguousUnderConstruction;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoStripedUnderConstruction;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoUnderConstruction;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockStoragePolicySuite;
|
||||
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants;
|
||||
|
@ -34,7 +34,6 @@
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@ -1209,8 +1208,17 @@ public void testAddStoredBlockDoesNotCauseSkippedReplication()
|
||||
BlockManager bm = new BlockManager(mockNS, new HdfsConfiguration());
|
||||
UnderReplicatedBlocks underReplicatedBlocks = bm.neededReplications;
|
||||
|
||||
BlockInfo block1 = genBlockInfo(ThreadLocalRandom.current().nextLong());
|
||||
BlockInfo block2 = genBlockInfo(ThreadLocalRandom.current().nextLong());
|
||||
long blkID1 = ThreadLocalRandom.current().nextLong();
|
||||
if (blkID1 < 0) {
|
||||
blkID1 *= -1;
|
||||
}
|
||||
long blkID2 = ThreadLocalRandom.current().nextLong();
|
||||
if (blkID2 < 0) {
|
||||
blkID2 *= -1;
|
||||
}
|
||||
|
||||
BlockInfo block1 = genBlockInfo(blkID1);
|
||||
BlockInfo block2 = genBlockInfo(blkID2);
|
||||
|
||||
// Adding QUEUE_UNDER_REPLICATED block
|
||||
underReplicatedBlocks.add(block1, 0, 1, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user