This is an automated email from the ASF dual-hosted git repository. xiangfu pushed a commit to branch bugfixing-auto-delete-zk-dir in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
commit 843cd603c0134353e61f19bdf2237f9a81fb1156 Author: Xiang Fu <[email protected]> AuthorDate: Fri Apr 24 00:49:49 2020 -0700 Allow user to specify zk data dir and don't do clean up during zk shutdown --- .../tools/admin/command/StartZookeeperCommand.java | 25 +--------------------- 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartZookeeperCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartZookeeperCommand.java index 3f980eb..c44b608 100644 --- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartZookeeperCommand.java +++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartZookeeperCommand.java @@ -18,11 +18,9 @@ */ package org.apache.pinot.tools.admin.command; -import com.google.common.io.Files; import java.io.File; import java.io.IOException; import org.I0Itec.zkclient.IDefaultNameSpace; -import org.apache.commons.io.FileUtils; import org.apache.pinot.common.utils.ZkStarter; import org.apache.pinot.tools.Command; import org.kohsuke.args4j.Option; @@ -64,13 +62,6 @@ public class StartZookeeperCommand extends AbstractBaseAdminCommand implements C @Override public void cleanup() { - if (_tmpdir != null) { - try { - FileUtils.deleteDirectory(_tmpdir); - } catch (IOException e) { - // Nothing to do right now. - } - } } @Override @@ -89,7 +80,6 @@ public class StartZookeeperCommand extends AbstractBaseAdminCommand implements C } private ZkStarter.ZookeeperInstance _zookeeperInstance; - private File _tmpdir; public void init(int zkPort, String dataDir) { _zkPort = zkPort; @@ -100,10 +90,6 @@ public class StartZookeeperCommand extends AbstractBaseAdminCommand implements C public boolean execute() throws IOException { LOGGER.info("Executing command: " + toString()); - _tmpdir = createAutoDeleteTempDir(); - - File logdir = new File(_tmpdir + File.separator + "translog"); - File datadir = new File(_tmpdir + File.separator + "snapshot"); IDefaultNameSpace _defaultNameSpace = new IDefaultNameSpace() { @Override @@ -112,7 +98,7 @@ public class StartZookeeperCommand extends AbstractBaseAdminCommand implements C } }; - _zookeeperInstance = ZkStarter.startLocalZkServer(_zkPort, datadir.getAbsolutePath()); + _zookeeperInstance = ZkStarter.startLocalZkServer(_zkPort, _dataDir); LOGGER.info("Start zookeeper at localhost:" + _zkPort + " in thread " + Thread.currentThread().getName()); @@ -120,15 +106,6 @@ public class StartZookeeperCommand extends AbstractBaseAdminCommand implements C return true; } - public static File createAutoDeleteTempDir() { - File tempdir = Files.createTempDir(); - tempdir.delete(); - tempdir.mkdir(); - - tempdir.deleteOnExit(); - return tempdir; - } - public boolean stop() { ZkStarter.stopLocalZkServer(_zookeeperInstance); return true; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
