Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大炮V587
oceanbase
提交
ec988d25
O
oceanbase
项目概览
大炮V587
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ec988d25
编写于
3月 20, 2023
作者:
O
obdev
提交者:
ob-robot
3月 20, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix compaction diagnose info and scn_revert defence, and optimize the mechanism of fetching ls_info
上级
e42bb429
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
74 addition
and
24 deletion
+74
-24
src/rootserver/freeze/ob_major_merge_progress_checker.cpp
src/rootserver/freeze/ob_major_merge_progress_checker.cpp
+52
-9
src/rootserver/freeze/ob_major_merge_progress_checker.h
src/rootserver/freeze/ob_major_merge_progress_checker.h
+5
-1
src/rootserver/freeze/ob_major_merge_scheduler.cpp
src/rootserver/freeze/ob_major_merge_scheduler.cpp
+3
-0
src/share/ob_global_merge_table_operator.cpp
src/share/ob_global_merge_table_operator.cpp
+6
-6
src/share/ob_zone_merge_table_operator.cpp
src/share/ob_zone_merge_table_operator.cpp
+8
-8
未找到文件。
src/rootserver/freeze/ob_major_merge_progress_checker.cpp
浏览文件 @
ec988d25
...
...
@@ -38,7 +38,8 @@ ObMajorMergeProgressChecker::ObMajorMergeProgressChecker()
schema_service_
(
nullptr
),
zone_merge_mgr_
(
nullptr
),
lst_operator_
(
nullptr
),
server_trace_
(
nullptr
),
tablet_compaction_map_
(),
table_count_
(
0
),
table_ids_
(),
table_compaction_map_
(),
tablet_validator_
(),
index_validator_
(),
cross_cluster_validator_
(),
uncompacted_tablets_
(),
diagnose_rw_lock_
(
ObLatchIds
::
MAJOR_FREEZE_DIAGNOSE_LOCK
)
uncompacted_tablets_
(),
diagnose_rw_lock_
(
ObLatchIds
::
MAJOR_FREEZE_DIAGNOSE_LOCK
),
ls_infos_map_
()
{}
int
ObMajorMergeProgressChecker
::
init
(
...
...
@@ -60,6 +61,8 @@ int ObMajorMergeProgressChecker::init(
LOG_WARN
(
"fail to create tablet compaction status map"
,
KR
(
ret
),
K
(
tenant_id
),
K
(
DEFAULT_MAP_BUCKET_CNT
));
}
else
if
(
OB_FAIL
(
table_compaction_map_
.
create
(
DEFAULT_MAP_BUCKET_CNT
,
"MFTbCompMap"
,
"MFTbCompMap"
,
tenant_id
)))
{
LOG_WARN
(
"fail to create table compaction status map"
,
KR
(
ret
),
K
(
tenant_id
),
K
(
DEFAULT_MAP_BUCKET_CNT
));
}
else
if
(
OB_FAIL
(
ls_infos_map_
.
create
(
300
,
"MFLsInfoMap"
,
"MFLsInfoMap"
,
tenant_id
)))
{
LOG_WARN
(
"fail to create table compaction status map"
,
KR
(
ret
),
K
(
tenant_id
));
}
else
if
(
OB_FAIL
(
tablet_validator_
.
init
(
tenant_id
,
is_primary_service
,
sql_proxy
,
zone_merge_mgr
)))
{
LOG_WARN
(
"fail to init tablet validator"
,
KR
(
ret
),
K
(
tenant_id
));
}
else
if
(
OB_FAIL
(
index_validator_
.
init
(
tenant_id
,
is_primary_service
,
sql_proxy
,
zone_merge_mgr
)))
{
...
...
@@ -253,6 +256,8 @@ int ObMajorMergeProgressChecker::check_merge_progress(
LOG_WARN
(
"fail to generate tablet table map"
,
K_
(
tenant_id
),
KR
(
ret
));
}
else
if
(
OB_FAIL
(
schema_guard
.
get_table_ids_in_tenant
(
tenant_id_
,
table_ids_
)))
{
LOG_WARN
(
"fail to get table ids in tenant"
,
KR
(
ret
),
K_
(
tenant_id
));
}
else
if
(
OB_FAIL
(
refresh_ls_infos
()))
{
LOG_WARN
(
"fail to refresh ls infos"
,
KR
(
ret
),
K_
(
tenant_id
));
}
else
{
ObTabletInfo
tablet_info
;
while
(
!
stop
&&
OB_SUCC
(
ret
))
{
...
...
@@ -371,15 +376,18 @@ int ObMajorMergeProgressChecker::check_tablet(
ObLSInfo
ls_info
;
int64_t
cluster_id
=
GCONF
.
cluster_id
;
const
ObLSID
&
ls_id
=
tablet_info
.
get_ls_id
();
{
FREEZE_TIME_GUARD
;
if
(
OB_FAIL
(
lst_operator_
->
get
(
cluster_id
,
tenant_id_
,
ls_id
,
share
::
ObLSTable
::
DEFAULT_MODE
,
ls_info
)))
{
LOG_WARN
(
"fail to get ls info"
,
KR
(
ret
),
K_
(
tenant_id
),
K
(
ls_id
));
if
(
OB_FAIL
(
ls_infos_map_
.
get_refactored
(
ls_id
,
ls_info
)))
{
if
(
OB_HASH_NOT_EXIST
==
ret
)
{
// ls_info does not exist, ignore this tablet
ret
=
OB_SUCCESS
;
if
(
TC_REACH_TIME_INTERVAL
(
30
*
1000
*
1000
))
{
// 30s
LOG_WARN
(
"ls_info does not exist"
,
K_
(
tenant_id
),
K
(
ls_id
),
K
(
tablet_info
));
}
}
else
{
LOG_WARN
(
"fail to get ls_info from ls_info_map"
,
KR
(
ret
),
K
(
ls_id
),
K_
(
tenant_id
));
}
}
if
(
FAILEDx
(
check_tablet_compaction_scn
(
all_progress
,
global_broadcast_scn
,
tablet_info
,
ls_info
)))
{
LOG_WARN
(
"fail to check data version"
,
KR
(
ret
),
K
(
tablet_info
),
K
(
ls_info
));
}
else
if
(
OB_FAIL
(
check_tablet_compaction_scn
(
all_progress
,
global_broadcast_scn
,
tablet_info
,
ls_info
)))
{
LOG_WARN
(
"fail to check tablet compaction_scn"
,
KR
(
ret
),
K
(
tablet_info
),
K
(
ls_info
));
}
}
...
...
@@ -544,5 +552,40 @@ void ObMajorMergeProgressChecker::reset_uncompacted_tablets()
uncompacted_tablets_
.
reset
();
}
int
ObMajorMergeProgressChecker
::
refresh_ls_infos
()
{
int
ret
=
OB_SUCCESS
;
if
(
IS_NOT_INIT
)
{
ret
=
OB_NOT_INIT
;
LOG_WARN
(
"not init"
,
KR
(
ret
),
K_
(
tenant_id
));
}
else
{
FREEZE_TIME_GUARD
;
// 1. clear ls_infos cached in memory
ls_infos_map_
.
reuse
();
SMART_VAR
(
ObArray
<
ObLSInfo
>
,
ls_infos
)
{
// 2. load ls_infos from __all_ls_meta_table
const
bool
inner_table_only
=
false
;
if
(
OB_ISNULL
(
lst_operator_
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"lst_operator is null"
,
KR
(
ret
),
K_
(
tenant_id
));
}
else
if
(
OB_FAIL
(
lst_operator_
->
get_by_tenant
(
tenant_id_
,
inner_table_only
,
ls_infos
)))
{
LOG_WARN
(
"fail to get ls infos"
,
KR
(
ret
),
K_
(
tenant_id
));
}
else
{
// 3. update ls_infos cached in memory
const
int64_t
ls_infos_cnt
=
ls_infos
.
count
();
for
(
int64_t
i
=
0
;
(
i
<
ls_infos_cnt
)
&&
OB_SUCC
(
ret
);
++
i
)
{
const
ObLSID
&
ls_id
=
ls_infos
.
at
(
i
).
get_ls_id
();
const
ObLSInfo
&
ls_info
=
ls_infos
.
at
(
i
);
if
(
OB_FAIL
(
ls_infos_map_
.
set_refactored
(
ls_id
,
ls_info
,
true
/*overwrite*/
)))
{
LOG_WARN
(
"fail to set refactored"
,
KR
(
ret
),
K
(
ls_id
),
K
(
ls_info
));
}
}
}
LOG_INFO
(
"finish to refresh ls infos"
,
KR
(
ret
),
K
(
ls_infos
));
}
}
return
ret
;
}
}
// namespace rootserver
}
// namespace oceanbase
src/rootserver/freeze/ob_major_merge_progress_checker.h
浏览文件 @
ec988d25
...
...
@@ -25,6 +25,7 @@ namespace share
{
class
ObTabletTableOperator
;
class
ObLSInfo
;
class
ObLSID
;
class
ObLSTableOperator
;
class
ObIServerTrace
;
struct
ObTabletInfo
;
...
...
@@ -155,6 +156,7 @@ public:
void
set_major_merge_start_time
(
const
int64_t
major_merge_start_us
);
int
get_uncompacted_tablets
(
common
::
ObArray
<
share
::
ObTabletReplica
>
&
uncompacted_tablets
)
const
;
void
reset_uncompacted_tablets
();
public:
ObMergeTimeStatistics
merge_time_statistics_
;
...
...
@@ -170,7 +172,7 @@ private:
const
share
::
ObTabletInfo
&
tablet
,
const
share
::
ObLSInfo
&
ls_info
);
int
mark_uncompacted_tables_as_verified
(
const
common
::
ObIArray
<
share
::
ObTableCompactionInfo
>
&
uncompacted_tables
);
void
reset_uncompacted_tablet
s
();
int
refresh_ls_info
s
();
private:
bool
is_inited_
;
...
...
@@ -192,6 +194,8 @@ private:
ObCrossClusterTabletChecksumValidator
cross_cluster_validator_
;
common
::
ObArray
<
share
::
ObTabletReplica
>
uncompacted_tablets_
;
// record for diagnose
common
::
SpinRWLock
diagnose_rw_lock_
;
// cache of ls_infos in __all_ls_meta_table
common
::
hash
::
ObHashMap
<
share
::
ObLSID
,
share
::
ObLSInfo
>
ls_infos_map_
;
DISALLOW_COPY_AND_ASSIGN
(
ObMajorMergeProgressChecker
);
};
...
...
src/rootserver/freeze/ob_major_merge_scheduler.cpp
浏览文件 @
ec988d25
...
...
@@ -149,6 +149,9 @@ void ObMajorMergeScheduler::run3()
}
else
if
(
OB_FAIL
(
do_work
()))
{
LOG_WARN
(
"fail to do major scheduler work"
,
KR
(
ret
),
K_
(
tenant_id
),
"cur_epoch"
,
get_epoch
());
}
// out of do_work, there must be no major merge on this server. therefore, here, clear
// compcation diagnose infos that stored in memory of this server.
progress_checker_
.
reset_uncompacted_tablets
();
int
tmp_ret
=
OB_SUCCESS
;
if
(
OB_TMP_FAIL
(
try_idle
(
DEFAULT_IDLE_US
,
ret
)))
{
...
...
src/share/ob_global_merge_table_operator.cpp
浏览文件 @
ec988d25
...
...
@@ -221,18 +221,18 @@ int ObGlobalMergeTableOperator::check_scn_revert(
if
(
it
->
need_update_
&&
it
->
is_scn_
)
{
if
(
0
==
STRCMP
(
it
->
name_
,
"frozen_scn"
))
{
if
(
it
->
get_scn
()
<
global_merge_info
.
frozen_scn_
.
get_scn
())
{
LOG_
ERROR
(
"frozen_scn revert"
,
K
(
tenant_id
),
"origin
_frozen_scn"
,
it
->
get_scn
(),
"
new
_frozen_scn"
,
global_merge_info
.
frozen_scn_
.
get_scn
());
LOG_
WARN
(
"frozen_scn revert"
,
K
(
tenant_id
),
"new
_frozen_scn"
,
it
->
get_scn
(),
"
origin
_frozen_scn"
,
global_merge_info
.
frozen_scn_
.
get_scn
());
}
}
else
if
(
0
==
STRCMP
(
it
->
name_
,
"global_broadcast_scn"
))
{
if
(
it
->
get_scn
()
<
global_merge_info
.
global_broadcast_scn_
.
get_scn
())
{
LOG_
ERROR
(
"global_broadcast_scn revert"
,
K
(
tenant_id
),
"origin
_global_broadcast_scn"
,
it
->
get_scn
(),
"
new
_global_broadcast_scn"
,
global_merge_info
.
global_broadcast_scn_
.
get_scn
());
LOG_
WARN
(
"global_broadcast_scn revert"
,
K
(
tenant_id
),
"new
_global_broadcast_scn"
,
it
->
get_scn
(),
"
origin
_global_broadcast_scn"
,
global_merge_info
.
global_broadcast_scn_
.
get_scn
());
}
}
else
if
(
0
==
STRCMP
(
it
->
name_
,
"last_merged_scn"
))
{
if
(
it
->
get_scn
()
<
global_merge_info
.
last_merged_scn_
.
get_scn
())
{
LOG_
ERROR
(
"last_merged_scn revert"
,
K
(
tenant_id
),
"origin
_last_merged_scn"
,
it
->
get_scn
(),
"
new
_last_merged_scn"
,
global_merge_info
.
last_merged_scn_
.
get_scn
());
LOG_
WARN
(
"last_merged_scn revert"
,
K
(
tenant_id
),
"new
_last_merged_scn"
,
it
->
get_scn
(),
"
origin
_last_merged_scn"
,
global_merge_info
.
last_merged_scn_
.
get_scn
());
}
}
}
...
...
src/share/ob_zone_merge_table_operator.cpp
浏览文件 @
ec988d25
...
...
@@ -492,23 +492,23 @@ int ObZoneMergeTableOperator::check_scn_revert(
if
(
it
->
need_update_
&&
it
->
is_scn_
)
{
if
(
0
==
STRCMP
(
it
->
name_
,
"frozen_scn"
))
{
if
(
it
->
get_scn
()
<
zone_merge_info
.
frozen_scn_
.
get_scn
())
{
LOG_
ERROR
(
"frozen_scn revert"
,
K
(
tenant_id
),
"origin
_frozen_scn"
,
it
->
get_scn
(),
"
new
_frozen_scn"
,
zone_merge_info
.
frozen_scn_
.
get_scn
());
LOG_
WARN
(
"frozen_scn revert"
,
K
(
tenant_id
),
"new
_frozen_scn"
,
it
->
get_scn
(),
"
origin
_frozen_scn"
,
zone_merge_info
.
frozen_scn_
.
get_scn
());
}
}
else
if
(
0
==
STRCMP
(
it
->
name_
,
"broadcast_scn"
))
{
if
(
it
->
get_scn
()
<
zone_merge_info
.
broadcast_scn_
.
get_scn
())
{
LOG_
ERROR
(
"broadcast_scn revert"
,
K
(
tenant_id
),
"origin
_broadcast_scn"
,
it
->
get_scn
(),
"
new
_broadcast_scn"
,
zone_merge_info
.
broadcast_scn_
.
get_scn
());
LOG_
WARN
(
"broadcast_scn revert"
,
K
(
tenant_id
),
"new
_broadcast_scn"
,
it
->
get_scn
(),
"
origin
_broadcast_scn"
,
zone_merge_info
.
broadcast_scn_
.
get_scn
());
}
}
else
if
(
0
==
STRCMP
(
it
->
name_
,
"last_merged_scn"
))
{
if
(
it
->
get_scn
()
<
zone_merge_info
.
last_merged_scn_
.
get_scn
())
{
LOG_
ERROR
(
"last_merged_scn revert"
,
K
(
tenant_id
),
"origin
_last_merged_scn"
,
it
->
get_scn
(),
"
new
_last_merged_scn"
,
zone_merge_info
.
last_merged_scn_
.
get_scn
());
LOG_
WARN
(
"last_merged_scn revert"
,
K
(
tenant_id
),
"new
_last_merged_scn"
,
it
->
get_scn
(),
"
origin
_last_merged_scn"
,
zone_merge_info
.
last_merged_scn_
.
get_scn
());
}
}
else
if
(
0
==
STRCMP
(
it
->
name_
,
"all_merged_scn"
))
{
if
(
it
->
get_scn
()
<
zone_merge_info
.
all_merged_scn_
.
get_scn
())
{
LOG_
ERROR
(
"all_merged_scn revert"
,
K
(
tenant_id
),
"origin
_all_merged_scn"
,
it
->
get_scn
(),
"
new
_all_merged_scn"
,
zone_merge_info
.
all_merged_scn_
.
get_scn
());
LOG_
WARN
(
"all_merged_scn revert"
,
K
(
tenant_id
),
"new
_all_merged_scn"
,
it
->
get_scn
(),
"
origin
_all_merged_scn"
,
zone_merge_info
.
all_merged_scn_
.
get_scn
());
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录