You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by sh...@apache.org on 2009/10/30 01:32:45 UTC
svn commit: r831172 - in /hadoop/hdfs/branches/branch-0.21: CHANGES.txt
src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
src/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java
Author: shv
Date: Fri Oct 30 00:32:44 2009
New Revision: 831172
URL: http://svn.apache.org/viewvc?rev=831172&view=rev
Log:
HDFS-736. Merge -r 831169:831170 from trunk to BRANCH-0.21.
Modified:
hadoop/hdfs/branches/branch-0.21/CHANGES.txt
hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java
Modified: hadoop/hdfs/branches/branch-0.21/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/CHANGES.txt?rev=831172&r1=831171&r2=831172&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/CHANGES.txt (original)
+++ hadoop/hdfs/branches/branch-0.21/CHANGES.txt Fri Oct 30 00:32:44 2009
@@ -289,6 +289,9 @@
HDFS-728. Create a comprehensive functional test for append. (hairong)
+ HDFS-736. commitBlockSynchronization() updates block GS and length in-place.
+ (shv)
+
BUG FIXES
HDFS-76. Better error message to users when commands fail because of
Modified: hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=831172&r1=831171&r2=831172&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java (original)
+++ hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java Fri Oct 30 00:32:44 2009
@@ -1860,19 +1860,19 @@
+ ", closeFile=" + closeFile
+ ", deleteBlock=" + deleteblock
+ ")");
- final BlockInfo oldblockinfo = blockManager.getStoredBlock(lastblock);
- if (oldblockinfo == null) {
+ final BlockInfo storedBlock = blockManager.getStoredBlock(lastblock);
+ if (storedBlock == null) {
throw new IOException("Block (=" + lastblock + ") not found");
}
- INodeFile iFile = oldblockinfo.getINode();
- if (!iFile.isUnderConstruction() || oldblockinfo.isComplete()) {
+ INodeFile iFile = storedBlock.getINode();
+ if (!iFile.isUnderConstruction() || storedBlock.isComplete()) {
throw new IOException("Unexpected block (=" + lastblock
+ ") since the file (=" + iFile.getLocalName()
+ ") is not under construction");
}
long recoveryId =
- ((BlockInfoUnderConstruction)oldblockinfo).getBlockRecoveryId();
+ ((BlockInfoUnderConstruction)storedBlock).getBlockRecoveryId();
if(recoveryId != newgenerationstamp) {
throw new IOException("The recovery id " + newgenerationstamp
+ " does not match current recovery id "
@@ -1881,21 +1881,14 @@
INodeFileUnderConstruction pendingFile = (INodeFileUnderConstruction)iFile;
-
- // Remove old block from blocks map. This always have to be done
- // because the generation stamp of this block is changing.
- blockManager.removeBlockFromMap(oldblockinfo);
-
if (deleteblock) {
pendingFile.removeLastBlock(lastblock);
+ blockManager.removeBlockFromMap(storedBlock);
}
else {
- // update last block, construct newblockinfo and add it to the blocks map
- lastblock.set(lastblock.getBlockId(), newlength, newgenerationstamp);
- BlockInfoUnderConstruction newblockinfo =
- new BlockInfoUnderConstruction(
- lastblock, pendingFile.getReplication());
- blockManager.addINode(newblockinfo, pendingFile);
+ // update last block
+ storedBlock.setGenerationStamp(newgenerationstamp);
+ storedBlock.setNumBytes(newlength);
// find the DatanodeDescriptor objects
// There should be no locations in the blockManager till now because the
@@ -1912,11 +1905,11 @@
// Otherwise fsck will report these blocks as MISSING, especially if the
// blocksReceived from Datanodes take a long time to arrive.
for (int i = 0; i < descriptors.length; i++) {
- descriptors[i].addBlock(newblockinfo);
+ descriptors[i].addBlock(storedBlock);
}
}
- // add locations into the INodeUnderConstruction
- pendingFile.setLastBlock(newblockinfo, descriptors);
+ // add pipeline locations into the INodeUnderConstruction
+ pendingFile.setLastBlock(storedBlock, descriptors);
}
// If this commit does not want to close the file, persist
@@ -1932,7 +1925,7 @@
}
// commit the last block
- blockManager.commitLastBlock(pendingFile, lastblock);
+ blockManager.commitLastBlock(pendingFile, storedBlock);
//remove lease, close file
finalizeINodeFileUnderConstruction(src, pendingFile);
Modified: hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java?rev=831172&r1=831171&r2=831172&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java (original)
+++ hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java Fri Oct 30 00:32:44 2009
@@ -193,19 +193,6 @@
return blocks[blocks.length - 2];
}
- // SHV !!! this is not used anywhere - remove
- INodeFileUnderConstruction toINodeFileUnderConstruction(
- String clientName, String clientMachine, DatanodeDescriptor clientNode
- ) throws IOException {
- if (isUnderConstruction()) {
- return (INodeFileUnderConstruction)this;
- }
- return new INodeFileUnderConstruction(name,
- blockReplication, modificationTime, preferredBlockSize,
- blocks, getPermissionStatus(),
- clientName, clientMachine, clientNode);
- }
-
/**
* Get the last block of the file.
* Make sure it has the right type.