locator: Always preserve balancing_enabled in tablet_metadata::copy()

When there are zero tablets, tablet_metadata::_balancing_enabled
is ignored in the copy.

The property not being preserved can result in balancer not
respecting user's wish to disable balancing when a replica is
created later on.

Fixes #21175.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>

Closes scylladb/scylladb#21177
This commit is contained in:
Raphael S. Carvalho
2024-10-18 11:20:42 -03:00
committed by Tomasz Grabiec
parent 5c0db8a49e
commit dfc217f99a

View File

@@ -200,9 +200,6 @@ future<> tablet_metadata::mutate_tablet_map_async(table_id id, noncopyable_funct
}
future<tablet_metadata> tablet_metadata::copy() const {
if (_tablets.empty()) {
co_return tablet_metadata{};
}
tablet_metadata copy;
for (const auto& e : _tablets) {
copy._tablets.emplace(e.first, co_await e.second.copy());