HDFS-4308. addBlock() should persist file blocks once. Contributed by Plamen Jeliazkov.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1426703 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Konstantin Shvachko 2012-12-29 04:18:00 +00:00
parent 52742c9a65
commit 6a4b1b881c
2 changed files with 4 additions and 4 deletions

View File

@ -338,6 +338,9 @@ Release 2.0.3-alpha - Unreleased
HDFS-4140. fuse-dfs handles open(O_TRUNC) poorly. (Colin Patrick McCabe HDFS-4140. fuse-dfs handles open(O_TRUNC) poorly. (Colin Patrick McCabe
via atm) via atm)
HDFS-4308. addBlock() should persist file blocks once.
(Plamen Jeliazkov via shv)
BREAKDOWN OF HDFS-3077 SUBTASKS BREAKDOWN OF HDFS-3077 SUBTASKS
HDFS-3077. Quorum-based protocol for reading and writing edit logs. HDFS-3077. Quorum-based protocol for reading and writing edit logs.

View File

@ -419,19 +419,16 @@ public class FSDirectory implements Closeable {
/** /**
* Remove a block from the file. * Remove a block from the file.
*/ */
boolean removeBlock(String path, INodeFileUnderConstruction fileNode, void removeBlock(String path, INodeFileUnderConstruction fileNode,
Block block) throws IOException { Block block) throws IOException {
waitForReady(); waitForReady();
writeLock(); writeLock();
try { try {
unprotectedRemoveBlock(path, fileNode, block); unprotectedRemoveBlock(path, fileNode, block);
// write modified block locations to log
fsImage.getEditLog().logOpenFile(path, fileNode);
} finally { } finally {
writeUnlock(); writeUnlock();
} }
return true;
} }
void unprotectedRemoveBlock(String path, INodeFileUnderConstruction fileNode, void unprotectedRemoveBlock(String path, INodeFileUnderConstruction fileNode,