diff --git a/db/snapshot-ctl.cc b/db/snapshot-ctl.cc index bf829aee39..0500700320 100644 --- a/db/snapshot-ctl.cc +++ b/db/snapshot-ctl.cc @@ -22,6 +22,7 @@ #include "index/secondary_index_manager.hh" #include "replica/database.hh" #include "replica/global_table_ptr.hh" +#include "replica/schema_describe_helper.hh" #include "sstables/sstables_manager.hh" #include "service/storage_proxy.hh" @@ -196,7 +197,26 @@ snapshot_ctl::get_snapshot_details() { using snapshot_map = std::unordered_map; co_return co_await run_snapshot_list_operation(coroutine::lambda([this] () -> future { - return _db.local().get_snapshot_details(); + auto details = co_await _db.local().get_snapshot_details(); + + for (auto& [snapshot_name, snapshot_details] : details) { + for (auto& table : snapshot_details) { + auto schema = _db.local().as_data_dictionary().try_find_table( + table.ks, table.cf); + if (!schema || !schema->schema()->is_view()) { + continue; + } + + auto helper = replica::make_schema_describe_helper( + schema->schema(), _db.local().as_data_dictionary()); + if (helper.type == schema_describe_helper::type::index) { + table.cf = secondary_index::index_name_from_table_name( + table.cf); + } + } + } + + co_return details; })); } diff --git a/test/rest_api/test_storage_service.py b/test/rest_api/test_storage_service.py index a6e7ec692c..8a47adcb6d 100644 --- a/test/rest_api/test_storage_service.py +++ b/test/rest_api/test_storage_service.py @@ -420,11 +420,11 @@ def test_storage_service_snapshot_mv_si(cql, this_dc, rest_api): }) with new_secondary_index(cql, table, 'v', 'si') as si: - named_index_desc = cql.execute(f"DESC INDEX {si}").one() - with new_test_snapshot(rest_api, keyspace, named_index_desc.name) as snap: + index_name = si.split('.')[1] + with new_test_snapshot(rest_api, keyspace, index_name) as snap: verify_snapshot_details(rest_api, { 'key': snap, - 'value': [{'ks': keyspace, 'cf': named_index_desc.name, 'total': 0, 'live': 0}] + 'value': [{'ks': keyspace, 'cf': index_name, 'total': 0, 'live': 0}] }) ks, cf = table.split('.')