diff --git a/dbms/src/Storages/System/StorageSystemDTSegments.cpp b/dbms/src/Storages/System/StorageSystemDTSegments.cpp index c10165141c2..0092d984d49 100644 --- a/dbms/src/Storages/System/StorageSystemDTSegments.cpp +++ b/dbms/src/Storages/System/StorageSystemDTSegments.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -37,6 +38,7 @@ StorageSystemDTSegments::StorageSystemDTSegments(const std::string & name_) {"tidb_database", std::make_shared()}, {"tidb_table", std::make_shared()}, + {"keyspace_id", std::make_shared(std::make_shared())}, {"table_id", std::make_shared()}, {"is_tombstone", std::make_shared()}, @@ -115,11 +117,19 @@ BlockInputStreams StorageSystemDTSegments::read( res_columns[j++]->insert(table_name); String tidb_db_name; + KeyspaceID keyspace_id = NullspaceID; if (db_tiflash) - tidb_db_name = mapper.displayDatabaseName(db_tiflash->getDatabaseInfo()); + { + tidb_db_name = db_tiflash->getDatabaseInfo().name; + keyspace_id = db_tiflash->getDatabaseInfo().keyspace_id; + } res_columns[j++]->insert(tidb_db_name); - String tidb_table_name = mapper.displayTableName(table_info); + String tidb_table_name = table_info.name; res_columns[j++]->insert(tidb_table_name); + if (keyspace_id == NullspaceID) + res_columns[j++]->insert(Field()); + else + res_columns[j++]->insert(static_cast(keyspace_id)); res_columns[j++]->insert(table_id); res_columns[j++]->insert(dm_storage->getTombstone()); diff --git a/dbms/src/Storages/System/StorageSystemDTTables.cpp b/dbms/src/Storages/System/StorageSystemDTTables.cpp index e4dbdbc2f64..2a0d45957a1 100644 --- a/dbms/src/Storages/System/StorageSystemDTTables.cpp +++ b/dbms/src/Storages/System/StorageSystemDTTables.cpp @@ -14,12 +14,14 @@ #include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -37,6 +39,7 @@ StorageSystemDTTables::StorageSystemDTTables(const std::string & name_) {"tidb_database", std::make_shared()}, {"tidb_table", std::make_shared()}, + {"keyspace_id", std::make_shared(std::make_shared())}, {"table_id", std::make_shared()}, {"is_tombstone", std::make_shared()}, @@ -146,11 +149,19 @@ BlockInputStreams StorageSystemDTTables::read( res_columns[j++]->insert(table_name); String tidb_db_name; + KeyspaceID keyspace_id = NullspaceID; if (db_tiflash) - tidb_db_name = mapper.displayDatabaseName(db_tiflash->getDatabaseInfo()); + { + tidb_db_name = db_tiflash->getDatabaseInfo().name; + keyspace_id = db_tiflash->getDatabaseInfo().keyspace_id; + } res_columns[j++]->insert(tidb_db_name); - String tidb_table_name = mapper.displayTableName(table_info); + String tidb_table_name = table_info.name; res_columns[j++]->insert(tidb_table_name); + if (keyspace_id == NullspaceID) + res_columns[j++]->insert(Field()); + else + res_columns[j++]->insert(static_cast(keyspace_id)); res_columns[j++]->insert(table_id); res_columns[j++]->insert(dm_storage->getTombstone());