Skip to content

Commit

Permalink
cluster: allow broker configuration update with decreasing core count
Browse files Browse the repository at this point in the history
  • Loading branch information
ztlpn committed Jun 28, 2024
1 parent d5a8d41 commit 34e43b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
13 changes: 1 addition & 12 deletions src/v/cluster/cluster_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -401,18 +401,7 @@ std::optional<ss::sstring> check_result_configuration(
new_configuration.id());
}
auto& current_configuration = it->second.broker;
/**
* do no allow to decrease node core count
*/
if (
current_configuration.properties().cores
> new_configuration.properties().cores) {
return fmt::format(
"core count must not decrease on any broker, currently configured "
"core count: {}, requested core count: {}",
current_configuration.properties().cores,
new_configuration.properties().cores);
}

/**
* When cluster member configuration changes Redpanda by default doesn't
* allow the change if a new cluster configuration would have two
Expand Down
16 changes: 7 additions & 9 deletions src/v/cluster/scheduling/allocation_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,13 @@ void allocation_node::remove_final_count(partition_allocation_domain domain) {
}

void allocation_node::update_core_count(uint32_t core_count) {
vassert(
core_count >= cpus(),
"decreasing node core count is not supported, current core count {} > "
"requested core count {}",
cpus(),
core_count);
auto current_cpus = cpus();
for (auto i = current_cpus; i < core_count; ++i) {
_weights.push_back(0);
auto old_count = _weights.size();
if (core_count < old_count) {
_weights.resize(core_count);
} else {
for (auto i = old_count; i < core_count; ++i) {
_weights.push_back(0);
}
}
_max_capacity = allocation_capacity(
(core_count * _partitions_per_shard()) - _partitions_reserve_shard0());
Expand Down

0 comments on commit 34e43b9

Please sign in to comment.