Skip to content

Commit 29d1fd0

Browse files
zs0wangzelin19961202
authored andcommitted
replace ObTableSchema to ObSimpleTableSchemaV2
1 parent 2b13a66 commit 29d1fd0

38 files changed

+153
-133
lines changed

src/rootserver/ob_alter_locality_checker.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ int ObAlterLocalityChecker::check_alter_locality_finished_by_tenant(const uint64
250250
} else {
251251
for (int64_t i = 0; OB_SUCC(ret) && i < table_ids.count(); ++i) {
252252
bool table_locality_finished = true;
253-
const ObTableSchema* table_schema = NULL;
253+
const ObSimpleTableSchemaV2* table_schema = NULL;
254254
if (OB_FAIL(check_stop())) {
255255
LOG_WARN("root balancer stop", K(ret));
256256
} 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(
504504
* the argument null_locality_table_match is an input/output argument
505505
*/
506506
int ObAlterLocalityChecker::process_single_table(share::schema::ObSchemaGetterGuard& schema_guard,
507-
const share::schema::ObTableSchema& table_schema, const share::schema::ObTenantSchema& tenant_schema,
507+
const share::schema::ObSimpleTableSchemaV2& table_schema, const share::schema::ObTenantSchema& tenant_schema,
508508
const balancer::HashIndexCollection& hash_index_collection, rootserver::TenantBalanceStat& tenant_stat,
509509
bool& null_locality_table_match, bool& table_locality_finished)
510510
{
@@ -654,7 +654,7 @@ int ObAlterLocalityChecker::process_single_non_binding_tablegroup(share::schema:
654654
} else {
655655
for (int64_t i = 0; OB_SUCC(ret) && i < table_ids.count() && tablegroup_locality_finished; ++i) {
656656
bool table_locality_finished = true;
657-
const ObTableSchema* table_schema = NULL;
657+
const ObSimpleTableSchemaV2* table_schema = NULL;
658658
if (OB_FAIL(check_stop())) {
659659
LOG_WARN("root balancer stop", K(ret));
660660
} 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
732732
}
733733

734734
int ObAlterLocalityChecker::process_single_table_under_new_tablegroup(share::schema::ObSchemaGetterGuard& schema_guard,
735-
const share::schema::ObTableSchema& table_schema, const share::schema::ObTablegroupSchema& tablegroup_schema,
735+
const share::schema::ObSimpleTableSchemaV2& table_schema,
736+
const share::schema::ObTablegroupSchema& tablegroup_schema,
736737
const balancer::HashIndexCollection& hash_index_collection, rootserver::TenantBalanceStat& tenant_stat,
737738
bool& table_locality_finished)
738739
{

src/rootserver/ob_alter_locality_checker.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ObPartitionInfo;
2727
namespace schema {
2828
class ObMultiVersionSchemaService;
2929
class ObSchemaGetterGuard;
30-
class ObTableSchema;
30+
class ObSimpleTableSchemaV2;
3131
class ObTenantSchema;
3232
} // namespace schema
3333
} // namespace share
@@ -127,7 +127,7 @@ class ObAlterLocalityChecker {
127127
const balancer::HashIndexCollection& hash_index_collection, rootserver::TenantBalanceStat& tenant_stat,
128128
bool& is_finished);
129129
int process_single_table(share::schema::ObSchemaGetterGuard& schema_guard,
130-
const share::schema::ObTableSchema& table_schema, const share::schema::ObTenantSchema& tenant_schema,
130+
const share::schema::ObSimpleTableSchemaV2& table_schema, const share::schema::ObTenantSchema& tenant_schema,
131131
const balancer::HashIndexCollection& hash_index_collection, rootserver::TenantBalanceStat& tenant_stat,
132132
bool& null_locality_table_finished, bool& table_locality_finished);
133133
int process_single_binding_tablegroup(share::schema::ObSchemaGetterGuard& schema_guard,
@@ -143,7 +143,8 @@ class ObAlterLocalityChecker {
143143
const balancer::HashIndexCollection& hash_index_collection, rootserver::TenantBalanceStat& tenant_stat,
144144
bool& tablegroup_locality_finished);
145145
int process_single_table_under_new_tablegroup(share::schema::ObSchemaGetterGuard& schema_guard,
146-
const share::schema::ObTableSchema& table_schema, const share::schema::ObTablegroupSchema& tablegroup_schema,
146+
const share::schema::ObSimpleTableSchemaV2& table_schema,
147+
const share::schema::ObTablegroupSchema& tablegroup_schema,
147148
const balancer::HashIndexCollection& hash_index_collection, rootserver::TenantBalanceStat& tenant_stat,
148149
bool& table_locality_finished);
149150
int check_stop();

src/rootserver/ob_balance_group_analyzer.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ int ShardGroupAnalyzer::analysis(uint64_t tenant_id)
8787
// 1. Partition function does not require equality
8888
// 2. The number of partitions is not required to be equal
8989
// (this is to ensure that the ShardGroup will not be broken up when adding partitions)
90-
int ShardGroupAnalyzer::build_prefix_key(const ObTableSchema& table, TablePrefixKey& prefix_key)
90+
int ShardGroupAnalyzer::build_prefix_key(const ObSimpleTableSchemaV2& table, TablePrefixKey& prefix_key)
9191
{
9292
int ret = OB_SUCCESS;
9393
const ObString& table_name = table.get_table_name_str();
@@ -100,7 +100,7 @@ int ShardGroupAnalyzer::build_prefix_key(const ObTableSchema& table, TablePrefix
100100
int ShardGroupAnalyzer::build_prefix_map(uint64_t tenant_id, ShardGroupPrefixMap& prefix_map)
101101
{
102102
int ret = OB_SUCCESS;
103-
ObArray<const ObTableSchema*> table_schemas;
103+
ObArray<const ObSimpleTableSchemaV2*> table_schemas;
104104
// In the case of shardgroup, just process standlone table, not process tablegroup
105105
if (OB_FAIL(StatFinderUtil::get_need_balance_table_schemas_in_tenant(schema_guard_, tenant_id, table_schemas))) {
106106
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
109109
for (int64_t i = 0; i < table_schemas.count() && OB_SUCC(ret); ++i) {
110110
ObIArray<TablePrefixValue>* prefix_info_array = NULL;
111111
TablePrefixKey prefix_key;
112-
const ObTableSchema& table = *table_schemas.at(i);
112+
const ObSimpleTableSchemaV2& table = *table_schemas.at(i);
113113
const ObString& table_name = table.get_table_name_str();
114114
if (OB_FAIL(build_prefix_key(table, prefix_key))) {
115115
LOG_WARN("fail extract prefix", K(ret), K(table_name), K(ret));
@@ -415,7 +415,7 @@ int ShardGroupAnalyzer::add_to_shardgroup(ObIArray<TablePrefixValue>& cur_shard,
415415
return ret;
416416
}
417417

418-
int ShardGroupAnalyzer::next(ObIArray<const ObTableSchema*>& schemas)
418+
int ShardGroupAnalyzer::next(ObIArray<const ObSimpleTableSchemaV2*>& schemas)
419419
{
420420
int ret = OB_SUCCESS;
421421
if (cur_shard_group_idx_ >= shard_groups_.count()) {
@@ -586,7 +586,7 @@ int TableGroupAnalyzer::next(const share::schema::ObPartitionSchema*& partition_
586586
int PartitionTableAnalyzer::analysis(const uint64_t tenant_id)
587587
{
588588
int ret = OB_SUCCESS;
589-
common::ObArray<const share::schema::ObTableSchema*> my_table_schemas;
589+
common::ObArray<const share::schema::ObSimpleTableSchemaV2*> my_table_schemas;
590590
if (OB_UNLIKELY(OB_INVALID_ID == tenant_id)) {
591591
ret = OB_INVALID_ARGUMENT;
592592
LOG_WARN("invalid argument", K(ret), K(tenant_id));
@@ -596,7 +596,7 @@ int PartitionTableAnalyzer::analysis(const uint64_t tenant_id)
596596
} else {
597597
table_schemas_.reset();
598598
for (int64_t i = 0; OB_SUCC(ret) && i < my_table_schemas.count(); ++i) {
599-
const share::schema::ObTableSchema* table_schema = my_table_schemas.at(i);
599+
const share::schema::ObSimpleTableSchemaV2* table_schema = my_table_schemas.at(i);
600600
int64_t part_num = 0;
601601
if (OB_UNLIKELY(nullptr == table_schema)) {
602602
ret = OB_ERR_UNEXPECTED;
@@ -621,7 +621,7 @@ int PartitionTableAnalyzer::analysis(const uint64_t tenant_id)
621621
return ret;
622622
}
623623

624-
int PartitionTableAnalyzer::next(const share::schema::ObTableSchema*& table_schema)
624+
int PartitionTableAnalyzer::next(const share::schema::ObSimpleTableSchemaV2*& table_schema)
625625
{
626626
int ret = OB_SUCCESS;
627627
table_schema = nullptr;
@@ -636,7 +636,7 @@ int PartitionTableAnalyzer::next(const share::schema::ObTableSchema*& table_sche
636636
int NonPartitionTableAnalyzer::analysis(const uint64_t tenant_id)
637637
{
638638
int ret = OB_SUCCESS;
639-
common::ObArray<const share::schema::ObTableSchema*> table_schemas;
639+
common::ObArray<const share::schema::ObSimpleTableSchemaV2*> table_schemas;
640640
common::ObArray<const share::schema::ObTablegroupSchema*> tg_schemas;
641641
common::ObArray<const share::schema::ObPartitionSchema*> target_schemas;
642642
if (OB_UNLIKELY(OB_INVALID_ID == tenant_id)) {
@@ -649,7 +649,7 @@ int NonPartitionTableAnalyzer::analysis(const uint64_t tenant_id)
649649
LOG_WARN("fail to get tablegroup schemas in tenant", K(ret), K(tenant_id));
650650
} else {
651651
for (int64_t i = 0; OB_SUCC(ret) && i < table_schemas.count(); ++i) {
652-
const ObTableSchema* schema = table_schemas.at(i);
652+
const ObSimpleTableSchemaV2* schema = table_schemas.at(i);
653653
int64_t part_num = 0;
654654
if (OB_UNLIKELY(NULL == schema)) {
655655
ret = OB_ERR_UNEXPECTED;

src/rootserver/ob_balance_group_analyzer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace oceanbase {
2525

2626
namespace share {
2727
namespace schema {
28-
class ObTableSchema;
28+
class ObSimpleTableSchemaV2;
2929
class ObSchemaGetterGuard;
3030
} // namespace schema
3131
} // namespace share
@@ -63,7 +63,7 @@ class TablePrefixValue {
6363
public:
6464
uint64_t tablegroup_id_;
6565
uint64_t table_id_;
66-
const share::schema::ObTableSchema* schema_;
66+
const share::schema::ObSimpleTableSchemaV2* schema_;
6767
TO_STRING_KV(K_(tablegroup_id), K_(table_id));
6868
};
6969

@@ -91,7 +91,7 @@ class ShardGroupAnalyzer {
9191
// Iterate the ShardGroup.
9292
// Note: If there are multiple tables belonging to the same table group,
9393
// only the primary table in the table group is taken as a representative and stored in tids
94-
int next(common::ObIArray<const share::schema::ObTableSchema*>& schemas);
94+
int next(common::ObIArray<const share::schema::ObSimpleTableSchemaV2*>& schemas);
9595

9696
private:
9797
int build_prefix_map(uint64_t tenant_id, ShardGroupPrefixMap& prefix_map);
@@ -101,7 +101,7 @@ class ShardGroupAnalyzer {
101101
int add_to_shardgroup(common::ObIArray<TablePrefixValue>& cur_shard, int64_t cur_shard_idx,
102102
common::hash::ObHashMap<uint64_t, int64_t>& shardgroup_map, common::ObIArray<ShardGroup*>& shardgroups);
103103
int extract_table_name_prefix(const common::ObString& table, TablePrefixKey& prefix_info);
104-
int build_prefix_key(const share::schema::ObTableSchema& table, TablePrefixKey& prefix_key);
104+
int build_prefix_key(const share::schema::ObSimpleTableSchemaV2& table, TablePrefixKey& prefix_key);
105105

106106
private:
107107
share::schema::ObSchemaGetterGuard& schema_guard_;
@@ -153,14 +153,14 @@ class PartitionTableAnalyzer {
153153
cur_table_idx_(0)
154154
{}
155155
int analysis(const uint64_t tenant_id);
156-
int next(const share::schema::ObTableSchema*& table_schema);
156+
int next(const share::schema::ObSimpleTableSchemaV2*& table_schema);
157157

158158
private:
159159
share::schema::ObSchemaGetterGuard& schema_guard_;
160160
ITenantStatFinder& stat_finder_;
161161
common::ObIAllocator& allocator_;
162162
common::hash::ObHashSet<uint64_t>& processed_tids_;
163-
common::ObArray<const share::schema::ObTableSchema*> table_schemas_;
163+
common::ObArray<const share::schema::ObSimpleTableSchemaV2*> table_schemas_;
164164
int64_t cur_table_idx_;
165165
};
166166

0 commit comments

Comments
 (0)