diff --git a/cql3/statements/describe_statement.cc b/cql3/statements/describe_statement.cc index 58d717fe5b..3d91adfe8c 100644 --- a/cql3/statements/describe_statement.cc +++ b/cql3/statements/describe_statement.cc @@ -23,6 +23,7 @@ #include "index/vector_index.hh" #include "schema/schema.hh" #include "service/client_state.hh" +#include "service/paxos/paxos_state.hh" #include "types/types.hh" #include "cql3/query_processor.hh" #include "cql3/cql_statement.hh" @@ -329,6 +330,19 @@ future> table(const data_dictionary::database& db, cons "*/", *table_desc.create_statement); + table_desc.create_statement = std::move(os).to_managed_string(); + } else if (service::paxos::paxos_store::try_get_base_table(name)) { + // Paxos state table is internally managed by Scylla and it shouldn't be exposed to the user. + // The table is allowed to be described as a comment to ease administrative work but it's hidden from all listings. + fragmented_ostringstream os{}; + + fmt::format_to(os.to_iter(), + "/* Do NOT execute this statement! It's only for informational purposes.\n" + " A paxos state table is created automatically when enabling LWT on a base table.\n" + "\n{}\n" + "*/", + *table_desc.create_statement); + table_desc.create_statement = std::move(os).to_managed_string(); } result.push_back(std::move(table_desc)); @@ -364,7 +378,7 @@ future> table(const data_dictionary::database& db, cons future> tables(const data_dictionary::database& db, const lw_shared_ptr& ks, std::optional with_internals = std::nullopt) { auto& replica_db = db.real_database(); auto tables = ks->tables() | std::views::filter([&replica_db] (const schema_ptr& s) { - return !cdc::is_log_for_some_table(replica_db, s->ks_name(), s->cf_name()); + return !cdc::is_log_for_some_table(replica_db, s->ks_name(), s->cf_name()) && !service::paxos::paxos_store::try_get_base_table(s->cf_name()); }) | std::ranges::to>(); std::ranges::sort(tables, std::ranges::less(), std::mem_fn(&schema::cf_name));