Skip to content

Commit aaac07f

Browse files
committed
[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 91a54b6 [Wang, Fei] prefix Authored-by: Wang, Fei <fwang12@ebay.com> Signed-off-by: Wang, Fei <fwang12@ebay.com>
1 parent 2021574 commit aaac07f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,15 @@ case class KyuubiConf(loadSysDefault: Boolean = true) extends Logging {
193193
cloned
194194
}
195195

196-
private lazy val serverOnlyPrefixes = get(KyuubiConf.SERVER_ONLY_PREFIXES)
197-
private lazy val serverOnlyPrefixConfigKeys = settings.keys().asScala
196+
private lazy val serverOnlyPrefixes: Set[String] = get(KyuubiConf.SERVER_ONLY_PREFIXES)
197+
private lazy val serverOnlyPrefixConfigKeys: Set[String] = settings.keys().asScala
198198
// for ConfigEntry, respect the serverOnly flag and exclude it here
199199
.filter(key => getConfigEntry(key) == null)
200200
.filter { key =>
201201
serverOnlyPrefixes.exists { prefix =>
202202
key.startsWith(prefix)
203203
}
204-
}
204+
}.toSet
205205

206206
def getUserDefaults(user: String): KyuubiConf = {
207207
val cloned = KyuubiConf(false)

kyuubi-common/src/test/scala/org/apache/kyuubi/config/KyuubiConfSuite.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,10 @@ class KyuubiConfSuite extends KyuubiFunSuite {
231231
Some("/var/run/secrets/kubernetes.io/token.ns2"))
232232
}
233233

234-
test("KYUUBI #7053 - Support to exclude server only configs with prefixes") {
234+
test("KYUUBI #7055 - Support to exclude server only configs with prefixes") {
235235
val kyuubiConf = KyuubiConf(false)
236236
kyuubiConf.set("kyuubi.backend.server.event.kafka.broker", "localhost:9092")
237237
assert(kyuubiConf.getUserDefaults("kyuubi").getAll.size == 0)
238+
assert(kyuubiConf.getUserDefaults("user").getAll.size == 0)
238239
}
239240
}

0 commit comments

Comments
 (0)