|
@@ -40,6 +40,7 @@ import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
|
import org.apache.hadoop.hdfs.server.blockmanagement.BlockIdManager;
|
|
import org.apache.hadoop.hdfs.server.blockmanagement.BlockIdManager;
|
|
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
|
|
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
|
|
|
|
+import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoStriped;
|
|
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoStripedUnderConstruction;
|
|
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoStripedUnderConstruction;
|
|
import org.apache.hadoop.hdfs.protocol.Block;
|
|
import org.apache.hadoop.hdfs.protocol.Block;
|
|
import org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo;
|
|
import org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo;
|
|
@@ -416,7 +417,7 @@ public class FSEditLogLoader {
|
|
newFile.setAccessTime(addCloseOp.atime, Snapshot.CURRENT_STATE_ID);
|
|
newFile.setAccessTime(addCloseOp.atime, Snapshot.CURRENT_STATE_ID);
|
|
newFile.setModificationTime(addCloseOp.mtime, Snapshot.CURRENT_STATE_ID);
|
|
newFile.setModificationTime(addCloseOp.mtime, Snapshot.CURRENT_STATE_ID);
|
|
// TODO whether the file is striped should later be retrieved from iip
|
|
// TODO whether the file is striped should later be retrieved from iip
|
|
- updateBlocks(fsDir, addCloseOp, iip, newFile, fsDir.getECPolicy(iip));
|
|
|
|
|
|
+ updateBlocks(fsDir, addCloseOp, iip, newFile, fsDir.isInECZone(iip));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case OP_CLOSE: {
|
|
case OP_CLOSE: {
|
|
@@ -437,7 +438,7 @@ public class FSEditLogLoader {
|
|
file.setAccessTime(addCloseOp.atime, Snapshot.CURRENT_STATE_ID);
|
|
file.setAccessTime(addCloseOp.atime, Snapshot.CURRENT_STATE_ID);
|
|
file.setModificationTime(addCloseOp.mtime, Snapshot.CURRENT_STATE_ID);
|
|
file.setModificationTime(addCloseOp.mtime, Snapshot.CURRENT_STATE_ID);
|
|
// TODO whether the file is striped should later be retrieved from iip
|
|
// TODO whether the file is striped should later be retrieved from iip
|
|
- updateBlocks(fsDir, addCloseOp, iip, file, fsDir.getECPolicy(iip));
|
|
|
|
|
|
+ updateBlocks(fsDir, addCloseOp, iip, file, fsDir.isInECZone(iip));
|
|
|
|
|
|
// Now close the file
|
|
// Now close the file
|
|
if (!file.isUnderConstruction() &&
|
|
if (!file.isUnderConstruction() &&
|
|
@@ -496,7 +497,7 @@ public class FSEditLogLoader {
|
|
INodeFile oldFile = INodeFile.valueOf(iip.getLastINode(), path);
|
|
INodeFile oldFile = INodeFile.valueOf(iip.getLastINode(), path);
|
|
// Update in-memory data structures
|
|
// Update in-memory data structures
|
|
// TODO whether the file is striped should later be retrieved from iip
|
|
// TODO whether the file is striped should later be retrieved from iip
|
|
- updateBlocks(fsDir, updateOp, iip, oldFile, fsDir.getECPolicy(iip));
|
|
|
|
|
|
+ updateBlocks(fsDir, updateOp, iip, oldFile, fsDir.isInECZone(iip));
|
|
|
|
|
|
if (toAddRetryCache) {
|
|
if (toAddRetryCache) {
|
|
fsNamesys.addCacheEntry(updateOp.rpcClientId, updateOp.rpcCallId);
|
|
fsNamesys.addCacheEntry(updateOp.rpcClientId, updateOp.rpcCallId);
|
|
@@ -514,7 +515,7 @@ public class FSEditLogLoader {
|
|
INodeFile oldFile = INodeFile.valueOf(iip.getLastINode(), path);
|
|
INodeFile oldFile = INodeFile.valueOf(iip.getLastINode(), path);
|
|
// add the new block to the INodeFile
|
|
// add the new block to the INodeFile
|
|
// TODO whether the file is striped should later be retrieved from iip
|
|
// TODO whether the file is striped should later be retrieved from iip
|
|
- addNewBlock(addBlockOp, oldFile, fsDir.getECPolicy(iip));
|
|
|
|
|
|
+ addNewBlock(addBlockOp, oldFile, fsDir.isInECZone(iip));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case OP_SET_REPLICATION: {
|
|
case OP_SET_REPLICATION: {
|
|
@@ -1079,8 +1080,9 @@ public class FSEditLogLoader {
|
|
// is only executed when loading edits written by prior
|
|
// is only executed when loading edits written by prior
|
|
// versions of Hadoop. Current versions always log
|
|
// versions of Hadoop. Current versions always log
|
|
// OP_ADD operations as each block is allocated.
|
|
// OP_ADD operations as each block is allocated.
|
|
- newBI = new BlockInfoContiguous(newBlock,
|
|
|
|
- file.getPreferredBlockReplication());
|
|
|
|
|
|
+ newBI = isStriped ? new BlockInfoStriped(newBlock,
|
|
|
|
+ HdfsConstants.NUM_DATA_BLOCKS, HdfsConstants.NUM_PARITY_BLOCKS) :
|
|
|
|
+ new BlockInfoContiguous(newBlock, file.getPreferredBlockReplication());
|
|
}
|
|
}
|
|
fsNamesys.getBlockManager().addBlockCollectionWithCheck(newBI, file);
|
|
fsNamesys.getBlockManager().addBlockCollectionWithCheck(newBI, file);
|
|
file.addBlock(newBI);
|
|
file.addBlock(newBI);
|