hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jiten...@apache.org
Subject svn commit: r1199534 - in /hadoop/common/branches/branch-0.20-security: CHANGES.txt src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
Date Tue, 08 Nov 2011 23:37:46 GMT
Author: jitendra
Date: Tue Nov  8 23:37:46 2011
New Revision: 1199534

URL: http://svn.apache.org/viewvc?rev=1199534&view=rev
Log:
HDFS-1257. Race condition on FSNamesystem#recentInvalidateSets introduced by HADOOP-5124.
Contributed by Eric Payne.

Modified:
    hadoop/common/branches/branch-0.20-security/CHANGES.txt
    hadoop/common/branches/branch-0.20-security/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

Modified: hadoop/common/branches/branch-0.20-security/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security/CHANGES.txt?rev=1199534&r1=1199533&r2=1199534&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.20-security/CHANGES.txt Tue Nov  8 23:37:46 2011
@@ -142,6 +142,9 @@ Release 0.20.205.1 - unreleased
     "HdfsFileStatus" and "localName" respectively to "FileStatus" and
     "pathSuffix" in JSON response.  (szetszwo)
 
+    HDFS-1257. Race condition on FSNamesystem#recentInvalidateSets introduced 
+    by HADOOP-5124. (Eric Payne via jitendra)
+
 Release 0.20.205.0 - 2011.10.06
 
   NEW FEATURES

Modified: hadoop/common/branches/branch-0.20-security/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=1199534&r1=1199533&r2=1199534&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
(original)
+++ hadoop/common/branches/branch-0.20-security/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
Tue Nov  8 23:37:46 2011
@@ -2837,12 +2837,14 @@ public class FSNamesystem implements FSC
    * @return total number of block for deletion
    */
   int computeInvalidateWork(int nodesToProcess) {
-    int numOfNodes = recentInvalidateSets.size();
+    int numOfNodes = 0;
+    ArrayList<String> keyArray;
+    synchronized (this) {
+      numOfNodes = recentInvalidateSets.size();
+      // get an array of the keys
+      keyArray = new ArrayList<String>(recentInvalidateSets.keySet());
+    }
     nodesToProcess = Math.min(numOfNodes, nodesToProcess);
-    
-    // get an array of the keys
-    ArrayList<String> keyArray =
-      new ArrayList<String>(recentInvalidateSets.keySet());
 
     // randomly pick up <i>nodesToProcess</i> nodes 
     // and put them at [0, nodesToProcess)
@@ -3164,8 +3166,9 @@ public class FSNamesystem implements FSC
       return 0;
     }
     Collection<Block> invalidateSet = recentInvalidateSets.get(nodeId);
-    if (invalidateSet == null)
+    if (invalidateSet == null) {
       return 0;
+    }
 
     ArrayList<Block> blocksToInvalidate = 
       new ArrayList<Block>(blockInvalidateLimit);



Mime
View raw message