mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-22 17:40:34 +00:00
tablet_allocator: Exclude migrating tables from load balancing
The tablet load balancer operates on all tablet-based tables that appear in the tablet metadata. With the introduction of the vnodes-to-tablets migration procedure later in this series, migrating tables will also appear in the tablet metadata, but they need to be treated as vnode tables until migration is finished. This patch excludes such tables from load balancing. Signed-off-by: Nikos Dragazis <nikolaos.dragazis@scylladb.com>
This commit is contained in:
@@ -1175,6 +1175,9 @@ public:
|
||||
future<> consider_scheduled_load(node_load_map& nodes) {
|
||||
const locator::topology& topo = _tm->get_topology();
|
||||
for (auto&& [table, tables] : _tm->tablets().all_table_groups()) {
|
||||
if (is_migrating_table(table)) {
|
||||
continue;
|
||||
}
|
||||
const auto& tmap = _tm->tablets().get_tablet_map(table);
|
||||
for (auto&& [tid, trinfo]: tmap.transitions()) {
|
||||
co_await coroutine::maybe_yield();
|
||||
@@ -1233,6 +1236,9 @@ public:
|
||||
utils::chunked_vector<repair_plan> plans;
|
||||
auto migration_tablet_ids = co_await mplan.get_migration_tablet_ids();
|
||||
for (auto&& [table, tables] : _tm->tablets().all_table_groups()) {
|
||||
if (is_migrating_table(table)) {
|
||||
continue;
|
||||
}
|
||||
const auto& tmap = _tm->tablets().get_tablet_map(table);
|
||||
co_await coroutine::maybe_yield();
|
||||
auto config = tmap.get_repair_scheduler_config();
|
||||
@@ -1465,6 +1471,9 @@ public:
|
||||
table_resize_plan resize_plan;
|
||||
|
||||
for (auto&& [table, tables] : _tm->tablets().all_table_groups()) {
|
||||
if (is_migrating_table(table)) {
|
||||
continue;
|
||||
}
|
||||
const auto& tmap = _tm->tablets().get_tablet_map(table);
|
||||
if (!tmap.needs_merge()) {
|
||||
continue;
|
||||
@@ -1689,6 +1698,18 @@ public:
|
||||
return rs;
|
||||
}
|
||||
|
||||
// Returns true if the table is under vnodes-to-tablets migration.
|
||||
// Such tables have a tablet map but their keyspace RS doesn't use tablets.
|
||||
// They should be excluded from load balancing.
|
||||
bool is_migrating_table(table_id table) {
|
||||
auto t = _db.get_tables_metadata().get_table_if_exists(table);
|
||||
if (!t) {
|
||||
return false;
|
||||
}
|
||||
auto& ks = _db.find_keyspace(t->schema()->ks_name());
|
||||
return !ks.get_replication_strategy().uses_tablets();
|
||||
}
|
||||
|
||||
struct table_sizing {
|
||||
size_t current_tablet_count; // Tablet count in group0.
|
||||
size_t target_tablet_count; // Tablet count wanted by scheduler.
|
||||
@@ -1886,6 +1907,9 @@ public:
|
||||
};
|
||||
|
||||
for (const auto& [table, tables] : _tm->tablets().all_table_groups()) {
|
||||
if (is_migrating_table(table)) {
|
||||
continue;
|
||||
}
|
||||
const auto& tmap = _tm->tablets().get_tablet_map(table);
|
||||
auto [s, rs] = get_schema_and_rs(table);
|
||||
|
||||
@@ -3581,6 +3605,9 @@ public:
|
||||
// Compute tablet load on nodes.
|
||||
|
||||
for (auto&& [table, tables] : _tm->tablets().all_table_groups()) {
|
||||
if (is_migrating_table(table)) {
|
||||
continue;
|
||||
}
|
||||
const auto& tmap = _tm->tablets().get_tablet_map(table);
|
||||
|
||||
co_await tmap.for_each_tablet([&, table = table] (tablet_id tid, const tablet_info& ti) -> future<> {
|
||||
@@ -3717,6 +3744,9 @@ public:
|
||||
_disk_used_per_table.clear();
|
||||
|
||||
for (auto&& [table, tables] : _tm->tablets().all_table_groups()) {
|
||||
if (is_migrating_table(table)) {
|
||||
continue;
|
||||
}
|
||||
const auto& tmap = _tm->tablets().get_tablet_map(table);
|
||||
uint64_t total_tablet_count = 0;
|
||||
uint64_t total_tablet_sizes = 0;
|
||||
|
||||
Reference in New Issue
Block a user