diff --git a/deps/oblib/src/lib/container/ob_vector.h b/deps/oblib/src/lib/container/ob_vector.h index 3316e3a237..ea944b874f 100644 --- a/deps/oblib/src/lib/container/ob_vector.h +++ b/deps/oblib/src/lib/container/ob_vector.h @@ -148,7 +148,7 @@ public: int remove_if(const ValueType &value, Predicate predicate); template int remove_if(const ValueType &value, Predicate predicate, value_type &removed_value); - int reserve(int32_t size) { return expand(size); } + int reserve(int64_t size) { return expand(size); } void clear(); inline void reset() { mem_end_ = mem_begin_; } int64_t to_string(char *buf, const int64_t buf_len) const; diff --git a/src/share/schema/ob_multi_version_schema_service.cpp b/src/share/schema/ob_multi_version_schema_service.cpp index 9fdc422a1c..9a73685e78 100644 --- a/src/share/schema/ob_multi_version_schema_service.cpp +++ b/src/share/schema/ob_multi_version_schema_service.cpp @@ -1785,6 +1785,7 @@ int ObMultiVersionSchemaService::broadcast_tenant_schema( } ObArray simple_table_schemas; ObSchemaMgr *schema_mgr_for_cache = NULL; + const bool refresh_full_schema = true; if (FAILEDx(convert_to_simple_schema(table_schemas, simple_table_schemas))) { LOG_WARN("failed to convert", KR(ret), K(tenant_id)); } else if (OB_FAIL(schema_mgr_for_cache_map_.get_refactored( @@ -1793,7 +1794,7 @@ int ObMultiVersionSchemaService::broadcast_tenant_schema( } else if (OB_ISNULL(schema_mgr_for_cache)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("schema_mgr is null", KR(ret), K(tenant_id)); - } else if (OB_FAIL(schema_mgr_for_cache->add_tables(simple_table_schemas))) { + } else if (OB_FAIL(schema_mgr_for_cache->add_tables(simple_table_schemas, refresh_full_schema))) { LOG_WARN("failed to add tables", KR(ret), K(tenant_id)); } else if (FALSE_IT(schema_mgr_for_cache->set_schema_version( OB_CORE_SCHEMA_VERSION + 1))) { diff --git a/src/share/schema/ob_schema_mgr.cpp b/src/share/schema/ob_schema_mgr.cpp index 28b08ab9c1..b5e8206f57 100644 --- a/src/share/schema/ob_schema_mgr.cpp +++ b/src/share/schema/ob_schema_mgr.cpp @@ -722,6 +722,7 @@ ObSchemaMgr &ObSchemaMgr::operator =(const ObSchemaMgr &other) int ObSchemaMgr::assign(const ObSchemaMgr &other) { int ret = OB_SUCCESS; + int64_t start_time = ObTimeUtility::current_time(); if (!check_inner_stat()) { ret = OB_NOT_INIT; LOG_WARN("not init", K(ret)); @@ -732,9 +733,12 @@ int ObSchemaMgr::assign(const ObSchemaMgr &other) is_consistent_ = other.is_consistent_; #define ASSIGN_FIELD(x) \ if (OB_SUCC(ret)) { \ + int64_t start_ts = ObTimeUtility::current_time(); \ if (OB_FAIL(x.assign(other.x))) { \ LOG_WARN("assign " #x "failed", K(ret)); \ } \ + LOG_INFO("assign "#x" cost", KR(ret), \ + "cost", ObTimeUtility::current_time() - start_ts); \ } ASSIGN_FIELD(tenant_infos_); // System variables need to be assigned first @@ -781,6 +785,7 @@ int ObSchemaMgr::assign(const ObSchemaMgr &other) } else if (OB_FAIL(sequence_mgr_.assign(other.sequence_mgr_))) { LOG_WARN("assign sequence mgr failed", K(ret)); } else if (OB_FAIL(keystore_mgr_.assign(other.keystore_mgr_))) { + LOG_WARN("assign keystore mgr failed", K(ret)); } else if (OB_FAIL(tablespace_mgr_.assign(other.tablespace_mgr_))) { LOG_WARN("assign sequence mgr failed", K(ret)); } else if (OB_FAIL(label_se_policy_mgr_.assign(other.label_se_policy_mgr_))) { @@ -812,13 +817,14 @@ int ObSchemaMgr::assign(const ObSchemaMgr &other) } } } - + LOG_INFO("ObSchemaMgr assign cost", KR(ret), "cost", ObTimeUtility::current_time() - start_time); return ret; } int ObSchemaMgr::deep_copy(const ObSchemaMgr &other) { int ret = OB_SUCCESS; + int64_t start_time = ObTimeUtility::current_time(); if (!check_inner_stat()) { ret = OB_NOT_INIT; LOG_WARN("not init", K(ret)); @@ -829,6 +835,7 @@ int ObSchemaMgr::deep_copy(const ObSchemaMgr &other) is_consistent_ = other.is_consistent_; #define ADD_SCHEMA(SCHEMA, SCHEMA_TYPE, SCHEMA_ITER) \ if (OB_SUCC(ret)) { \ + int64_t start_ts = ObTimeUtility::current_time(); \ for (SCHEMA_ITER iter = other.SCHEMA##_infos_.begin(); \ OB_SUCC(ret) && iter != other.SCHEMA##_infos_.end(); iter++) { \ const SCHEMA_TYPE *schema = *iter; \ @@ -839,6 +846,9 @@ int ObSchemaMgr::deep_copy(const ObSchemaMgr &other) LOG_WARN("add "#SCHEMA" failed", K(ret), K(*schema)); \ } \ } \ + LOG_INFO("add "#SCHEMA"s cost", KR(ret), \ + "count", other.SCHEMA##_infos_.count(), \ + "cost", ObTimeUtility::current_time() - start_ts); \ } ADD_SCHEMA(tenant, ObSimpleTenantSchema, ConstTenantIterator); // System variables need to be copied first @@ -913,7 +923,7 @@ int ObSchemaMgr::deep_copy(const ObSchemaMgr &other) } } } - + LOG_INFO("ObSchemaMgr deep_copy cost", KR(ret), "cost", ObTimeUtility::current_time() - start_time); return ret; } @@ -2284,25 +2294,156 @@ int ObSchemaMgr::get_tablegroup_schema( return ret; } -int ObSchemaMgr::add_tables(const ObIArray &table_schemas) +int ObSchemaMgr::add_tables( + const ObIArray &table_schemas, + const bool refresh_full_schema/*= false*/) { int ret = OB_SUCCESS; - + int64_t start_time = ObTimeUtility::current_time(); + static const int64_t STAGE_CNT = 5; + int64_t cost_time_array[STAGE_CNT] = {0}; + ObArrayWrap cost_array(cost_time_array, STAGE_CNT); if (!check_inner_stat()) { ret = OB_NOT_INIT; - LOG_WARN("not init", K(ret)); + LOG_WARN("not init", KR(ret)); + } else if (refresh_full_schema && OB_FAIL(reserved_mem_for_tables_(table_schemas))) { + LOG_WARN("fail to reserved mem for tables", KR(ret)); } else { - FOREACH_CNT_X(table_schema, table_schemas, OB_SUCC(ret)) { - if (OB_FAIL(add_table(*table_schema))) { - LOG_WARN("add table failed", K(ret), - "table_schema", *table_schema); + bool desc_order = true; + if (OB_SUCC(ret) && table_schemas.count() >= 2) { + // 1. when refresh user simple table schemas, table_schemas will be sorted in desc order by sql. + // 2. when broadcast schema or refresh core/system tables or other situations, table_schemas will be sorted in asc order. + // Because table_infos_ are sorted in asc order, we should also add table in asc order to reduce performance lost. + // Normally, we consider table_schemas are in desc order in most situations. + desc_order = table_schemas.at(0).get_table_id() > table_schemas.at(1).get_table_id(); + } + + if (OB_SUCC(ret)) { + if (desc_order) { + for (int64_t i = table_schemas.count() - 1; OB_SUCC(ret) && i >= 0; i--) { + const ObSimpleTableSchemaV2 &table = table_schemas.at(i); + if (OB_FAIL(add_table(table, &cost_array))) { + LOG_WARN("add table failed", KR(ret), K(table)); + } + } // end for + } else { + for (int64_t i = 0; OB_SUCC(ret) && i < table_schemas.count(); i++) { + const ObSimpleTableSchemaV2 &table = table_schemas.at(i); + if (OB_FAIL(add_table(table, &cost_array))) { + LOG_WARN("add table failed", KR(ret), K(table)); + } + } // end for } } } - + FLOG_INFO("add tables", KR(ret), + "stage_cost", cost_array, + "cost", ObTimeUtility::current_time() - start_time); return ret; } +int ObSchemaMgr::reserved_mem_for_tables_( + const ObIArray &table_schemas) +{ + int ret = OB_SUCCESS; + int64_t start_time = ObTimeUtility::current_time(); + const int64_t table_cnt = table_schemas.count(); + int64_t index_cnt = 0; + int64_t vp_cnt = 0; + int64_t lob_meta_cnt = 0; + int64_t lob_piece_cnt = 0; + int64_t hidden_table_cnt = 0; + int64_t other_table_cnt = 0; + int64_t fk_cnt = 0; + int64_t cst_cnt = 0; + const int64_t OBJECT_SIZE = sizeof(void*); + if (!check_inner_stat()) { + ret = OB_NOT_INIT; + LOG_WARN("not init", K(ret)); + } else if (OB_FAIL(table_infos_.reserve(table_cnt))) { + LOG_WARN("fail to reserved array", KR(ret), K(table_cnt)); + } else { + //(void) table_id_map_.set_sub_map_mem_size(table_cnt * OBJECT_SIZE); + + for (int64_t i = 0; OB_SUCC(ret) && i < table_schemas.count(); i++) { + const ObSimpleTableSchemaV2 &table = table_schemas.at(i); + if (table.is_index_table() || table.is_materialized_view()) { + index_cnt++; + } else if (table.is_aux_vp_table()) { + vp_cnt++; + } else if (table.is_aux_lob_meta_table()) { + lob_meta_cnt++; + } else if (table.is_aux_lob_piece_table()) { + lob_piece_cnt++; + } else if (table.is_user_hidden_table()) { + hidden_table_cnt++; + } else { + other_table_cnt++; + } + + if ((table.is_table() || table.is_oracle_tmp_table()) + && !table.is_user_hidden_table()) { + fk_cnt += table.get_simple_foreign_key_info_array().count(); + } + + if ((table.is_table() || table.is_oracle_tmp_table()) + && !table.is_user_hidden_table() + && !table.is_mysql_tmp_table()) { + cst_cnt += table.get_simple_constraint_info_array().count(); + } + } // end for + + if (OB_SUCC(ret) && index_cnt > 0) { + if (OB_FAIL(index_infos_.reserve(index_cnt))) { + LOG_WARN("fail to reserved array", KR(ret), K(index_cnt)); + } else { + //(void) index_name_map_.set_sub_map_mem_size(index_cnt * OBJECT_SIZE); + } + } + + if (OB_SUCC(ret) && vp_cnt > 0) { + if (OB_FAIL(aux_vp_infos_.reserve(vp_cnt))) { + LOG_WARN("fail to reserved array", KR(ret), K(vp_cnt)); + } else { + //(void) aux_vp_name_map_.set_sub_map_mem_size(vp_cnt * OBJECT_SIZE); + } + } + + if (OB_SUCC(ret) && lob_meta_cnt > 0) { + if (OB_FAIL(lob_meta_infos_.reserve(lob_meta_cnt))) { + LOG_WARN("fail to reserved array", KR(ret), K(lob_meta_cnt)); + } + } + + if (OB_SUCC(ret) && lob_piece_cnt > 0) { + if (OB_FAIL(lob_piece_infos_.reserve(lob_piece_cnt))) { + LOG_WARN("fail to reserved array", KR(ret), K(lob_piece_cnt)); + } + } + + if (OB_SUCC(ret) && other_table_cnt > 0) { + //(void) table_name_map_.set_sub_map_mem_size(other_table_cnt * OBJECT_SIZE); + } + + if (OB_SUCC(ret) && fk_cnt > 0) { + //(void) foreign_key_name_map_.set_sub_map_mem_size(fk_cnt * OBJECT_SIZE); + } + + if (OB_SUCC(ret) && cst_cnt > 0) { + //(void) constraint_name_map_.set_sub_map_mem_size(cst_cnt * OBJECT_SIZE); + } + + } + FLOG_INFO("reserve mem", KR(ret), + K(table_cnt), K(index_cnt), K(vp_cnt), + K(lob_meta_cnt), K(lob_piece_cnt), + K(hidden_table_cnt), K(other_table_cnt), + K(fk_cnt), K(cst_cnt), + "cost", ObTimeUtility::current_time() - start_time); + return ret; +} + + int ObSchemaMgr::del_tables(const ObIArray &tables) { int ret = OB_SUCCESS; @@ -2323,7 +2464,9 @@ int ObSchemaMgr::del_tables(const ObIArray &tables) return ret; } -int ObSchemaMgr::add_table(const ObSimpleTableSchemaV2 &table_schema) +int ObSchemaMgr::add_table( + const ObSimpleTableSchemaV2 &table_schema, + common::ObArrayWrap *cost_array /*= NULL*/) { int ret = OB_SUCCESS; @@ -2333,6 +2476,7 @@ int ObSchemaMgr::add_table(const ObSimpleTableSchemaV2 &table_schema) ObSimpleTableSchemaV2 *replaced_table = NULL; const uint64_t table_id = table_schema.get_table_id(); bool is_system_table = false; + bool idx = 0; if (OB_ALL_CORE_TABLE_TID == table_schema.get_table_id()) { FLOG_INFO("add __all_core_table schema", KR(ret), K(table_schema), K(lbt())); } @@ -2365,6 +2509,7 @@ int ObSchemaMgr::add_table(const ObSimpleTableSchemaV2 &table_schema) LOG_WARN("invalid case mode", K(ret), K(mode)); } + int64_t start_time = ObTimeUtility::current_time(); if (OB_FAIL(ret)){ } else if (OB_FAIL(ObSchemaUtils::alloc_schema(allocator_, table_schema, new_table_schema))) { LOG_WARN("alloc schema failed", K(ret)); @@ -2372,6 +2517,11 @@ int ObSchemaMgr::add_table(const ObSimpleTableSchemaV2 &table_schema) ret = OB_ERR_UNEXPECTED; LOG_WARN("NULL ptr", K(ret), K(new_table_schema)); } + if (OB_NOT_NULL(cost_array) && idx < cost_array->count()) { + cost_array->at(idx++) += ObTimeUtility::current_time() - start_time; + } + + start_time = ObTimeUtility::current_time(); if (OB_FAIL(ret)) { } else if (FALSE_IT(new_table_schema->set_name_case_mode(mode))) { // will not reach here @@ -2418,7 +2568,11 @@ int ObSchemaMgr::add_table(const ObSimpleTableSchemaV2 &table_schema) LOG_WARN("failed to add lob piece schema", K(ret)); } } + if (OB_NOT_NULL(cost_array) && idx < cost_array->count()) { + cost_array->at(idx++) += ObTimeUtility::current_time() - start_time; + } + start_time = ObTimeUtility::current_time(); if (OB_SUCC(ret)) { if (NULL == replaced_table) { // do-nothing @@ -2428,11 +2582,21 @@ int ObSchemaMgr::add_table(const ObSimpleTableSchemaV2 &table_schema) LOG_WARN("failed to deal with change table state", K(ret)); } } + if (OB_NOT_NULL(cost_array) && idx < cost_array->count()) { + cost_array->at(idx++) += ObTimeUtility::current_time() - start_time; + } + if (OB_SUCC(ret)) { + start_time = ObTimeUtility::current_time(); int over_write = 1; int hash_ret = table_id_map_.set_refactored(new_table_schema->get_table_id(), new_table_schema, over_write); + if (OB_NOT_NULL(cost_array) && idx < cost_array->count()) { + cost_array->at(idx++) += ObTimeUtility::current_time() - start_time; + } + + start_time = ObTimeUtility::current_time(); if (OB_SUCCESS != hash_ret && OB_HASH_EXIST != hash_ret) { ret = OB_ERR_UNEXPECTED; LOG_WARN("build table id hashmap failed", K(ret), K(hash_ret), @@ -2563,6 +2727,9 @@ int ObSchemaMgr::add_table(const ObSimpleTableSchemaV2 &table_schema) } } } + if (OB_NOT_NULL(cost_array) && idx < cost_array->count()) { + cost_array->at(idx++) += ObTimeUtility::current_time() - start_time; + } } return ret; diff --git a/src/share/schema/ob_schema_mgr.h b/src/share/schema/ob_schema_mgr.h index 0147b398c6..3b283ea3b2 100644 --- a/src/share/schema/ob_schema_mgr.h +++ b/src/share/schema/ob_schema_mgr.h @@ -575,9 +575,11 @@ public: int get_tablegroup_ids_in_tenant(const uint64_t tenant_id, common::ObIArray &tablegroup_id_array); // table - int add_tables(const common::ObIArray &table_schemas); + int add_tables(const common::ObIArray &table_schemas, + const bool refresh_full_schema = false); int del_tables(const common::ObIArray &tables); - int add_table(const ObSimpleTableSchemaV2 &table_schema); + int add_table(const ObSimpleTableSchemaV2 &table_schema, + common::ObArrayWrap *cost_array = NULL); int del_table(const ObTenantTableId table); int remove_aux_table(const ObSimpleTableSchemaV2 &schema_to_del); int get_table_schema(const uint64_t tenant_id, @@ -893,6 +895,9 @@ private: int get_database_statistics(ObSchemaStatisticsInfo &schema_info) const; int get_tablegroup_statistics(ObSchemaStatisticsInfo &schema_info) const; int get_table_statistics(ObSchemaStatisticsInfo &schema_info) const; + + int reserved_mem_for_tables_( + const common::ObIArray &table_schemas); private: common::ObArenaAllocator local_allocator_; common::ObIAllocator &allocator_; diff --git a/src/share/schema/ob_schema_service_sql_impl.cpp b/src/share/schema/ob_schema_service_sql_impl.cpp index 650e7725b7..d22734cbef 100644 --- a/src/share/schema/ob_schema_service_sql_impl.cpp +++ b/src/share/schema/ob_schema_service_sql_impl.cpp @@ -4409,6 +4409,7 @@ int ObSchemaServiceSQLImpl::fetch_tables( const uint64_t exec_tenant_id = fill_exec_tenant_id(schema_status); const char *table_name = NULL; int64_t start_time = ObTimeUtility::current_time(); + int64_t inc_cnt = 0; // for reserved mem only if (!check_inner_stat()) { ret = OB_NOT_INIT; LOG_WARN("check inner stat fail", K(ret)); @@ -4420,7 +4421,7 @@ int ObSchemaServiceSQLImpl::fetch_tables( LOG_WARN("fail to get all table name", K(ret), K(exec_tenant_id)); } else if (!is_increase_schema) { const char *tname = OB_ALL_TABLE_HISTORY_TNAME; - if (OB_FAIL(set_refresh_full_schema_timeout_ctx_(sql_client, tenant_id, tname, ctx))) { + if (OB_FAIL(set_refresh_full_schema_timeout_ctx_(sql_client, tenant_id, tname, ctx, inc_cnt))) { LOG_WARN("fail to set refresh full schema timeout ctx", KR(ret), K(tenant_id), "tname", tname); } else if (OB_FAIL(sql.append_fmt(FETCH_ALL_TABLE_HISTORY_FULL_SCHEMA, table_name, table_name, @@ -4440,6 +4441,8 @@ int ObSchemaServiceSQLImpl::fetch_tables( LOG_WARN("append failed", K(ret)); } else if (OB_FAIL(SQL_APPEND_SCHEMA_ID(table, schema_keys, schema_key_size, sql))) { LOG_WARN("sql append table id failed", K(ret)); + } else { + inc_cnt = schema_key_size; } } if (OB_SUCC(ret)) { @@ -4452,6 +4455,8 @@ int ObSchemaServiceSQLImpl::fetch_tables( } else if (OB_UNLIKELY(NULL == (result = res.get_result()))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("fail to get result. ", K(ret)); + } else if (OB_FAIL(schema_array.reserve(orig_cnt + inc_cnt))) { + LOG_WARN("fail to reserved schem array", KR(ret), K(orig_cnt), K(inc_cnt)); } else if (OB_FAIL(ObSchemaRetrieveUtils::retrieve_table_schema(tenant_id, *result, schema_array))) { LOG_WARN("failed to retrieve table schema", K(ret)); } @@ -4459,13 +4464,17 @@ int ObSchemaServiceSQLImpl::fetch_tables( } if (!is_increase_schema) { FLOG_INFO("[REFRESH_SCHEMA] fetch all tables cost", - KR(ret), K(tenant_id), - "cost", ObTimeUtility::current_time() - start_time); + KR(ret), K(tenant_id), "cost", ObTimeUtility::current_time() - start_time); } } if (OB_SUCC(ret)) { ObArray table_ids; ObArray tables; + if (OB_FAIL(table_ids.reserve(inc_cnt))) { + LOG_WARN("fail to reserved array", KR(ret), K(inc_cnt)); + } else if (OB_FAIL(tables.reserve(inc_cnt))) { + LOG_WARN("fail to reserved array", KR(ret), K(inc_cnt)); + } for (int64_t i = orig_cnt; OB_SUCC(ret) && i < schema_array.count(); ++i) { const uint64_t table_id = schema_array.at(i).get_table_id(); if (OB_FAIL(table_ids.push_back(table_id))) { @@ -8813,16 +8822,18 @@ int ObSchemaServiceSQLImpl::set_refresh_full_schema_timeout_ctx_( ObISQLClient &sql_client, const uint64_t tenant_id, const char* tname, - ObTimeoutCtx &ctx) + ObTimeoutCtx &ctx, + int64_t &table_cnt) { int ret = OB_SUCCESS; int64_t timeout = 0; + table_cnt = 0; if (OB_UNLIKELY( OB_INVALID_TENANT_ID == tenant_id || OB_ISNULL(tname))) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid tenant_id or tname is empty", KR(ret), K(tenant_id), KP(tname)); - } else if (OB_FAIL(calc_refresh_full_schema_timeout_ctx_(sql_client, tenant_id, tname, timeout))) { + } else if (OB_FAIL(calc_refresh_full_schema_timeout_ctx_(sql_client, tenant_id, tname, timeout, table_cnt))) { LOG_WARN("fail to calc refresh full schema timeout", KR(ret), K(tenant_id), "tname", tname); } else { const int64_t ori_ctx_timeout = ctx.get_timeout(); @@ -8836,7 +8847,8 @@ int ObSchemaServiceSQLImpl::set_refresh_full_schema_timeout_ctx_( K(ori_ctx_timeout), K(ori_worker_timeout), "calc_timeout", timeout, - "actual_timeout", ctx.get_timeout()); + "actual_timeout", ctx.get_timeout(), + K(table_cnt)); } return ret; } @@ -8901,11 +8913,13 @@ int ObSchemaServiceSQLImpl::calc_refresh_full_schema_timeout_ctx_( ObISQLClient &sql_client, const uint64_t tenant_id, const char* tname, - int64_t &timeout) + int64_t &timeout, + int64_t &table_cnt) { int ret = OB_SUCCESS; ObTimeoutCtx ctx; timeout = 0; + table_cnt = 0; int64_t start_time = ObTimeUtility::current_time(); SMART_VAR(ObMySQLProxy::MySQLResult, res) { ObMySQLResult *result = NULL; @@ -8934,11 +8948,12 @@ int ObSchemaServiceSQLImpl::calc_refresh_full_schema_timeout_ctx_( if (OB_SUCC(ret)) { // each 100w history may cost almost 400s (almost each 7w history may cost `internal_sql_execute_timeout`) // for more details: ob/qa/gqk9w2 - timeout = ((row_cnt / (70 * 1000L)) + 1) * GCONF.internal_sql_execute_timeout; + table_cnt = row_cnt; + timeout = ((table_cnt / (70 * 1000L)) + 1) * GCONF.internal_sql_execute_timeout; FLOG_INFO("[REFRESH_SCHEMA] calc refresh schema timeout", KR(ret), K(tenant_id), "tname", tname, - K(row_cnt), K(timeout), + K(table_cnt), K(timeout), "cost", ObTimeUtility::current_time() - start_time); } } diff --git a/src/share/schema/ob_schema_service_sql_impl.h b/src/share/schema/ob_schema_service_sql_impl.h index c4d17d6f07..f37c6e9c36 100644 --- a/src/share/schema/ob_schema_service_sql_impl.h +++ b/src/share/schema/ob_schema_service_sql_impl.h @@ -987,13 +987,15 @@ private: ObISQLClient &sql_client, const uint64_t tenant_id, const char* tname, - ObTimeoutCtx &ctx); + ObTimeoutCtx &ctx, + int64_t &table_cnt); int calc_refresh_full_schema_timeout_ctx_( ObISQLClient &sql_client, const uint64_t tenant_id, const char* tname, - int64_t &timeout); + int64_t &timeout, + int64_t &table_cnt); private: common::ObMySQLProxy *mysql_proxy_; common::ObDbLinkProxy *dblink_proxy_; diff --git a/src/share/schema/ob_server_schema_service.cpp b/src/share/schema/ob_server_schema_service.cpp index 0435857fa0..ef6c30b4da 100644 --- a/src/share/schema/ob_server_schema_service.cpp +++ b/src/share/schema/ob_server_schema_service.cpp @@ -6204,6 +6204,7 @@ int ObServerSchemaService::refresh_tenant_full_normal_schema( } } + const bool refresh_full_schema = true; // add simple schema for cache if (OB_FAIL(ret)) { } else if (OB_FAIL(schema_mgr_for_cache->sys_variable_mgr_ @@ -6215,7 +6216,7 @@ int ObServerSchemaService::refresh_tenant_full_normal_schema( LOG_WARN("add databases failed", K(ret)); } else if (OB_FAIL(schema_mgr_for_cache->add_tablegroups(simple_tablegroups))) { LOG_WARN("add tablegroups failed", K(ret)); - } else if (OB_FAIL(schema_mgr_for_cache->add_tables(simple_tables))) { + } else if (OB_FAIL(schema_mgr_for_cache->add_tables(simple_tables, refresh_full_schema))) { LOG_WARN("add tables failed", K(ret)); } else if (OB_FAIL(schema_mgr_for_cache->outline_mgr_.add_outlines(simple_outlines))) { LOG_WARN("add outlines failed", K(ret));