You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2014/01/10 02:52:20 UTC

svn commit: r1557009 - /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java

Author: larsh
Date: Fri Jan 10 01:52:20 2014
New Revision: 1557009

URL: http://svn.apache.org/r1557009
Log:
HBASE-10306 Backport HBASE-6820 to 0.94, MiniZookeeperCluster should ensure that ZKDatabase is closed upon shutdown() (chendihao)

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java?rev=1557009&r1=1557008&r2=1557009&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java Fri Jan 10 01:52:20 2014
@@ -197,7 +197,9 @@ public class MiniZooKeeperCluster {
 
   private void recreateDir(File dir) throws IOException {
     if (dir.exists()) {
-      FileUtil.fullyDelete(dir);
+      if(!FileUtil.fullyDelete(dir)) {
+        throw new IOException("Could not delete zk base directory: " + dir);
+      }
     }
     try {
       dir.mkdirs();
@@ -213,6 +215,7 @@ public class MiniZooKeeperCluster {
     if (!started) {
       return;
     }
+
     // shut down all the zk servers
     for (int i = 0; i < standaloneServerFactoryList.size(); i++) {
       NIOServerCnxnFactory standaloneServerFactory =
@@ -224,6 +227,10 @@ public class MiniZooKeeperCluster {
         throw new IOException("Waiting for shutdown of standalone server");
       }
     }
+    for (ZooKeeperServer zkServer: zooKeeperServers) {
+      //explicitly close ZKDatabase since ZookeeperServer does not close them
+      zkServer.getZKDatabase().close();
+    }
 
     // clear everything
     started = false;