Skip to content

Commit

Permalink
Merge pull request #15725 from andijcr/issue/13362/cleanup-aliases-in…
Browse files Browse the repository at this point in the history
…-config-snapshot

cluster/config_manager: use property's main name in store_delta
  • Loading branch information
andijcr authored Dec 18, 2023
2 parents 3e44a5d + 3e428ba commit 3011453
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/v/cluster/config_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,29 @@ void config_manager::merge_apply_result(
*/
ss::future<>
config_manager::store_delta(cluster_config_delta_cmd_data const& data) {
auto& cfg = config::shard_local_cfg();

for (const auto& u : data.upsert) {
_raw_values[u.key] = u.value;
if (!cfg.contains(u.key)) {
// passthrough unknown values
_raw_values[u.key] = u.value;
continue;
}

auto& prop = cfg.get(u.key);
if (prop.name() == u.key) {
// u key is already the main name of the property
_raw_values[u.key] = u.value;
continue;
}

// ensure only the main name is used
_raw_values[ss::sstring{prop.name()}] = u.value;
// cleanup any old alias lying around (it should be normally not
// necessary, and at most one loop)
for (auto const& alias : prop.aliases()) {
_raw_values.erase(ss::sstring{alias});
}
}
for (const auto& d : data.remove) {
_raw_values.erase(d);
Expand Down

0 comments on commit 3011453

Please sign in to comment.