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 dd...@apache.org on 2009/05/08 10:00:52 UTC
svn commit: r772876 - in /hadoop/core/trunk: CHANGES.txt
src/core/org/apache/hadoop/fs/LocalDirAllocator.java
Author: ddas
Date: Fri May 8 08:00:52 2009
New Revision: 772876
URL: http://svn.apache.org/viewvc?rev=772876&view=rev
Log:
HADOOP-5349. Fixes a problem in LocalDirAllocator to check for the return path value that is returned for the case where the file we want to write is of an unknown size. Contributed by Vinod Kumar Vavilapalli.
Modified:
hadoop/core/trunk/CHANGES.txt
hadoop/core/trunk/src/core/org/apache/hadoop/fs/LocalDirAllocator.java
Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=772876&r1=772875&r2=772876&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Fri May 8 08:00:52 2009
@@ -580,7 +580,11 @@
kills itself if it ever discovers that the port to which jetty is actually
bound is invalid (-1). (ddas)
-Release 0.20.0 - Unreleased
+ HADOOP-5349. Fixes a problem in LocalDirAllocator to check for the return
+ path value that is returned for the case where the file we want to write
+ is of an unknown size. (Vinod Kumar Vavilapalli via ddas)
+
+Release 0.20.0 - 2009-04-15
INCOMPATIBLE CHANGES
Modified: hadoop/core/trunk/src/core/org/apache/hadoop/fs/LocalDirAllocator.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/fs/LocalDirAllocator.java?rev=772876&r1=772875&r2=772876&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/fs/LocalDirAllocator.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/fs/LocalDirAllocator.java Fri May 8 08:00:52 2009
@@ -306,16 +306,24 @@
availableOnDisk[i] = dirDF[i].getAvailable();
totalAvailable += availableOnDisk[i];
}
- // "roll the ball" -- pick a directory
+
+ // Keep rolling the wheel till we get a valid path
Random r = new java.util.Random();
- long randomPosition = Math.abs(r.nextLong()) % totalAvailable;
- int dir=0;
- while(randomPosition > availableOnDisk[dir]) {
- randomPosition -= availableOnDisk[dir];
- dir++;
+ while (numDirsSearched < numDirs && returnPath == null) {
+ long randomPosition = Math.abs(r.nextLong()) % totalAvailable;
+ int dir = 0;
+ while (randomPosition > availableOnDisk[dir]) {
+ randomPosition -= availableOnDisk[dir];
+ dir++;
+ }
+ dirNumLastAccessed = dir;
+ returnPath = createPath(pathStr);
+ if (returnPath == null) {
+ totalAvailable -= availableOnDisk[dir];
+ availableOnDisk[dir] = 0; // skip this disk
+ numDirsSearched++;
+ }
}
- dirNumLastAccessed = dir;
- returnPath = createPath(pathStr);
} else {
while (numDirsSearched < numDirs && returnPath == null) {
long capacity = dirDF[dirNumLastAccessed].getAvailable();