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
07b63227
Commit
07b63227
authored
Feb 21, 2013
by
antirez
Browse files
Cluster: more correct update of slots state when PONG is received.
parent
c6da9d9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
07b63227
...
@@ -655,8 +655,7 @@ int clusterProcessPacket(clusterLink *link) {
...
@@ -655,8 +655,7 @@ int clusterProcessPacket(clusterLink *link) {
}
}
}
}
/* Update our info about served slots if this new node is serving
/* Update our info about served slots. */
* slots that are not served from our point of view. */
if
(
sender
&&
sender
->
flags
&
REDIS_NODE_MASTER
)
{
if
(
sender
&&
sender
->
flags
&
REDIS_NODE_MASTER
)
{
int
newslots
,
j
;
int
newslots
,
j
;
...
@@ -666,6 +665,9 @@ int clusterProcessPacket(clusterLink *link) {
...
@@ -666,6 +665,9 @@ int clusterProcessPacket(clusterLink *link) {
if
(
newslots
)
{
if
(
newslots
)
{
for
(
j
=
0
;
j
<
REDIS_CLUSTER_SLOTS
;
j
++
)
{
for
(
j
=
0
;
j
<
REDIS_CLUSTER_SLOTS
;
j
++
)
{
if
(
clusterNodeGetSlotBit
(
sender
,
j
))
{
if
(
clusterNodeGetSlotBit
(
sender
,
j
))
{
/* If this slot was not served, or served by a node
* in FAIL state, update the table with the new node
* caliming to serve the slot. */
if
(
server
.
cluster
->
slots
[
j
]
==
sender
)
continue
;
if
(
server
.
cluster
->
slots
[
j
]
==
sender
)
continue
;
if
(
server
.
cluster
->
slots
[
j
]
==
NULL
||
if
(
server
.
cluster
->
slots
[
j
]
==
NULL
||
server
.
cluster
->
slots
[
j
]
->
flags
&
REDIS_NODE_FAIL
)
server
.
cluster
->
slots
[
j
]
->
flags
&
REDIS_NODE_FAIL
)
...
@@ -674,6 +676,16 @@ int clusterProcessPacket(clusterLink *link) {
...
@@ -674,6 +676,16 @@ int clusterProcessPacket(clusterLink *link) {
clusterAddSlot
(
sender
,
j
);
clusterAddSlot
(
sender
,
j
);
update_state
=
update_config
=
1
;
update_state
=
update_config
=
1
;
}
}
}
else
{
/* If this slot was served by this node, but it is
* no longer claiming it, del it from the table. */
if
(
server
.
cluster
->
slots
[
j
]
==
sender
)
{
/* Set the bit again before calling
* clusterDelSlot() or the assert will fail. */
clusterNodeSetSlotBit
(
sender
,
j
);
clusterDelSlot
(
j
);
update_state
=
update_config
=
1
;
}
}
}
}
}
}
}
...
...
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