hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hair...@apache.org
Subject svn commit: r672924 - in /hadoop/core/branches/branch-0.18: CHANGES.txt src/hdfs/org/apache/hadoop/dfs/DFSClient.java src/test/org/apache/hadoop/dfs/TestDistributedFileSystem.java
Date Mon, 30 Jun 2008 21:10:33 GMT
Author: hairong
Date: Mon Jun 30 14:10:32 2008
New Revision: 672924

URL: http://svn.apache.org/viewvc?rev=672924&view=rev
Log:
Merge -r 672920:672921 from trunk to branch 0.18 to move the change of HADOOP-3539 into the
release 0.18.0 section.

Modified:
    hadoop/core/branches/branch-0.18/CHANGES.txt
    hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/DFSClient.java
    hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestDistributedFileSystem.java

Modified: hadoop/core/branches/branch-0.18/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/CHANGES.txt?rev=672924&r1=672923&r2=672924&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.18/CHANGES.txt Mon Jun 30 14:10:32 2008
@@ -688,6 +688,9 @@
     HADOOP-3635. Uncaught exception in DataBlockScanner. 
     (Tsz Wo (Nicholas), SZE via hairong)
 
+    HADOOP-3539. Exception when closing DFSClient while multiple files are
+    open. (Benjamin Gufler via hairong)
+
 Release 0.17.1 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/DFSClient.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/DFSClient.java?rev=672924&r1=672923&r2=672924&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/DFSClient.java (original)
+++ hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/DFSClient.java Mon Jun
30 14:10:32 2008
@@ -207,20 +207,18 @@
     synchronized (this) {
       checkOpen();
       synchronized (pendingCreates) {
-        Iterator file_itr = pendingCreates.keySet().iterator();
-        while (file_itr.hasNext()) {
-          String name = (String) file_itr.next();
-          OutputStream out = pendingCreates.get(name);
-          try {
-            if (out != null) {
+        while (!pendingCreates.isEmpty()) {
+          String name = pendingCreates.firstKey();
+          OutputStream out = pendingCreates.remove(name);
+          if (out != null) {
+            try {
               out.close();
+            } catch (IOException ie) {
+              System.err.println("Exception closing file " + name);
+              ie.printStackTrace();
             }
-          } catch (IOException ie) {
-            System.err.println("Exception closing file " + name);
-            ie.printStackTrace();
           }
         }
-        pendingCreates.clear();
       }
       this.clientRunning = false;
       try {

Modified: hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestDistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestDistributedFileSystem.java?rev=672924&r1=672923&r2=672924&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestDistributedFileSystem.java
(original)
+++ hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestDistributedFileSystem.java
Mon Jun 30 14:10:32 2008
@@ -22,6 +22,7 @@
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
 
 public class TestDistributedFileSystem extends junit.framework.TestCase {
   public void testFileSystemCloseAll() throws Exception {
@@ -42,4 +43,26 @@
       if (cluster != null) {cluster.shutdown();}
     }
   }
+  
+  /**
+   * Tests DFSClient.close throws no ConcurrentModificationException if 
+   * multiple files are open.
+   */
+  public void testDFSClose() throws Exception {
+    Configuration conf = new Configuration();
+    MiniDFSCluster cluster = new MiniDFSCluster(conf, 2, true, null);
+    FileSystem fileSys = cluster.getFileSystem();
+
+    try {
+      // create two files
+      fileSys.create(new Path("/test/dfsclose/file-0"));
+      fileSys.create(new Path("/test/dfsclose/file-1"));
+
+      fileSys.close();
+    }
+    finally {
+      if (cluster != null) {cluster.shutdown();}
+    }
+  }
+
 }



Mime
View raw message