repair: get_sharder_for_tables: throw no_such_column_family
Insteadof std::runtime_error with a message that resembles no_such_column_family, throw a no_such_column_family given the keyspace and table uuid. The latter can be explicitly caught and handled if needed. Refs #8612 Test: unit(dev) Signed-off-by: Benny Halevy <bhalevy@scylladb.com> Message-Id: <20210608113605.91292-1-bhalevy@scylladb.com>
This commit is contained in:
@@ -1189,6 +1189,11 @@ no_such_column_family::no_such_column_family(std::string_view ks_name, std::stri
|
||||
{
|
||||
}
|
||||
|
||||
no_such_column_family::no_such_column_family(std::string_view ks_name, const utils::UUID& uuid)
|
||||
: runtime_error{format("Can't find a column family with UUID {} in keyspace {}", uuid, ks_name)}
|
||||
{
|
||||
}
|
||||
|
||||
column_family& database::find_column_family(const schema_ptr& schema) {
|
||||
return find_column_family(schema->id());
|
||||
}
|
||||
|
||||
@@ -1201,6 +1201,7 @@ class no_such_column_family : public std::runtime_error {
|
||||
public:
|
||||
no_such_column_family(const utils::UUID& uuid);
|
||||
no_such_column_family(std::string_view ks_name, std::string_view cf_name);
|
||||
no_such_column_family(std::string_view ks_name, const utils::UUID& uuid);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -581,7 +581,7 @@ get_sharder_for_tables(seastar::sharded<database>& db, const sstring& keyspace,
|
||||
try {
|
||||
s = db.local().find_column_family(table_ids[idx]).schema();
|
||||
} catch(...) {
|
||||
throw std::runtime_error(format("No column family '{}' in keyspace '{}'", table_ids[idx], keyspace));
|
||||
throw no_such_column_family(keyspace, table_ids[idx]);
|
||||
}
|
||||
if (last_s && last_s->get_sharder() != s->get_sharder()) {
|
||||
throw std::runtime_error(
|
||||
|
||||
Reference in New Issue
Block a user