hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r417245 - in /lucene/hadoop/trunk: ./ src/java/org/apache/hadoop/dfs/ src/java/org/apache/hadoop/fs/ src/test/org/apache/hadoop/fs/
Date Mon, 26 Jun 2006 17:32:23 GMT
Author: cutting
Date: Mon Jun 26 10:32:23 2006
New Revision: 417245

URL: http://svn.apache.org/viewvc?rev=417245&view=rev
Log:
HADOOP-319.  Fix FileSystem.close() to remove FileSystem instance from the cache.  Contributed
by Hairong.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/LocalFileSystem.java
    lucene/hadoop/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=417245&r1=417244&r2=417245&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Mon Jun 26 10:32:23 2006
@@ -41,6 +41,9 @@
  9. HADOOP-316.  Fix a potential deadlock in the jobtracker.
     (omalley via cutting)
 
+10. HADOOP-319.  Fix FileSystem.close() to remove the FileSystem
+    instance from the cache.  (Hairong Kuang via cutting)
+
 
 Release 0.3.2 - 2006-06-09
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java?rev=417245&r1=417244&r2=417245&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java Mon Jun
26 10:32:23 2006
@@ -196,6 +196,7 @@
     }
 
     public void close() throws IOException {
+        super.close();
         dfs.close();
     }
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java?rev=417245&r1=417244&r2=417245&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java Mon Jun 26 10:32:23
2006
@@ -540,7 +540,9 @@
      * No more filesystem operations are needed.  Will
      * release any held locks.
      */
-    public abstract void close() throws IOException;
+    public void close() throws IOException {
+        NAME_TO_FS.remove(getName());
+    }
 
     /**
      * Report a checksum error to the file system.

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/LocalFileSystem.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/LocalFileSystem.java?rev=417245&r1=417244&r2=417245&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/LocalFileSystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/LocalFileSystem.java Mon Jun 26 10:32:23
2006
@@ -322,7 +322,9 @@
       throws IOException {
     }
 
-    public void close() throws IOException {}
+    public void close() throws IOException {
+        super.close();
+    }
 
     public String toString() {
         return "LocalFS";

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java?rev=417245&r1=417244&r2=417245&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java Mon Jun 26 10:32:23
2006
@@ -171,12 +171,10 @@
   public void testCopyFromDfsToDfs() throws IOException {
     String namenode = null;
     MiniDFSCluster cluster = null;
-    FileSystem fileSys = null;
     try {
       Configuration conf = new Configuration();
       cluster = new MiniDFSCluster(65314, conf);
-      fileSys = cluster.getFileSystem();
-      namenode = fileSys.getName();
+      namenode = conf.get("fs.default.name", "local");
       if (!"local".equals(namenode)) {
         MyFile[] files = createFiles(namenode, "/srcdat");
         CopyFiles.main(new String[] {"dfs://"+namenode+"/srcdat",
@@ -187,7 +185,6 @@
         deldir(namenode, "/srcdat");
       }
     } finally {
-      if (fileSys != null) { fileSys.close(); }
       if (cluster != null) { cluster.shutdown(); }
     }
   }
@@ -196,12 +193,10 @@
   public void testCopyFromLocalToDfs() throws IOException {
     String namenode = null;
     MiniDFSCluster cluster = null;
-    FileSystem fileSys = null;
     try {
       Configuration conf = new Configuration();
       cluster = new MiniDFSCluster(65316, conf);
-      fileSys = cluster.getFileSystem();
-      namenode = fileSys.getName();
+      namenode = conf.get("fs.default.name", "local");
       if (!"local".equals(namenode)) {
         MyFile[] files = createFiles("local", TEST_ROOT_DIR+"/srcdat");
         CopyFiles.main(new String[] {"file://"+TEST_ROOT_DIR+"/srcdat",
@@ -212,7 +207,6 @@
         deldir("local", TEST_ROOT_DIR+"/srcdat");
       }
     } finally {
-      if (fileSys != null) { fileSys.close(); }
       if (cluster != null) { cluster.shutdown(); }
     }
   }
@@ -221,12 +215,10 @@
   public void testCopyFromDfsToLocal() throws IOException {
     String namenode = null;
     MiniDFSCluster cluster = null;
-    FileSystem fileSys = null;
     try {
       Configuration conf = new Configuration();
       cluster = new MiniDFSCluster(65318, conf);
-      fileSys = cluster.getFileSystem();
-      namenode = fileSys.getName();
+      namenode = conf.get("fs.default.name", "local");
       if (!"local".equals(namenode)) {
         MyFile[] files = createFiles(namenode, "/srcdat");
         CopyFiles.main(new String[] {"dfs://"+namenode+"/srcdat",
@@ -237,7 +229,6 @@
         deldir(namenode, "/srcdat");
       }
     } finally {
-      if (fileSys != null) { fileSys.close(); }
       if (cluster != null) { cluster.shutdown(); }
     }
  }



Mime
View raw message