Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大炮V587
oceanbase
提交
99db3122
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,发现更多精彩内容 >>
提交
99db3122
编写于
2月 06, 2023
作者:
O
obdev
提交者:
ob-robot
2月 06, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[rebuild] add get_election_leader()
上级
4bca2395
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
53 addition
and
0 deletion
+53
-0
src/logservice/ob_log_handler.cpp
src/logservice/ob_log_handler.cpp
+6
-0
src/logservice/ob_log_handler.h
src/logservice/ob_log_handler.h
+8
-0
src/logservice/palf/palf_handle.cpp
src/logservice/palf/palf_handle.cpp
+6
-0
src/logservice/palf/palf_handle.h
src/logservice/palf/palf_handle.h
+1
-0
src/logservice/palf/palf_handle_impl.cpp
src/logservice/palf/palf_handle_impl.cpp
+24
-0
src/logservice/palf/palf_handle_impl.h
src/logservice/palf/palf_handle_impl.h
+3
-0
unittest/storage/mock_ob_log_handler.h
unittest/storage/mock_ob_log_handler.h
+5
-0
未找到文件。
src/logservice/ob_log_handler.cpp
浏览文件 @
99db3122
...
...
@@ -404,6 +404,12 @@ int ObLogHandler::get_global_learner_list(common::GlobalLearnerList &learner_lis
return
palf_handle_
.
get_global_learner_list
(
learner_list
);
}
int
ObLogHandler
::
get_election_leader
(
common
::
ObAddr
&
addr
)
const
{
RLockGuard
guard
(
lock_
);
return
palf_handle_
.
get_election_leader
(
addr
);
}
int
ObLogHandler
::
enable_sync
()
{
RLockGuard
guard
(
lock_
);
...
...
src/logservice/ob_log_handler.h
浏览文件 @
99db3122
...
...
@@ -96,6 +96,7 @@ public:
virtual
int
get_end_scn
(
share
::
SCN
&
scn
)
const
=
0
;
virtual
int
get_paxos_member_list
(
common
::
ObMemberList
&
member_list
,
int64_t
&
paxos_replica_num
)
const
=
0
;
virtual
int
get_global_learner_list
(
common
::
GlobalLearnerList
&
learner_list
)
const
=
0
;
virtual
int
get_election_leader
(
common
::
ObAddr
&
addr
)
const
=
0
;
virtual
int
change_replica_num
(
const
common
::
ObMemberList
&
member_list
,
const
int64_t
curr_replica_num
,
const
int64_t
new_replica_num
,
...
...
@@ -292,6 +293,13 @@ public:
// @brief, get global learner list of this paxos group
// @param[out] common::GlobalLearnerList&
int
get_global_learner_list
(
common
::
GlobalLearnerList
&
learner_list
)
const
override
final
;
// @brief, get leader from election, used for non_palf_leader rebuilding
// @param[out] addr: address of leader
// retval:
// OB_SUCCESS
// OB_NOT_INIT
// OB_LEADER_NOT_EXIST
int
get_election_leader
(
common
::
ObAddr
&
addr
)
const
override
final
;
// PalfBaseInfo include the 'base_lsn' and the 'prev_log_info' of sliding window.
// @param[in] const LSN&, base_lsn of ls.
// @param[out] PalfBaseInfo&, palf_base_info
...
...
src/logservice/palf/palf_handle.cpp
浏览文件 @
99db3122
...
...
@@ -288,6 +288,12 @@ int PalfHandle::get_paxos_member_list(common::ObMemberList &member_list, int64_t
return
palf_handle_impl_
->
get_paxos_member_list
(
member_list
,
paxos_replica_num
);
}
int
PalfHandle
::
get_election_leader
(
common
::
ObAddr
&
addr
)
const
{
CHECK_VALID
;
return
palf_handle_impl_
->
get_election_leader
(
addr
);
}
int
PalfHandle
::
change_replica_num
(
const
common
::
ObMemberList
&
member_list
,
const
int64_t
curr_replica_num
,
const
int64_t
new_replica_num
,
...
...
src/logservice/palf/palf_handle.h
浏览文件 @
99db3122
...
...
@@ -178,6 +178,7 @@ public:
int
get_global_learner_list
(
common
::
GlobalLearnerList
&
learner_list
)
const
;
int
get_paxos_member_list
(
common
::
ObMemberList
&
member_list
,
int64_t
&
paxos_replica_num
)
const
;
int
get_election_leader
(
common
::
ObAddr
&
addr
)
const
;
// @brief: a special config change interface, change replica number of paxos group
// @param[in] common::ObMemberList: current memberlist, for pre-check
...
...
src/logservice/palf/palf_handle_impl.cpp
浏览文件 @
99db3122
...
...
@@ -489,6 +489,14 @@ int PalfHandleImpl::get_paxos_member_list(
return
ret
;
}
int
PalfHandleImpl
::
get_election_leader
(
ObAddr
&
addr
)
const
{
int
ret
=
OB_SUCCESS
;
RLockGuard
guard
(
lock_
);
ret
=
get_election_leader_without_lock_
(
addr
);
return
ret
;
}
int
PalfHandleImpl
::
config_change_pre_check
(
const
ObAddr
&
server
,
const
LogGetMCStReq
&
req
,
LogGetMCStResp
&
resp
)
...
...
@@ -3478,6 +3486,22 @@ int PalfHandleImpl::append_disk_log_to_sw_(const LSN &start_lsn)
return
ret
;
}
int
PalfHandleImpl
::
get_election_leader_without_lock_
(
ObAddr
&
addr
)
const
{
int
ret
=
OB_SUCCESS
;
int64_t
unused_leader_epoch
=
-
1
;
if
(
IS_NOT_INIT
)
{
ret
=
OB_NOT_INIT
;
PALF_LOG
(
ERROR
,
"PalfHandleImpl has not inited"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
election_
.
get_current_leader_likely
(
addr
,
unused_leader_epoch
)))
{
PALF_LOG
(
WARN
,
"get_election_leader failed"
,
K
(
ret
),
KPC
(
this
));
}
else
if
(
OB_UNLIKELY
(
!
addr
.
is_valid
()))
{
ret
=
OB_LEADER_NOT_EXIST
;
PALF_LOG
(
WARN
,
"election has no leader"
,
K
(
ret
),
KPC
(
this
));
}
return
ret
;
}
int
PalfHandleImpl
::
revoke_leader
(
const
int64_t
proposal_id
)
{
int
ret
=
OB_SUCCESS
;
...
...
src/logservice/palf/palf_handle_impl.h
浏览文件 @
99db3122
...
...
@@ -238,6 +238,7 @@ public:
virtual
int
get_global_learner_list
(
common
::
GlobalLearnerList
&
learner_list
)
const
=
0
;
virtual
int
get_paxos_member_list
(
common
::
ObMemberList
&
member_list
,
int64_t
&
paxos_replica_num
)
const
=
0
;
virtual
int
get_election_leader
(
common
::
ObAddr
&
addr
)
const
=
0
;
// @brief: a special config change interface, change replica number of paxos group
// @param[in] common::ObMemberList: current memberlist, for pre-check
...
...
@@ -634,6 +635,7 @@ public:
int
change_leader_to
(
const
common
::
ObAddr
&
dest_addr
)
override
final
;
int
get_global_learner_list
(
common
::
GlobalLearnerList
&
learner_list
)
const
override
final
;
int
get_paxos_member_list
(
common
::
ObMemberList
&
member_list
,
int64_t
&
paxos_replica_num
)
const
override
final
;
int
get_election_leader
(
common
::
ObAddr
&
addr
)
const
;
int
change_replica_num
(
const
common
::
ObMemberList
&
member_list
,
const
int64_t
curr_replica_num
,
const
int64_t
new_replica_num
,
...
...
@@ -913,6 +915,7 @@ private:
int
check_need_advance_base_info_
(
const
LSN
&
base_lsn
,
const
LogInfo
&
base_prev_log_info
,
const
bool
is_rebuild
);
int
get_election_leader_without_lock_
(
ObAddr
&
addr
)
const
;
// ========================= flashback ==============================
int
can_do_flashback_
(
const
int64_t
mode_version
,
const
share
::
SCN
&
flashback_scn
,
...
...
unittest/storage/mock_ob_log_handler.h
浏览文件 @
99db3122
...
...
@@ -409,6 +409,11 @@ public:
}
int
enable_vote
()
{
return
OB_SUCCESS
;
}
int
disable_vote
()
{
return
OB_SUCCESS
;
}
int
get_election_leader
(
common
::
ObAddr
&
addr
)
const
{
UNUSED
(
addr
);
return
OB_SUCCESS
;
}
int
register_rebuild_cb
(
palf
::
PalfRebuildCb
*
rebuild_cb
)
{
UNUSED
(
rebuild_cb
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录