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
59ad6ac5
Commit
59ad6ac5
authored
Jan 21, 2015
by
antirez
Browse files
Cluster: set the slaves->slaveof filed to NULL when master is freed.
Related to issue #2289.
parent
491d57ab
Changes
1
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
59ad6ac5
...
@@ -821,6 +821,14 @@ int clusterCountNonFailingSlaves(clusterNode *n) {
...
@@ -821,6 +821,14 @@ int clusterCountNonFailingSlaves(clusterNode *n) {
void
freeClusterNode
(
clusterNode
*
n
)
{
void
freeClusterNode
(
clusterNode
*
n
)
{
sds
nodename
;
sds
nodename
;
int
j
;
/* If the node is a master with associated slaves, we have to set
* all the slaves->slaveof fields to NULL (unknown). */
if
(
nodeIsMaster
(
n
))
{
for
(
j
=
0
;
j
<
n
->
numslaves
;
j
++
)
n
->
slaves
[
j
]
->
slaveof
=
NULL
;
}
nodename
=
sdsnewlen
(
n
->
name
,
REDIS_CLUSTER_NAMELEN
);
nodename
=
sdsnewlen
(
n
->
name
,
REDIS_CLUSTER_NAMELEN
);
redisAssert
(
dictDelete
(
server
.
cluster
->
nodes
,
nodename
)
==
DICT_OK
);
redisAssert
(
dictDelete
(
server
.
cluster
->
nodes
,
nodename
)
==
DICT_OK
);
...
...
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