[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 <fwang12@ebay.com> Signed-off-by: Wang, Fei <fwang12@ebay.com>
This commit is contained in:
parent
2021574a33
commit
aaac07fa55
@ -193,15 +193,15 @@ case class KyuubiConf(loadSysDefault: Boolean = true) extends Logging {
|
|||||||
cloned
|
cloned
|
||||||
}
|
}
|
||||||
|
|
||||||
private lazy val serverOnlyPrefixes = get(KyuubiConf.SERVER_ONLY_PREFIXES)
|
private lazy val serverOnlyPrefixes: Set[String] = get(KyuubiConf.SERVER_ONLY_PREFIXES)
|
||||||
private lazy val serverOnlyPrefixConfigKeys = settings.keys().asScala
|
private lazy val serverOnlyPrefixConfigKeys: Set[String] = settings.keys().asScala
|
||||||
// for ConfigEntry, respect the serverOnly flag and exclude it here
|
// for ConfigEntry, respect the serverOnly flag and exclude it here
|
||||||
.filter(key => getConfigEntry(key) == null)
|
.filter(key => getConfigEntry(key) == null)
|
||||||
.filter { key =>
|
.filter { key =>
|
||||||
serverOnlyPrefixes.exists { prefix =>
|
serverOnlyPrefixes.exists { prefix =>
|
||||||
key.startsWith(prefix)
|
key.startsWith(prefix)
|
||||||
}
|
}
|
||||||
}
|
}.toSet
|
||||||
|
|
||||||
def getUserDefaults(user: String): KyuubiConf = {
|
def getUserDefaults(user: String): KyuubiConf = {
|
||||||
val cloned = KyuubiConf(false)
|
val cloned = KyuubiConf(false)
|
||||||
|
|||||||
@ -231,9 +231,10 @@ class KyuubiConfSuite extends KyuubiFunSuite {
|
|||||||
Some("/var/run/secrets/kubernetes.io/token.ns2"))
|
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)
|
val kyuubiConf = KyuubiConf(false)
|
||||||
kyuubiConf.set("kyuubi.backend.server.event.kafka.broker", "localhost:9092")
|
kyuubiConf.set("kyuubi.backend.server.event.kafka.broker", "localhost:9092")
|
||||||
assert(kyuubiConf.getUserDefaults("kyuubi").getAll.size == 0)
|
assert(kyuubiConf.getUserDefaults("kyuubi").getAll.size == 0)
|
||||||
|
assert(kyuubiConf.getUserDefaults("user").getAll.size == 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user