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

feiwang 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 aaac07fa55 [KYUUBI #7110] Fix `serverOnlyPrefixConfigKeys` is iterator 
issue
aaac07fa55 is described below

commit aaac07fa55cb73f9f5108d53110425af2ed610e3
Author: Wang, Fei <fwan...@ebay.com>
AuthorDate: Mon Jun 23 19:27:58 2025 -0700

    [KYUUBI #7110] Fix `serverOnlyPrefixConfigKeys` is iterator issue
    
    ### Why are the changes needed?
    
    Followup for #7055
    Before this PR, the `serverOnlyPrefixConfigKeys` is type of iterator.
    
    After one time iteration, it become empty.
    
    In this PR, we convert it to `Set` to fix this issue.
    
    ### How was this patch tested?
    
    UT.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #7110 from turboFei/exclude_prefix.
    
    Closes #7110
    
    91a54b6f0 [Wang, Fei] prefix
    
    Authored-by: Wang, Fei <fwan...@ebay.com>
    Signed-off-by: Wang, Fei <fwan...@ebay.com>
---
 .../src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala        | 6 +++---
 .../src/test/scala/org/apache/kyuubi/config/KyuubiConfSuite.scala   | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala 
b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
index 5e90102151..5ca5c78a8d 100644
--- a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
+++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
@@ -193,15 +193,15 @@ case class KyuubiConf(loadSysDefault: Boolean = true) 
extends Logging {
     cloned
   }
 
-  private lazy val serverOnlyPrefixes = get(KyuubiConf.SERVER_ONLY_PREFIXES)
-  private lazy val serverOnlyPrefixConfigKeys = settings.keys().asScala
+  private lazy val serverOnlyPrefixes: Set[String] = 
get(KyuubiConf.SERVER_ONLY_PREFIXES)
+  private lazy val serverOnlyPrefixConfigKeys: Set[String] = 
settings.keys().asScala
     // for ConfigEntry, respect the serverOnly flag and exclude it here
     .filter(key => getConfigEntry(key) == null)
     .filter { key =>
       serverOnlyPrefixes.exists { prefix =>
         key.startsWith(prefix)
       }
-    }
+    }.toSet
 
   def getUserDefaults(user: String): KyuubiConf = {
     val cloned = KyuubiConf(false)
diff --git 
a/kyuubi-common/src/test/scala/org/apache/kyuubi/config/KyuubiConfSuite.scala 
b/kyuubi-common/src/test/scala/org/apache/kyuubi/config/KyuubiConfSuite.scala
index 4b1a45fbce..45c9b3c365 100644
--- 
a/kyuubi-common/src/test/scala/org/apache/kyuubi/config/KyuubiConfSuite.scala
+++ 
b/kyuubi-common/src/test/scala/org/apache/kyuubi/config/KyuubiConfSuite.scala
@@ -231,9 +231,10 @@ class KyuubiConfSuite extends KyuubiFunSuite {
       Some("/var/run/secrets/kubernetes.io/token.ns2"))
   }
 
-  test("KYUUBI #7053 - Support to exclude server only configs with prefixes") {
+  test("KYUUBI #7055 - Support to exclude server only configs with prefixes") {
     val kyuubiConf = KyuubiConf(false)
     kyuubiConf.set("kyuubi.backend.server.event.kafka.broker", 
"localhost:9092")
     assert(kyuubiConf.getUserDefaults("kyuubi").getAll.size == 0)
+    assert(kyuubiConf.getUserDefaults("user").getAll.size == 0)
   }
 }

Reply via email to