You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cd...@apache.org on 2008/03/19 19:31:58 UTC
svn commit: r638964 - in /hadoop/core/trunk: CHANGES.txt
src/java/org/apache/hadoop/fs/InMemoryFileSystem.java
Author: cdouglas
Date: Wed Mar 19 11:31:54 2008
New Revision: 638964
URL: http://svn.apache.org/viewvc?rev=638964&view=rev
Log:
HADOOP-3030. Release reserved space for file in InMemoryFileSystem if
checksum reservation fails. Contributed by Devaraj Das.
Modified:
hadoop/core/trunk/CHANGES.txt
hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java
Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=638964&r1=638963&r2=638964&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Wed Mar 19 11:31:54 2008
@@ -279,7 +279,10 @@
HADOOP-3029. Datanode prints log message "firstbadlink" only if
it detects a bad connection to another datanode in the pipeline. (dhruba)
-
+
+ HADOOP-3030. Release reserved space for file in InMemoryFileSystem if
+ checksum reservation fails. (Devaraj Das via cdouglas)
+
Release 0.16.2 - Unreleased
BUG FIXES
Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java?rev=638964&r1=638963&r2=638964&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java Wed Mar 19 11:31:54 2008
@@ -319,6 +319,15 @@
return true;
}
}
+ public void unreserveSpace(Path f) {
+ synchronized (this) {
+ FileAttributes fAttr = tempFileAttribs.remove(getPath(f));
+ if (fAttr != null) {
+ fAttr.data = null;
+ totalUsed -= fAttr.size;
+ }
+ }
+ }
/** This API getClosedFiles could have been implemented over listPathsRaw
* but it is an overhead to maintain directory structures for this impl of
@@ -416,11 +425,17 @@
* false.
*/
public boolean reserveSpaceWithCheckSum(Path f, long size) {
- long checksumSize = getChecksumFileLength(f, size);
RawInMemoryFileSystem mfs = (RawInMemoryFileSystem)getRawFileSystem();
synchronized(mfs) {
- return (mfs.reserveSpace(f, size) &&
- mfs.reserveSpace(getChecksumFile(f), checksumSize));
+ boolean b = mfs.reserveSpace(f, size);
+ if (b) {
+ long checksumSize = getChecksumFileLength(f, size);
+ b = mfs.reserveSpace(getChecksumFile(f), checksumSize);
+ if (!b) {
+ mfs.unreserveSpace(f);
+ }
+ }
+ return b;
}
}