mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-28 10:41:12 +00:00
topology.tablets_migration: Add revert_migration transition stage
It's like end_migration, but old replicas intact just removing the transition (including new replicas). Coordinators use old replicas. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -38,6 +38,8 @@ write_replica_set_selector get_selector_for_writes(tablet_transition_stage stage
|
||||
return write_replica_set_selector::next;
|
||||
case tablet_transition_stage::cleanup:
|
||||
return write_replica_set_selector::next;
|
||||
case tablet_transition_stage::revert_migration:
|
||||
return write_replica_set_selector::previous;
|
||||
case tablet_transition_stage::end_migration:
|
||||
return write_replica_set_selector::next;
|
||||
}
|
||||
@@ -59,6 +61,8 @@ read_replica_set_selector get_selector_for_reads(tablet_transition_stage stage)
|
||||
return read_replica_set_selector::next;
|
||||
case tablet_transition_stage::cleanup:
|
||||
return read_replica_set_selector::next;
|
||||
case tablet_transition_stage::revert_migration:
|
||||
return read_replica_set_selector::previous;
|
||||
case tablet_transition_stage::end_migration:
|
||||
return read_replica_set_selector::next;
|
||||
}
|
||||
@@ -275,6 +279,7 @@ static const std::unordered_map<tablet_transition_stage, sstring> tablet_transit
|
||||
{tablet_transition_stage::streaming, "streaming"},
|
||||
{tablet_transition_stage::use_new, "use_new"},
|
||||
{tablet_transition_stage::cleanup, "cleanup"},
|
||||
{tablet_transition_stage::revert_migration, "revert_migration"},
|
||||
{tablet_transition_stage::end_migration, "end_migration"},
|
||||
};
|
||||
|
||||
|
||||
@@ -157,6 +157,7 @@ enum class tablet_transition_stage {
|
||||
write_both_read_new,
|
||||
use_new,
|
||||
cleanup,
|
||||
revert_migration,
|
||||
end_migration,
|
||||
};
|
||||
|
||||
|
||||
@@ -425,6 +425,8 @@ private:
|
||||
return false;
|
||||
case tablet_transition_stage::cleanup:
|
||||
return false;
|
||||
case tablet_transition_stage::revert_migration:
|
||||
return false;
|
||||
case tablet_transition_stage::end_migration:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1047,6 +1047,16 @@ class topology_coordinator : public endpoint_lifecycle_subscriber {
|
||||
transition_to(locator::tablet_transition_stage::end_migration);
|
||||
}
|
||||
break;
|
||||
case locator::tablet_transition_stage::revert_migration:
|
||||
// Need a separate stage and a barrier after cleanup RPC to cut off stale RPCs.
|
||||
// See do_tablet_operation() doc.
|
||||
if (do_barrier()) {
|
||||
_tablets.erase(gid);
|
||||
updates.emplace_back(get_mutation_builder()
|
||||
.del_transition(last_token)
|
||||
.build());
|
||||
}
|
||||
break;
|
||||
case locator::tablet_transition_stage::end_migration:
|
||||
// Need a separate stage and a barrier after cleanup RPC to cut off stale RPCs.
|
||||
// See do_tablet_operation() doc.
|
||||
|
||||
Reference in New Issue
Block a user