Skip to content

Commit fdd8f17

Browse files
biangjuangpan3793
authored andcommitted
[KYUUBI apache#5441] Make the configuration kyuubi.zookeeper.embedded.data.log.dir effective
### _Why are the changes needed?_ The configuration `kyuubi.zookeeper.embedded.data.log.dir` exists, but it is not used by the `EmbeddedZookeeper`, it is ineffective ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [x] [Run test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests) locally before make a pull request ### _Was this patch authored or co-authored using generative AI tooling?_ No Closes apache#5440 from biangjuang/zk-log-dir. Closes apache#5441 784619c [lawulu] Make the configuration kyuubi.zookeeper.embedded.data.log.dir effective Authored-by: lawulu <biangjuang@gmail.com> Signed-off-by: Cheng Pan <chengpan@apache.org>
1 parent 47555eb commit fdd8f17

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

kyuubi-zookeeper/src/main/scala/org/apache/kyuubi/zookeeper/EmbeddedZookeeper.scala

+7-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ class EmbeddedZookeeper extends AbstractService("EmbeddedZookeeper") {
3131
private var zks: ZooKeeperServer = _
3232
private var serverFactory: NIOServerCnxnFactory = _
3333
private var dataDirectory: File = _
34+
private var dataLogDirectory: File = _
3435
// TODO: Is it right in prod?
3536
private val deleteDataDirectoryOnClose = true
3637
private var host: String = _
3738

3839
override def initialize(conf: KyuubiConf): Unit = synchronized {
3940
dataDirectory = new File(conf.get(ZK_DATA_DIR))
41+
dataLogDirectory = new File(conf.get(ZK_DATA_LOG_DIR))
4042
val clientPort = conf.get(ZK_CLIENT_PORT)
4143
val tickTime = conf.get(ZK_TICK_TIME)
4244
val maxClientCnxns = conf.get(ZK_MAX_CLIENT_CONNECTIONS)
@@ -51,7 +53,7 @@ class EmbeddedZookeeper extends AbstractService("EmbeddedZookeeper") {
5153
}
5254

5355
try {
54-
zks = new ZooKeeperServer(dataDirectory, dataDirectory, tickTime)
56+
zks = new ZooKeeperServer(dataDirectory, dataLogDirectory, tickTime)
5557
zks.setMinSessionTimeout(minSessionTimeout)
5658
zks.setMaxSessionTimeout(maxSessionTimeout)
5759

@@ -79,7 +81,10 @@ class EmbeddedZookeeper extends AbstractService("EmbeddedZookeeper") {
7981
if (getServiceState == ServiceState.STARTED) {
8082
if (null != serverFactory) serverFactory.shutdown()
8183
if (null != zks) zks.shutdown()
82-
if (deleteDataDirectoryOnClose) deleteDirectoryRecursively(dataDirectory)
84+
if (deleteDataDirectoryOnClose) {
85+
deleteDirectoryRecursively(dataDirectory)
86+
deleteDirectoryRecursively(dataLogDirectory)
87+
}
8388
}
8489
super.stop()
8590
}

0 commit comments

Comments
 (0)