hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r396721 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/dfs/FSNamesystem.java
Date Mon, 24 Apr 2006 23:23:38 GMT
Author: cutting
Date: Mon Apr 24 16:23:37 2006
New Revision: 396721

URL: http://svn.apache.org/viewcvs?rev=396721&view=rev
Log:
Fix HADOOP-162.  Stop generating ConcurrentModificationExceptions when releasing file locks.
 Contributed by Owen O'Malley.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/CHANGES.txt?rev=396721&r1=396720&r2=396721&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Mon Apr 24 16:23:37 2006
@@ -83,6 +83,10 @@
 22. Fix HADOOP-150.  Improved task names that include job
     names. (omalley via cutting)
 
+23. Fix HADOOP-162.  Fix ConcurrentModificationException when
+    releasing file locks. (omalley via cutting)
+
+
 Release 0.1.1 - 2006-04-08
 
  1. Added CHANGES.txt, logging all significant changes to Hadoop.  (cutting)

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java?rev=396721&r1=396720&r2=396721&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java Mon Apr 24 16:23:37
2006
@@ -37,6 +37,10 @@
  ***************************************************/
 class FSNamesystem implements FSConstants {
     public static final Logger LOG = LogFormatter.getLogger("org.apache.hadoop.fs.FSNamesystem");
+    static {
+      // for debugging the pending Creates problems
+      LOG.setLevel(Level.FINE);
+    }
 
     //
     // Stores the correct file name hierarchy
@@ -391,7 +395,22 @@
                                                    ) throws IOException {
       LOG.info("abandoning file in progress on " + src.toString());
       synchronized (leases) {
-        internalReleaseCreate(src, holder);
+        // find the lease
+        Lease lease = (Lease) leases.get(holder);
+        if (lease != null) {
+          // remove the file from the lease
+          if (lease.completedCreate(src)) {
+            // if we found the file in the lease, remove it from pendingCreates
+            internalReleaseCreate(src, holder);
+          } else {
+            LOG.info("Attempt by " + holder.toString() + 
+                " to release someone else's create lock on " + 
+                src.toString());
+          }
+        } else {
+          LOG.info("Attempt to release a lock from an unknown lease holder "
+              + holder.toString() + " for " + src.toString());
+        }
       }
     }
 
@@ -818,33 +837,18 @@
      * @param holder The datanode that was creating the file
      */
     private void internalReleaseCreate(UTF8 src, UTF8 holder) {
-      // find the lease
-      Lease lease = (Lease) leases.get(holder);
-      if (lease != null) {
-        // remove the file from the lease
-        if (lease.completedCreate(src)) {
-          // if we found the file in the lease, remove it from pendingCreates
-          FileUnderConstruction v = 
-            (FileUnderConstruction) pendingCreates.remove(src);
-          if (v != null) {
-            LOG.info("Removing " + src + " from pendingCreates for " + 
-                     holder + " (failure)");
-            for (Iterator it2 = v.getBlocks().iterator(); it2.hasNext(); ) {
-              Block b = (Block) it2.next();
-              pendingCreateBlocks.remove(b);
-            }
-          } else {
-            LOG.info("Attempt to release a create lock on " + src.toString() +
-                     " that was not in pendingCreates");
-          }
-        } else {
-          LOG.info("Attempt by " + holder.toString() + 
-                   " to release someone else's create lock on " + 
-                   src.toString());
+      FileUnderConstruction v = 
+        (FileUnderConstruction) pendingCreates.remove(src);
+      if (v != null) {
+        LOG.info("Removing " + src + " from pendingCreates for " + 
+            holder + " (failure)");
+        for (Iterator it2 = v.getBlocks().iterator(); it2.hasNext(); ) {
+          Block b = (Block) it2.next();
+          pendingCreateBlocks.remove(b);
         }
       } else {
-        LOG.info("Attempt to release a lock from an unknown lease holder "
-                 + holder.toString() + " for " + src.toString());
+        LOG.info("Attempt to release a create lock on " + src.toString()
+                 + " that was not in pendingCreates");
       }
     }
 



Mime
View raw message