diff --git a/src/rootserver/ob_alter_locality_checker.cpp b/src/rootserver/ob_alter_locality_checker.cpp index c2e96526ad..8798568703 100644 --- a/src/rootserver/ob_alter_locality_checker.cpp +++ b/src/rootserver/ob_alter_locality_checker.cpp @@ -250,7 +250,7 @@ int ObAlterLocalityChecker::check_alter_locality_finished_by_tenant(const uint64 } else { for (int64_t i = 0; OB_SUCC(ret) && i < table_ids.count(); ++i) { bool table_locality_finished = true; - const ObTableSchema* table_schema = NULL; + const ObSimpleTableSchemaV2* table_schema = NULL; if (OB_FAIL(check_stop())) { LOG_WARN("root balancer stop", K(ret)); } else if (OB_FAIL(schema_guard.get_table_schema(table_ids.at(i), table_schema))) { @@ -504,7 +504,7 @@ int ObAlterLocalityChecker::check_locality_match_replica_distribution( * the argument null_locality_table_match is an input/output argument */ int ObAlterLocalityChecker::process_single_table(share::schema::ObSchemaGetterGuard& schema_guard, - const share::schema::ObTableSchema& table_schema, const share::schema::ObTenantSchema& tenant_schema, + const share::schema::ObSimpleTableSchemaV2& table_schema, const share::schema::ObTenantSchema& tenant_schema, const balancer::HashIndexCollection& hash_index_collection, rootserver::TenantBalanceStat& tenant_stat, bool& null_locality_table_match, bool& table_locality_finished) { @@ -654,7 +654,7 @@ int ObAlterLocalityChecker::process_single_non_binding_tablegroup(share::schema: } else { for (int64_t i = 0; OB_SUCC(ret) && i < table_ids.count() && tablegroup_locality_finished; ++i) { bool table_locality_finished = true; - const ObTableSchema* table_schema = NULL; + const ObSimpleTableSchemaV2* table_schema = NULL; if (OB_FAIL(check_stop())) { LOG_WARN("root balancer stop", K(ret)); } else if (OB_FAIL(schema_guard.get_table_schema(table_ids.at(i), table_schema))) { @@ -732,7 +732,8 @@ int ObAlterLocalityChecker::process_single_tablegroup(share::schema::ObSchemaGet } int ObAlterLocalityChecker::process_single_table_under_new_tablegroup(share::schema::ObSchemaGetterGuard& schema_guard, - const share::schema::ObTableSchema& table_schema, const share::schema::ObTablegroupSchema& tablegroup_schema, + const share::schema::ObSimpleTableSchemaV2& table_schema, + const share::schema::ObTablegroupSchema& tablegroup_schema, const balancer::HashIndexCollection& hash_index_collection, rootserver::TenantBalanceStat& tenant_stat, bool& table_locality_finished) { diff --git a/src/rootserver/ob_alter_locality_checker.h b/src/rootserver/ob_alter_locality_checker.h index 9575d6a65f..a62cbb39a4 100644 --- a/src/rootserver/ob_alter_locality_checker.h +++ b/src/rootserver/ob_alter_locality_checker.h @@ -27,7 +27,7 @@ class ObPartitionInfo; namespace schema { class ObMultiVersionSchemaService; class ObSchemaGetterGuard; -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObTenantSchema; } // namespace schema } // namespace share @@ -127,7 +127,7 @@ private: const balancer::HashIndexCollection& hash_index_collection, rootserver::TenantBalanceStat& tenant_stat, bool& is_finished); int process_single_table(share::schema::ObSchemaGetterGuard& schema_guard, - const share::schema::ObTableSchema& table_schema, const share::schema::ObTenantSchema& tenant_schema, + const share::schema::ObSimpleTableSchemaV2& table_schema, const share::schema::ObTenantSchema& tenant_schema, const balancer::HashIndexCollection& hash_index_collection, rootserver::TenantBalanceStat& tenant_stat, bool& null_locality_table_finished, bool& table_locality_finished); int process_single_binding_tablegroup(share::schema::ObSchemaGetterGuard& schema_guard, @@ -143,7 +143,8 @@ private: const balancer::HashIndexCollection& hash_index_collection, rootserver::TenantBalanceStat& tenant_stat, bool& tablegroup_locality_finished); int process_single_table_under_new_tablegroup(share::schema::ObSchemaGetterGuard& schema_guard, - const share::schema::ObTableSchema& table_schema, const share::schema::ObTablegroupSchema& tablegroup_schema, + const share::schema::ObSimpleTableSchemaV2& table_schema, + const share::schema::ObTablegroupSchema& tablegroup_schema, const balancer::HashIndexCollection& hash_index_collection, rootserver::TenantBalanceStat& tenant_stat, bool& table_locality_finished); int check_stop(); diff --git a/src/rootserver/ob_balance_group_analyzer.cpp b/src/rootserver/ob_balance_group_analyzer.cpp index ae1aeca134..762fbf9527 100644 --- a/src/rootserver/ob_balance_group_analyzer.cpp +++ b/src/rootserver/ob_balance_group_analyzer.cpp @@ -87,7 +87,7 @@ int ShardGroupAnalyzer::analysis(uint64_t tenant_id) // 1. Partition function does not require equality // 2. The number of partitions is not required to be equal // (this is to ensure that the ShardGroup will not be broken up when adding partitions) -int ShardGroupAnalyzer::build_prefix_key(const ObTableSchema& table, TablePrefixKey& prefix_key) +int ShardGroupAnalyzer::build_prefix_key(const ObSimpleTableSchemaV2& table, TablePrefixKey& prefix_key) { int ret = OB_SUCCESS; const ObString& table_name = table.get_table_name_str(); @@ -100,7 +100,7 @@ int ShardGroupAnalyzer::build_prefix_key(const ObTableSchema& table, TablePrefix int ShardGroupAnalyzer::build_prefix_map(uint64_t tenant_id, ShardGroupPrefixMap& prefix_map) { int ret = OB_SUCCESS; - ObArray table_schemas; + ObArray table_schemas; // In the case of shardgroup, just process standlone table, not process tablegroup if (OB_FAIL(StatFinderUtil::get_need_balance_table_schemas_in_tenant(schema_guard_, tenant_id, table_schemas))) { LOG_WARN("fail get schemas in tenant", K(tenant_id), K(ret)); @@ -109,7 +109,7 @@ int ShardGroupAnalyzer::build_prefix_map(uint64_t tenant_id, ShardGroupPrefixMap for (int64_t i = 0; i < table_schemas.count() && OB_SUCC(ret); ++i) { ObIArray* prefix_info_array = NULL; TablePrefixKey prefix_key; - const ObTableSchema& table = *table_schemas.at(i); + const ObSimpleTableSchemaV2& table = *table_schemas.at(i); const ObString& table_name = table.get_table_name_str(); if (OB_FAIL(build_prefix_key(table, prefix_key))) { LOG_WARN("fail extract prefix", K(ret), K(table_name), K(ret)); @@ -415,7 +415,7 @@ int ShardGroupAnalyzer::add_to_shardgroup(ObIArray& cur_shard, return ret; } -int ShardGroupAnalyzer::next(ObIArray& schemas) +int ShardGroupAnalyzer::next(ObIArray& schemas) { int ret = OB_SUCCESS; if (cur_shard_group_idx_ >= shard_groups_.count()) { @@ -586,7 +586,7 @@ int TableGroupAnalyzer::next(const share::schema::ObPartitionSchema*& partition_ int PartitionTableAnalyzer::analysis(const uint64_t tenant_id) { int ret = OB_SUCCESS; - common::ObArray my_table_schemas; + common::ObArray my_table_schemas; if (OB_UNLIKELY(OB_INVALID_ID == tenant_id)) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid argument", K(ret), K(tenant_id)); @@ -596,7 +596,7 @@ int PartitionTableAnalyzer::analysis(const uint64_t tenant_id) } else { table_schemas_.reset(); for (int64_t i = 0; OB_SUCC(ret) && i < my_table_schemas.count(); ++i) { - const share::schema::ObTableSchema* table_schema = my_table_schemas.at(i); + const share::schema::ObSimpleTableSchemaV2* table_schema = my_table_schemas.at(i); int64_t part_num = 0; if (OB_UNLIKELY(nullptr == table_schema)) { ret = OB_ERR_UNEXPECTED; @@ -621,7 +621,7 @@ int PartitionTableAnalyzer::analysis(const uint64_t tenant_id) return ret; } -int PartitionTableAnalyzer::next(const share::schema::ObTableSchema*& table_schema) +int PartitionTableAnalyzer::next(const share::schema::ObSimpleTableSchemaV2*& table_schema) { int ret = OB_SUCCESS; table_schema = nullptr; @@ -636,7 +636,7 @@ int PartitionTableAnalyzer::next(const share::schema::ObTableSchema*& table_sche int NonPartitionTableAnalyzer::analysis(const uint64_t tenant_id) { int ret = OB_SUCCESS; - common::ObArray table_schemas; + common::ObArray table_schemas; common::ObArray tg_schemas; common::ObArray target_schemas; if (OB_UNLIKELY(OB_INVALID_ID == tenant_id)) { @@ -649,7 +649,7 @@ int NonPartitionTableAnalyzer::analysis(const uint64_t tenant_id) LOG_WARN("fail to get tablegroup schemas in tenant", K(ret), K(tenant_id)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < table_schemas.count(); ++i) { - const ObTableSchema* schema = table_schemas.at(i); + const ObSimpleTableSchemaV2* schema = table_schemas.at(i); int64_t part_num = 0; if (OB_UNLIKELY(NULL == schema)) { ret = OB_ERR_UNEXPECTED; diff --git a/src/rootserver/ob_balance_group_analyzer.h b/src/rootserver/ob_balance_group_analyzer.h index 4725abd301..32a64dd02c 100644 --- a/src/rootserver/ob_balance_group_analyzer.h +++ b/src/rootserver/ob_balance_group_analyzer.h @@ -25,7 +25,7 @@ namespace oceanbase { namespace share { namespace schema { -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObSchemaGetterGuard; } // namespace schema } // namespace share @@ -63,7 +63,7 @@ class TablePrefixValue { public: uint64_t tablegroup_id_; uint64_t table_id_; - const share::schema::ObTableSchema* schema_; + const share::schema::ObSimpleTableSchemaV2* schema_; TO_STRING_KV(K_(tablegroup_id), K_(table_id)); }; @@ -91,7 +91,7 @@ public: // Iterate the ShardGroup. // Note: If there are multiple tables belonging to the same table group, // only the primary table in the table group is taken as a representative and stored in tids - int next(common::ObIArray& schemas); + int next(common::ObIArray& schemas); private: int build_prefix_map(uint64_t tenant_id, ShardGroupPrefixMap& prefix_map); @@ -101,7 +101,7 @@ private: int add_to_shardgroup(common::ObIArray& cur_shard, int64_t cur_shard_idx, common::hash::ObHashMap& shardgroup_map, common::ObIArray& shardgroups); int extract_table_name_prefix(const common::ObString& table, TablePrefixKey& prefix_info); - int build_prefix_key(const share::schema::ObTableSchema& table, TablePrefixKey& prefix_key); + int build_prefix_key(const share::schema::ObSimpleTableSchemaV2& table, TablePrefixKey& prefix_key); private: share::schema::ObSchemaGetterGuard& schema_guard_; @@ -153,14 +153,14 @@ public: cur_table_idx_(0) {} int analysis(const uint64_t tenant_id); - int next(const share::schema::ObTableSchema*& table_schema); + int next(const share::schema::ObSimpleTableSchemaV2*& table_schema); private: share::schema::ObSchemaGetterGuard& schema_guard_; ITenantStatFinder& stat_finder_; common::ObIAllocator& allocator_; common::hash::ObHashSet& processed_tids_; - common::ObArray table_schemas_; + common::ObArray table_schemas_; int64_t cur_table_idx_; }; diff --git a/src/rootserver/ob_balance_group_container.cpp b/src/rootserver/ob_balance_group_container.cpp index e941aaf21f..7d6292a019 100644 --- a/src/rootserver/ob_balance_group_container.cpp +++ b/src/rootserver/ob_balance_group_container.cpp @@ -65,11 +65,11 @@ int PartitionSchemaChecker::check_same_primary_zone( } int PartitionSchemaChecker::check_same_primary_zone( - const common::ObIArray& table_schemas, + const common::ObIArray& table_schemas, share::schema::ObSchemaGetterGuard& schema_guard, bool& same) { int ret = OB_SUCCESS; - const share::schema::ObTableSchema* sample = nullptr; + const share::schema::ObSimpleTableSchemaV2* sample = nullptr; if (OB_UNLIKELY(table_schemas.count()) <= 0) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid argument", K(ret)); @@ -79,7 +79,7 @@ int PartitionSchemaChecker::check_same_primary_zone( } else { same = true; for (int64_t i = 0; OB_SUCC(ret) && i < table_schemas.count() && same; ++i) { - const share::schema::ObTableSchema* ref = table_schemas.at(i); + const share::schema::ObSimpleTableSchemaV2* ref = table_schemas.at(i); if (nullptr == ref) { ret = OB_ERR_UNEXPECTED; LOG_WARN("ref ptr is null", K(ret)); @@ -111,11 +111,12 @@ int PartitionSchemaChecker::check_same_primary_zone( * For the range partition, this function ignores the part_num check * FIXME:Support non-templated secondary partition */ -bool PartitionSchemaChecker::is_same_partition_schema(const ObTableSchema& ref, const ObTableSchema& other) +bool PartitionSchemaChecker::is_same_partition_schema( + const ObSimpleTableSchemaV2& ref, const ObSimpleTableSchemaV2& other) { bool same = false; if (!rootserver::ObTenantUtils::is_balance_target_schema(other)) { - /* Ignore irregular tables in system tables */ + // Ignore irregular tables in system tables same = true; } else if (ref.get_part_level() == other.get_part_level()) { switch (ref.get_part_level()) { @@ -126,9 +127,11 @@ bool PartitionSchemaChecker::is_same_partition_schema(const ObTableSchema& ref, same = (ref.get_part_option().get_part_num() == other.get_part_option().get_part_num()); } // The partition column needs to be able to compare + /* if (same) { - same = (is_same_schema_partition_key_info(ref.get_partition_key_info(), other.get_partition_key_info())); - } + same = (is_same_schema_partition_key_info(ref.get_partition_key_info(), + other.get_partition_key_info())); + }*/ break; case PARTITION_LEVEL_TWO: same = (ref.get_part_option().get_part_func_type() == other.get_part_option().get_part_func_type()) && @@ -141,34 +144,39 @@ bool PartitionSchemaChecker::is_same_partition_schema(const ObTableSchema& ref, if (same && (ref.is_hash_subpart() || ref.is_key_subpart())) { same = (ref.get_sub_part_option().get_part_num() == other.get_sub_part_option().get_part_num()); } + /* if (same) { - same = (is_same_schema_partition_key_info(ref.get_partition_key_info(), other.get_partition_key_info())); + same = (is_same_schema_partition_key_info(ref.get_partition_key_info(), + other.get_partition_key_info())); } // subpartition column needs to be able to compare if (same) { - same = - (is_same_schema_partition_key_info(ref.get_subpartition_key_info(), other.get_subpartition_key_info())); + same = (is_same_schema_partition_key_info(ref.get_subpartition_key_info(), + other.get_subpartition_key_info())); } + */ break; default: - same = true; /* LEVEL_ZERO */ + same = true; // LEVEL_ZERO break; } } return same; } +/* bool PartitionSchemaChecker::is_same_schema_partition_key_info( - const common::ObRowkeyInfo& left, const common::ObRowkeyInfo& right) + const common::ObRowkeyInfo &left, + const common::ObRowkeyInfo &right) { bool bool_ret = true; if (left.get_size() != right.get_size()) { bool_ret = false; } else { for (int64_t i = 0; bool_ret && i < left.get_size(); ++i) { - const ObRowkeyColumn* left_c = left.get_column(i); - const ObRowkeyColumn* right_c = right.get_column(i); + const ObRowkeyColumn *left_c = left.get_column(i); + const ObRowkeyColumn *right_c = right.get_column(i); if (nullptr == left_c || nullptr == right_c) { bool_ret = false; } else if (left_c->get_meta_type() != right_c->get_meta_type()) { @@ -178,20 +186,21 @@ bool PartitionSchemaChecker::is_same_schema_partition_key_info( } return bool_ret; } +*/ bool PartitionSchemaChecker::is_one_level_and_partition_by_range( - common::ObIArray& schemas) + common::ObIArray& schemas) { bool bret = false; if (schemas.count() > 0 && NULL != schemas.at(0)) { - const share::schema::ObTableSchema& schema = *schemas.at(0); + const share::schema::ObSimpleTableSchemaV2& schema = *schemas.at(0); bret = PARTITION_LEVEL_ONE == schema.get_part_level() && schema.get_part_option().is_range_part(); } return bret; } int ShardGroupValidator::check_table_schemas_compatible(ITenantStatFinder& stat_finder, - ObSchemaGetterGuard& schema_guard, const ObIArray& tables, bool& compatible, + ObSchemaGetterGuard& schema_guard, const ObIArray& tables, bool& compatible, const bool check_primary_zone) { int ret = OB_SUCCESS; @@ -221,14 +230,14 @@ int ShardGroupValidator::check_table_schemas_compatible(ITenantStatFinder& stat_ } // 2. Ensure that the schema of each group of tablegroups is compatible, // such as the compatibility of the partitioning method and the number of partitions - const ObTableSchema* first_table_schema = tables.at(0); + const ObSimpleTableSchemaV2* first_table_schema = tables.at(0); ARRAY_FOREACH_X(tables, idx, cnt, OB_SUCC(ret) && compatible) { - const ObTableSchema* table_schema = tables.at(idx); + const ObSimpleTableSchemaV2* table_schema = tables.at(idx); uint64_t tablegroup_id = table_schema->get_tablegroup_id(); bool same = false; if (OB_INVALID_ID != tablegroup_id) { - ObArray tg_tables; + ObArray tg_tables; if (OB_FAIL(schema_guard.get_table_schemas_in_tablegroup(tenant_id, tablegroup_id, tg_tables))) { LOG_WARN("get_table_schema_by_tg_id fail", K(tenant_id), K(tablegroup_id), K(ret)); } else { @@ -452,7 +461,7 @@ int PartitionTableContainerBuilder::build() if (OB_FAIL(analyzer.analysis(tenant_id_))) { LOG_WARN("fail to analysis partition table", K(ret), K(tenant_id_)); } else { - const ObTableSchema* table_schema = nullptr; + const ObSimpleTableSchemaV2* table_schema = nullptr; while (OB_SUCC(ret) && OB_SUCC(analyzer.next(table_schema))) { if (OB_UNLIKELY(nullptr == table_schema)) { ret = OB_ERR_UNEXPECTED; @@ -469,7 +478,8 @@ int PartitionTableContainerBuilder::build() return ret; } -int PartitionTableContainerBuilder::build_partition_table_container(const share::schema::ObTableSchema* table_schema) +int PartitionTableContainerBuilder::build_partition_table_container( + const share::schema::ObSimpleTableSchemaV2* table_schema) { int ret = OB_SUCCESS; if (OB_UNLIKELY(!inited_)) { @@ -1023,7 +1033,7 @@ int ShardGroupContainerBuilder::TableSchemaPartitionCntCmp::sort() } bool ShardGroupContainerBuilder::TableSchemaPartitionCntCmp::operator()( - const share::schema::ObTableSchema* left, const share::schema::ObTableSchema* right) + const share::schema::ObSimpleTableSchemaV2* left, const share::schema::ObSimpleTableSchemaV2* right) { bool b_ret = false; int64_t l_part_cnt = 0; @@ -1064,7 +1074,7 @@ int ShardGroupContainerBuilder::build() if (OB_FAIL(analyzer.analysis(tenant_id_))) { LOG_WARN("fail to analysis shardgroup", K(ret), K(tenant_id_)); } else { - ObArray shardgroup_table_schemas; + ObArray shardgroup_table_schemas; while (OB_SUCC(ret) && OB_SUCC(analyzer.next(shardgroup_table_schemas))) { if (shardgroup_table_schemas.count() < 1) { ret = OB_ERR_UNEXPECTED; @@ -1082,12 +1092,12 @@ int ShardGroupContainerBuilder::build() } int ShardGroupContainerBuilder::build_shardgroup_container( - common::ObArray& shardgroup_schemas) + common::ObArray& shardgroup_schemas) { int ret = OB_SUCCESS; common::ObZone integrated_primary_zone; bool primary_zone_match = true; - const share::schema::ObTableSchema* sample_schema = nullptr; + const share::schema::ObSimpleTableSchemaV2* sample_schema = nullptr; if (OB_UNLIKELY(!inited_)) { ret = OB_NOT_INIT; LOG_WARN("not init", K(ret)); @@ -1160,7 +1170,7 @@ int ShardGroupContainerBuilder::locate_same_range_array( int ShardGroupContainerBuilder::set_same_range_array(SameRangeMap& same_range_map, const share::schema::ObPartition& partition, const int64_t part_idx, - const share::schema::ObTableSchema& table_schema) + const share::schema::ObSimpleTableSchemaV2& table_schema) { int ret = OB_SUCCESS; if (OB_UNLIKELY(!inited_)) { @@ -1193,7 +1203,7 @@ int ShardGroupContainerBuilder::set_same_range_array(SameRangeMap& same_range_ma } int ShardGroupContainerBuilder::build_one_level_range_shard_partition_container( - common::ObArray& shardgroup_schemas, const bool primary_zone_match, + common::ObArray& shardgroup_schemas, const bool primary_zone_match, const common::ObZone& integrated_primary_zone) { int ret = OB_SUCCESS; @@ -1218,7 +1228,7 @@ int ShardGroupContainerBuilder::build_one_level_range_shard_partition_container( // invalid shard group map } else { for (int64_t i = 0; OB_SUCC(ret) && i < shardgroup_schemas.count(); ++i) { - const share::schema::ObTableSchema* table_schema = shardgroup_schemas.at(i); + const share::schema::ObSimpleTableSchemaV2* table_schema = shardgroup_schemas.at(i); if (OB_UNLIKELY(NULL == table_schema)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("table schema ptr is null", K(ret)); @@ -1333,7 +1343,7 @@ int ShardGroupContainerBuilder::do_build_one_level_range_partition_container(Sam * - - - - ..... pkn p(k+1)n 2 p(k+1)n */ int ShardGroupContainerBuilder::build_shardgroup_partition_container( - common::ObArray& shardgroup_schemas, const bool primary_zone_match, + common::ObArray& shardgroup_schemas, const bool primary_zone_match, const common::ObZone& integrated_primary_zone) { int ret = OB_SUCCESS; @@ -1372,7 +1382,7 @@ int ShardGroupContainerBuilder::build_shardgroup_partition_container( } } for (int64_t i = 0; OB_SUCC(ret) && i < shardgroup_schemas.count(); ++i) { - const share::schema::ObTableSchema* table_schema = shardgroup_schemas.at(i); + const share::schema::ObSimpleTableSchemaV2* table_schema = shardgroup_schemas.at(i); int64_t this_part_num = 0; if (OB_UNLIKELY(NULL == table_schema)) { ret = OB_ERR_UNEXPECTED; @@ -1414,7 +1424,7 @@ int ShardGroupContainerBuilder::build_shardgroup_partition_container( int64_t start_balance_group_id = max_used_balance_group_id_ + 1; for (int64_t i = shardgroup_schemas.count() - 1; OB_SUCC(ret) && i >= 0; --i) { const int64_t in_shard_index = shardgroup_schemas.count() - (i + 1); - const share::schema::ObTableSchema* table_schema = shardgroup_schemas.at(i); + const share::schema::ObSimpleTableSchemaV2* table_schema = shardgroup_schemas.at(i); int64_t all_tg_idx = OB_INVALID_INDEX_INT64; if (OB_UNLIKELY(NULL == table_schema)) { ret = OB_ERR_UNEXPECTED; diff --git a/src/rootserver/ob_balance_group_container.h b/src/rootserver/ob_balance_group_container.h index d8402620b6..7013e569e3 100644 --- a/src/rootserver/ob_balance_group_container.h +++ b/src/rootserver/ob_balance_group_container.h @@ -31,7 +31,7 @@ namespace oceanbase { namespace share { namespace schema { -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObSchemaGetterGuard; class ObPartition; } // namespace schema @@ -53,19 +53,24 @@ public: const share::schema::ObPartitionSchema& other, share::schema::ObSchemaGetterGuard& schema_guard, bool& same); static int check_same_primary_zone(const common::ObIArray& partition_schemas, share::schema::ObSchemaGetterGuard& schema_guard, bool& same); - static int check_same_primary_zone(const common::ObIArray& partition_schemas, + static int check_same_primary_zone( + const common::ObIArray& partition_schemas, share::schema::ObSchemaGetterGuard& schema_guard, bool& same); static bool is_same_partition_schema( - const share::schema::ObTableSchema& ref, const share::schema::ObTableSchema& other); - static bool is_same_schema_partition_key_info(const common::ObRowkeyInfo& left, const common::ObRowkeyInfo& right); - static bool is_one_level_and_partition_by_range(common::ObIArray& schemas); + const share::schema::ObSimpleTableSchemaV2& ref, const share::schema::ObSimpleTableSchemaV2& other); + /* + static bool is_same_schema_partition_key_info(const common::ObRowkeyInfo &left, + const common::ObRowkeyInfo &right); + */ + static bool is_one_level_and_partition_by_range( + common::ObIArray& schemas); }; class ShardGroupValidator { public: static int check_table_schemas_compatible(ITenantStatFinder& stat_finder, share::schema::ObSchemaGetterGuard& schema_guard, - const common::ObIArray& tables, bool& compatible, + const common::ObIArray& tables, bool& compatible, const bool check_primary_zone = false); }; @@ -118,7 +123,7 @@ public: int build() override; private: - int build_partition_table_container(const share::schema::ObTableSchema* table_schema); + int build_partition_table_container(const share::schema::ObSimpleTableSchemaV2* table_schema); }; class NonPartitionTableContainerBuilder : public IBalanceGroupContainerBuilder { @@ -178,29 +183,30 @@ private: typedef common::hash::ObHashMap SameRangeMap; class TableSchemaPartitionCntCmp { public: - TableSchemaPartitionCntCmp(common::ObArray& shardgroup_schemas) + TableSchemaPartitionCntCmp(common::ObArray& shardgroup_schemas) : shardgroup_schemas_(shardgroup_schemas), ret_(common::OB_SUCCESS) {} int sort(); public: - bool operator()(const share::schema::ObTableSchema* l, const share::schema::ObTableSchema* r); + bool operator()(const share::schema::ObSimpleTableSchemaV2* l, const share::schema::ObSimpleTableSchemaV2* r); private: - common::ObArray& shardgroup_schemas_; + common::ObArray& shardgroup_schemas_; int ret_; }; private: - int build_shardgroup_container(common::ObArray& shardgroup_table_schemas); + int build_shardgroup_container( + common::ObArray& shardgroup_table_schemas); int build_one_level_range_shard_partition_container( - common::ObArray& shardgroup_table_schemas, const bool primary_zone_match, - const common::ObZone& integrated_primary_zone); + common::ObArray& shardgroup_table_schemas, + const bool primary_zone_match, const common::ObZone& integrated_primary_zone); int build_shardgroup_partition_container( - common::ObArray& shargroup_table_schemas, const bool primary_zone_match, - const common::ObZone& integrated_primary_zone); + common::ObArray& shargroup_table_schemas, + const bool primary_zone_match, const common::ObZone& integrated_primary_zone); int set_same_range_array(SameRangeMap& same_range_map, const share::schema::ObPartition& partition, - const int64_t part_idx, const share::schema::ObTableSchema& table_schema); + const int64_t part_idx, const share::schema::ObSimpleTableSchemaV2& table_schema); int locate_same_range_array( SameRangeMap& same_range_map, const share::schema::ObPartition& partition, SameRangeArray*& same_range_array); int do_build_one_level_range_partition_container(SameRangeMap& same_range_map, const uint64_t base_index_group_id, diff --git a/src/rootserver/ob_balance_info.cpp b/src/rootserver/ob_balance_info.cpp index 316c9a6dbf..b96d049282 100644 --- a/src/rootserver/ob_balance_info.cpp +++ b/src/rootserver/ob_balance_info.cpp @@ -1559,7 +1559,7 @@ int TenantBalanceStat::get_partition_locality(const Partition& partition, ret = OB_ERR_UNEXPECTED; LOG_WARN("invalid schema guard", K(ret), K_(schema_guard)); } else if (!is_tablegroup_id(partition.table_id_)) { - const ObTableSchema* table_schema = nullptr; + const ObSimpleTableSchemaV2* table_schema = nullptr; const uint64_t table_id = partition.table_id_; if (OB_FAIL(schema_guard_->get_table_schema(table_id, table_schema))) { LOG_WARN("fail to get table schema", K(ret), K(table_id)); @@ -3254,7 +3254,7 @@ int TenantBalanceStat::get_full_replica_num(const Partition& p, int64_t& count) const uint64_t schema_id = p.table_id_; int64_t full_count = 0; if (!is_tablegroup_id(schema_id)) { - const ObTableSchema* table_schema = nullptr; + const ObSimpleTableSchemaV2* table_schema = nullptr; if (OB_FAIL(schema_guard_->get_table_schema(schema_id, table_schema))) { LOG_WARN("fail to get table schema", "table_id", schema_id); } else if (OB_UNLIKELY(NULL == table_schema)) { @@ -3309,7 +3309,7 @@ int TenantBalanceStat::get_schema_quorum_size(const Partition& p, int64_t& quoru const uint64_t schema_id = p.table_id_; int64_t paxos_count = 0; if (!is_tablegroup_id(schema_id)) { - const ObTableSchema* table_schema = nullptr; + const ObSimpleTableSchemaV2* table_schema = nullptr; if (OB_FAIL(schema_guard_->get_table_schema(schema_id, table_schema))) { LOG_WARN("fail to get table schema", "table_id", schema_id); } else if (OB_UNLIKELY(NULL == table_schema)) { diff --git a/src/rootserver/ob_balancer_interface.cpp b/src/rootserver/ob_balancer_interface.cpp index 71d5f4f21c..c633debf99 100644 --- a/src/rootserver/ob_balancer_interface.cpp +++ b/src/rootserver/ob_balancer_interface.cpp @@ -100,7 +100,7 @@ int StatFinderUtil::get_partition_entity_schemas_by_tg_idx(ITenantStatFinder& st FOREACH_X(tid, tids, OB_SUCC(ret)) { if (!is_new_tablegroup_id(*tid)) { - const ObTableSchema* schema = nullptr; + const ObSimpleTableSchemaV2* schema = nullptr; if (OB_FAIL(schema_guard.get_table_schema(*tid, schema))) { LOG_WARN("fail get table schema", K(tenant_id), K(*tid), K(tids), K(ret)); } else if (OB_ISNULL(schema)) { @@ -126,7 +126,7 @@ int StatFinderUtil::get_partition_entity_schemas_by_tg_idx(ITenantStatFinder& st } int StatFinderUtil::get_need_balance_table_schemas_in_tenant(share::schema::ObSchemaGetterGuard& schema_guard, - uint64_t tenant_id, common::ObIArray& tables) + uint64_t tenant_id, common::ObIArray& tables) { int ret = OB_SUCCESS; ObArray tids; @@ -135,7 +135,7 @@ int StatFinderUtil::get_need_balance_table_schemas_in_tenant(share::schema::ObSc } else { FOREACH_X(tid, tids, OB_SUCC(ret)) { - const ObTableSchema* schema = NULL; + const ObSimpleTableSchemaV2* schema = NULL; if (OB_FAIL(schema_guard.get_table_schema(*tid, schema))) { LOG_WARN("fail get table schema", K(tenant_id), K(*tid), K(ret)); } else if (OB_ISNULL(schema)) { diff --git a/src/rootserver/ob_balancer_interface.h b/src/rootserver/ob_balancer_interface.h index 152376af1f..09e403ef72 100644 --- a/src/rootserver/ob_balancer_interface.h +++ b/src/rootserver/ob_balancer_interface.h @@ -21,7 +21,7 @@ namespace oceanbase { namespace share { namespace schema { -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObSchemaGetterGuard; } // namespace schema } // namespace share @@ -105,7 +105,7 @@ public: // Obtaining the table list from StatFinder is a snapshot, not because of map_balancer // The result of each call in the running process is different static int get_need_balance_table_schemas_in_tenant(share::schema::ObSchemaGetterGuard& schema_guard, - uint64_t tenant_id, common::ObIArray& tables); + uint64_t tenant_id, common::ObIArray& tables); }; class IUnitProvider { diff --git a/src/rootserver/ob_locality_checker.cpp b/src/rootserver/ob_locality_checker.cpp index e79e0fb8e0..29852e8754 100644 --- a/src/rootserver/ob_locality_checker.cpp +++ b/src/rootserver/ob_locality_checker.cpp @@ -619,7 +619,7 @@ int ObLocalityChecker::check_can_modify_quorum(const balancer::HashIndexCollecti ret = OB_EAGAIN; LOG_WARN("locality changed, generate task next round", K(ret)); } else if (!is_tablegroup_id(table_id)) { - const ObTableSchema* table_schema = NULL; + const ObSimpleTableSchemaV2* table_schema = NULL; if (OB_FAIL(schema_guard.get_table_schema(table_id, table_schema))) { LOG_WARN("fail to get table schema", K(ret), K(table_id)); } else if (OB_ISNULL(table_schema)) { @@ -738,7 +738,7 @@ int ObLocalityChecker::get_partition_locality(ObFilterLocalityUtility& checker, ret = OB_EAGAIN; LOG_WARN("locality changed, generate task next round", K(ret)); } else if (!is_tablegroup_id(table_id)) { - const ObTableSchema* table_schema = nullptr; + const ObSimpleTableSchemaV2* table_schema = nullptr; if (OB_FAIL(schema_guard.get_table_schema(table_id, table_schema))) { LOG_WARN("fail to get table schema", K(ret), K(table_id)); } else if (OB_UNLIKELY(nullptr == table_schema)) { diff --git a/src/rootserver/ob_locality_checker.h b/src/rootserver/ob_locality_checker.h index 66f66f7819..d0d5b8a2db 100644 --- a/src/rootserver/ob_locality_checker.h +++ b/src/rootserver/ob_locality_checker.h @@ -22,7 +22,7 @@ namespace oceanbase { namespace share { class ObPartitionInfo; namespace schema { -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObMultiVersionSchemaService; } // namespace schema } // namespace share diff --git a/src/rootserver/ob_locality_util.h b/src/rootserver/ob_locality_util.h index 49a6cc0d1a..a955c1dd9c 100644 --- a/src/rootserver/ob_locality_util.h +++ b/src/rootserver/ob_locality_util.h @@ -31,7 +31,7 @@ namespace schema { class ObZoneRegion; class ObSchemaGetterGuard; class ObLocality; -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObTablegroupSchema; class ObTenantSchema; class ObDatabaseSchema; diff --git a/src/rootserver/ob_partition_disk_balancer.h b/src/rootserver/ob_partition_disk_balancer.h index da1c04d357..1efe2207d7 100644 --- a/src/rootserver/ob_partition_disk_balancer.h +++ b/src/rootserver/ob_partition_disk_balancer.h @@ -22,7 +22,7 @@ namespace oceanbase { namespace share { namespace schema { class ObMultiVersionSchemaService; -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObSchemaGetterGuard; } // namespace schema } // namespace share diff --git a/src/rootserver/ob_partition_leader_count_balancer.cpp b/src/rootserver/ob_partition_leader_count_balancer.cpp index 8f53aa6058..8bc1eb8d03 100644 --- a/src/rootserver/ob_partition_leader_count_balancer.cpp +++ b/src/rootserver/ob_partition_leader_count_balancer.cpp @@ -408,7 +408,7 @@ int PartitionLeaderCountBalancer::do_update_map_item_replica_attributes(SquareId common::ObSEArray designated_zone_locality; bool compensate_readonly_all_server = false; if (!is_tablegroup_id(schema_id)) { - const ObTableSchema* table_schema = nullptr; + const ObSimpleTableSchemaV2* table_schema = nullptr; if (OB_FAIL(schema_guard_.get_table_schema(schema_id, table_schema))) { LOG_WARN("fail to get table schema", K(ret), "table_id", schema_id); } else if (OB_UNLIKELY(nullptr == table_schema)) { diff --git a/src/rootserver/ob_partition_leader_count_balancer.h b/src/rootserver/ob_partition_leader_count_balancer.h index afe00ae163..7c946377f8 100644 --- a/src/rootserver/ob_partition_leader_count_balancer.h +++ b/src/rootserver/ob_partition_leader_count_balancer.h @@ -22,7 +22,7 @@ namespace oceanbase { namespace share { namespace schema { class ObMultiVersionSchemaService; -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObSchemaGetterGuard; } // namespace schema } // namespace share diff --git a/src/rootserver/ob_partition_spliter.cpp b/src/rootserver/ob_partition_spliter.cpp index ea9b527ef5..1f6ac8ad54 100644 --- a/src/rootserver/ob_partition_spliter.cpp +++ b/src/rootserver/ob_partition_spliter.cpp @@ -194,7 +194,7 @@ int ObPartitionSpliter::try_split_partition() ///////////////////////////////////////////// -int ObPartitionSplitExecutor::split_table_partition(const share::schema::ObTableSchema& schema, +int ObPartitionSplitExecutor::split_table_partition(const share::schema::ObSimpleTableSchemaV2& schema, share::ObPartitionTableOperator& pt_operator, obrpc::ObSrvRpcProxy& rpc_proxy, ObSplitPartitionArg& arg, ObSplitProgress& split_process) { diff --git a/src/rootserver/ob_partition_spliter.h b/src/rootserver/ob_partition_spliter.h index c233fa8261..9ea11af602 100644 --- a/src/rootserver/ob_partition_spliter.h +++ b/src/rootserver/ob_partition_spliter.h @@ -96,8 +96,9 @@ public: int split_tablegroup_partition(share::schema::ObSchemaGetterGuard& schema_guard, const share::schema::ObTablegroupSchema& tablegroup_schema, common::ObISQLClient& client, share::ObSplitProgress& split_status); - int split_table_partition(const share::schema::ObTableSchema& schema, share::ObPartitionTableOperator& pt_operator, - obrpc::ObSrvRpcProxy& rpc_proxy, obrpc::ObSplitPartitionArg& arg, share::ObSplitProgress& split_process); + int split_table_partition(const share::schema::ObSimpleTableSchemaV2& schema, + share::ObPartitionTableOperator& pt_operator, obrpc::ObSrvRpcProxy& rpc_proxy, obrpc::ObSplitPartitionArg& arg, + share::ObSplitProgress& split_process); int split_binding_tablegroup_partition(const share::schema::ObTablegroupSchema& schema, share::ObPartitionTableOperator& pt_operator, obrpc::ObSrvRpcProxy& rpc_proxy, obrpc::ObSplitPartitionArg& arg, share::ObSplitProgress& split_process); diff --git a/src/rootserver/ob_partition_table_util.cpp b/src/rootserver/ob_partition_table_util.cpp index 638663f676..657fc5bb20 100644 --- a/src/rootserver/ob_partition_table_util.cpp +++ b/src/rootserver/ob_partition_table_util.cpp @@ -164,7 +164,7 @@ int ObPartitionTableUtil::check_merge_progress( } else if (is_restore && !is_inner_table(this_partition_entity_id)) { need_check = false; // user table do not suspend merge during restore } else if (!is_tablegroup_id(this_partition_entity_id)) { - const share::schema::ObTableSchema* table_schema = nullptr; + const share::schema::ObSimpleTableSchemaV2* table_schema = nullptr; if (OB_FAIL(schema_guard.get_table_schema(this_partition_entity_id, table_schema))) { LOG_WARN("fail to get table schema", K(ret), "table_id", this_partition_entity_id); } else if (nullptr == table_schema) { diff --git a/src/rootserver/ob_rebalance_task.cpp b/src/rootserver/ob_rebalance_task.cpp index 81df7e91b4..6636fc6935 100644 --- a/src/rootserver/ob_rebalance_task.cpp +++ b/src/rootserver/ob_rebalance_task.cpp @@ -1435,7 +1435,7 @@ int ObAddTaskInfo::check_quorum(const share::ObPartitionInfo& partition, const b // we need to try to modify quorum at the same time int64_t paxos_num = OB_INVALID_COUNT; if (!is_tablegroup_id(partition.get_table_id())) { - const share::schema::ObTableSchema* schema = NULL; + const share::schema::ObSimpleTableSchemaV2* schema = NULL; if (OB_FAIL(schema_guard.get_table_schema(partition.get_table_id(), schema))) { LOG_WARN("get table schema failed", K(ret), "table", partition.get_table_id()); } else if (OB_ISNULL(schema)) { diff --git a/src/rootserver/ob_replica_creator.cpp b/src/rootserver/ob_replica_creator.cpp index 57198b238c..cbc2e5b2fd 100644 --- a/src/rootserver/ob_replica_creator.cpp +++ b/src/rootserver/ob_replica_creator.cpp @@ -147,8 +147,8 @@ int ObReplicaCreator::alloc_tablegroup_partitions_for_create(const share::schema * partition replicas are aligned to the partition replicas * already exist of this tablegroup. */ -int ObReplicaCreator::alloc_partitions_for_create(const ObTableSchema& table, obrpc::ObCreateTableMode create_mode, - ObITablePartitionAddr& addr, ObIArray& ten_unit_arr) +int ObReplicaCreator::alloc_partitions_for_create(const ObSimpleTableSchemaV2& table, + obrpc::ObCreateTableMode create_mode, ObITablePartitionAddr& addr, ObIArray& ten_unit_arr) { int ret = OB_SUCCESS; RS_TRACE(alloc_replica_begin); @@ -1170,7 +1170,7 @@ int ObReplicaCreator::init_addr_allocator_parameter(const share::schema::ObParti return ret; } -int ObReplicaCreator::get_pg_partitions(const ObTableSchema& table, ObITablePartitionAddr& addr) +int ObReplicaCreator::get_pg_partitions(const ObSimpleTableSchemaV2& table, ObITablePartitionAddr& addr) { int ret = OB_SUCCESS; ObSchemaGetterGuard guard; @@ -1330,7 +1330,7 @@ int ObReplicaCreator::check_all_partition_allocated( // sample_info: logonly replicas on logonly unit are filtered already // only replicas on non logonly unit are concerned int ObReplicaCreator::set_same_addr_ignore_logonly(const share::ObPartitionInfo& sample_info, - share::schema::ObSchemaGetterGuard& schema_guard, const share::schema::ObTableSchema& table_schema, + share::schema::ObSchemaGetterGuard& schema_guard, const share::schema::ObSimpleTableSchemaV2& table_schema, const int64_t replica_num, ObPartitionAddr& paddr) { int ret = OB_SUCCESS; @@ -1432,7 +1432,7 @@ int ObReplicaCreator::partition_all_replica( const uint64_t table_id, const uint64_t partition_id, share::ObPartitionInfo& partition_info) { int ret = OB_SUCCESS; - const ObTableSchema* table = NULL; + const ObSimpleTableSchemaV2* table = NULL; const ObTablegroupSchema* tablegroup = NULL; const uint64_t tenant_id = extract_tenant_id(table_id); ObReplicaFilterHolder filter; @@ -1479,7 +1479,7 @@ int ObReplicaCreator::table_all_partition( { int ret = OB_SUCCESS; const uint64_t tenant_id = extract_tenant_id(table_id); - const ObTableSchema* table = NULL; + const ObSimpleTableSchemaV2* table = NULL; ObReplicaFilterHolder filter; ObSchemaGetterGuard schema_guard; ObArray unit_ids; @@ -1750,7 +1750,7 @@ int ObReplicaCreator::process_replica_in_logonly_unit(const share::schema::ObPar return ret; } -int ObReplicaCreator::standby_alloc_partitions_for_split(const share::schema::ObTableSchema& table, +int ObReplicaCreator::standby_alloc_partitions_for_split(const share::schema::ObSimpleTableSchemaV2& table, const common::ObIArray& source_part_ids, const common::ObIArray& partition_ids, ObITablePartitionAddr& addr) { @@ -1797,7 +1797,7 @@ int ObReplicaCreator::standby_alloc_partitions_for_split(const share::schema::Ob RS_TRACE(alloc_replica_end); return ret; } -int ObReplicaCreator::alloc_table_partitions_for_standby(const share::schema::ObTableSchema& schema, +int ObReplicaCreator::alloc_table_partitions_for_standby(const share::schema::ObSimpleTableSchemaV2& schema, const common::ObIArray& keys, obrpc::ObCreateTableMode create_mode, ObITablePartitionAddr& addr, share::schema::ObSchemaGetterGuard& guard) { diff --git a/src/rootserver/ob_replica_creator.h b/src/rootserver/ob_replica_creator.h index 45e3cca57a..863de24e6e 100644 --- a/src/rootserver/ob_replica_creator.h +++ b/src/rootserver/ob_replica_creator.h @@ -67,8 +67,9 @@ public: const obrpc::ObCreateTableMode create_mode, common::ObIArray& tablegroup_addr, ObIArray& ten_unit_arr); // add partition for create table - int alloc_partitions_for_create(const share::schema::ObTableSchema& table, obrpc::ObCreateTableMode create_mode, - ObITablePartitionAddr& addr, ObIArray& ten_unit_arr); + int alloc_partitions_for_create(const share::schema::ObSimpleTableSchemaV2& table, + obrpc::ObCreateTableMode create_mode, ObITablePartitionAddr& addr, + ObIArray& ten_unit_arr); // add partition for add partition template int alloc_partitions_for_add(const SCHEMA& table, const SCHEMA& inc_table, const obrpc::ObCreateTableMode create_mode, @@ -76,10 +77,10 @@ public: // add partition for split int alloc_partitions_for_split(const share::schema::ObPartitionSchema& table, const share::schema::ObPartitionSchema& inc_table, ObITablePartitionAddr& addr); - int standby_alloc_partitions_for_split(const share::schema::ObTableSchema& table, + int standby_alloc_partitions_for_split(const share::schema::ObSimpleTableSchemaV2& table, const common::ObIArray& source_part_ids, const common::ObIArray& dest_partition_ids, ObITablePartitionAddr& addr); - int alloc_table_partitions_for_standby(const share::schema::ObTableSchema& table, + int alloc_table_partitions_for_standby(const share::schema::ObSimpleTableSchemaV2& table, const common::ObIArray& keys, obrpc::ObCreateTableMode create_mode, ObITablePartitionAddr& addr, share::schema::ObSchemaGetterGuard& guard); int alloc_tablegroup_partitions_for_standby(const share::schema::ObTablegroupSchema& table_group, @@ -117,7 +118,7 @@ private: balancer::ObSinglePtBalanceContainer& pt_balance_container, common::ObIArray& high_priority_zone_array, common::ObSEArray& zone_score_array); - int get_pg_partitions(const share::schema::ObTableSchema& table, ObITablePartitionAddr& addr); + int get_pg_partitions(const share::schema::ObSimpleTableSchemaV2& table, ObITablePartitionAddr& addr); int init_addr_allocator_parameter(const share::schema::ObPartitionSchema& partition_schema, const obrpc::ObCreateTableMode create_mode, ObIArray& zone_list, ZoneUnitArray& unit_pool, ObIArray& zone_locality, ZoneUnitPtrArray& all_zone_units_alive, @@ -184,7 +185,7 @@ private: int partition_all_replica(const uint64_t table_id, const uint64_t partition_id, share::ObPartitionInfo& part); int set_same_addr_ignore_logonly(const share::ObPartitionInfo& info, share::schema::ObSchemaGetterGuard& schema_guard, - const share::schema::ObTableSchema& table, const int64_t replica_num, ObPartitionAddr& addr); + const share::schema::ObSimpleTableSchemaV2& table, const int64_t replica_num, ObPartitionAddr& addr); int set_same_addr(const share::ObPartitionInfo& sample_info, ObPartitionAddr& paddr); // Get tenant all online (has heartbeat with rs) unit grouped by zone. diff --git a/src/rootserver/ob_root_backup.cpp b/src/rootserver/ob_root_backup.cpp index c2053e7a2b..909cfb8214 100644 --- a/src/rootserver/ob_root_backup.cpp +++ b/src/rootserver/ob_root_backup.cpp @@ -2661,7 +2661,7 @@ int ObTenantBackup::generate_standalone_backup_task(const share::ObTenantBackupT int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; ObArray table_ids; - const ObTableSchema* table_schema = NULL; + const ObSimpleTableSchemaV2* table_schema = NULL; int64_t table_id_index = 0; if (!is_inited_) { @@ -3059,7 +3059,7 @@ int ObTenantBackup::add_standalone_key_to_extern_list(ObExternPGListMgr& pg_list int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; ObArray table_ids; - const ObTableSchema* table_schema = NULL; + const ObSimpleTableSchemaV2* table_schema = NULL; if (!is_inited_) { ret = OB_NOT_INIT; LOG_WARN("tenant backup do not init", K(ret)); @@ -3616,7 +3616,7 @@ int ObTenantBackup::get_table_count_with_partition(const uint64_t tenant_id, con } else { for (int64_t i = 0; OB_SUCC(ret) && i < table_ids.count(); ++i) { const uint64_t table_id = table_ids.at(i); - const ObTableSchema* table_schema = NULL; + const ObSimpleTableSchemaV2* table_schema = NULL; if (OB_FAIL(schema_guard.get_table_schema(table_id, table_schema))) { LOG_WARN("failed to get table schema", K(ret), K(table_id)); } else if (OB_ISNULL(table_schema)) { @@ -3631,7 +3631,7 @@ int ObTenantBackup::get_table_count_with_partition(const uint64_t tenant_id, con } int ObTenantBackup::check_standalone_table_need_backup( - const share::schema::ObTableSchema* table_schema, bool& need_backup) + const share::schema::ObSimpleTableSchemaV2* table_schema, bool& need_backup) { int ret = OB_SUCCESS; ObIndexStatus status; diff --git a/src/rootserver/ob_root_backup.h b/src/rootserver/ob_root_backup.h index 9b5236f6ab..a9af4ee9ab 100644 --- a/src/rootserver/ob_root_backup.h +++ b/src/rootserver/ob_root_backup.h @@ -42,7 +42,7 @@ class ObPartitionTableOperator; class ObIBackupLeaseService; namespace schema { -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObMultiVersionSchemaService; class ObSchemaGetterGuard; } // namespace schema @@ -306,7 +306,7 @@ private: int cancel_doing_pg_tasks(const share::ObTenantBackupTaskInfo& task_info, common::ObISQLClient& trans); int get_table_count_with_partition(const uint64_t tenant_id, const int64_t tablegroup_id, share::schema::ObSchemaGetterGuard& schema_guard, int64_t& table_count); - int check_standalone_table_need_backup(const share::schema::ObTableSchema* table_schema, bool& need_backup); + int check_standalone_table_need_backup(const share::schema::ObSimpleTableSchemaV2* table_schema, bool& need_backup); int commit_trans(ObMySQLTransaction& trans); int start_trans(ObTimeoutCtx& timeout_ctx, ObMySQLTransaction& trans); int cancel_pending_pg_tasks(const share::ObTenantBackupTaskInfo& task_info, common::ObISQLClient& trans); diff --git a/src/rootserver/ob_root_balancer.cpp b/src/rootserver/ob_root_balancer.cpp index 36d5c34f73..d2f56b1cbf 100644 --- a/src/rootserver/ob_root_balancer.cpp +++ b/src/rootserver/ob_root_balancer.cpp @@ -329,15 +329,15 @@ int ObRootBalancer::alloc_tablegroup_partitions_for_create(const share::schema:: return ret; } -int ObRootBalancer::standby_alloc_partitions_for_split(const share::schema::ObTableSchema& table, +int ObRootBalancer::standby_alloc_partitions_for_split(const share::schema::ObSimpleTableSchemaV2& table, const common::ObIArray& source_partition_ids, const common::ObIArray& dest_partition_ids, ObITablePartitionAddr& addr) { return replica_creator_.standby_alloc_partitions_for_split(table, source_partition_ids, dest_partition_ids, addr); } -int ObRootBalancer::alloc_partitions_for_create( - const share::schema::ObTableSchema& table, obrpc::ObCreateTableMode create_mode, ObITablePartitionAddr& addr) +int ObRootBalancer::alloc_partitions_for_create(const share::schema::ObSimpleTableSchemaV2& table, + obrpc::ObCreateTableMode create_mode, ObITablePartitionAddr& addr) { int ret = OB_SUCCESS; SpinWLockGuard guard(refresh_unit_replica_cnt_lock_); @@ -355,7 +355,7 @@ int ObRootBalancer::alloc_partitions_for_create( return ret; } -int ObRootBalancer::alloc_table_partitions_for_standby(const share::schema::ObTableSchema& table, +int ObRootBalancer::alloc_table_partitions_for_standby(const share::schema::ObSimpleTableSchemaV2& table, const common::ObIArray& keys, obrpc::ObCreateTableMode create_mode, ObITablePartitionAddr& addr, share::schema::ObSchemaGetterGuard& guard) { diff --git a/src/rootserver/ob_root_balancer.h b/src/rootserver/ob_root_balancer.h index 3279fdac65..18cd652c4c 100644 --- a/src/rootserver/ob_root_balancer.h +++ b/src/rootserver/ob_root_balancer.h @@ -50,7 +50,7 @@ class ObPartitionInfo; class ObPartitionTableOperator; class ObSplitInfo; namespace schema { -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObMultiVersionSchemaService; class ObSchemaGetterGuard; } // namespace schema @@ -137,16 +137,16 @@ public: void check_server_deleting(); virtual int alloc_tablegroup_partitions_for_create(const share::schema::ObTablegroupSchema& tablegroup_schema, const obrpc::ObCreateTableMode create_mode, common::ObIArray& tablegroup_addr); - virtual int alloc_partitions_for_create(const share::schema::ObTableSchema& table, + virtual int alloc_partitions_for_create(const share::schema::ObSimpleTableSchemaV2& table, const obrpc::ObCreateTableMode create_mode, ObITablePartitionAddr& addr); - virtual int alloc_table_partitions_for_standby(const share::schema::ObTableSchema& table, + virtual int alloc_table_partitions_for_standby(const share::schema::ObSimpleTableSchemaV2& table, const common::ObIArray& keys, const obrpc::ObCreateTableMode create_mode, ObITablePartitionAddr& addr, share::schema::ObSchemaGetterGuard& guard); virtual int alloc_tablegroup_partitions_for_standby(const share::schema::ObTablegroupSchema& table_group, const common::ObIArray& keys, const obrpc::ObCreateTableMode create_mode, ObITablePartitionAddr& addr, share::schema::ObSchemaGetterGuard& guard); - virtual int standby_alloc_partitions_for_split(const share::schema::ObTableSchema& table, + virtual int standby_alloc_partitions_for_split(const share::schema::ObSimpleTableSchemaV2& table, const common::ObIArray& source_partition_ids, const common::ObIArray& dest_partition_ids, ObITablePartitionAddr& addr); template diff --git a/src/rootserver/ob_root_utils.cpp b/src/rootserver/ob_root_utils.cpp index 4319659428..eff21d4125 100644 --- a/src/rootserver/ob_root_utils.cpp +++ b/src/rootserver/ob_root_utils.cpp @@ -349,7 +349,7 @@ int ObTenantUtils::remove_ineffective_task(ObMySQLTransaction& trans, const uint return ret; } -bool ObTenantUtils::is_balance_target_schema(const share::schema::ObTableSchema& table_schema) +bool ObTenantUtils::is_balance_target_schema(const share::schema::ObSimpleTableSchemaV2& table_schema) { return USER_TABLE == table_schema.get_table_type() || TMP_TABLE == table_schema.get_table_type() || MATERIALIZED_VIEW == table_schema.get_table_type() || TMP_TABLE_ORA_SESS == table_schema.get_table_type() || diff --git a/src/rootserver/ob_root_utils.h b/src/rootserver/ob_root_utils.h index d0599a16a8..62c3074d35 100644 --- a/src/rootserver/ob_root_utils.h +++ b/src/rootserver/ob_root_utils.h @@ -232,7 +232,7 @@ public: static int check_small_tenant(const uint64_t tenant_id, bool& small_tenant); static int remove_ineffective_task(common::ObMySQLTransaction& trans, const uint64_t tenant_id); - static bool is_balance_target_schema(const share::schema::ObTableSchema& table_schema); + static bool is_balance_target_schema(const share::schema::ObSimpleTableSchemaV2& table_schema); private: static int check_small_tenant_primary_zone_and_locality_condition( diff --git a/src/rootserver/ob_single_partition_balance.cpp b/src/rootserver/ob_single_partition_balance.cpp index 8e35d77d78..d92f8e4c6d 100644 --- a/src/rootserver/ob_single_partition_balance.cpp +++ b/src/rootserver/ob_single_partition_balance.cpp @@ -247,7 +247,7 @@ int ObSinglePartBalance::prepare_replica_capacity(const uint64_t tenant_id, LOG_WARN("not init", KR(ret)); } else { const share::schema::ObTenantSchema* tenant_schema = NULL; - common::ObArray table_schemas; + common::ObArray table_schemas; common::ObArray tablegroup_schemas; common::ObArray non_partition_tg; ObSEArray zone_score_array; @@ -275,7 +275,7 @@ int ObSinglePartBalance::prepare_replica_capacity(const uint64_t tenant_id, LOG_WARN("fail to get table schemas in tenant", KR(ret)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < table_schemas.count(); ++i) { - const share::schema::ObTableSchema* table_schema = table_schemas.at(i); + const share::schema::ObSimpleTableSchemaV2* table_schema = table_schemas.at(i); if (OB_ISNULL(table_schema)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("schema ptr is null", KR(ret)); diff --git a/src/rootserver/ob_single_partition_balance.h b/src/rootserver/ob_single_partition_balance.h index 23dca75f39..e07975b318 100644 --- a/src/rootserver/ob_single_partition_balance.h +++ b/src/rootserver/ob_single_partition_balance.h @@ -24,7 +24,7 @@ class ObPartitionReplica; namespace schema { class ObTenantSchema; class ObTablegroupSchema; -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObSchemaMgr; class ObSchemaGetterGuard; } // namespace schema diff --git a/src/rootserver/ob_single_zone_mode_migrate_replica.h b/src/rootserver/ob_single_zone_mode_migrate_replica.h index 048bfdd1ca..54d17e1330 100644 --- a/src/rootserver/ob_single_zone_mode_migrate_replica.h +++ b/src/rootserver/ob_single_zone_mode_migrate_replica.h @@ -25,7 +25,7 @@ class ObPartitionTableOperator; namespace schema { class ObMultiVersionSchemaService; class ObSchemaGetterGuard; -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObTenantSchema; } // namespace schema } // namespace share diff --git a/src/rootserver/ob_startup_progress_tracker.cpp b/src/rootserver/ob_startup_progress_tracker.cpp index 88449b5569..f4387d09dc 100644 --- a/src/rootserver/ob_startup_progress_tracker.cpp +++ b/src/rootserver/ob_startup_progress_tracker.cpp @@ -148,7 +148,7 @@ int ObStartupProgressTracker::calculate_startup_progress(bool& is_finished) LOG_WARN("table iterator iterate failed", K(ret), K(table_iterator)); } } else { - const ObTableSchema* table_schema = NULL; + const ObSimpleTableSchemaV2* table_schema = NULL; if (OB_FAIL(schema_guard.get_table_schema(table_id, table_schema))) { LOG_WARN("get table schema failed", KT(table_id), K(ret)); } else if (NULL == table_schema) { diff --git a/src/rootserver/virtual_table/ob_all_server_stat.h b/src/rootserver/virtual_table/ob_all_server_stat.h index b0c0d30944..ed9ff25a2a 100644 --- a/src/rootserver/virtual_table/ob_all_server_stat.h +++ b/src/rootserver/virtual_table/ob_all_server_stat.h @@ -22,7 +22,7 @@ namespace oceanbase { namespace share { namespace schema { class ObMultiVersionSchemaService; -class ObTableSchema; +class ObSimpleTableSchemaV2; } // namespace schema } // namespace share namespace rootserver { diff --git a/src/share/ob_leader_election_waiter.cpp b/src/share/ob_leader_election_waiter.cpp index 726b2bdd5c..d47247edbd 100644 --- a/src/share/ob_leader_election_waiter.cpp +++ b/src/share/ob_leader_election_waiter.cpp @@ -96,7 +96,7 @@ int ObLeaderElectionWaiter::wait(const ObTablegroupSchema& tablegroup_schema, co return ret; } -int ObLeaderElectionWaiter::wait(const ObTableSchema& table_schema, const int64_t timeout) +int ObLeaderElectionWaiter::wait(const ObSimpleTableSchemaV2& table_schema, const int64_t timeout) { int ret = OB_SUCCESS; const int64_t start_time = ObTimeUtility::current_time(); diff --git a/src/share/ob_leader_election_waiter.h b/src/share/ob_leader_election_waiter.h index 225fa31c38..5f8bea6999 100644 --- a/src/share/ob_leader_election_waiter.h +++ b/src/share/ob_leader_election_waiter.h @@ -29,7 +29,7 @@ class ObMySQLResult; } // namespace common namespace share { namespace schema { -class ObTableSchema; +class ObSimpleTableSchemaV2; class ObTablegroupSchema; } // namespace schema class ObPartitionTableOperator; @@ -58,7 +58,7 @@ public: int wait(const uint64_t table_id, const int64_t partition_id, const int64_t timeout, common::ObAddr& leader); // when observer finish sending create table rpc to rs, // invoke following function to wait the new table's leader elected - int wait(const share::schema::ObTableSchema& table_schema, const int64_t timeout); + int wait(const share::schema::ObSimpleTableSchemaV2& table_schema, const int64_t timeout); int wait(const share::schema::ObTablegroupSchema& tablegroup_schema, const int64_t timeout); int wait( const common::ObArray& table_ids, const common::ObArray& part_nums, const int64_t timeout); diff --git a/src/share/partition_table/ob_partition_location_cache.cpp b/src/share/partition_table/ob_partition_location_cache.cpp index 7ba83ef738..1f4470f92b 100644 --- a/src/share/partition_table/ob_partition_location_cache.cpp +++ b/src/share/partition_table/ob_partition_location_cache.cpp @@ -2562,7 +2562,7 @@ int ObPartitionLocationCache::get(const uint64_t table_id, ObIArrayget_tenant_schema_guard(tenant_id, schema_guard))) { diff --git a/src/share/partition_table/ob_partition_table_iterator.cpp b/src/share/partition_table/ob_partition_table_iterator.cpp index 1d0b227311..02759bcdbd 100644 --- a/src/share/partition_table/ob_partition_table_iterator.cpp +++ b/src/share/partition_table/ob_partition_table_iterator.cpp @@ -1306,7 +1306,7 @@ int ObFullMetaTableIterator::get_part_num(const uint64_t table_id, int64_t& part { int ret = OB_SUCCESS; ObSchemaGetterGuard guard; - const ObTableSchema* table = NULL; + const ObSimpleTableSchemaV2* table = NULL; const uint64_t tenant_id = extract_tenant_id(table_id); if (!inited_) { ret = OB_NOT_INIT; diff --git a/src/share/schema/ob_schema_utils.cpp b/src/share/schema/ob_schema_utils.cpp index 339da53e63..d7bcafe0e5 100644 --- a/src/share/schema/ob_schema_utils.cpp +++ b/src/share/schema/ob_schema_utils.cpp @@ -303,7 +303,7 @@ int ObSchemaUtils::get_primary_zone_array(common::PageArena<>& alloc, const ObTa return ret; } -int ObSchemaUtils::get_primary_zone_array(common::PageArena<>& alloc, const ObTableSchema& table_schema, +int ObSchemaUtils::get_primary_zone_array(common::PageArena<>& alloc, const ObSimpleTableSchemaV2& table_schema, ObSchemaGetterGuard& schema_guard, common::ObIArray& primary_zone_array) { int ret = OB_SUCCESS; diff --git a/src/share/schema/ob_schema_utils.h b/src/share/schema/ob_schema_utils.h index 5d90a3c168..1cab181157 100644 --- a/src/share/schema/ob_schema_utils.h +++ b/src/share/schema/ob_schema_utils.h @@ -67,7 +67,7 @@ public: } static int add_column_to_table_schema(ObColumnSchemaV2& column, ObTableSchema& table_schema); static int convert_sys_param_to_sysvar_schema(const ObSysParam& sysparam, ObSysVarSchema& sysvar_schema); - static int get_primary_zone_array(common::PageArena<>& alloc, const ObTableSchema& table_schema, + static int get_primary_zone_array(common::PageArena<>& alloc, const ObSimpleTableSchemaV2& table_schema, ObSchemaGetterGuard& schema_guard, common::ObIArray& primary_zone_array); static int get_primary_zone_array(common::PageArena<>& alloc, const ObTablegroupSchema& tg_schema, ObSchemaGetterGuard& schema_guard, common::ObIArray& primary_zone_array);