tablets: Fail gracefully when migrating tablet has no pending replica

Before the patch we SIGSEGV trying to access pending replica in this
case. Fail early instead.
This commit is contained in:
Tomasz Grabiec
2023-11-23 00:29:28 +01:00
parent d1c1b59236
commit 7a59acf248

View File

@@ -213,6 +213,10 @@ future<tablet_metadata> read_tablet_metadata(cql3::query_processor& qp) {
for (auto&& r : tablet_replicas) {
pending.erase(r);
}
if (pending.size() == 0) {
throw std::runtime_error(format("Stage set but no pending replica for table {} tablet {}",
table, current->tid));
}
if (pending.size() > 1) {
throw std::runtime_error(format("Too many pending replicas for table {} tablet {}: {}",
table, current->tid, pending));