diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java index 5b16de8..16659cf 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java @@ -201,7 +201,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(); @@ -217,6 +219,7 @@ public class MiniZooKeeperCluster { if (!started) { return; } + // shut down all the zk servers for (int i = 0; i < standaloneServerFactoryList.size(); i++) { NIOServerCnxnFactory standaloneServerFactory = @@ -228,6 +231,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;