Explorar o código

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.19@719756 13f79535-47bb-0310-9956-ffa450edef68
Tsz-wo Sze %!s(int64=16) %!d(string=hai) anos
pai
achega
f6e8fb23a8

+ 3 - 0
CHANGES.txt

@@ -1007,6 +1007,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/hdfs/server/namenode/NamenodeFsck.java

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

+ 4 - 1
src/test/org/apache/hadoop/hdfs/server/namenode/TestFsck.java

@@ -72,6 +72,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");
@@ -107,6 +108,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");
@@ -127,7 +129,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();
@@ -184,6 +186,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  ";