Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
画布下的乐园
oceanbase
提交
7a3b382f
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,体验更适合开发者的 AI 搜索 >>
提交
7a3b382f
编写于
11月 03, 2022
作者:
O
obdev
提交者:
wangzelin.wzl
11月 03, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix check_snapshot_gc_ts error
上级
85163268
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
15 deletion
+27
-15
src/rootserver/freeze/ob_freeze_info_manager.cpp
src/rootserver/freeze/ob_freeze_info_manager.cpp
+25
-13
src/rootserver/freeze/ob_freeze_info_manager.h
src/rootserver/freeze/ob_freeze_info_manager.h
+2
-2
未找到文件。
src/rootserver/freeze/ob_freeze_info_manager.cpp
浏览文件 @
7a3b382f
...
...
@@ -471,6 +471,7 @@ int ObFreezeInfoManager::renew_snapshot_gc_ts()
int64_t
affected_rows
=
0
;
ObMySQLTransaction
trans
;
ObRecursiveMutexGuard
guard
(
lock_
);
int64_t
max_stale_time_ns
=
transaction
::
ObWeakReadUtil
::
default_max_stale_time_for_weak_consistency
()
*
1000
;
if
(
OB_FAIL
(
check_inner_stat
()))
{
LOG_WARN
(
"inner error"
,
KR
(
ret
));
...
...
@@ -480,8 +481,7 @@ int ObFreezeInfoManager::renew_snapshot_gc_ts()
LOG_WARN
(
"fail to select snapshot_gc_scn for update"
,
KR
(
ret
),
K_
(
tenant_id
));
}
else
if
(
OB_FAIL
(
get_gts
(
cur_gts
)))
{
LOG_WARN
(
"fail to get_gts"
,
KR
(
ret
));
}
else
if
(
FALSE_IT
(
new_snapshot_gc_scn
=
(
cur_gts
-
transaction
::
ObWeakReadUtil
::
default_max_stale_time_for_weak_consistency
())))
{
}
else
if
(
FALSE_IT
(
new_snapshot_gc_scn
=
(
cur_gts
-
max_stale_time_ns
)))
{
LOG_WARN
(
"fail to calc new snapshot_gc_scn"
,
KR
(
ret
),
K
(
cur_gts
));
}
else
if
((
new_snapshot_gc_scn
<=
freeze_info_
.
latest_snapshot_gc_ts_
)
||
(
cur_snapshot_gc_scn
>=
new_snapshot_gc_scn
))
{
...
...
@@ -547,17 +547,20 @@ int ObFreezeInfoManager::try_gc_freeze_info()
ObRecursiveMutexGuard
guard
(
lock_
);
int
ret
=
OB_SUCCESS
;
const
int64_t
MAX_KEEP_INTERVAL_
US
=
30
*
24
*
60
*
60
*
1000L
*
1000L
;
// 30 day
const
int64_t
MAX_KEEP_INTERVAL_
NS
=
30
*
24
*
60
*
60
*
1000L
*
1000L
*
1000L
;
// 30 day
const
int64_t
MIN_REMAINED_VERSION_COUNT
=
32
;
int64_t
now
=
ObTimeUtility
::
current_time
();
int64_t
min_frozen_scn
=
(
now
-
MAX_KEEP_INTERVAL_US
)
*
1000L
;
// frozen_scn is nano_second
int64_t
cur_gts
=
0
;
if
(
OB_FAIL
(
get_gts
(
cur_gts
)))
{
LOG_WARN
(
"fail to get_gts"
,
KR
(
ret
));
}
int64_t
min_frozen_scn
=
cur_gts
-
MAX_KEEP_INTERVAL_NS
;
// frozen_scn is nano_second
ObFreezeInfoProxy
freeze_info_proxy
(
tenant_id_
);
ObMySQLTransaction
trans
;
ObArray
<
ObSimpleFrozenStatus
>
all_frozen_status
;
int64_t
cur_snapshot_gc_scn
=
0
;
if
(
OB_FAIL
(
check_inner_stat
()))
{
if
(
FAILEDx
(
check_inner_stat
()))
{
LOG_WARN
(
"inner stat error"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
trans
.
start
(
sql_proxy_
,
tenant_id_
)))
{
LOG_WARN
(
"fail to start transaction"
,
KR
(
ret
),
K_
(
tenant_id
));
...
...
@@ -608,22 +611,31 @@ int ObFreezeInfoManager::try_update_zone_info(const int64_t expected_epoch)
int
ObFreezeInfoManager
::
check_snapshot_gc_ts
()
{
int
ret
=
OB_SUCCESS
;
int64_t
cur_gts
=
0
;
int64_t
snapshot_gc_ts
=
0
;
int64_t
delay
=
0
;
ObRecursiveMutexGuard
guard
(
lock_
);
if
(
OB_FAIL
(
check_inner_stat
()))
{
LOG_WARN
(
"fail to check inner stat"
,
KR
(
ret
));
}
else
if
(
OB_FAIL
(
get_gts
(
cur_gts
)))
{
LOG_WARN
(
"fail to get_gts"
,
KR
(
ret
));
}
else
{
snapshot_gc_ts
=
freeze_info_
.
latest_snapshot_gc_ts_
;
delay
=
((
snapshot_gc_ts
==
0
)
?
0
:
(
ObTimeUtility
::
current_time
()
-
snapshot_gc_ts
));
if
(
REACH_TIME_INTERVAL
(
60
*
1000
*
1000
))
{
if
(
delay
>
SNAPSHOT_GC_TS_ERROR
)
{
LOG_ERROR
(
"rs_monitor_check : snapshot_gc_ts delay for a long time"
,
if
(
snapshot_gc_ts
>
cur_gts
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"fail to check snapshot_gc_ts, snapshot_gc_ts is larger than cur_gts"
,
KR
(
ret
),
K
(
snapshot_gc_ts
),
K
(
cur_gts
),
K_
(
tenant_id
));
}
else
{
delay
=
((
snapshot_gc_ts
==
0
)
?
0
:
(
cur_gts
-
snapshot_gc_ts
));
if
(
TC_REACH_TIME_INTERVAL
(
60
*
1000
*
1000
))
{
if
(
delay
>
SNAPSHOT_GC_TS_ERROR
)
{
LOG_ERROR
(
"rs_monitor_check : snapshot_gc_ts delay for a long time"
,
K
(
snapshot_gc_ts
),
K
(
delay
),
K_
(
tenant_id
));
}
else
if
(
delay
>
SNAPSHOT_GC_TS_WARN
)
{
LOG_WARN
(
"rs_monitor_check : snapshot_gc_ts delay for a long time"
,
K
(
snapshot_gc_ts
),
K
(
delay
),
K_
(
tenant_id
));
}
else
if
(
delay
>
SNAPSHOT_GC_TS_WARN
)
{
LOG_WARN
(
"rs_monitor_check : snapshot_gc_ts delay for a long time"
,
K
(
snapshot_gc_ts
),
K
(
delay
),
K_
(
tenant_id
));
}
}
}
}
...
...
src/rootserver/freeze/ob_freeze_info_manager.h
浏览文件 @
7a3b382f
...
...
@@ -128,8 +128,8 @@ public:
static
const
int64_t
ORIGIN_FROZEN_SCN
=
1
;
static
const
int64_t
ORIGIN_SCHEMA_VERSION
=
1
;
static
const
int64_t
SNAPSHOT_GC_TS_WARN
=
30LL
*
60LL
*
1000LL
*
1000LL
;
static
const
int64_t
SNAPSHOT_GC_TS_ERROR
=
2LL
*
60LL
*
60LL
*
1000LL
*
1000LL
;
static
const
int64_t
SNAPSHOT_GC_TS_WARN
=
30LL
*
60LL
*
1000LL
*
1000LL
*
1000LL
;
// ns
static
const
int64_t
SNAPSHOT_GC_TS_ERROR
=
2LL
*
60LL
*
60LL
*
1000LL
*
1000LL
*
1000LL
;
// ns
private:
bool
is_inited_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录