From 8d44e64648cfb5de837edb71cf4cc81facc159cd Mon Sep 17 00:00:00 2001 From: obdev Date: Mon, 19 Sep 2022 08:33:28 +0000 Subject: [PATCH] add virtual table for schema memory and slot --- deps/oblib/src/lib/ob_define.h | 1 + src/observer/CMakeLists.txt | 2 + .../ob_all_virtual_schema_memory.cpp | 139 +++++++ .../ob_all_virtual_schema_memory.h | 60 +++ .../ob_all_virtual_schema_slot.cpp | 165 +++++++++ .../ob_all_virtual_schema_slot.h | 67 ++++ .../ob_virtual_table_iterator_factory.cpp | 22 ++ .../ob_inner_table_schema.12301_12350.cpp | 348 ++++++++++++++++++ src/share/inner_table/ob_inner_table_schema.h | 10 +- .../ob_inner_table_schema_constants.h | 4 + .../inner_table/ob_inner_table_schema_def.py | 43 +++ .../ob_multi_version_schema_service.cpp | 53 +++ .../schema/ob_multi_version_schema_service.h | 6 +- src/share/schema/ob_schema_mem_mgr.cpp | 89 ++++- src/share/schema/ob_schema_mem_mgr.h | 53 ++- src/share/schema/ob_schema_mgr_cache.cpp | 171 +++++++++ src/share/schema/ob_schema_mgr_cache.h | 55 +++ src/share/schema/ob_schema_store.cpp | 17 + src/share/schema/ob_schema_store.h | 1 + .../r/mysql/inner_table_overall.result | 2 + 20 files changed, 1298 insertions(+), 10 deletions(-) create mode 100644 src/observer/virtual_table/ob_all_virtual_schema_memory.cpp create mode 100644 src/observer/virtual_table/ob_all_virtual_schema_memory.h create mode 100644 src/observer/virtual_table/ob_all_virtual_schema_slot.cpp create mode 100644 src/observer/virtual_table/ob_all_virtual_schema_slot.h diff --git a/deps/oblib/src/lib/ob_define.h b/deps/oblib/src/lib/ob_define.h index 7f807be07b..a46db3e6a0 100644 --- a/deps/oblib/src/lib/ob_define.h +++ b/deps/oblib/src/lib/ob_define.h @@ -164,6 +164,7 @@ const int64_t OB_MAX_USER_TABLE_NAME_LENGTH_ORACLE = // The actual maximum table name length of table_schema (the index table will have an additional prefix, so the actual // length is greater than OB_MAX_USER_TABLE_NAME_LENGTH) const int64_t OB_MAX_TABLE_NAME_LENGTH = 256; +const int64_t OB_MAX_SCHEMA_REF_INFO = 4096; const int64_t OB_MAX_TABLE_NAME_BUF_LENGTH = OB_MAX_TABLE_NAME_LENGTH + 1; const int64_t OB_MAX_PLAN_EXPLAIN_NAME_LENGTH = 256; const int64_t OB_MAX_TABLE_TYPE_LENGTH = 64; diff --git a/src/observer/CMakeLists.txt b/src/observer/CMakeLists.txt index 477b2291d2..28a3221f9b 100644 --- a/src/observer/CMakeLists.txt +++ b/src/observer/CMakeLists.txt @@ -149,6 +149,8 @@ ob_set_subtarget(ob_server vt virtual_table/ob_all_virtual_server_memory_info.cpp virtual_table/ob_all_virtual_server_object_pool.cpp virtual_table/ob_all_virtual_server_schema_info.cpp + virtual_table/ob_all_virtual_schema_memory.cpp + virtual_table/ob_all_virtual_schema_slot.cpp virtual_table/ob_all_virtual_session_event.cpp virtual_table/ob_all_virtual_session_stat.cpp virtual_table/ob_all_virtual_session_wait.cpp diff --git a/src/observer/virtual_table/ob_all_virtual_schema_memory.cpp b/src/observer/virtual_table/ob_all_virtual_schema_memory.cpp new file mode 100644 index 0000000000..bb54d8e945 --- /dev/null +++ b/src/observer/virtual_table/ob_all_virtual_schema_memory.cpp @@ -0,0 +1,139 @@ +/** + * Copyright (c) 2022 OceanBase + * OceanBase is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan + * PubL v2. You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY + * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO + * NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the + * Mulan PubL v2 for more details. + */ + +#define USING_LOG_PREFIX SERVER +#include "ob_all_virtual_schema_memory.h" +#include "observer/ob_server_struct.h" + +namespace oceanbase { +namespace observer { +int ObAllVirtualSchemaMemory::inner_open() +{ + int ret = OB_SUCCESS; + const ObAddr &addr = GCTX.self_addr_; + + if (false == addr.ip_to_string(ip_buffer_, sizeof(ip_buffer_))) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("fail to convert ip to string", KR(ret), K(addr)); + } else if (OB_FAIL(schema_service_.get_schema_store_tenants(tenant_ids_))) { + LOG_WARN("fail to get schema store tenants", KR(ret)); + } + return ret; +} + +int ObAllVirtualSchemaMemory::get_next_tenant_mem_info(ObSchemaMemory &schema_mem) +{ + int ret = OB_SUCCESS; + int tmp_ret = OB_SUCCESS; + + if (mem_idx_ >= schema_mem_infos_.count()) { + do { + schema_mem_infos_.reset(); + if (++tenant_idx_ >= tenant_ids_.count()) { + ret = OB_ITER_END; + } else { + uint64_t tenant_id = tenant_ids_[tenant_idx_]; + if (OB_INVALID_TENANT_ID == tenant_id) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("invalid tenant_id", KR(ret), K(tenant_idx_)); + // ignore single failture + } else if (OB_SUCCESS != (tmp_ret = schema_service_.get_tenant_mem_info(tenant_id, schema_mem_infos_))) { + LOG_WARN("fail to get tenant mem info", KR(tmp_ret), K(tenant_id)); + schema_mem_infos_.reset(); + } else { + mem_idx_ = 0; + } + } + } while (0 == schema_mem_infos_.count() && OB_SUCC(ret)); + } + if (OB_SUCC(ret)) { + if (OB_UNLIKELY(mem_idx_ < 0 || mem_idx_ >= schema_mem_infos_.count())) { + ret = OB_ERROR_OUT_OF_RANGE; + LOG_WARN("mem_idx_ out of range", KR(ret), K(mem_idx_)); + } else { + schema_mem = schema_mem_infos_[mem_idx_++]; + } + } + return ret; +} + +int ObAllVirtualSchemaMemory::inner_get_next_row(common::ObNewRow *&row) +{ + int ret = OB_SUCCESS; + ObSchemaMemory schema_mem; + + if (OB_FAIL(get_next_tenant_mem_info(schema_mem))) { + if (OB_ITER_END != ret) { + LOG_WARN("fail to get next tenant_mem_info", KR(ret)); + } + } + if (OB_SUCC(ret)) { + const int64_t pos = schema_mem.get_pos(); + const uint64_t tenant_id = schema_mem.get_tenant_id(); + const int64_t used_schema_mgr_cnt = schema_mem.get_used_schema_mgr_cnt(); + const int64_t free_schema_mgr_cnt = schema_mem.get_free_schema_mgr_cnt(); + const int64_t mem_used = schema_mem.get_mem_used(); + const int64_t mem_total = schema_mem.get_mem_total(); + + const int64_t col_count = output_column_ids_.count(); + for (int64_t i = 0; OB_SUCC(ret) && i < col_count; ++i) { + uint64_t col_id = output_column_ids_.at(i); + switch (col_id) { + case SVR_IP: { + cur_row_.cells_[i].set_varchar(common::ObString::make_string(ip_buffer_)); + cur_row_.cells_[i].set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); + break; + } + case SVR_PORT: { + cur_row_.cells_[i].set_int(static_cast((GCTX.self_addr_).get_port())); + break; + } + case TENANT_ID: { + cur_row_.cells_[i].set_int(static_cast(tenant_id)); + break; + } + case ALLOCATOR_TYPE: { + cur_row_.cells_[i].set_varchar(0 == pos ? "current" : "another"); + cur_row_.cells_[i].set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); + break; + } + case USED_SCHEMA_MGR_CNT: { + cur_row_.cells_[i].set_int(used_schema_mgr_cnt); + break; + } + case FREE_SCHEMA_MGR_CNT: { + cur_row_.cells_[i].set_int(free_schema_mgr_cnt); + break; + } + case MEM_USED: { + cur_row_.cells_[i].set_int(mem_used); + break; + } + case MEM_TOTAL: { + cur_row_.cells_[i].set_int(mem_total); + break; + } + default: { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("invalid col_id", KR(ret), K(col_id)); + } + } + } + + if (OB_SUCC(ret)) { + row = &cur_row_; + } + } + return ret; +} +} /* namespace observer */ +} /* namespace oceanbase */ diff --git a/src/observer/virtual_table/ob_all_virtual_schema_memory.h b/src/observer/virtual_table/ob_all_virtual_schema_memory.h new file mode 100644 index 0000000000..266ba37f2c --- /dev/null +++ b/src/observer/virtual_table/ob_all_virtual_schema_memory.h @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2022 OceanBase + * OceanBase is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan + * PubL v2. You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY + * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO + * NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the + * Mulan PubL v2 for more details. + */ + +#ifndef OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_ALL_VIRTUAL_SCHEMA_MEMORY_H_ +#define OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_ALL_VIRTUAL_SCHEMA_MEMORY_H_ + +#include "share/ob_virtual_table_scanner_iterator.h" +#include "share/ob_scanner.h" +#include "share/schema/ob_multi_version_schema_service.h" +#include "common/row/ob_row.h" + +namespace oceanbase { +class ObSchemaMemory; +namespace observer { +class ObAllVirtualSchemaMemory : public common::ObVirtualTableScannerIterator { + enum COLUMN_ID_LIST { + SVR_IP = common::OB_APP_MIN_COLUMN_ID, + SVR_PORT, + TENANT_ID, + ALLOCATOR_TYPE, + USED_SCHEMA_MGR_CNT, + FREE_SCHEMA_MGR_CNT, + MEM_USED, + MEM_TOTAL, + }; + +public: + explicit ObAllVirtualSchemaMemory(share::schema::ObMultiVersionSchemaService &schema_service) + : tenant_idx_(OB_INVALID_INDEX), mem_idx_(0), schema_service_(schema_service), tenant_ids_() + {} + virtual ~ObAllVirtualSchemaMemory() + {} + +public: + virtual int inner_open(); + virtual int inner_get_next_row(common::ObNewRow *&row); + int get_next_tenant_mem_info(ObSchemaMemory &schema_mem); + +private: + int64_t tenant_idx_; + int64_t mem_idx_; + const static int64_t DEFAULT_TENANT_NUM = 10; + const static int64_t DEFAULT_ALLOCATOR_COUNT = 2; + char ip_buffer_[OB_MAX_SERVER_ADDR_SIZE]; + share::schema::ObMultiVersionSchemaService &schema_service_; + common::ObSEArray schema_mem_infos_; + common::ObSEArray tenant_ids_; +}; // class ObAllVirtualServerSchemaMem +} // namespace observer +} // namespace oceanbase +#endif // OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_ALL_VIRTUAL_SCHEMA_MEM_H_ diff --git a/src/observer/virtual_table/ob_all_virtual_schema_slot.cpp b/src/observer/virtual_table/ob_all_virtual_schema_slot.cpp new file mode 100644 index 0000000000..b1d36dc0af --- /dev/null +++ b/src/observer/virtual_table/ob_all_virtual_schema_slot.cpp @@ -0,0 +1,165 @@ +/** + * Copyright (c) 2022 OceanBase + * OceanBase is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan + * PubL v2. You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY + * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO + * NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the + * Mulan PubL v2 for more details. + */ + +#define USING_LOG_PREFIX SERVER +#include "observer/virtual_table/ob_all_virtual_schema_slot.h" +#include "observer/ob_server_struct.h" +#include "share/schema/ob_schema_mgr.h" +#include "share/schema/ob_schema_mgr_cache.h" + +namespace oceanbase { +namespace observer { +void ObAllVirtualSchemaSlot::reset(common::ObIAllocator &allocator, common::ObIArray &tenant_slot_infos) +{ + const char *ptr = NULL; + common::ObString str; + int ret = OB_SUCCESS; + int len = tenant_slot_infos.count(); + + for (int64_t i = 0; i < len && OB_SUCC(ret); ++i) { + ptr = ((tenant_slot_infos.at(i)).get_mod_ref_infos()).ptr(); + if (OB_NOT_NULL(ptr)) { + allocator.free(const_cast(ptr)); + } + (tenant_slot_infos.at(i)).reset(); + } + tenant_slot_infos.reset(); +} + +int ObAllVirtualSchemaSlot::inner_open() +{ + const ObAddr &addr = GCTX.self_addr_; + int ret = OB_SUCCESS; + + if (false == addr.ip_to_string(ip_buffer_, sizeof(ip_buffer_))) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("fail to convert ip to string", KR(ret), K(addr)); + } else if (OB_FAIL(schema_service_.get_schema_store_tenants(tenant_ids_))) { + LOG_WARN("fail to get schema store tenants", KR(ret)); + } + return ret; +} + +int ObAllVirtualSchemaSlot::get_next_tenant_slot_info(ObSchemaSlot &schema_slot) +{ + int ret = OB_SUCCESS; + int tmp_ret = OB_SUCCESS; + + if (OB_ISNULL(allocator_)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("allocator_ is null", KR(ret)); + } else if (slot_idx_ >= schema_slot_infos_.count()) { + do { + reset(*allocator_, schema_slot_infos_); + if (++tenant_idx_ >= tenant_ids_.count()) { + ret = OB_ITER_END; + } else { + uint64_t tenant_id = tenant_ids_[tenant_idx_]; + if (OB_INVALID_TENANT_ID == tenant_id) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("invalid tenant_id", KR(ret), K(tenant_idx_)); + // ignore single failture + } else if (OB_SUCCESS != + (tmp_ret = schema_service_.get_tenant_slot_info(*allocator_, tenant_id, schema_slot_infos_))) { + LOG_WARN("fail to get tenant slot info", KR(tmp_ret), K(tenant_id)); + reset(*allocator_, schema_slot_infos_); + } else { + slot_idx_ = 0; + } + } + } while (0 == schema_slot_infos_.count() && OB_SUCC(ret)); + } + if (OB_SUCC(ret)) { + if (OB_UNLIKELY(slot_idx_ < 0 || slot_idx_ >= schema_slot_infos_.count())) { + ret = OB_ERROR_OUT_OF_RANGE; + LOG_WARN("slot_idx_ out of range", KR(ret), K(slot_idx_)); + } else { + schema_slot = schema_slot_infos_[slot_idx_++]; + } + } + return ret; +} + +int ObAllVirtualSchemaSlot::inner_get_next_row(common::ObNewRow *&row) +{ + int ret = OB_SUCCESS; + ObSchemaSlot schema_slot; + + if (OB_FAIL(get_next_tenant_slot_info(schema_slot))) { + if (OB_ITER_END != ret) { + LOG_WARN("fail to get next tenant_info", KR(ret)); + } + } + if (OB_SUCC(ret)) { + const uint64_t tenant_id = schema_slot.get_tenant_id(); + const int64_t slot_id = schema_slot.get_slot_id(); + const int64_t total_ref_cnt = schema_slot.get_ref_cnt(); + const int64_t schema_version = schema_slot.get_schema_version(); + const int64_t schema_count = schema_slot.get_schema_count(); + + const int64_t col_count = output_column_ids_.count(); + for (int64_t i = 0; OB_SUCC(ret) && i < col_count; ++i) { + uint64_t col_id = output_column_ids_.at(i); + switch (col_id) { + case SVR_IP: { + cur_row_.cells_[i].set_varchar(common::ObString::make_string(ip_buffer_)); + cur_row_.cells_[i].set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); + break; + } + case SVR_PORT: { + cur_row_.cells_[i].set_int(static_cast((GCTX.self_addr_).get_port())); + break; + } + case TENANT_ID: { + cur_row_.cells_[i].set_int(static_cast(tenant_id)); + break; + } + case SLOT_ID: { + cur_row_.cells_[i].set_int(static_cast(slot_id)); + break; + } + case SCHEMA_VERSION: { + cur_row_.cells_[i].set_int(static_cast(schema_version)); + break; + } + case SCHEMA_COUNT: { + cur_row_.cells_[i].set_int(static_cast(schema_count)); + break; + } + case REF_CNT: { + cur_row_.cells_[i].set_int(static_cast(total_ref_cnt)); + break; + } + case REF_INFO: { + if (OB_NOT_NULL(schema_slot.get_mod_ref_infos().ptr())) { + cur_row_.cells_[i].set_varchar(schema_slot.get_mod_ref_infos()); + } else { + cur_row_.cells_[i].set_varchar(""); + } + cur_row_.cells_[i].set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); + break; + } + default: { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("invalid col_id", KR(ret), K(col_id)); + } + } + } + + if (OB_SUCC(ret)) { + row = &cur_row_; + } + } + return ret; +} +} /* namespace observer */ +} /* namespace oceanbase */ diff --git a/src/observer/virtual_table/ob_all_virtual_schema_slot.h b/src/observer/virtual_table/ob_all_virtual_schema_slot.h new file mode 100644 index 0000000000..f4ef35fc2f --- /dev/null +++ b/src/observer/virtual_table/ob_all_virtual_schema_slot.h @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2022 OceanBase + * OceanBase is licensed under Mulan PubL v2. + * You can use this software according to the terms and conditions of the Mulan + * PubL v2. You may obtain a copy of Mulan PubL v2 at: + * http://license.coscl.org.cn/MulanPubL-2.0 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY + * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO + * NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the + * Mulan PubL v2 for more details. + */ + +#ifndef OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_ALL_VIRTUAL_SCHEMA_SLOT_H_ +#define OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_ALL_VIRTUAL_SCHEMA_SLOT_H_ + +#include "share/ob_virtual_table_scanner_iterator.h" +#include "share/ob_scanner.h" +#include "share/schema/ob_multi_version_schema_service.h" +#include "common/row/ob_row.h" +#include "lib/string/ob_string.h" +#include "lib/container/ob_se_array.h" +#include "lib/string/ob_sql_string.h" + +namespace oceanbase { +namespace observer { +class ObAllVirtualSchemaSlot : public common::ObVirtualTableScannerIterator { + enum COLUMN_ID_LIST { + SVR_IP = common::OB_APP_MIN_COLUMN_ID, + SVR_PORT, + TENANT_ID, + SLOT_ID, + SCHEMA_VERSION, + SCHEMA_COUNT, + REF_CNT, + REF_INFO, + }; + +public: + explicit ObAllVirtualSchemaSlot(share::schema::ObMultiVersionSchemaService &schema_service) + : tenant_idx_(OB_INVALID_INDEX), + slot_idx_(0), + tenant_ids_(), + schema_service_(schema_service), + schema_slot_infos_() + {} + virtual ~ObAllVirtualSchemaSlot() + {} + +public: + virtual int inner_open(); + virtual int inner_get_next_row(common::ObNewRow *&row); + void reset(common::ObIAllocator &allocator, common::ObIArray &schema_slot_infos); + int get_next_tenant_slot_info(ObSchemaSlot &schema_slot); + +private: + int64_t tenant_idx_; // tenant_iterator + int64_t slot_idx_; // slot iterator + const static int64_t DEFAULT_TENANT_NUM = 10; + const static int64_t DEFAULT_SLOT_NUM = 128; + char ip_buffer_[OB_MAX_SERVER_ADDR_SIZE]; + common::ObSEArray tenant_ids_; + share::schema::ObMultiVersionSchemaService &schema_service_; + common::ObSEArray schema_slot_infos_; // specified tenant's all slot info +}; // class ObAllVirtualSchemaSlot +} // namespace observer +} // namespace oceanbase +#endif // OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_ALL_VIRTUAL_SCHEMA_SLOT_H_ diff --git a/src/observer/virtual_table/ob_virtual_table_iterator_factory.cpp b/src/observer/virtual_table/ob_virtual_table_iterator_factory.cpp index a67e8ed8a7..dfd7e50d7f 100644 --- a/src/observer/virtual_table/ob_virtual_table_iterator_factory.cpp +++ b/src/observer/virtual_table/ob_virtual_table_iterator_factory.cpp @@ -193,6 +193,8 @@ #include "observer/virtual_table/ob_virtual_open_cursor_table.h" #include "observer/virtual_table/ob_all_virtual_backupset_history_mgr.h" #include "observer/virtual_table/ob_all_virtual_backup_clean_info.h" +#include "observer/virtual_table/ob_all_virtual_schema_memory.h" +#include "observer/virtual_table/ob_all_virtual_schema_slot.h" namespace oceanbase { using namespace common; @@ -1995,6 +1997,26 @@ int ObVTIterCreator::create_vt_iter(ObVTableScanParam& params, ObVirtualTableIte } break; } + case OB_ALL_VIRTUAL_SCHEMA_MEMORY_TID: { + ObAllVirtualSchemaMemory *schema_memory = NULL; + share::schema::ObMultiVersionSchemaService &schema_service = root_service_.get_schema_service(); + if (OB_FAIL(NEW_VIRTUAL_TABLE(ObAllVirtualSchemaMemory, schema_memory, schema_service))) { + SERVER_LOG(ERROR, "ObAllVirtualSchemaMemory construct fail", KR(ret)); + } else { + vt_iter = static_cast(schema_memory); + } + break; + } + case OB_ALL_VIRTUAL_SCHEMA_SLOT_TID: { + ObAllVirtualSchemaSlot *schema_slot = NULL; + share::schema::ObMultiVersionSchemaService &schema_service = root_service_.get_schema_service(); + if (OB_FAIL(NEW_VIRTUAL_TABLE(ObAllVirtualSchemaSlot, schema_slot, schema_service))) { + SERVER_LOG(ERROR, "ObAllVirtualSchemaSlot construct fail", KR(ret)); + } else { + vt_iter = static_cast(schema_slot); + } + break; + } case OB_ALL_VIRTUAL_REPLICA_TASK_TID: { ObAllReplicaTask* all_replica_task = NULL; bool is_index = false; diff --git a/src/share/inner_table/ob_inner_table_schema.12301_12350.cpp b/src/share/inner_table/ob_inner_table_schema.12301_12350.cpp index bc2d1ec50f..92f6c6c441 100644 --- a/src/share/inner_table/ob_inner_table_schema.12301_12350.cpp +++ b/src/share/inner_table/ob_inner_table_schema.12301_12350.cpp @@ -726,6 +726,354 @@ int ObInnerTableSchema::all_virtual_kv_ttl_task_history_schema(ObTableSchema &ta return ret; } +int ObInnerTableSchema::all_virtual_schema_memory_schema(ObTableSchema &table_schema) +{ + int ret = OB_SUCCESS; + uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1; + + //generated fields: + table_schema.set_tenant_id(OB_SYS_TENANT_ID); + table_schema.set_tablegroup_id(combine_id(OB_SYS_TENANT_ID, OB_SYS_TABLEGROUP_ID)); + table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_SYS_DATABASE_ID)); + table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_ALL_VIRTUAL_SCHEMA_MEMORY_TID)); + table_schema.set_rowkey_split_pos(0); + table_schema.set_is_use_bloomfilter(false); + table_schema.set_progressive_merge_num(0); + table_schema.set_rowkey_column_num(0); + table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK); + table_schema.set_table_type(VIRTUAL_TABLE); + table_schema.set_index_type(INDEX_TYPE_IS_NOT); + table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL); + + if (OB_SUCC(ret)) { + if (OB_FAIL(table_schema.set_table_name(OB_ALL_VIRTUAL_SCHEMA_MEMORY_TNAME))) { + LOG_ERROR("fail to set table_name", K(ret)); + } + } + + if (OB_SUCC(ret)) { + if (OB_FAIL(table_schema.set_compress_func_name(OB_DEFAULT_COMPRESS_FUNC_NAME))) { + LOG_ERROR("fail to set compress_func_name", K(ret)); + } + } + table_schema.set_part_level(PARTITION_LEVEL_ZERO); + table_schema.set_charset_type(ObCharset::get_default_charset()); + table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); + table_schema.set_create_mem_version(1); + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("svr_ip", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 1, //part_key_pos + ObVarcharType, //column_type + CS_TYPE_INVALID, //column_collation_type + MAX_IP_ADDR_LENGTH, //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("svr_port", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 2, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("tenant_id", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("type", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObVarcharType, //column_type + CS_TYPE_INVALID, //column_collation_type + 128, //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("used_schema_mgr_cnt", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("free_schema_mgr_cnt", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("mem_used", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("mem_total", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + if (OB_SUCC(ret)) { + table_schema.get_part_option().set_part_func_type(PARTITION_FUNC_TYPE_HASH); + if (OB_FAIL(table_schema.get_part_option().set_part_expr("hash (addr_to_partition_id(svr_ip, svr_port))"))) { + LOG_WARN("set_part_expr failed", K(ret)); + } + table_schema.get_part_option().set_part_num(65536); + table_schema.set_part_level(PARTITION_LEVEL_ONE); + } + table_schema.set_index_using_type(USING_HASH); + table_schema.set_row_store_type(FLAT_ROW_STORE); + table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL); + table_schema.set_progressive_merge_round(1); + table_schema.set_storage_format_version(3); + + table_schema.set_max_used_column_id(column_id); + table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1); + table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0); + return ret; +} + +int ObInnerTableSchema::all_virtual_schema_slot_schema(ObTableSchema &table_schema) +{ + int ret = OB_SUCCESS; + uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1; + + //generated fields: + table_schema.set_tenant_id(OB_SYS_TENANT_ID); + table_schema.set_tablegroup_id(combine_id(OB_SYS_TENANT_ID, OB_SYS_TABLEGROUP_ID)); + table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_SYS_DATABASE_ID)); + table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_ALL_VIRTUAL_SCHEMA_SLOT_TID)); + table_schema.set_rowkey_split_pos(0); + table_schema.set_is_use_bloomfilter(false); + table_schema.set_progressive_merge_num(0); + table_schema.set_rowkey_column_num(0); + table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK); + table_schema.set_table_type(VIRTUAL_TABLE); + table_schema.set_index_type(INDEX_TYPE_IS_NOT); + table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL); + + if (OB_SUCC(ret)) { + if (OB_FAIL(table_schema.set_table_name(OB_ALL_VIRTUAL_SCHEMA_SLOT_TNAME))) { + LOG_ERROR("fail to set table_name", K(ret)); + } + } + + if (OB_SUCC(ret)) { + if (OB_FAIL(table_schema.set_compress_func_name(OB_DEFAULT_COMPRESS_FUNC_NAME))) { + LOG_ERROR("fail to set compress_func_name", K(ret)); + } + } + table_schema.set_part_level(PARTITION_LEVEL_ZERO); + table_schema.set_charset_type(ObCharset::get_default_charset()); + table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); + table_schema.set_create_mem_version(1); + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("svr_ip", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 1, //part_key_pos + ObVarcharType, //column_type + CS_TYPE_INVALID, //column_collation_type + MAX_IP_ADDR_LENGTH, //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("svr_port", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 2, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("tenant_id", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("slot_id", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("schema_version", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("schema_count", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("total_ref_cnt", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("ref_info", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObVarcharType, //column_type + CS_TYPE_INVALID, //column_collation_type + OB_MAX_SCHEMA_REF_INFO, //column_length + -1, //column_precision + -1, //column_scale + false, //is_nullable + false); //is_autoincrement + } + if (OB_SUCC(ret)) { + table_schema.get_part_option().set_part_func_type(PARTITION_FUNC_TYPE_HASH); + if (OB_FAIL(table_schema.get_part_option().set_part_expr("hash (addr_to_partition_id(svr_ip, svr_port))"))) { + LOG_WARN("set_part_expr failed", K(ret)); + } + table_schema.get_part_option().set_part_num(65536); + table_schema.set_part_level(PARTITION_LEVEL_ONE); + } + table_schema.set_index_using_type(USING_HASH); + table_schema.set_row_store_type(FLAT_ROW_STORE); + table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL); + table_schema.set_progressive_merge_round(1); + table_schema.set_storage_format_version(3); + + table_schema.set_max_used_column_id(column_id); + table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1); + table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0); + return ret; +} + } // end namespace share } // end namespace oceanbase diff --git a/src/share/inner_table/ob_inner_table_schema.h b/src/share/inner_table/ob_inner_table_schema.h index 433fc4ff80..38974a5bea 100644 --- a/src/share/inner_table/ob_inner_table_schema.h +++ b/src/share/inner_table/ob_inner_table_schema.h @@ -770,6 +770,8 @@ public: static int all_virtual_query_response_time_schema(share::schema::ObTableSchema &table_schema); static int all_virtual_kv_ttl_task_schema(share::schema::ObTableSchema &table_schema); static int all_virtual_kv_ttl_task_history_schema(share::schema::ObTableSchema &table_schema); + static int all_virtual_schema_memory_schema(share::schema::ObTableSchema &table_schema); + static int all_virtual_schema_slot_schema(share::schema::ObTableSchema &table_schema); static int all_virtual_table_agent_schema(share::schema::ObTableSchema &table_schema); static int all_virtual_column_agent_schema(share::schema::ObTableSchema &table_schema); static int all_virtual_database_agent_schema(share::schema::ObTableSchema &table_schema); @@ -1812,6 +1814,8 @@ const schema_create_func virtual_table_schema_creators [] = { ObInnerTableSchema::all_virtual_query_response_time_schema, ObInnerTableSchema::all_virtual_kv_ttl_task_schema, ObInnerTableSchema::all_virtual_kv_ttl_task_history_schema, + ObInnerTableSchema::all_virtual_schema_memory_schema, + ObInnerTableSchema::all_virtual_schema_slot_schema, ObInnerTableSchema::all_virtual_table_agent_schema, ObInnerTableSchema::all_virtual_column_agent_schema, ObInnerTableSchema::all_virtual_database_agent_schema, @@ -4084,11 +4088,11 @@ static inline bool is_only_rs_virtual_table(const uint64_t tid) const int64_t OB_CORE_TABLE_COUNT = 5; const int64_t OB_SYS_TABLE_COUNT = 189; -const int64_t OB_VIRTUAL_TABLE_COUNT = 466; +const int64_t OB_VIRTUAL_TABLE_COUNT = 468; const int64_t OB_SYS_VIEW_COUNT = 365; -const int64_t OB_SYS_TENANT_TABLE_COUNT = 1026; +const int64_t OB_SYS_TENANT_TABLE_COUNT = 1028; const int64_t OB_CORE_SCHEMA_VERSION = 1; -const int64_t OB_BOOTSTRAP_SCHEMA_VERSION = 1029; +const int64_t OB_BOOTSTRAP_SCHEMA_VERSION = 1031; } // end namespace share } // end namespace oceanbase diff --git a/src/share/inner_table/ob_inner_table_schema_constants.h b/src/share/inner_table/ob_inner_table_schema_constants.h index ca46bc59de..f0a85041e5 100644 --- a/src/share/inner_table/ob_inner_table_schema_constants.h +++ b/src/share/inner_table/ob_inner_table_schema_constants.h @@ -503,6 +503,8 @@ const uint64_t OB_ALL_VIRTUAL_GLOBAL_TRANSACTION_TID = 12206; // "__all_virtual_ const uint64_t OB_ALL_VIRTUAL_QUERY_RESPONSE_TIME_TID = 12325; // "__all_virtual_query_response_time" const uint64_t OB_ALL_VIRTUAL_KV_TTL_TASK_TID = 12326; // "__all_virtual_kv_ttl_task" const uint64_t OB_ALL_VIRTUAL_KV_TTL_TASK_HISTORY_TID = 12327; // "__all_virtual_kv_ttl_task_history" +const uint64_t OB_ALL_VIRTUAL_SCHEMA_MEMORY_TID = 12336; // "__all_virtual_schema_memory" +const uint64_t OB_ALL_VIRTUAL_SCHEMA_SLOT_TID = 12337; // "__all_virtual_schema_slot" const uint64_t OB_ALL_VIRTUAL_TABLE_AGENT_TID = 15001; // "ALL_VIRTUAL_TABLE_AGENT" const uint64_t OB_ALL_VIRTUAL_COLUMN_AGENT_TID = 15002; // "ALL_VIRTUAL_COLUMN_AGENT" const uint64_t OB_ALL_VIRTUAL_DATABASE_AGENT_TID = 15003; // "ALL_VIRTUAL_DATABASE_AGENT" @@ -1533,6 +1535,8 @@ const char *const OB_ALL_VIRTUAL_GLOBAL_TRANSACTION_TNAME = "__all_virtual_globa const char *const OB_ALL_VIRTUAL_QUERY_RESPONSE_TIME_TNAME = "__all_virtual_query_response_time"; const char *const OB_ALL_VIRTUAL_KV_TTL_TASK_TNAME = "__all_virtual_kv_ttl_task"; const char *const OB_ALL_VIRTUAL_KV_TTL_TASK_HISTORY_TNAME = "__all_virtual_kv_ttl_task_history"; +const char *const OB_ALL_VIRTUAL_SCHEMA_MEMORY_TNAME = "__all_virtual_schema_memory"; +const char *const OB_ALL_VIRTUAL_SCHEMA_SLOT_TNAME = "__all_virtual_schema_slot"; const char *const OB_ALL_VIRTUAL_TABLE_AGENT_TNAME = "ALL_VIRTUAL_TABLE_AGENT"; const char *const OB_ALL_VIRTUAL_COLUMN_AGENT_TNAME = "ALL_VIRTUAL_COLUMN_AGENT"; const char *const OB_ALL_VIRTUAL_DATABASE_AGENT_TNAME = "ALL_VIRTUAL_DATABASE_AGENT"; diff --git a/src/share/inner_table/ob_inner_table_schema_def.py b/src/share/inner_table/ob_inner_table_schema_def.py index 0839c492e4..0c02cf76d3 100644 --- a/src/share/inner_table/ob_inner_table_schema_def.py +++ b/src/share/inner_table/ob_inner_table_schema_def.py @@ -10244,6 +10244,49 @@ def_table_schema(**gen_iterate_virtual_table_def( real_tenant_id=True, table_name = '__all_virtual_kv_ttl_task_history', keywords = all_def_keywords['__all_kv_ttl_task_history'])) +def_table_schema( + table_name = '__all_virtual_schema_memory', + table_id = '12336', + table_type = 'VIRTUAL_TABLE', + gm_columns = [], + rowkey_columns = [ + ], + + in_tenant_space = False, + normal_columns = [ + ('svr_ip', 'varchar:MAX_IP_ADDR_LENGTH'), + ('svr_port', 'int'), + ('tenant_id', 'int'), + ('type', 'varchar:128'), + ('used_schema_mgr_cnt', 'int'), + ('free_schema_mgr_cnt', 'int'), + ('mem_used', 'int'), + ('mem_total', 'int'), + ], + partition_columns = ['svr_ip', 'svr_port'], +) + +def_table_schema( + table_name = '__all_virtual_schema_slot', + table_id = '12337', + table_type = 'VIRTUAL_TABLE', + gm_columns = [], + rowkey_columns = [ + ], + + in_tenant_space = False, + normal_columns = [ + ('svr_ip', 'varchar:MAX_IP_ADDR_LENGTH'), + ('svr_port', 'int'), + ('tenant_id', 'int'), + ('slot_id', 'int'), + ('schema_version', 'int'), + ('schema_count', 'int'), + ('total_ref_cnt', 'int'), + ('ref_info','varchar:OB_MAX_SCHEMA_REF_INFO'), + ], + partition_columns = ['svr_ip', 'svr_port'], +) ################################################################################ # Oracle Virtual Table(15000,20000] diff --git a/src/share/schema/ob_multi_version_schema_service.cpp b/src/share/schema/ob_multi_version_schema_service.cpp index d9f0045b08..6bd6666cb6 100644 --- a/src/share/schema/ob_multi_version_schema_service.cpp +++ b/src/share/schema/ob_multi_version_schema_service.cpp @@ -4369,6 +4369,59 @@ int ObMultiVersionSchemaService::get_new_schema_version(uint64_t tenant_id, int6 return ret; } +int ObMultiVersionSchemaService::get_tenant_mem_info( + const uint64_t &tenant_id, common::ObIArray &tenant_mem_infos) +{ + int ret = OB_SUCCESS; + ObSchemaMemMgr *mem_mgr = NULL; + + if (OB_INVALID_TENANT_ID == tenant_id) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("invalid tenant_id", KR(ret), K(tenant_id)); + } else if (OB_ISNULL(schema_service_)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("schema service is null", KR(ret), K(tenant_id)); + } else if (OB_FAIL(mem_mgr_map_.get_refactored(tenant_id, mem_mgr))) { + LOG_WARN("fail to get tenant mem_mgr", KR(ret), K(tenant_id)); + } else if (OB_ISNULL(mem_mgr)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("mem_mgr is NULL", KR(ret), K(tenant_id)); + } else if (OB_FAIL(mem_mgr->get_all_alloc_info(tenant_mem_infos))) { + LOG_WARN("fail to get mem_mgr alloc info", KR(ret), K(tenant_id)); + } + return ret; +} + +int ObMultiVersionSchemaService::get_tenant_slot_info( + common::ObIAllocator &allocator, const uint64_t &tenant_id, common::ObIArray &tenant_slot_infos) +{ + int ret = OB_SUCCESS; + ObSchemaStore *schema_store = NULL; + + if (OB_INVALID_TENANT_ID == tenant_id) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("invalid tenant_id", KR(ret), K(tenant_id)); + } else if (OB_ISNULL(schema_service_)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("schema service is null", KR(ret), K(tenant_id)); + } else if (OB_ISNULL(schema_store = schema_store_map_.get(tenant_id))) { + ret = OB_ENTRY_NOT_EXIST; + LOG_WARN("fail to get schema_store", KR(ret), K(tenant_id)); + } else if (OB_FAIL((schema_store->schema_mgr_cache_).get_slot_info(allocator, tenant_slot_infos))) { + LOG_WARN("fail tp get slot info from schema_mgr_cache", KR(ret), K(tenant_id)); + } + return ret; +} + +int ObMultiVersionSchemaService::get_schema_store_tenants(common::ObIArray &tenant_ids) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(schema_store_map_.get_all_tenant(tenant_ids))) { + LOG_WARN("fail to get all_tenant from schema_store_map_", KR(ret)); + } + return ret; +} + // If schema_status_array is empty, it means strong consistent reading int ObMultiVersionSchemaService::get_schema_status(const ObArray& schema_status_array, const uint64_t tenant_id, ObRefreshSchemaStatus& schema_status) diff --git a/src/share/schema/ob_multi_version_schema_service.h b/src/share/schema/ob_multi_version_schema_service.h index a64e6155ef..7d75e8388d 100644 --- a/src/share/schema/ob_multi_version_schema_service.h +++ b/src/share/schema/ob_multi_version_schema_service.h @@ -24,6 +24,7 @@ #include "share/inner_table/ob_inner_table_schema.h" namespace oceanbase { +class ObSchemaSlot; namespace common {} namespace tools { class ObAgentTaskGenerator; @@ -120,7 +121,10 @@ public: const int64_t init_version_count, const int64_t init_version_count_for_liboblog, const bool with_timestamp); int init_sys_schema(const common::ObIArray& table_schemas); - + int get_tenant_mem_info(const uint64_t &tenant_id, common::ObIArray &tenant_mem_infos); + int get_tenant_slot_info( + common::ObIAllocator &allocator, const uint64_t &tenant_id, common::ObIArray &tenant_slot_infos); + int get_schema_store_tenants(common::ObIArray &tenant_ids); public: //--------ddl funcs for RS module ---------// // check table exist diff --git a/src/share/schema/ob_schema_mem_mgr.cpp b/src/share/schema/ob_schema_mem_mgr.cpp index e49d5de615..86e2a6da0f 100644 --- a/src/share/schema/ob_schema_mem_mgr.cpp +++ b/src/share/schema/ob_schema_mem_mgr.cpp @@ -17,7 +17,26 @@ namespace oceanbase { using namespace common; +void ObSchemaMemory::reset() +{ + pos_ = OB_INVALID_INDEX; + tenant_id_ = OB_INVALID_TENANT_ID; + mem_used_ = OB_INVALID_COUNT; + mem_total_ = OB_INVALID_COUNT; + used_schema_mgr_cnt_ = OB_INVALID_COUNT; + free_schema_mgr_cnt_ = OB_INVALID_COUNT; +} +void ObSchemaMemory::init(const int64_t pos, const uint64_t &tenant_id, const int64_t &mem_used, + const int64_t &mem_total, const int64_t &used_schema_mgr_cnt, const int64_t &free_schema_mgr_cnt) +{ + pos_ = pos; + tenant_id_ = tenant_id; + mem_used_ = mem_used; + mem_total_ = mem_total; + used_schema_mgr_cnt_ = used_schema_mgr_cnt; + free_schema_mgr_cnt_ = free_schema_mgr_cnt; +} namespace share { namespace schema { @@ -59,7 +78,7 @@ int ObSchemaMemMgr::alloc(const int size, void*& ptr, ObIAllocator** allocator) if (NULL != allocator) { *allocator = NULL; } - + SpinWLockGuard guard(schema_mem_rwlock_); if (!check_inner_stat()) { ret = OB_INNER_STAT_ERROR; LOG_WARN("inner stat error", K(ret)); @@ -119,6 +138,8 @@ int ObSchemaMemMgr::in_current_allocator(const void* ptr, bool& in_curr_allocato int ret = OB_SUCCESS; in_curr_allocator = false; int tmp_idx = -1; + + SpinRLockGuard guard(schema_mem_rwlock_); if (OB_ISNULL(ptr)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("ptr is null", K(ret)); @@ -136,6 +157,7 @@ int ObSchemaMemMgr::free(void* ptr) { int ret = OB_SUCCESS; + SpinWLockGuard guard(schema_mem_rwlock_); if (!check_inner_stat()) { ret = OB_INNER_STAT_ERROR; LOG_WARN("inner stat error", K(ret)); @@ -178,6 +200,7 @@ int ObSchemaMemMgr::get_cur_alloc_cnt(int64_t& cnt) const int ret = OB_SUCCESS; cnt = 0; + SpinRLockGuard guard(schema_mem_rwlock_); if (!check_inner_stat()) { ret = OB_INNER_STAT_ERROR; LOG_WARN("inner stat error", K(ret)); @@ -188,9 +211,50 @@ int ObSchemaMemMgr::get_cur_alloc_cnt(int64_t& cnt) const return ret; } +int ObSchemaMemMgr::get_all_alloc_info(common::ObIArray &schema_mem_infos) +{ + int ret = OB_SUCCESS; + schema_mem_infos.reset(); + + SpinRLockGuard guard(schema_mem_rwlock_); + if (!check_inner_stat()) { + ret = OB_INNER_STAT_ERROR; + LOG_WARN("inner stat error", K(ret)); + } else { + ObSchemaMemory schema_mem; + int64_t mem_used = OB_INVALID_COUNT; + int64_t mem_total = OB_INVALID_COUNT; + int64_t used_schema_mgr_cnt = OB_INVALID_COUNT; + int64_t free_schema_mgr_cnt = OB_INVALID_COUNT; + int64_t tenant_id = OB_INVALID_TENANT_ID; + + tenant_id = tenant_id_; + mem_used = allocator_[pos_].used(); + mem_total = allocator_[pos_].total(); + used_schema_mgr_cnt = ptrs_[pos_].count(); + free_schema_mgr_cnt = all_ptrs_[pos_].count() - used_schema_mgr_cnt; + schema_mem.init(0, tenant_id, mem_used, mem_total, used_schema_mgr_cnt, free_schema_mgr_cnt); + if (OB_FAIL(schema_mem_infos.push_back(schema_mem))) { + LOG_WARN("fail to push back schema_mem", KR(ret)); + } else { + mem_used = allocator_[1 - pos_].used(); + mem_total = allocator_[1 - pos_].total(); + used_schema_mgr_cnt = ptrs_[1 - pos_].count(); + free_schema_mgr_cnt = all_ptrs_[1 - pos_].count() - used_schema_mgr_cnt; + schema_mem.init(1, tenant_id, mem_used, mem_total, used_schema_mgr_cnt, free_schema_mgr_cnt); + if (OB_FAIL(schema_mem_infos.push_back(schema_mem))) { + LOG_WARN("fail to push back schema_mem", KR(ret)); + } + } + } + return ret; +} + int ObSchemaMemMgr::is_same_allocator(const void* p1, const void* p2, bool& is_same_allocator) { int ret = OB_SUCCESS; + SpinRLockGuard guard(schema_mem_rwlock_); + if (!check_inner_stat()) { ret = OB_INNER_STAT_ERROR; LOG_WARN("inner stat error", K(ret)); @@ -258,6 +322,7 @@ int ObSchemaMemMgr::check_can_switch_allocator(bool& can_switch) const int ret = OB_SUCCESS; can_switch = false; + SpinRLockGuard guard(schema_mem_rwlock_); if (!check_inner_stat()) { ret = OB_INNER_STAT_ERROR; LOG_WARN("inner stat error", K(ret)); @@ -272,13 +337,14 @@ int ObSchemaMemMgr::switch_allocator() { int ret = OB_SUCCESS; + SpinWLockGuard guard(schema_mem_rwlock_); if (!check_inner_stat()) { ret = OB_INNER_STAT_ERROR; LOG_WARN("inner stat error", K(ret)); } else if (0 != ptrs_[1 - pos_].count()) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpected error", K(ret)); - dump(); + dump_without_lock_(); } else { allocator_[1 - pos_].reset(); all_ptrs_[1 - pos_].reset(); @@ -290,6 +356,12 @@ int ObSchemaMemMgr::switch_allocator() } void ObSchemaMemMgr::dump() const +{ + SpinRLockGuard guard(schema_mem_rwlock_); + dump_without_lock_(); +} + +void ObSchemaMemMgr::dump_without_lock_() const { LOG_INFO("[SCHEMA_STATISTICS] cur allocator", K_(tenant_id), @@ -329,6 +401,8 @@ int ObSchemaMemMgr::check_can_release(bool& can_release) const { int ret = OB_SUCCESS; can_release = false; + + SpinRLockGuard guard(schema_mem_rwlock_); if (!check_inner_stat()) { ret = OB_INNER_STAT_ERROR; LOG_WARN("inner stat error", K(ret)); @@ -342,6 +416,7 @@ int ObSchemaMemMgr::try_reset_allocator() { int ret = OB_SUCCESS; + SpinWLockGuard guard(schema_mem_rwlock_); if (!check_inner_stat()) { ret = OB_INNER_STAT_ERROR; LOG_WARN("inner stat error", K(ret)); @@ -350,7 +425,7 @@ int ObSchemaMemMgr::try_reset_allocator() if (OB_FAIL(ret)) { } else if (0 != ptrs_[pos_].count()) { LOG_INFO("allocator is not empty, just skip", K_(tenant_id)); - dump(); + dump_without_lock_(); } else { all_ptrs_[pos_].reset(); allocator_[pos_].reset(); @@ -360,7 +435,7 @@ int ObSchemaMemMgr::try_reset_allocator() if (OB_FAIL(ret)) { } else if (0 != ptrs_[1 - pos_].count()) { LOG_INFO("another allocator is not empty, just skip", K_(tenant_id)); - dump(); + dump_without_lock_(); } else { all_ptrs_[1 - pos_].reset(); allocator_[1 - pos_].reset(); @@ -372,12 +447,14 @@ int ObSchemaMemMgr::try_reset_allocator() int ObSchemaMemMgr::try_reset_another_allocator() { int ret = OB_SUCCESS; + + SpinWLockGuard guard(schema_mem_rwlock_); if (!check_inner_stat()) { ret = OB_INNER_STAT_ERROR; LOG_WARN("inner stat error", K(ret)); } else if (0 != ptrs_[1 - pos_].count()) { LOG_INFO("another allocator is not empty, just skip", K_(tenant_id)); - dump(); + dump_without_lock_(); } else if (0 != all_ptrs_[1 - pos_].count()) { all_ptrs_[1 - pos_].reset(); allocator_[1 - pos_].reset(); @@ -389,6 +466,8 @@ int ObSchemaMemMgr::try_reset_another_allocator() int ObSchemaMemMgr::get_another_ptrs(common::ObArray& ptrs) { int ret = OB_SUCCESS; + + SpinRLockGuard guard(schema_mem_rwlock_); if (!check_inner_stat()) { ret = OB_INNER_STAT_ERROR; LOG_WARN("inner stat error", K(ret)); diff --git a/src/share/schema/ob_schema_mem_mgr.h b/src/share/schema/ob_schema_mem_mgr.h index aaac6d1a0e..b14325b8a8 100644 --- a/src/share/schema/ob_schema_mem_mgr.h +++ b/src/share/schema/ob_schema_mem_mgr.h @@ -19,6 +19,55 @@ #include "lib/container/ob_array.h" namespace oceanbase { +class ObSchemaMemory { +public: + ObSchemaMemory() + : pos_(OB_INVALID_INDEX), + tenant_id_(OB_INVALID_TENANT_ID), + mem_used_(OB_INVALID_COUNT), + mem_total_(OB_INVALID_COUNT), + used_schema_mgr_cnt_(OB_INVALID_COUNT), + free_schema_mgr_cnt_(OB_INVALID_COUNT) + {} + ~ObSchemaMemory() + {} + void reset(); + void init(const int64_t pos, const uint64_t &tenant_id, const int64_t &mem_used, const int64_t &mem_total, + const int64_t &used_schema_mgr_cnt, const int64_t &free_schema_mgr_cnt); + int64_t get_pos() const + { + return pos_; + } + uint64_t get_tenant_id() const + { + return tenant_id_; + } + int64_t get_mem_used() const + { + return mem_used_; + } + int64_t get_mem_total() const + { + return mem_total_; + } + int64_t get_used_schema_mgr_cnt() const + { + return used_schema_mgr_cnt_; + } + int64_t get_free_schema_mgr_cnt() const + { + return free_schema_mgr_cnt_; + } + TO_STRING_KV(K_(pos), K_(mem_used), K_(mem_total), K_(used_schema_mgr_cnt), K_(free_schema_mgr_cnt)); + +private: + int64_t pos_; + uint64_t tenant_id_; + int64_t mem_used_; + int64_t mem_total_; + int64_t used_schema_mgr_cnt_; + int64_t free_schema_mgr_cnt_; +}; namespace common {} namespace share { namespace schema { @@ -43,12 +92,13 @@ public: { return tenant_id_; } - int try_reset_another_allocator(); int get_another_ptrs(common::ObArray& ptrs); + int get_all_alloc_info(common::ObIArray &tenant_mem_infos); private: bool check_inner_stat() const; + void dump_without_lock_() const; int find_ptr(const void* ptr, const int ptrs_pos, int& idx); private: @@ -61,6 +111,7 @@ private: int pos_; bool is_inited_; uint64_t tenant_id_; + common::SpinRWLock schema_mem_rwlock_; }; } // end of namespace schema diff --git a/src/share/schema/ob_schema_mgr_cache.cpp b/src/share/schema/ob_schema_mgr_cache.cpp index 63af94fcf8..3c5f42b60f 100644 --- a/src/share/schema/ob_schema_mgr_cache.cpp +++ b/src/share/schema/ob_schema_mgr_cache.cpp @@ -21,6 +21,26 @@ namespace oceanbase { using namespace common; +void ObSchemaSlot::reset() +{ + tenant_id_ = OB_INVALID_TENANT_ID; + slot_id_ = OB_INVALID_INDEX; + schema_version_ = OB_INVALID_VERSION; + schema_count_ = OB_INVALID_COUNT; + mod_ref_infos_.reset(); + ref_cnt_ = OB_INVALID_COUNT; +} + +void ObSchemaSlot::init(const uint64_t &tenant_id, const int64_t &slot_id, const int64_t &schema_version, + const int64_t &schema_count, const int64_t &ref_cnt, const common::ObString &str) +{ + tenant_id_ = tenant_id; + slot_id_ = slot_id; + schema_version_ = schema_version; + schema_count_ = schema_count; + ref_cnt_ = ref_cnt; + mod_ref_infos_ = str; +} namespace share { namespace schema { @@ -310,6 +330,157 @@ int ObSchemaMgrCache::get_recycle_schema_version(int64_t& schema_version) const return ret; } +static const char *ref_info_type_strs[] = { + "STACK", + "VTABLE_SCAN_PARAM", + "INNER_SQL_RESULT", + "TABLE_API_ROW_ITER", + "STAT_CONV_INFO", + "SHUFFLE_TASK_HANDLE", + "LOAD_DATA_IMPL", + "PX_TASK_PROCESSS", + "TABLE_SCAN", + "DIST_EXECUTER", + "MINI_TASK_BASE", + "REMOTE_EXE", + "CACHED_GUARD", + "UNIQ_CHECK", + "LOGIC_ROW", + "TAILORED_ROW_ITER", + "SSTABLE_MERGE_CTX", + "SSTABLE_SPLIT_CTX", + "RELATIVE_TABLE", + "RECOVER_POINT", + "PART_SCHEMA_RECORDER", + "VIRTUAL_TABLE", + "PHY_RES_STAT", + "TENANT_PT_ITER", + "INDEX_PARAM", + "BACKUP_CHECKER", + "DIS_TASK_SPLITER", + "DAS_CTX", + "SCHEMA_RECORDER", + "MOD_MAX", +}; + +int ObSchemaMgrCache::get_ref_info_type_str_(const int64_t &index, const char *&type_str) +{ + STATIC_ASSERT(ARRAYSIZEOF(ref_info_type_strs) == (int64_t)ObSchemaMgrItem::Mod::MOD_MAX + 1, + "type string array size mismatch with enum Mod count"); + int ret = OB_SUCCESS; + int type_str_len = ARRAYSIZEOF(ref_info_type_strs); + if (index >= type_str_len) { + ret = OB_ERROR_OUT_OF_RANGE; + LOG_WARN("index is out of range", KR(ret), K(type_str_len)); + } else { + type_str = ref_info_type_strs[index]; + } + return ret; +} + +int ObSchemaMgrCache::build_ref_mod_infos_( + const int64_t *mod_ref, char *&buff, const int64_t &buf_len, common::ObString &str) +{ + int ret = OB_SUCCESS; + str.reset(); + MEMSET(buff, 0, buf_len); + + if (OB_ISNULL(mod_ref)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("mod ref is NULL", KR(ret)); + } + int64_t pos = 0; + const char *type_str = NULL; + + for (int64_t i = 0; i < ARRAYSIZEOF(ref_info_type_strs) && OB_SUCC(ret); ++i) { + if (mod_ref[i] > 0) { + if (OB_FAIL(get_ref_info_type_str_(i, type_str))) { + LOG_WARN("fail to get ref info type str", KR(ret)); + } else if (OB_FAIL( + databuff_printf(buff, buf_len, pos, "%s%s:%ld", (0 != pos ? "," : ""), type_str, mod_ref[i]))) { + LOG_WARN("fail to fail to databuff printf tmp_buff", KR(ret), K(type_str), K(mod_ref[i])); + } + } + } + if (OB_SUCC(ret)) { + int str_len = pos; + if (0 != str_len) { + str.assign(buff, str_len); + } + } + return ret; +} + +int ObSchemaMgrCache::get_slot_info(common::ObIAllocator &allocator, common::ObIArray &schema_slot_infos) +{ + int ret = OB_SUCCESS; + if (!check_inner_stat()) { + ret = OB_INNER_STAT_ERROR; + LOG_WARN("inner stat error", KR(ret)); + } else { + int64_t *mod_ref = NULL; + ObSchemaMgr *schema_mgr = NULL; + int64_t cached_slot_num = OB_INVALID_COUNT; + int64_t slot_id = OB_INVALID_INDEX; + uint64_t tenant_id = OB_INVALID_TENANT_ID; + int64_t schema_version = OB_INVALID_VERSION; + int64_t schema_count = OB_INVALID_COUNT; + int64_t ref_cnt = OB_INVALID_COUNT; + ObSchemaSlot schema_slot; + ObString tmp_str; + ObString ref_infos; + // alloc 4096 in advance to organize ref_infos and reuse it + int64_t buf_len = OB_MAX_SCHEMA_REF_INFO; + char *tmp_buff = static_cast(allocator.alloc(buf_len)); + if (OB_ISNULL(tmp_buff)) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("alloc tmp_buff faild", KR(ret)); + } else { + TCRLockGuard guard(lock_); + cached_slot_num = max_cached_num_; + for (int64_t i = 0; i < cached_slot_num && OB_SUCC(ret); ++i) { + schema_mgr = schema_mgr_items_[i].schema_mgr_; + if (OB_NOT_NULL(schema_mgr)) { + ref_infos.reset(); + tmp_str.reset(); + slot_id = i; + tenant_id = schema_mgr->get_tenant_id(); + schema_version = schema_mgr->get_schema_version(); + ref_cnt = schema_mgr_items_[i].ref_cnt_; + mod_ref = schema_mgr_items_[i].mod_ref_cnt_; + if (OB_FAIL(schema_mgr->get_schema_count(schema_count))) { + LOG_WARN("fail to get schema count", KR(ret), K(tenant_id), K(schema_version)); + } else if (0 == ref_cnt) { + // do nothing + } else if (OB_ISNULL(mod_ref)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("tenant slot ref_cnt size > 0 but mod ref array is NULL", + KR(ret), + K(tenant_id), + K(slot_id), + K(schema_version)); + } else if (OB_FAIL(build_ref_mod_infos_(mod_ref, tmp_buff, buf_len, tmp_str))) { + LOG_WARN("fail to build mode_ref_cnt to string", KR(ret), K(tenant_id), K(schema_version)); + // deep copy string + } else if (OB_FAIL(ob_write_string(allocator, tmp_str, ref_infos))) { + LOG_WARN("set mod_ref_infos string faild", K(tmp_str)); + } + if (OB_SUCC(ret)) { + schema_slot.init(tenant_id, slot_id, schema_version, schema_count, ref_cnt, ref_infos); + if (OB_FAIL(schema_slot_infos.push_back(schema_slot))) { + LOG_WARN("push back to schema_slot_infos failed", KR(ret), K(tenant_id), K(schema_version)); + } + } + } // OB_NOT_NULL(schema_mgr) + } // for + if (OB_NOT_NULL(tmp_buff)) { + allocator.free(tmp_buff); + } + } + } + return ret; +} + // in: // schema_mgr : mgr that will put // eli_schema_mgr : Eliminate the mgr diff --git a/src/share/schema/ob_schema_mgr_cache.h b/src/share/schema/ob_schema_mgr_cache.h index 103f5805c2..29a887047e 100644 --- a/src/share/schema/ob_schema_mgr_cache.h +++ b/src/share/schema/ob_schema_mgr_cache.h @@ -16,8 +16,58 @@ #include #include "lib/lock/ob_tc_rwlock.h" #include "share/ob_define.h" +#include "lib/string/ob_string.h" namespace oceanbase { +class ObSchemaSlot { +public: + ObSchemaSlot() + : tenant_id_(OB_INVALID_TENANT_ID), + slot_id_(OB_INVALID_INDEX), + schema_version_(OB_INVALID_VERSION), + schema_count_(OB_INVALID_COUNT), + ref_cnt_(OB_INVALID_COUNT), + mod_ref_infos_() + {} + ~ObSchemaSlot() + {} + void reset(); + void init(const uint64_t &tenant_id, const int64_t &slot_id, const int64_t &schema_version, + const int64_t &schema_count, const int64_t &ref_cnt, const common::ObString &str); + uint64_t get_tenant_id() const + { + return tenant_id_; + } + int64_t get_slot_id() const + { + return slot_id_; + } + int64_t get_schema_version() const + { + return schema_version_; + } + int64_t get_schema_count() const + { + return schema_count_; + } + int64_t get_ref_cnt() const + { + return ref_cnt_; + } + const common::ObString &get_mod_ref_infos() const + { + return mod_ref_infos_; + } + TO_STRING_KV(K_(tenant_id), K_(slot_id), K_(schema_version), K_(schema_count), K_(ref_cnt), K_(mod_ref_infos)); + +private: + uint64_t tenant_id_; + int64_t slot_id_; + int64_t schema_version_; + int64_t schema_count_; + int64_t ref_cnt_; + common::ObString mod_ref_infos_; +}; namespace common {} namespace share { namespace schema { @@ -53,6 +103,8 @@ struct ObSchemaMgrItem { MOD_INDEX_PARAM = 24, MOD_BACKUP_CHECKER = 25, MOD_DIS_TASK_SPLITER = 26, + MOD_DAS_CTX = 27, + MOD_SCHEMA_RECORDER = 28, MOD_MAX }; ObSchemaMgrItem() : schema_mgr_(NULL), ref_cnt_(0) @@ -99,6 +151,7 @@ public: int get(const int64_t schema_version, const ObSchemaMgr*& schema_mgr, ObSchemaMgrHandle& handle); int get_nearest(const int64_t schema_version, const ObSchemaMgr*& schema_mgr, ObSchemaMgrHandle& handle); int get_recycle_schema_version(int64_t& schema_version) const; + int get_slot_info(common::ObIAllocator &allocator, common::ObIArray &tenant_slot_infos); int put(ObSchemaMgr* schema_mgr, ObSchemaMgr*& eli_schema_mgr, ObSchemaMgrHandle* handle = NULL); int try_gc_tenant_schema_mgr(ObSchemaMgr*& eli_schema_mgr); int try_elimiante_schema_mgr(ObSchemaMgr*& eli_schema_mgr); @@ -110,6 +163,8 @@ private: bool check_inner_stat() const; // need process in wlock int try_update_latest_schema_idx(); + int get_ref_info_type_str_(const int64_t &index, const char *&type_str); + int build_ref_mod_infos_(const int64_t *mod_ref, char *&buff, const int64_t &buf_len, common::ObString &str); private: DISALLOW_COPY_AND_ASSIGN(ObSchemaMgrCache); diff --git a/src/share/schema/ob_schema_store.cpp b/src/share/schema/ob_schema_store.cpp index 5f2e67166f..b51e226cbd 100644 --- a/src/share/schema/ob_schema_store.cpp +++ b/src/share/schema/ob_schema_store.cpp @@ -132,6 +132,23 @@ ObSchemaStore* ObSchemaStoreMap::get(uint64_t tenant_id) return slot ? *slot : NULL; } +int ObSchemaStoreMap::get_all_tenant(common::ObIArray &tenant_ids) +{ + int ret = OB_SUCCESS; + tenant_ids.reset(); + common::ObLinkArray::Seg *seg = map_.head(); + int64_t idx = 0; + void **p = NULL; + while (OB_NOT_NULL(p = map_.next(seg, idx)) && OB_SUCC(ret)) { + ObSchemaStore *schema_store = (ObSchemaStore *)*p; + if (OB_NOT_NULL(schema_store)) { + if (OB_FAIL(tenant_ids.push_back(schema_store->tenant_id_))) { + LOG_WARN("fail to push tenant_id to tenant_ids", KR(ret), K(schema_store->tenant_id_)); + } + } + } + return ret; +} }; // end namespace schema }; // end namespace share }; // end namespace oceanbase diff --git a/src/share/schema/ob_schema_store.h b/src/share/schema/ob_schema_store.h index 787e1f4528..e7d5f4ea33 100644 --- a/src/share/schema/ob_schema_store.h +++ b/src/share/schema/ob_schema_store.h @@ -66,6 +66,7 @@ public: int create(const uint64_t tenant_id, const int64_t init_version_count, const int64_t init_version_count_for_liboblog); const ObSchemaStore* get(uint64_t tenant_id) const; ObSchemaStore* get(uint64_t tenant_id); + int get_all_tenant(common::ObIArray &tenant_ids); private: common::ObLinkArray map_; diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/inner_table_overall.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/inner_table_overall.result index ad3fd60c56..77cfcf9b14 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/inner_table_overall.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/inner_table_overall.result @@ -473,6 +473,8 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr 12325 __all_virtual_query_response_time 2 1099511627777 65536 12326 __all_virtual_kv_ttl_task 2 1099511627777 1 12327 __all_virtual_kv_ttl_task_history 2 1099511627777 1 +12336 __all_virtual_schema_memory 2 1099511627777 65536 +12337 __all_virtual_schema_slot 2 1099511627777 65536 15001 ALL_VIRTUAL_TABLE_AGENT 2 1099511627782 1 15002 ALL_VIRTUAL_COLUMN_AGENT 2 1099511627782 1 15003 ALL_VIRTUAL_DATABASE_AGENT 2 1099511627782 1