tablet_scheduler: Make disabling of balancing interrupt shuffle mode

Tests will rely on that, they will run in shuffle mode, and disable
balancing around section which otherwise would be infinitely blocked
by ongoing shuffling (like repair).

(cherry picked from commit 1513d6f0b0)
This commit is contained in:
Tomasz Grabiec
2024-05-09 17:31:49 +02:00
committed by Mergify
parent 3fec9e1344
commit d5ebfea1ff
2 changed files with 6 additions and 8 deletions

View File

@@ -6166,13 +6166,6 @@ future<> storage_service::set_tablet_balancing_enabled(bool enabled) {
while (true) {
group0_guard guard = co_await _group0->client().start_operation(&_group0_as, raft_timeout{});
while (_topology_state_machine._topology.is_busy()) {
rtlogger.debug("set_tablet_balancing_enabled(): topology is busy");
release_guard(std::move(guard));
co_await _topology_state_machine.event.wait();
guard = co_await _group0->client().start_operation(&_group0_as, raft_timeout{});
}
std::vector<canonical_mutation> updates;
updates.push_back(canonical_mutation(topology_mutation_builder(guard.write_timestamp())
.set_tablet_balancing_enabled(enabled)
@@ -6189,6 +6182,11 @@ future<> storage_service::set_tablet_balancing_enabled(bool enabled) {
rtlogger.debug("set_tablet_balancing_enabled(): concurrent modification");
}
}
while (_topology_state_machine._topology.is_busy()) {
rtlogger.debug("set_tablet_balancing_enabled(): topology is busy");
co_await _topology_state_machine.event.wait();
}
}
future<> storage_service::await_topology_quiesced() {

View File

@@ -1373,7 +1373,7 @@ public:
});
}
if (!nodes_to_drain.empty() || shuffle || (max_load != min_load && _tm->tablets().balancing_enabled())) {
if (!nodes_to_drain.empty() || (_tm->tablets().balancing_enabled() && (shuffle || max_load != min_load))) {
host_id target = *min_load_node;
lblogger.info("target node: {}, avg_load: {}, max: {}", target, min_load, max_load);
plan.merge(co_await make_internode_plan(dc, nodes, nodes_to_drain, target));