mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
replica/database: keyspace: add uses_tablets()
Mirroring table::uses_tablets(), provides a convenient and -- more importabtly -- easily discoverable way to determine whether the keyspace uses tablets or not. This information is of course already available via the abstract replication strategy, but as seen in a few examples, this is not easily discoverable and sometimes people resorted to enumerating the keyspace's tables to be able to invoke table::uses_tablets().
This commit is contained in:
@@ -488,7 +488,7 @@ bool cluster_describe_statement::should_add_range_ownership(replica::database& d
|
||||
//TODO: produce range ownership for tables using tablets too
|
||||
bool uses_tablets = false;
|
||||
try {
|
||||
uses_tablets = !ks.empty() && db.find_keyspace(ks).get_replication_strategy().uses_tablets();
|
||||
uses_tablets = !ks.empty() && db.find_keyspace(ks).uses_tablets();
|
||||
} catch (const data_dictionary::no_such_keyspace&) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@@ -1710,7 +1710,7 @@ future<> view_update_generator::mutate_MV(
|
||||
// are more frequent and backward compatibility is less important.
|
||||
// TODO: Maybe allow users to set use_legacy_self_pairing explicitly
|
||||
// on a view, like we have the synchronous_updates_flag.
|
||||
bool use_legacy_self_pairing = !ks.get_replication_strategy().uses_tablets();
|
||||
bool use_legacy_self_pairing = !ks.uses_tablets();
|
||||
auto target_endpoint = get_view_natural_endpoint(base_ermp, view_ermp, network_topology, base_token, view_token, use_legacy_self_pairing);
|
||||
auto remote_endpoints = view_ermp->get_pending_endpoints(view_token);
|
||||
auto sem_units = pending_view_updates.split(mut.fm.representation().size());
|
||||
|
||||
@@ -1318,6 +1318,10 @@ public:
|
||||
|
||||
locator::vnode_effective_replication_map_ptr get_vnode_effective_replication_map() const;
|
||||
|
||||
bool uses_tablets() const {
|
||||
return _replication_strategy->uses_tablets();
|
||||
}
|
||||
|
||||
column_family::config make_column_family_config(const schema& s, const database& db) const;
|
||||
void add_or_update_column_family(const schema_ptr& s);
|
||||
void add_user_type(const user_type ut);
|
||||
|
||||
@@ -4635,7 +4635,7 @@ future<> storage_service::move(token new_token) {
|
||||
|
||||
future<std::vector<storage_service::token_range_endpoints>>
|
||||
storage_service::describe_ring(const sstring& keyspace, bool include_only_local_dc) const {
|
||||
if (_db.local().find_keyspace(keyspace).get_replication_strategy().uses_tablets()) {
|
||||
if (_db.local().find_keyspace(keyspace).uses_tablets()) {
|
||||
throw std::runtime_error(fmt::format("The keyspace {} has tablet table. Query describe_ring with the table parameter!", keyspace));
|
||||
}
|
||||
co_return co_await locator::describe_ring(_db.local(), _gossiper, keyspace, include_only_local_dc);
|
||||
|
||||
Reference in New Issue
Block a user