|
@@ -26,6 +26,7 @@ import org.apache.hadoop.hdfs.protocol.Block;
|
|
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
|
|
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
|
|
import org.apache.hadoop.hdfs.server.common.GenerationStamp;
|
|
import org.apache.hadoop.hdfs.server.common.GenerationStamp;
|
|
import org.apache.hadoop.hdfs.server.common.Storage;
|
|
import org.apache.hadoop.hdfs.server.common.Storage;
|
|
|
|
+import org.apache.hadoop.hdfs.server.namenode.INodeId;
|
|
|
|
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
@@ -62,8 +63,9 @@ public class CreateEditsLog {
|
|
|
|
|
|
PermissionStatus p = new PermissionStatus("joeDoe", "people",
|
|
PermissionStatus p = new PermissionStatus("joeDoe", "people",
|
|
new FsPermission((short)0777));
|
|
new FsPermission((short)0777));
|
|
- INodeDirectory dirInode = new INodeDirectory(INodeId.GRANDFATHER_INODE_ID,
|
|
|
|
- null, p, 0L);
|
|
|
|
|
|
+ INodeId inodeId = new INodeId();
|
|
|
|
+ INodeDirectory dirInode = new INodeDirectory(inodeId.nextValue(), null, p,
|
|
|
|
+ 0L);
|
|
editLog.logMkDir(BASE_PATH, dirInode);
|
|
editLog.logMkDir(BASE_PATH, dirInode);
|
|
long blockSize = 10;
|
|
long blockSize = 10;
|
|
BlockInfo[] blocks = new BlockInfo[blocksPerFile];
|
|
BlockInfo[] blocks = new BlockInfo[blocksPerFile];
|
|
@@ -82,8 +84,8 @@ public class CreateEditsLog {
|
|
}
|
|
}
|
|
|
|
|
|
INodeFileUnderConstruction inode = new INodeFileUnderConstruction(
|
|
INodeFileUnderConstruction inode = new INodeFileUnderConstruction(
|
|
- INodeId.GRANDFATHER_INODE_ID, null, replication, 0, blockSize,
|
|
|
|
- blocks, p, "", "", null);
|
|
|
|
|
|
+ inodeId.nextValue(), null, replication, 0, blockSize, blocks, p, "",
|
|
|
|
+ "", null);
|
|
// Append path to filename with information about blockIDs
|
|
// Append path to filename with information about blockIDs
|
|
String path = "_" + iF + "_B" + blocks[0].getBlockId() +
|
|
String path = "_" + iF + "_B" + blocks[0].getBlockId() +
|
|
"_to_B" + blocks[blocksPerFile-1].getBlockId() + "_";
|
|
"_to_B" + blocks[blocksPerFile-1].getBlockId() + "_";
|
|
@@ -92,12 +94,11 @@ public class CreateEditsLog {
|
|
// Log the new sub directory in edits
|
|
// Log the new sub directory in edits
|
|
if ((iF % nameGenerator.getFilesPerDirectory()) == 0) {
|
|
if ((iF % nameGenerator.getFilesPerDirectory()) == 0) {
|
|
String currentDir = nameGenerator.getCurrentDir();
|
|
String currentDir = nameGenerator.getCurrentDir();
|
|
- dirInode = new INodeDirectory(INodeId.GRANDFATHER_INODE_ID, null, p, 0L);
|
|
|
|
|
|
+ dirInode = new INodeDirectory(inodeId.nextValue(), null, p, 0L);
|
|
editLog.logMkDir(currentDir, dirInode);
|
|
editLog.logMkDir(currentDir, dirInode);
|
|
}
|
|
}
|
|
editLog.logOpenFile(filePath, new INodeFileUnderConstruction(
|
|
editLog.logOpenFile(filePath, new INodeFileUnderConstruction(
|
|
- INodeId.GRANDFATHER_INODE_ID, p, replication, 0, blockSize, "", "",
|
|
|
|
- null));
|
|
|
|
|
|
+ inodeId.nextValue(), p, replication, 0, blockSize, "", "", null));
|
|
editLog.logCloseFile(filePath, inode);
|
|
editLog.logCloseFile(filePath, inode);
|
|
|
|
|
|
if (currentBlockId - bidAtSync >= 2000) { // sync every 2K blocks
|
|
if (currentBlockId - bidAtSync >= 2000) { // sync every 2K blocks
|