This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new fdd8f1729 [KYUUBI #5441] Make the configuration 
kyuubi.zookeeper.embedded.data.log.dir effective
fdd8f1729 is described below

commit fdd8f1729a8164e7a4dc49f5acaf0a96061e4561
Author: lawulu <[email protected]>
AuthorDate: Tue Oct 17 14:41:28 2023 +0800

    [KYUUBI #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 #5440 from biangjuang/zk-log-dir.
    
    Closes #5441
    
    784619cda [lawulu] Make the configuration 
kyuubi.zookeeper.embedded.data.log.dir effective
    
    Authored-by: lawulu <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../scala/org/apache/kyuubi/zookeeper/EmbeddedZookeeper.scala    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/kyuubi-zookeeper/src/main/scala/org/apache/kyuubi/zookeeper/EmbeddedZookeeper.scala
 
b/kyuubi-zookeeper/src/main/scala/org/apache/kyuubi/zookeeper/EmbeddedZookeeper.scala
index 4ea63d782..17caffedf 100644
--- 
a/kyuubi-zookeeper/src/main/scala/org/apache/kyuubi/zookeeper/EmbeddedZookeeper.scala
+++ 
b/kyuubi-zookeeper/src/main/scala/org/apache/kyuubi/zookeeper/EmbeddedZookeeper.scala
@@ -31,12 +31,14 @@ class EmbeddedZookeeper extends 
AbstractService("EmbeddedZookeeper") {
   private var zks: ZooKeeperServer = _
   private var serverFactory: NIOServerCnxnFactory = _
   private var dataDirectory: File = _
+  private var dataLogDirectory: File = _
   // TODO: Is it right in prod?
   private val deleteDataDirectoryOnClose = true
   private var host: String = _
 
   override def initialize(conf: KyuubiConf): Unit = synchronized {
     dataDirectory = new File(conf.get(ZK_DATA_DIR))
+    dataLogDirectory = new File(conf.get(ZK_DATA_LOG_DIR))
     val clientPort = conf.get(ZK_CLIENT_PORT)
     val tickTime = conf.get(ZK_TICK_TIME)
     val maxClientCnxns = conf.get(ZK_MAX_CLIENT_CONNECTIONS)
@@ -51,7 +53,7 @@ class EmbeddedZookeeper extends 
AbstractService("EmbeddedZookeeper") {
     }
 
     try {
-      zks = new ZooKeeperServer(dataDirectory, dataDirectory, tickTime)
+      zks = new ZooKeeperServer(dataDirectory, dataLogDirectory, tickTime)
       zks.setMinSessionTimeout(minSessionTimeout)
       zks.setMaxSessionTimeout(maxSessionTimeout)
 
@@ -79,7 +81,10 @@ class EmbeddedZookeeper extends 
AbstractService("EmbeddedZookeeper") {
     if (getServiceState == ServiceState.STARTED) {
       if (null != serverFactory) serverFactory.shutdown()
       if (null != zks) zks.shutdown()
-      if (deleteDataDirectoryOnClose) deleteDirectoryRecursively(dataDirectory)
+      if (deleteDataDirectoryOnClose) {
+        deleteDirectoryRecursively(dataDirectory)
+        deleteDirectoryRecursively(dataLogDirectory)
+      }
     }
     super.stop()
   }

Reply via email to