Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
知世而放
oceanbase
提交
29d1fd04
O
oceanbase
项目概览
知世而放
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
29d1fd04
编写于
9月 02, 2021
作者:
Z
zs0
提交者:
wangzelin.wzl
9月 02, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
replace ObTableSchema to ObSimpleTableSchemaV2
上级
2b13a66b
变更
38
隐藏空白更改
内联
并排
Showing
38 changed file
with
153 addition
and
133 deletion
+153
-133
src/rootserver/ob_alter_locality_checker.cpp
src/rootserver/ob_alter_locality_checker.cpp
+5
-4
src/rootserver/ob_alter_locality_checker.h
src/rootserver/ob_alter_locality_checker.h
+4
-3
src/rootserver/ob_balance_group_analyzer.cpp
src/rootserver/ob_balance_group_analyzer.cpp
+9
-9
src/rootserver/ob_balance_group_analyzer.h
src/rootserver/ob_balance_group_analyzer.h
+6
-6
src/rootserver/ob_balance_group_container.cpp
src/rootserver/ob_balance_group_container.cpp
+42
-32
src/rootserver/ob_balance_group_container.h
src/rootserver/ob_balance_group_container.h
+22
-16
src/rootserver/ob_balance_info.cpp
src/rootserver/ob_balance_info.cpp
+3
-3
src/rootserver/ob_balancer_interface.cpp
src/rootserver/ob_balancer_interface.cpp
+3
-3
src/rootserver/ob_balancer_interface.h
src/rootserver/ob_balancer_interface.h
+2
-2
src/rootserver/ob_locality_checker.cpp
src/rootserver/ob_locality_checker.cpp
+2
-2
src/rootserver/ob_locality_checker.h
src/rootserver/ob_locality_checker.h
+1
-1
src/rootserver/ob_locality_util.h
src/rootserver/ob_locality_util.h
+1
-1
src/rootserver/ob_partition_disk_balancer.h
src/rootserver/ob_partition_disk_balancer.h
+1
-1
src/rootserver/ob_partition_leader_count_balancer.cpp
src/rootserver/ob_partition_leader_count_balancer.cpp
+1
-1
src/rootserver/ob_partition_leader_count_balancer.h
src/rootserver/ob_partition_leader_count_balancer.h
+1
-1
src/rootserver/ob_partition_spliter.cpp
src/rootserver/ob_partition_spliter.cpp
+1
-1
src/rootserver/ob_partition_spliter.h
src/rootserver/ob_partition_spliter.h
+3
-2
src/rootserver/ob_partition_table_util.cpp
src/rootserver/ob_partition_table_util.cpp
+1
-1
src/rootserver/ob_rebalance_task.cpp
src/rootserver/ob_rebalance_task.cpp
+1
-1
src/rootserver/ob_replica_creator.cpp
src/rootserver/ob_replica_creator.cpp
+8
-8
src/rootserver/ob_replica_creator.h
src/rootserver/ob_replica_creator.h
+7
-6
src/rootserver/ob_root_backup.cpp
src/rootserver/ob_root_backup.cpp
+4
-4
src/rootserver/ob_root_backup.h
src/rootserver/ob_root_backup.h
+2
-2
src/rootserver/ob_root_balancer.cpp
src/rootserver/ob_root_balancer.cpp
+4
-4
src/rootserver/ob_root_balancer.h
src/rootserver/ob_root_balancer.h
+4
-4
src/rootserver/ob_root_utils.cpp
src/rootserver/ob_root_utils.cpp
+1
-1
src/rootserver/ob_root_utils.h
src/rootserver/ob_root_utils.h
+1
-1
src/rootserver/ob_single_partition_balance.cpp
src/rootserver/ob_single_partition_balance.cpp
+2
-2
src/rootserver/ob_single_partition_balance.h
src/rootserver/ob_single_partition_balance.h
+1
-1
src/rootserver/ob_single_zone_mode_migrate_replica.h
src/rootserver/ob_single_zone_mode_migrate_replica.h
+1
-1
src/rootserver/ob_startup_progress_tracker.cpp
src/rootserver/ob_startup_progress_tracker.cpp
+1
-1
src/rootserver/virtual_table/ob_all_server_stat.h
src/rootserver/virtual_table/ob_all_server_stat.h
+1
-1
src/share/ob_leader_election_waiter.cpp
src/share/ob_leader_election_waiter.cpp
+1
-1
src/share/ob_leader_election_waiter.h
src/share/ob_leader_election_waiter.h
+2
-2
src/share/partition_table/ob_partition_location_cache.cpp
src/share/partition_table/ob_partition_location_cache.cpp
+1
-1
src/share/partition_table/ob_partition_table_iterator.cpp
src/share/partition_table/ob_partition_table_iterator.cpp
+1
-1
src/share/schema/ob_schema_utils.cpp
src/share/schema/ob_schema_utils.cpp
+1
-1
src/share/schema/ob_schema_utils.h
src/share/schema/ob_schema_utils.h
+1
-1
未找到文件。
src/rootserver/ob_alter_locality_checker.cpp
浏览文件 @
29d1fd04
...
...
@@ -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
Ob
TableSchema
*
table_schema
=
NULL
;
const
Ob
SimpleTableSchemaV2
*
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
::
Ob
TableSchema
&
table_schema
,
const
share
::
schema
::
ObTenantSchema
&
tenant_schema
,
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
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
Ob
TableSchema
*
table_schema
=
NULL
;
const
Ob
SimpleTableSchemaV2
*
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
)
{
...
...
src/rootserver/ob_alter_locality_checker.h
浏览文件 @
29d1fd04
...
...
@@ -27,7 +27,7 @@ class ObPartitionInfo;
namespace
schema
{
class
ObMultiVersionSchemaService
;
class
ObSchemaGetterGuard
;
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
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
::
Ob
TableSchema
&
table_schema
,
const
share
::
schema
::
ObTenantSchema
&
tenant_schema
,
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
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
();
...
...
src/rootserver/ob_balance_group_analyzer.cpp
浏览文件 @
29d1fd04
...
...
@@ -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
Ob
TableSchema
&
table
,
TablePrefixKey
&
prefix_key
)
int
ShardGroupAnalyzer
::
build_prefix_key
(
const
Ob
SimpleTableSchemaV2
&
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
<
const
Ob
TableSchema
*>
table_schemas
;
ObArray
<
const
Ob
SimpleTableSchemaV2
*>
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
<
TablePrefixValue
>*
prefix_info_array
=
NULL
;
TablePrefixKey
prefix_key
;
const
Ob
TableSchema
&
table
=
*
table_schemas
.
at
(
i
);
const
Ob
SimpleTableSchemaV2
&
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<TablePrefixValue>& cur_shard,
return
ret
;
}
int
ShardGroupAnalyzer
::
next
(
ObIArray
<
const
Ob
TableSchema
*>&
schemas
)
int
ShardGroupAnalyzer
::
next
(
ObIArray
<
const
Ob
SimpleTableSchemaV2
*>&
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
<
const
share
::
schema
::
Ob
TableSchema
*>
my_table_schemas
;
common
::
ObArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>
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
::
Ob
TableSchema
*
table_schema
=
my_table_schemas
.
at
(
i
);
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
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
::
Ob
TableSchema
*&
table_schema
)
int
PartitionTableAnalyzer
::
next
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*&
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
<
const
share
::
schema
::
Ob
TableSchema
*>
table_schemas
;
common
::
ObArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>
table_schemas
;
common
::
ObArray
<
const
share
::
schema
::
ObTablegroupSchema
*>
tg_schemas
;
common
::
ObArray
<
const
share
::
schema
::
ObPartitionSchema
*>
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
Ob
TableSchema
*
schema
=
table_schemas
.
at
(
i
);
const
Ob
SimpleTableSchemaV2
*
schema
=
table_schemas
.
at
(
i
);
int64_t
part_num
=
0
;
if
(
OB_UNLIKELY
(
NULL
==
schema
))
{
ret
=
OB_ERR_UNEXPECTED
;
...
...
src/rootserver/ob_balance_group_analyzer.h
浏览文件 @
29d1fd04
...
...
@@ -25,7 +25,7 @@ namespace oceanbase {
namespace
share
{
namespace
schema
{
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
class
ObSchemaGetterGuard
;
}
// namespace schema
}
// namespace share
...
...
@@ -63,7 +63,7 @@ class TablePrefixValue {
public:
uint64_t
tablegroup_id_
;
uint64_t
table_id_
;
const
share
::
schema
::
Ob
TableSchema
*
schema_
;
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
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
<
const
share
::
schema
::
Ob
TableSchema
*>&
schemas
);
int
next
(
common
::
ObIArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
schemas
);
private:
int
build_prefix_map
(
uint64_t
tenant_id
,
ShardGroupPrefixMap
&
prefix_map
);
...
...
@@ -101,7 +101,7 @@ private:
int
add_to_shardgroup
(
common
::
ObIArray
<
TablePrefixValue
>&
cur_shard
,
int64_t
cur_shard_idx
,
common
::
hash
::
ObHashMap
<
uint64_t
,
int64_t
>&
shardgroup_map
,
common
::
ObIArray
<
ShardGroup
*>&
shardgroups
);
int
extract_table_name_prefix
(
const
common
::
ObString
&
table
,
TablePrefixKey
&
prefix_info
);
int
build_prefix_key
(
const
share
::
schema
::
Ob
TableSchema
&
table
,
TablePrefixKey
&
prefix_key
);
int
build_prefix_key
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
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
::
Ob
TableSchema
*&
table_schema
);
int
next
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*&
table_schema
);
private:
share
::
schema
::
ObSchemaGetterGuard
&
schema_guard_
;
ITenantStatFinder
&
stat_finder_
;
common
::
ObIAllocator
&
allocator_
;
common
::
hash
::
ObHashSet
<
uint64_t
>&
processed_tids_
;
common
::
ObArray
<
const
share
::
schema
::
Ob
TableSchema
*>
table_schemas_
;
common
::
ObArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>
table_schemas_
;
int64_t
cur_table_idx_
;
};
...
...
src/rootserver/ob_balance_group_container.cpp
浏览文件 @
29d1fd04
...
...
@@ -65,11 +65,11 @@ int PartitionSchemaChecker::check_same_primary_zone(
}
int
PartitionSchemaChecker
::
check_same_primary_zone
(
const
common
::
ObIArray
<
const
share
::
schema
::
Ob
TableSchema
*>&
table_schemas
,
const
common
::
ObIArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
table_schemas
,
share
::
schema
::
ObSchemaGetterGuard
&
schema_guard
,
bool
&
same
)
{
int
ret
=
OB_SUCCESS
;
const
share
::
schema
::
Ob
TableSchema
*
sample
=
nullptr
;
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
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
::
Ob
TableSchema
*
ref
=
table_schemas
.
at
(
i
);
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
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
<
const
share
::
schema
::
Ob
TableSchema
*>&
schemas
)
common
::
ObIArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
schemas
)
{
bool
bret
=
false
;
if
(
schemas
.
count
()
>
0
&&
NULL
!=
schemas
.
at
(
0
))
{
const
share
::
schema
::
Ob
TableSchema
&
schema
=
*
schemas
.
at
(
0
);
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
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
<
const
Ob
TableSchema
*>&
tables
,
bool
&
compatible
,
ObSchemaGetterGuard
&
schema_guard
,
const
ObIArray
<
const
Ob
SimpleTableSchemaV2
*>&
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
Ob
TableSchema
*
first_table_schema
=
tables
.
at
(
0
);
const
Ob
SimpleTableSchemaV2
*
first_table_schema
=
tables
.
at
(
0
);
ARRAY_FOREACH_X
(
tables
,
idx
,
cnt
,
OB_SUCC
(
ret
)
&&
compatible
)
{
const
Ob
TableSchema
*
table_schema
=
tables
.
at
(
idx
);
const
Ob
SimpleTableSchemaV2
*
table_schema
=
tables
.
at
(
idx
);
uint64_t
tablegroup_id
=
table_schema
->
get_tablegroup_id
();
bool
same
=
false
;
if
(
OB_INVALID_ID
!=
tablegroup_id
)
{
ObArray
<
const
Ob
TableSchema
*>
tg_tables
;
ObArray
<
const
Ob
SimpleTableSchemaV2
*>
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
Ob
TableSchema
*
table_schema
=
nullptr
;
const
Ob
SimpleTableSchemaV2
*
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
::
Ob
TableSchema
*
left
,
const
share
::
schema
::
ObTableSchema
*
right
)
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
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
<
const
Ob
TableSchema
*>
shardgroup_table_schemas
;
ObArray
<
const
Ob
SimpleTableSchemaV2
*>
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
<
const
share
::
schema
::
Ob
TableSchema
*>&
shardgroup_schemas
)
common
::
ObArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
shardgroup_schemas
)
{
int
ret
=
OB_SUCCESS
;
common
::
ObZone
integrated_primary_zone
;
bool
primary_zone_match
=
true
;
const
share
::
schema
::
Ob
TableSchema
*
sample_schema
=
nullptr
;
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
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
::
Ob
TableSchema
&
table_schema
)
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
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
<
const
share
::
schema
::
Ob
TableSchema
*>&
shardgroup_schemas
,
const
bool
primary_zone_match
,
common
::
ObArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
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
::
Ob
TableSchema
*
table_schema
=
shardgroup_schemas
.
at
(
i
);
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
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
<
const
share
::
schema
::
Ob
TableSchema
*>&
shardgroup_schemas
,
const
bool
primary_zone_match
,
common
::
ObArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
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
::
Ob
TableSchema
*
table_schema
=
shardgroup_schemas
.
at
(
i
);
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
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
::
Ob
TableSchema
*
table_schema
=
shardgroup_schemas
.
at
(
i
);
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
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
;
...
...
src/rootserver/ob_balance_group_container.h
浏览文件 @
29d1fd04
...
...
@@ -31,7 +31,7 @@ namespace oceanbase {
namespace
share
{
namespace
schema
{
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
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
<
const
share
::
schema
::
ObPartitionSchema
*>&
partition_schemas
,
share
::
schema
::
ObSchemaGetterGuard
&
schema_guard
,
bool
&
same
);
static
int
check_same_primary_zone
(
const
common
::
ObIArray
<
const
share
::
schema
::
ObTableSchema
*>&
partition_schemas
,
static
int
check_same_primary_zone
(
const
common
::
ObIArray
<
const
share
::
schema
::
ObSimpleTableSchemaV2
*>&
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
<
const
share
::
schema
::
ObTableSchema
*>&
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
<
const
share
::
schema
::
ObSimpleTableSchemaV2
*>&
schemas
);
};
class
ShardGroupValidator
{
public:
static
int
check_table_schemas_compatible
(
ITenantStatFinder
&
stat_finder
,
share
::
schema
::
ObSchemaGetterGuard
&
schema_guard
,
const
common
::
ObIArray
<
const
share
::
schema
::
Ob
TableSchema
*>&
tables
,
bool
&
compatible
,
const
common
::
ObIArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
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
::
Ob
TableSchema
*
table_schema
);
int
build_partition_table_container
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
table_schema
);
};
class
NonPartitionTableContainerBuilder
:
public
IBalanceGroupContainerBuilder
{
...
...
@@ -178,29 +183,30 @@ private:
typedef
common
::
hash
::
ObHashMap
<
common
::
ObRowkey
,
SameRangeArray
*>
SameRangeMap
;
class
TableSchemaPartitionCntCmp
{
public:
TableSchemaPartitionCntCmp
(
common
::
ObArray
<
const
share
::
schema
::
Ob
TableSchema
*>&
shardgroup_schemas
)
TableSchemaPartitionCntCmp
(
common
::
ObArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
shardgroup_schemas
)
:
shardgroup_schemas_
(
shardgroup_schemas
),
ret_
(
common
::
OB_SUCCESS
)
{}
int
sort
();
public:
bool
operator
()(
const
share
::
schema
::
Ob
TableSchema
*
l
,
const
share
::
schema
::
ObTableSchema
*
r
);
bool
operator
()(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
l
,
const
share
::
schema
::
ObSimpleTableSchemaV2
*
r
);
private:
common
::
ObArray
<
const
share
::
schema
::
Ob
TableSchema
*>&
shardgroup_schemas_
;
common
::
ObArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
shardgroup_schemas_
;
int
ret_
;
};
private:
int
build_shardgroup_container
(
common
::
ObArray
<
const
share
::
schema
::
ObTableSchema
*>&
shardgroup_table_schemas
);
int
build_shardgroup_container
(
common
::
ObArray
<
const
share
::
schema
::
ObSimpleTableSchemaV2
*>&
shardgroup_table_schemas
);
int
build_one_level_range_shard_partition_container
(
common
::
ObArray
<
const
share
::
schema
::
Ob
TableSchema
*>&
shardgroup_table_schemas
,
const
bool
primary_zone_match
,
const
common
::
ObZone
&
integrated_primary_zone
);
common
::
ObArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
shardgroup_table_schemas
,
const
bool
primary_zone_match
,
const
common
::
ObZone
&
integrated_primary_zone
);
int
build_shardgroup_partition_container
(
common
::
ObArray
<
const
share
::
schema
::
Ob
TableSchema
*>&
shargroup_table_schemas
,
const
bool
primary_zone_match
,
const
common
::
ObZone
&
integrated_primary_zone
);
common
::
ObArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
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
::
Ob
TableSchema
&
table_schema
);
const
int64_t
part_idx
,
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
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
,
...
...
src/rootserver/ob_balance_info.cpp
浏览文件 @
29d1fd04
...
...
@@ -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
Ob
TableSchema
*
table_schema
=
nullptr
;
const
Ob
SimpleTableSchemaV2
*
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
Ob
TableSchema
*
table_schema
=
nullptr
;
const
Ob
SimpleTableSchemaV2
*
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
Ob
TableSchema
*
table_schema
=
nullptr
;
const
Ob
SimpleTableSchemaV2
*
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
))
{
...
...
src/rootserver/ob_balancer_interface.cpp
浏览文件 @
29d1fd04
...
...
@@ -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
Ob
TableSchema
*
schema
=
nullptr
;
const
Ob
SimpleTableSchemaV2
*
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
<
const
share
::
schema
::
Ob
TableSchema
*>&
tables
)
uint64_t
tenant_id
,
common
::
ObIArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
tables
)
{
int
ret
=
OB_SUCCESS
;
ObArray
<
uint64_t
>
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
Ob
TableSchema
*
schema
=
NULL
;
const
Ob
SimpleTableSchemaV2
*
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
))
{
...
...
src/rootserver/ob_balancer_interface.h
浏览文件 @
29d1fd04
...
...
@@ -21,7 +21,7 @@ namespace oceanbase {
namespace
share
{
namespace
schema
{
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
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
<
const
share
::
schema
::
Ob
TableSchema
*>&
tables
);
uint64_t
tenant_id
,
common
::
ObIArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>&
tables
);
};
class
IUnitProvider
{
...
...
src/rootserver/ob_locality_checker.cpp
浏览文件 @
29d1fd04
...
...
@@ -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
Ob
TableSchema
*
table_schema
=
NULL
;
const
Ob
SimpleTableSchemaV2
*
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
Ob
TableSchema
*
table_schema
=
nullptr
;
const
Ob
SimpleTableSchemaV2
*
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
))
{
...
...
src/rootserver/ob_locality_checker.h
浏览文件 @
29d1fd04
...
...
@@ -22,7 +22,7 @@ namespace oceanbase {
namespace
share
{
class
ObPartitionInfo
;
namespace
schema
{
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
class
ObMultiVersionSchemaService
;
}
// namespace schema
}
// namespace share
...
...
src/rootserver/ob_locality_util.h
浏览文件 @
29d1fd04
...
...
@@ -31,7 +31,7 @@ namespace schema {
class
ObZoneRegion
;
class
ObSchemaGetterGuard
;
class
ObLocality
;
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
class
ObTablegroupSchema
;
class
ObTenantSchema
;
class
ObDatabaseSchema
;
...
...
src/rootserver/ob_partition_disk_balancer.h
浏览文件 @
29d1fd04
...
...
@@ -22,7 +22,7 @@ namespace oceanbase {
namespace
share
{
namespace
schema
{
class
ObMultiVersionSchemaService
;
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
class
ObSchemaGetterGuard
;
}
// namespace schema
}
// namespace share
...
...
src/rootserver/ob_partition_leader_count_balancer.cpp
浏览文件 @
29d1fd04
...
...
@@ -408,7 +408,7 @@ int PartitionLeaderCountBalancer::do_update_map_item_replica_attributes(SquareId
common
::
ObSEArray
<
share
::
ObZoneReplicaAttrSet
,
7
>
designated_zone_locality
;
bool
compensate_readonly_all_server
=
false
;
if
(
!
is_tablegroup_id
(
schema_id
))
{
const
Ob
TableSchema
*
table_schema
=
nullptr
;
const
Ob
SimpleTableSchemaV2
*
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
))
{
...
...
src/rootserver/ob_partition_leader_count_balancer.h
浏览文件 @
29d1fd04
...
...
@@ -22,7 +22,7 @@ namespace oceanbase {
namespace
share
{
namespace
schema
{
class
ObMultiVersionSchemaService
;
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
class
ObSchemaGetterGuard
;
}
// namespace schema
}
// namespace share
...
...
src/rootserver/ob_partition_spliter.cpp
浏览文件 @
29d1fd04
...
...
@@ -194,7 +194,7 @@ int ObPartitionSpliter::try_split_partition()
/////////////////////////////////////////////
int
ObPartitionSplitExecutor
::
split_table_partition
(
const
share
::
schema
::
Ob
TableSchema
&
schema
,
int
ObPartitionSplitExecutor
::
split_table_partition
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
schema
,
share
::
ObPartitionTableOperator
&
pt_operator
,
obrpc
::
ObSrvRpcProxy
&
rpc_proxy
,
ObSplitPartitionArg
&
arg
,
ObSplitProgress
&
split_process
)
{
...
...
src/rootserver/ob_partition_spliter.h
浏览文件 @
29d1fd04
...
...
@@ -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
);
...
...
src/rootserver/ob_partition_table_util.cpp
浏览文件 @
29d1fd04
...
...
@@ -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
::
Ob
TableSchema
*
table_schema
=
nullptr
;
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
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
)
{
...
...
src/rootserver/ob_rebalance_task.cpp
浏览文件 @
29d1fd04
...
...
@@ -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
::
Ob
TableSchema
*
schema
=
NULL
;
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
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
))
{
...
...
src/rootserver/ob_replica_creator.cpp
浏览文件 @
29d1fd04
...
...
@@ -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
Ob
TableSchema
&
table
,
obrpc
::
ObCreateTableMode
create_mod
e
,
ObITablePartitionAddr
&
addr
,
ObIArray
<
TenantUnitRepCnt
*>&
ten_unit_arr
)
int
ObReplicaCreator
::
alloc_partitions_for_create
(
const
Ob
SimpleTableSchemaV2
&
tabl
e
,
obrpc
::
ObCreateTableMode
create_mode
,
ObITablePartitionAddr
&
addr
,
ObIArray
<
TenantUnitRepCnt
*>&
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
Ob
TableSchema
&
table
,
ObITablePartitionAddr
&
addr
)
int
ObReplicaCreator
::
get_pg_partitions
(
const
Ob
SimpleTableSchemaV2
&
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
::
Ob
TableSchema
&
table_schema
,
share
::
schema
::
ObSchemaGetterGuard
&
schema_guard
,
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
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
Ob
TableSchema
*
table
=
NULL
;
const
Ob
SimpleTableSchemaV2
*
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
Ob
TableSchema
*
table
=
NULL
;
const
Ob
SimpleTableSchemaV2
*
table
=
NULL
;
ObReplicaFilterHolder
filter
;
ObSchemaGetterGuard
schema_guard
;
ObArray
<
uint64_t
>
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
::
Ob
TableSchema
&
table
,
int
ObReplicaCreator
::
standby_alloc_partitions_for_split
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
table
,
const
common
::
ObIArray
<
int64_t
>&
source_part_ids
,
const
common
::
ObIArray
<
int64_t
>&
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
::
Ob
TableSchema
&
schema
,
int
ObReplicaCreator
::
alloc_table_partitions_for_standby
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
schema
,
const
common
::
ObIArray
<
ObPartitionKey
>&
keys
,
obrpc
::
ObCreateTableMode
create_mode
,
ObITablePartitionAddr
&
addr
,
share
::
schema
::
ObSchemaGetterGuard
&
guard
)
{
...
...
src/rootserver/ob_replica_creator.h
浏览文件 @
29d1fd04
...
...
@@ -67,8 +67,9 @@ public:
const
obrpc
::
ObCreateTableMode
create_mode
,
common
::
ObIArray
<
ObPartitionAddr
>&
tablegroup_addr
,
ObIArray
<
share
::
TenantUnitRepCnt
*>&
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
<
share
::
TenantUnitRepCnt
*>&
ten_unit_arr
);
int
alloc_partitions_for_create
(
const
share
::
schema
::
ObSimpleTableSchemaV2
&
table
,
obrpc
::
ObCreateTableMode
create_mode
,
ObITablePartitionAddr
&
addr
,
ObIArray
<
share
::
TenantUnitRepCnt
*>&
ten_unit_arr
);
// add partition for add partition
template
<
typename
SCHEMA
>
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
::
Ob
TableSchema
&
table
,
int
standby_alloc_partitions_for_split
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
table
,
const
common
::
ObIArray
<
int64_t
>&
source_part_ids
,
const
common
::
ObIArray
<
int64_t
>&
dest_partition_ids
,
ObITablePartitionAddr
&
addr
);
int
alloc_table_partitions_for_standby
(
const
share
::
schema
::
Ob
TableSchema
&
table
,
int
alloc_table_partitions_for_standby
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
table
,
const
common
::
ObIArray
<
ObPartitionKey
>&
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
<
common
::
ObZone
>&
high_priority_zone_array
,
common
::
ObSEArray
<
share
::
ObRawPrimaryZoneUtil
::
ZoneScore
,
MAX_ZONE_NUM
>&
zone_score_array
);
int
get_pg_partitions
(
const
share
::
schema
::
Ob
TableSchema
&
table
,
ObITablePartitionAddr
&
addr
);
int
get_pg_partitions
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
table
,
ObITablePartitionAddr
&
addr
);
int
init_addr_allocator_parameter
(
const
share
::
schema
::
ObPartitionSchema
&
partition_schema
,
const
obrpc
::
ObCreateTableMode
create_mode
,
ObIArray
<
common
::
ObZone
>&
zone_list
,
ZoneUnitArray
&
unit_pool
,
ObIArray
<
share
::
ObZoneReplicaAttrSet
>&
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
::
Ob
TableSchema
&
table
,
const
int64_t
replica_num
,
ObPartitionAddr
&
addr
);
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
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.
...
...
src/rootserver/ob_root_backup.cpp
浏览文件 @
29d1fd04
...
...
@@ -2661,7 +2661,7 @@ int ObTenantBackup::generate_standalone_backup_task(const share::ObTenantBackupT
int
ret
=
OB_SUCCESS
;
ObSchemaGetterGuard
schema_guard
;
ObArray
<
uint64_t
>
table_ids
;
const
Ob
TableSchema
*
table_schema
=
NULL
;
const
Ob
SimpleTableSchemaV2
*
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
<
uint64_t
>
table_ids
;
const
Ob
TableSchema
*
table_schema
=
NULL
;
const
Ob
SimpleTableSchemaV2
*
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
Ob
TableSchema
*
table_schema
=
NULL
;
const
Ob
SimpleTableSchemaV2
*
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
::
Ob
TableSchema
*
table_schema
,
bool
&
need_backup
)
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
table_schema
,
bool
&
need_backup
)
{
int
ret
=
OB_SUCCESS
;
ObIndexStatus
status
;
...
...
src/rootserver/ob_root_backup.h
浏览文件 @
29d1fd04
...
...
@@ -42,7 +42,7 @@ class ObPartitionTableOperator;
class
ObIBackupLeaseService
;
namespace
schema
{
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
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
::
Ob
TableSchema
*
table_schema
,
bool
&
need_backup
);
int
check_standalone_table_need_backup
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
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
);
...
...
src/rootserver/ob_root_balancer.cpp
浏览文件 @
29d1fd04
...
...
@@ -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
::
Ob
TableSchema
&
table
,
int
ObRootBalancer
::
standby_alloc_partitions_for_split
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
table
,
const
common
::
ObIArray
<
int64_t
>&
source_partition_ids
,
const
common
::
ObIArray
<
int64_t
>&
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
::
Ob
TableSchema
&
table
,
int
ObRootBalancer
::
alloc_table_partitions_for_standby
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
table
,
const
common
::
ObIArray
<
ObPartitionKey
>&
keys
,
obrpc
::
ObCreateTableMode
create_mode
,
ObITablePartitionAddr
&
addr
,
share
::
schema
::
ObSchemaGetterGuard
&
guard
)
{
...
...
src/rootserver/ob_root_balancer.h
浏览文件 @
29d1fd04
...
...
@@ -50,7 +50,7 @@ class ObPartitionInfo;
class
ObPartitionTableOperator
;
class
ObSplitInfo
;
namespace
schema
{
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
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
<
ObPartitionAddr
>&
tablegroup_addr
);
virtual
int
alloc_partitions_for_create
(
const
share
::
schema
::
Ob
TableSchema
&
table
,
virtual
int
alloc_partitions_for_create
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
table
,
const
obrpc
::
ObCreateTableMode
create_mode
,
ObITablePartitionAddr
&
addr
);
virtual
int
alloc_table_partitions_for_standby
(
const
share
::
schema
::
Ob
TableSchema
&
table
,
virtual
int
alloc_table_partitions_for_standby
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
table
,
const
common
::
ObIArray
<
ObPartitionKey
>&
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
<
ObPartitionKey
>&
keys
,
const
obrpc
::
ObCreateTableMode
create_mode
,
ObITablePartitionAddr
&
addr
,
share
::
schema
::
ObSchemaGetterGuard
&
guard
);
virtual
int
standby_alloc_partitions_for_split
(
const
share
::
schema
::
Ob
TableSchema
&
table
,
virtual
int
standby_alloc_partitions_for_split
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
table
,
const
common
::
ObIArray
<
int64_t
>&
source_partition_ids
,
const
common
::
ObIArray
<
int64_t
>&
dest_partition_ids
,
ObITablePartitionAddr
&
addr
);
template
<
typename
SCHEMA
>
...
...
src/rootserver/ob_root_utils.cpp
浏览文件 @
29d1fd04
...
...
@@ -349,7 +349,7 @@ int ObTenantUtils::remove_ineffective_task(ObMySQLTransaction& trans, const uint
return
ret
;
}
bool
ObTenantUtils
::
is_balance_target_schema
(
const
share
::
schema
::
Ob
TableSchema
&
table_schema
)
bool
ObTenantUtils
::
is_balance_target_schema
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
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
()
||
...
...
src/rootserver/ob_root_utils.h
浏览文件 @
29d1fd04
...
...
@@ -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
::
Ob
TableSchema
&
table_schema
);
static
bool
is_balance_target_schema
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
table_schema
);
private:
static
int
check_small_tenant_primary_zone_and_locality_condition
(
...
...
src/rootserver/ob_single_partition_balance.cpp
浏览文件 @
29d1fd04
...
...
@@ -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
<
const
share
::
schema
::
Ob
TableSchema
*>
table_schemas
;
common
::
ObArray
<
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*>
table_schemas
;
common
::
ObArray
<
const
share
::
schema
::
ObTablegroupSchema
*>
tablegroup_schemas
;
common
::
ObArray
<
uint64_t
>
non_partition_tg
;
ObSEArray
<
ObRawPrimaryZoneUtil
::
ZoneScore
,
MAX_ZONE_NUM
>
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
::
Ob
TableSchema
*
table_schema
=
table_schemas
.
at
(
i
);
const
share
::
schema
::
Ob
SimpleTableSchemaV2
*
table_schema
=
table_schemas
.
at
(
i
);
if
(
OB_ISNULL
(
table_schema
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"schema ptr is null"
,
KR
(
ret
));
...
...
src/rootserver/ob_single_partition_balance.h
浏览文件 @
29d1fd04
...
...
@@ -24,7 +24,7 @@ class ObPartitionReplica;
namespace
schema
{
class
ObTenantSchema
;
class
ObTablegroupSchema
;
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
class
ObSchemaMgr
;
class
ObSchemaGetterGuard
;
}
// namespace schema
...
...
src/rootserver/ob_single_zone_mode_migrate_replica.h
浏览文件 @
29d1fd04
...
...
@@ -25,7 +25,7 @@ class ObPartitionTableOperator;
namespace
schema
{
class
ObMultiVersionSchemaService
;
class
ObSchemaGetterGuard
;
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
class
ObTenantSchema
;
}
// namespace schema
}
// namespace share
...
...
src/rootserver/ob_startup_progress_tracker.cpp
浏览文件 @
29d1fd04
...
...
@@ -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
Ob
TableSchema
*
table_schema
=
NULL
;
const
Ob
SimpleTableSchemaV2
*
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
)
{
...
...
src/rootserver/virtual_table/ob_all_server_stat.h
浏览文件 @
29d1fd04
...
...
@@ -22,7 +22,7 @@ namespace oceanbase {
namespace
share
{
namespace
schema
{
class
ObMultiVersionSchemaService
;
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
}
// namespace schema
}
// namespace share
namespace
rootserver
{
...
...
src/share/ob_leader_election_waiter.cpp
浏览文件 @
29d1fd04
...
...
@@ -96,7 +96,7 @@ int ObLeaderElectionWaiter::wait(const ObTablegroupSchema& tablegroup_schema, co
return
ret
;
}
int
ObLeaderElectionWaiter
::
wait
(
const
Ob
TableSchema
&
table_schema
,
const
int64_t
timeout
)
int
ObLeaderElectionWaiter
::
wait
(
const
Ob
SimpleTableSchemaV2
&
table_schema
,
const
int64_t
timeout
)
{
int
ret
=
OB_SUCCESS
;
const
int64_t
start_time
=
ObTimeUtility
::
current_time
();
...
...
src/share/ob_leader_election_waiter.h
浏览文件 @
29d1fd04
...
...
@@ -29,7 +29,7 @@ class ObMySQLResult;
}
// namespace common
namespace
share
{
namespace
schema
{
class
Ob
TableSchema
;
class
Ob
SimpleTableSchemaV2
;
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
::
Ob
TableSchema
&
table_schema
,
const
int64_t
timeout
);
int
wait
(
const
share
::
schema
::
Ob
SimpleTableSchemaV2
&
table_schema
,
const
int64_t
timeout
);
int
wait
(
const
share
::
schema
::
ObTablegroupSchema
&
tablegroup_schema
,
const
int64_t
timeout
);
int
wait
(
const
common
::
ObArray
<
uint64_t
>&
table_ids
,
const
common
::
ObArray
<
int64_t
>&
part_nums
,
const
int64_t
timeout
);
...
...
src/share/partition_table/ob_partition_location_cache.cpp
浏览文件 @
29d1fd04
...
...
@@ -2562,7 +2562,7 @@ int ObPartitionLocationCache::get(const uint64_t table_id, ObIArray<ObPartitionL
LOG_WARN
(
"location cache is not inited"
,
K
(
ret
));
}
else
{
if
(
!
is_virtual_table
(
table_id
))
{
const
Ob
TableSchema
*
table
=
NULL
;
const
Ob
SimpleTableSchemaV2
*
table
=
NULL
;
ObSchemaGetterGuard
schema_guard
;
const
uint64_t
tenant_id
=
extract_tenant_id
(
table_id
);
if
(
OB_FAIL
(
schema_service_
->
get_tenant_schema_guard
(
tenant_id
,
schema_guard
)))
{
...
...
src/share/partition_table/ob_partition_table_iterator.cpp
浏览文件 @
29d1fd04
...
...
@@ -1306,7 +1306,7 @@ int ObFullMetaTableIterator::get_part_num(const uint64_t table_id, int64_t& part
{
int
ret
=
OB_SUCCESS
;
ObSchemaGetterGuard
guard
;
const
Ob
TableSchema
*
table
=
NULL
;
const
Ob
SimpleTableSchemaV2
*
table
=
NULL
;
const
uint64_t
tenant_id
=
extract_tenant_id
(
table_id
);
if
(
!
inited_
)
{
ret
=
OB_NOT_INIT
;
...
...
src/share/schema/ob_schema_utils.cpp
浏览文件 @
29d1fd04
...
...
@@ -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
Ob
TableSchema
&
table_schema
,
int
ObSchemaUtils
::
get_primary_zone_array
(
common
::
PageArena
<>&
alloc
,
const
Ob
SimpleTableSchemaV2
&
table_schema
,
ObSchemaGetterGuard
&
schema_guard
,
common
::
ObIArray
<
ObZoneScore
>&
primary_zone_array
)
{
int
ret
=
OB_SUCCESS
;
...
...
src/share/schema/ob_schema_utils.h
浏览文件 @
29d1fd04
...
...
@@ -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
Ob
TableSchema
&
table_schema
,
static
int
get_primary_zone_array
(
common
::
PageArena
<>&
alloc
,
const
Ob
SimpleTableSchemaV2
&
table_schema
,
ObSchemaGetterGuard
&
schema_guard
,
common
::
ObIArray
<
ObZoneScore
>&
primary_zone_array
);
static
int
get_primary_zone_array
(
common
::
PageArena
<>&
alloc
,
const
ObTablegroupSchema
&
tg_schema
,
ObSchemaGetterGuard
&
schema_guard
,
common
::
ObIArray
<
ObZoneScore
>&
primary_zone_array
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录