HDFS-2886. CreateEditLogs should generate a realistic edit log. Contributed by Konstantin Shvachko.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1241296 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Konstantin Shvachko 2012-02-07 00:44:27 +00:00
parent 8dbf374f16
commit 7e4bd89590
5 changed files with 10 additions and 10 deletions

View File

@ -1689,6 +1689,8 @@ Release 0.22.1 - Unreleased
HDFS-2718. Optimize OP_ADD in edits loading. (shv) HDFS-2718. Optimize OP_ADD in edits loading. (shv)
HDFS-2886. CreateEditLogs should generate a realistic edit log. (shv)
BUG FIXES BUG FIXES
HDFS-2877. If locking of a storage dir fails, it will remove the other HDFS-2877. If locking of a storage dir fails, it will remove the other

View File

@ -313,12 +313,9 @@ else if(blocks.length == 0 || blocks[blocks.length-1].getBlockUCState()
*/ */
void updateFile(INodeFile file, void updateFile(INodeFile file,
String path, String path,
PermissionStatus permissions,
BlockInfo[] blocks, BlockInfo[] blocks,
short replication,
long mtime, long mtime,
long atime, long atime) throws IOException {
long preferredBlockSize) throws IOException {
// Update the salient file attributes. // Update the salient file attributes.
file.setAccessTime(atime); file.setAccessTime(atime);

View File

@ -203,9 +203,8 @@ int loadEditRecords(int logVersion, EditLogInputStream in, boolean closeOnExit,
addCloseOp.mtime, addCloseOp.atime, blockSize, addCloseOp.mtime, addCloseOp.atime, blockSize,
addCloseOp.clientName, addCloseOp.clientMachine); addCloseOp.clientName, addCloseOp.clientMachine);
} else { } else {
fsDir.updateFile(oldFile, fsDir.updateFile(oldFile, addCloseOp.path, blocks,
addCloseOp.path, permissions, blocks, replication, addCloseOp.mtime, addCloseOp.atime);
addCloseOp.mtime, addCloseOp.atime, blockSize);
if(addCloseOp.opCode == FSEditLogOpCodes.OP_CLOSE) { // OP_CLOSE if(addCloseOp.opCode == FSEditLogOpCodes.OP_CLOSE) { // OP_CLOSE
assert oldFile.isUnderConstruction() : assert oldFile.isUnderConstruction() :
"File is not under construction: " + addCloseOp.path; "File is not under construction: " + addCloseOp.path;

View File

@ -93,7 +93,9 @@ static void addFiles(FSEditLog editLog, int numFiles, short replication,
dirInode = new INodeDirectory(p, 0L); dirInode = new INodeDirectory(p, 0L);
editLog.logMkDir(currentDir, dirInode); editLog.logMkDir(currentDir, dirInode);
} }
editLog.logOpenFile(filePath, inode); editLog.logOpenFile(filePath,
new INodeFileUnderConstruction(
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

View File

@ -133,8 +133,8 @@ public void run() {
for (int i = 0; i < numTransactions; i++) { for (int i = 0; i < numTransactions; i++) {
INodeFileUnderConstruction inode = new INodeFileUnderConstruction( INodeFileUnderConstruction inode = new INodeFileUnderConstruction(
p, replication, blockSize, 0, "", "", null); p, replication, blockSize, 0, "", "", null);
editLog.logOpenFile("/filename" + startIndex + i, inode); editLog.logOpenFile("/filename" + (startIndex + i), inode);
editLog.logCloseFile("/filename" + startIndex + i, inode); editLog.logCloseFile("/filename" + (startIndex + i), inode);
editLog.logSync(); editLog.logSync();
} }
} }