Browse Source

HADOOP-4647. NamenodeFsck should close the DFSClient it has created. (szetszwo)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.18@719757 13f79535-47bb-0310-9956-ffa450edef68
Tsz-wo Sze 16 years ago
parent
commit
8d97a8f1fb

+ 3 - 0
CHANGES.txt

@@ -31,6 +31,9 @@ Release 0.18.3 - Unreleased
     HADOOP-4703. Should not wait for proxy forever in lease recovering.
     (szetszwo)
 
+    HADOOP-4647. NamenodeFsck should close the DFSClient it has created.
+    (szetszwo)
+
 Release 0.18.2 - 2008-11-03
 
   BUG FIXES

+ 4 - 0
src/hdfs/org/apache/hadoop/dfs/NamenodeFsck.java

@@ -300,6 +300,7 @@ public class NamenodeFsck {
   private void lostFoundMove(DFSFileInfo file, LocatedBlocks blocks)
     throws IOException {
     DFSClient dfs = new DFSClient(conf);
+    try {
     if (!lfInited) {
       lostFoundInit(dfs);
     }
@@ -359,6 +360,9 @@ public class NamenodeFsck {
       e.printStackTrace();
       LOG.warn(errmsg + ": " + e.getMessage());
     }
+    } finally {
+      dfs.close();
+    }
   }
       
   /*

+ 4 - 1
src/test/org/apache/hadoop/dfs/TestFsck.java

@@ -67,6 +67,7 @@ public class TestFsck extends TestCase {
     FileSystem fs = null;
     try {
       Configuration conf = new Configuration();
+      conf.setLong("dfs.blockreport.intervalMsec", 10000L);
       cluster = new MiniDFSCluster(conf, 4, true, null);
       fs = cluster.getFileSystem();
       util.createFiles(fs, "/srcdat");
@@ -102,6 +103,7 @@ public class TestFsck extends TestCase {
     FileSystem fs = null;
     try {
       Configuration conf = new Configuration();
+      conf.setLong("dfs.blockreport.intervalMsec", 10000L);
       cluster = new MiniDFSCluster(conf, 4, true, null);
       fs = cluster.getFileSystem();
       util.createFiles(fs, "/srcdat");
@@ -122,7 +124,7 @@ public class TestFsck extends TestCase {
     FileSystem fs = null;
     try {
       Configuration conf = new Configuration();
-      conf.set("dfs.blockreport.intervalMsec", Integer.toString(30));
+      conf.setLong("dfs.blockreport.intervalMsec", 10000L);
       cluster = new MiniDFSCluster(conf, 4, true, null);
       String topDir = "/srcdat";
       fs = cluster.getFileSystem();
@@ -179,6 +181,7 @@ public class TestFsck extends TestCase {
     FileSystem fs = null;
     try {
       Configuration conf = new Configuration();
+      conf.setLong("dfs.blockreport.intervalMsec", 10000L);
       cluster = new MiniDFSCluster(conf, 4, true, null);
       String topDir = "/srcdat";
       String randomString = "HADOOP  ";