From 5b21e4eb8362c985b1c28fc062629310665ffc44 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 27 Oct 2021 17:24:15 +0300 Subject: [PATCH 1/2] system_keyspace: rename 'system.status' to 'system.cluster_status' 'system.status' is too generic, it doesn't explain the status of what. 'system.node_status' is also ambiguous (this node? all nodes?) so I picked 'system.cluster_status'. The internal name, nodetool_status_table, was even worse (we're not querying the status of nodetool!) but fortunately wasn't exposed. The name is not in any released version, so we can safely rename it. --- db/system_keyspace.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/system_keyspace.cc b/db/system_keyspace.cc index 706fcc29a0..881115c1d4 100644 --- a/db/system_keyspace.cc +++ b/db/system_keyspace.cc @@ -1795,17 +1795,17 @@ future<> system_keyspace::set_bootstrap_state(bootstrap_state state) { }); } -class nodetool_status_table : public memtable_filling_virtual_table { +class cluster_status_table : public memtable_filling_virtual_table { private: service::storage_service& _ss; public: - nodetool_status_table(service::storage_service& ss) + cluster_status_table(service::storage_service& ss) : memtable_filling_virtual_table(build_schema()) , _ss(ss) {} static schema_ptr build_schema() { - auto id = generate_legacy_id(system_keyspace::NAME, "status"); - return schema_builder(system_keyspace::NAME, "status", std::make_optional(id)) + auto id = generate_legacy_id(system_keyspace::NAME, "cluster_status"); + return schema_builder(system_keyspace::NAME, "cluster_status", std::make_optional(id)) .with_column("peer", inet_addr_type, column_kind::partition_key) .with_column("dc", utf8_type) .with_column("up", boolean_type) @@ -1953,7 +1953,7 @@ void register_virtual_tables(service::storage_service& ss) { }; // Add built-in virtual tables here. - add_table(std::make_unique(ss)); + add_table(std::make_unique(ss)); add_table(std::make_unique(ss)); } From 5ea0940ca9654de337fb758eec0f9890cae95e80 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 27 Oct 2021 17:28:58 +0300 Subject: [PATCH 2/2] system_keyspace: rename 'system.describe_ring' to 'system.token_ring' Table names are usually nouns, so SELECT/INSERT statements sound natural: "SELECT * FROM pets". 'system.describe_ring' defies this convention. Rename it to 'system.token_ring' so selects are natural. The name is not in any released version, so we can safely rename it. --- db/system_keyspace.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/system_keyspace.cc b/db/system_keyspace.cc index 881115c1d4..08fa297e90 100644 --- a/db/system_keyspace.cc +++ b/db/system_keyspace.cc @@ -1855,11 +1855,11 @@ public: } }; -class describe_ring_table : public streaming_virtual_table { +class token_ring_table : public streaming_virtual_table { private: service::storage_service& _ss; public: - describe_ring_table(service::storage_service& ss) + token_ring_table(service::storage_service& ss) : streaming_virtual_table(build_schema()) , _ss(ss) { @@ -1867,8 +1867,8 @@ public: } static schema_ptr build_schema() { - auto id = generate_legacy_id(system_keyspace::NAME, "describe_ring"); - return schema_builder(system_keyspace::NAME, "describe_ring", std::make_optional(id)) + auto id = generate_legacy_id(system_keyspace::NAME, "token_ring"); + return schema_builder(system_keyspace::NAME, "token_ring", std::make_optional(id)) .with_column("keyspace_name", utf8_type, column_kind::partition_key) .with_column("start_token", utf8_type, column_kind::clustering_key) .with_column("endpoint", inet_addr_type, column_kind::clustering_key) @@ -1954,7 +1954,7 @@ void register_virtual_tables(service::storage_service& ss) { // Add built-in virtual tables here. add_table(std::make_unique(ss)); - add_table(std::make_unique(ss)); + add_table(std::make_unique(ss)); } std::vector system_keyspace::all_tables(const db::config& cfg) {