Author: jitendra
Date: Tue Nov 8 23:42:06 2011
New Revision: 1199536
URL: http://svn.apache.org/viewvc?rev=1199536&view=rev
Log:
Merged r1199534 from branch-0.20-security for HDFS-1257.
Modified:
hadoop/common/branches/branch-0.20-security-205/CHANGES.txt
hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
Modified: hadoop/common/branches/branch-0.20-security-205/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-205/CHANGES.txt?rev=1199536&r1=1199535&r2=1199536&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-205/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.20-security-205/CHANGES.txt Tue Nov 8
23:42:06 2011
@@ -83,6 +83,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-205/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=1199536&r1=1199535&r2=1199536&view=diff
==============================================================================
---
hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
(original)
+++
hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
Tue Nov 8 23:42:06 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);