Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
f0b807cd
Commit
f0b807cd
authored
Mar 07, 2013
by
antirez
Browse files
Cluster: update cluster state on PFAIL flag set/cleared on nodes.
parent
299b8f76
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
f0b807cd
...
@@ -1250,7 +1250,7 @@ void clusterPropagatePublish(robj *channel, robj *message) {
...
@@ -1250,7 +1250,7 @@ void clusterPropagatePublish(robj *channel, robj *message) {
void
clusterCron
(
void
)
{
void
clusterCron
(
void
)
{
dictIterator
*
di
;
dictIterator
*
di
;
dictEntry
*
de
;
dictEntry
*
de
;
int
j
;
int
j
,
update_state
=
0
;
time_t
min_ping_sent
=
0
;
time_t
min_ping_sent
=
0
;
clusterNode
*
min_ping_node
=
NULL
;
clusterNode
*
min_ping_node
=
NULL
;
...
@@ -1348,6 +1348,7 @@ void clusterCron(void) {
...
@@ -1348,6 +1348,7 @@ void clusterCron(void) {
* conditions detected by clearNodeFailureIfNeeded(). */
* conditions detected by clearNodeFailureIfNeeded(). */
if
(
node
->
flags
&
REDIS_NODE_PFAIL
)
{
if
(
node
->
flags
&
REDIS_NODE_PFAIL
)
{
node
->
flags
&=
~
REDIS_NODE_PFAIL
;
node
->
flags
&=
~
REDIS_NODE_PFAIL
;
update_state
=
1
;
}
else
if
(
node
->
flags
&
REDIS_NODE_FAIL
)
{
}
else
if
(
node
->
flags
&
REDIS_NODE_FAIL
)
{
clearNodeFailureIfNeeded
(
node
);
clearNodeFailureIfNeeded
(
node
);
}
}
...
@@ -1358,6 +1359,7 @@ void clusterCron(void) {
...
@@ -1358,6 +1359,7 @@ void clusterCron(void) {
redisLog
(
REDIS_DEBUG
,
"*** NODE %.40s possibly failing"
,
redisLog
(
REDIS_DEBUG
,
"*** NODE %.40s possibly failing"
,
node
->
name
);
node
->
name
);
node
->
flags
|=
REDIS_NODE_PFAIL
;
node
->
flags
|=
REDIS_NODE_PFAIL
;
update_state
=
1
;
}
}
}
}
}
}
...
@@ -1374,6 +1376,8 @@ void clusterCron(void) {
...
@@ -1374,6 +1376,8 @@ void clusterCron(void) {
replicationSetMaster
(
server
.
cluster
->
myself
->
slaveof
->
ip
,
replicationSetMaster
(
server
.
cluster
->
myself
->
slaveof
->
ip
,
server
.
cluster
->
myself
->
slaveof
->
port
);
server
.
cluster
->
myself
->
slaveof
->
port
);
}
}
if
(
update_state
)
clusterUpdateState
();
}
}
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment