Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
AdRainty
oceanbase
提交
f5022a11
O
oceanbase
项目概览
AdRainty
/
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 搜索 >>
提交
f5022a11
编写于
11月 04, 2022
作者:
O
obdev
提交者:
wangzelin.wzl
11月 04, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bug:priority's log_ts may fallback.
上级
eead0516
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
8 deletion
+15
-8
src/logservice/leader_coordinator/election_priority_impl/election_priority_v1.cpp
...ordinator/election_priority_impl/election_priority_v1.cpp
+15
-8
未找到文件。
src/logservice/leader_coordinator/election_priority_impl/election_priority_v1.cpp
浏览文件 @
f5022a11
...
...
@@ -81,16 +81,17 @@ int PriorityV1::compare(const AbstractPriority &rhs, int &result, ObStringHolder
int
PriorityV1
::
get_log_ts_
(
const
share
::
ObLSID
&
ls_id
,
int64_t
&
log_ts
)
{
LC_TIME_GUARD
(
100
_ms
);
#define PRINT_WRAPPER KR(ret), K(MTL_ID()), K(ls_id), K(*this)
int
ret
=
OB_SUCCESS
;
palf
::
PalfHandleGuard
palf_handle_guard
;
palf
::
AccessMode
access_mode
=
palf
::
AccessMode
::
INVALID_ACCESS_MODE
;
//
palf::AccessMode access_mode = palf::AccessMode::INVALID_ACCESS_MODE;
if
(
OB_ISNULL
(
MTL
(
ObLogService
*
)))
{
COORDINATOR_LOG_
(
ERROR
,
"ObLogService is nullptr"
);
}
else
if
(
OB
_FAIL
(
MTL
(
ObLogService
*
)
->
open_palf
(
ls_id
,
palf_handle_guard
)))
{
}
else
if
(
CLICK
_FAIL
(
MTL
(
ObLogService
*
)
->
open_palf
(
ls_id
,
palf_handle_guard
)))
{
COORDINATOR_LOG_
(
WARN
,
"open_palf failed"
);
}
else
if
(
OB
_FAIL
(
palf_handle_guard
.
get_palf_handle
()
->
get_access_mode
(
access_mode
)))
{
COORDINATOR_LOG_
(
WARN
,
"get_access_mode failed"
);
// } else if (CLICK
_FAIL(palf_handle_guard.get_palf_handle()->get_access_mode(access_mode))) {
//
COORDINATOR_LOG_(WARN, "get_access_mode failed");
// } else if (palf::AccessMode::APPEND != access_mode) {
// // Set log_ts to 0 when current access mode is not APPEND.
// log_ts = 0;
...
...
@@ -98,12 +99,12 @@ int PriorityV1::get_log_ts_(const share::ObLSID &ls_id, int64_t &log_ts)
common
::
ObRole
role
;
int64_t
unused_pid
=
-
1
;
int64_t
min_unreplay_log_ts_ns
=
OB_INVALID_TIMESTAMP
;
if
(
OB
_FAIL
(
palf_handle_guard
.
get_role
(
role
,
unused_pid
)))
{
if
(
CLICK
_FAIL
(
palf_handle_guard
.
get_role
(
role
,
unused_pid
)))
{
COORDINATOR_LOG_
(
WARN
,
"get_role failed"
);
}
else
if
(
OB
_FAIL
(
palf_handle_guard
.
get_max_ts_ns
(
log_ts
)))
{
}
else
if
(
CLICK
_FAIL
(
palf_handle_guard
.
get_max_ts_ns
(
log_ts
)))
{
COORDINATOR_LOG_
(
WARN
,
"get_max_ts_ns failed"
);
}
else
if
(
FOLLOWER
==
role
)
{
if
(
OB
_FAIL
(
MTL
(
ObLogService
*
)
->
get_log_replay_service
()
->
get_min_unreplayed_log_ts_ns
(
ls_id
,
min_unreplay_log_ts_ns
)))
{
if
(
CLICK
_FAIL
(
MTL
(
ObLogService
*
)
->
get_log_replay_service
()
->
get_min_unreplayed_log_ts_ns
(
ls_id
,
min_unreplay_log_ts_ns
)))
{
COORDINATOR_LOG_
(
WARN
,
"failed to get_min_unreplayed_log_ts_ns"
);
ret
=
OB_SUCCESS
;
}
else
if
(
min_unreplay_log_ts_ns
-
1
<
log_ts
)
{
...
...
@@ -111,6 +112,12 @@ int PriorityV1::get_log_ts_(const share::ObLSID &ls_id, int64_t &log_ts)
log_ts
=
min_unreplay_log_ts_ns
-
1
;
}
else
{}
}
else
{}
// log_ts may fallback because palf's role may be different with apply_service.
// So we need check it here to keep inc update semantic.
if
(
log_ts
<
log_ts_
)
{
COORDINATOR_LOG_
(
TRACE
,
"new log_ts is smaller than current, no need update"
,
K
(
role
),
K
(
min_unreplay_log_ts_ns
),
K
(
log_ts
));
log_ts
=
log_ts_
;
}
COORDINATOR_LOG_
(
TRACE
,
"get_log_ts_ finished"
,
K
(
role
),
K
(
min_unreplay_log_ts_ns
),
K
(
log_ts
));
}
return
ret
;
...
...
@@ -119,7 +126,7 @@ int PriorityV1::get_log_ts_(const share::ObLSID &ls_id, int64_t &log_ts)
int
PriorityV1
::
refresh_
(
const
share
::
ObLSID
&
ls_id
)
{
LC_TIME_GUARD
(
1
_
s
);
LC_TIME_GUARD
(
1
00
_m
s
);
#define PRINT_WRAPPER KR(ret), K(MTL_ID()), K(*this)
int
ret
=
OB_SUCCESS
;
ObLeaderCoordinator
*
coordinator
=
MTL
(
ObLeaderCoordinator
*
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录