Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
73706274
R
redis
项目概览
别团等shy哥发育
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
73706274
编写于
11月 18, 2013
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Sentinel: failover abort function simplified.
上级
66b03c1a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
2 addition
and
27 deletion
+2
-27
src/sentinel.c
src/sentinel.c
+2
-27
未找到文件。
src/sentinel.c
浏览文件 @
73706274
...
...
@@ -1157,7 +1157,7 @@ int sentinelResetMastersByPattern(char *pattern, int flags) {
/* Reset the specified master with sentinelResetMaster(), and also change
* the ip:port address, but take the name of the instance unmodified.
*
* This is used to handle the +switch-master
and +redirect-to-master events
.
* This is used to handle the +switch-master
event
.
*
* The function returns REDIS_ERR if the address can't be resolved for some
* reason. Otherwise REDIS_OK is returned. */
...
...
@@ -3063,40 +3063,15 @@ void sentinelFailoverStateMachine(sentinelRedisInstance *ri) {
*
* This function can only be called before the promoted slave acknowledged
* the slave -> master switch. Otherwise the failover can't be aborted and
* will reach its end.
*
* If there is a promoted slave and we already got acknowledge of the
* slave -> master switch, we clear our flags and redirect to the
* new master. Eventually the config will be propagated if it is the one
* with the greater config epoch for this master.
*
* Otherwise if we still did not received the acknowledgement from the
* promoted slave, or there is no promoted slave at all, we just clear the
* failover-in-progress state as there is nothing to do (if the promoted
* slave for some reason actually received our "SLAVEOF NO ONE" command
* even if we did not received the ACK, it will be reverted to slave again
* by one of the Sentinels). */
* will reach its end (possibly by timeout). */
void
sentinelAbortFailover
(
sentinelRedisInstance
*
ri
)
{
dictIterator
*
di
;
dictEntry
*
de
;
redisAssert
(
ri
->
flags
&
SRI_FAILOVER_IN_PROGRESS
);
redisAssert
(
ri
->
failover_state
<=
SENTINEL_FAILOVER_STATE_WAIT_PROMOTION
);
/* Clear failover related flags from slaves. */
di
=
dictGetIterator
(
ri
->
slaves
);
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
sentinelRedisInstance
*
slave
=
dictGetVal
(
de
);
slave
->
flags
&=
~
(
SRI_RECONF_SENT
|
SRI_RECONF_INPROG
|
SRI_RECONF_DONE
);
}
dictReleaseIterator
(
di
);
ri
->
flags
&=
~
(
SRI_FAILOVER_IN_PROGRESS
|
SRI_FORCE_FAILOVER
);
ri
->
failover_state
=
SENTINEL_FAILOVER_STATE_NONE
;
ri
->
failover_state_change_time
=
mstime
();
if
(
ri
->
promoted_slave
)
{
sentinelCallClientReconfScript
(
ri
,
SENTINEL_LEADER
,
"abort"
,
ri
->
promoted_slave
->
addr
,
ri
->
addr
);
ri
->
promoted_slave
->
flags
&=
~
SRI_PROMOTED
;
ri
->
promoted_slave
=
NULL
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录