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
11755719
Commit
11755719
authored
Mar 11, 2014
by
antirez
Browse files
Cluster: clusterCloseAllSlots() added.
parent
01eee56f
Changes
1
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
11755719
...
@@ -68,6 +68,7 @@ int bitmapTestBit(unsigned char *bitmap, int pos);
...
@@ -68,6 +68,7 @@ int bitmapTestBit(unsigned char *bitmap, int pos);
void clusterDoBeforeSleep(int flags);
void clusterDoBeforeSleep(int flags);
void clusterSendUpdate(clusterLink *link, clusterNode *node);
void clusterSendUpdate(clusterLink *link, clusterNode *node);
void resetManualFailover(void);
void resetManualFailover(void);
void clusterCloseAllSlots(void);
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
* Initialization
* Initialization
...
@@ -309,12 +310,8 @@ void clusterInit(void) {
...
@@ -309,12 +310,8 @@ void clusterInit(void) {
server.cluster->last_vote_epoch = 0;
server.cluster->last_vote_epoch = 0;
server.cluster->stats_bus_messages_sent = 0;
server.cluster->stats_bus_messages_sent = 0;
server.cluster->stats_bus_messages_received = 0;
server.cluster->stats_bus_messages_received = 0;
memset
(
server
.
cluster
->
migrating_slots_to
,
0
,
memset(server.cluster->slots,0, sizeof(server.cluster->slots));
sizeof
(
server
.
cluster
->
migrating_slots_to
));
clusterCloseAllSlots();
memset
(
server
.
cluster
->
importing_slots_from
,
0
,
sizeof
(
server
.
cluster
->
importing_slots_from
));
memset
(
server
.
cluster
->
slots
,
0
,
sizeof
(
server
.
cluster
->
slots
));
if (clusterLoadConfig(server.cluster_configfile) == REDIS_ERR) {
if (clusterLoadConfig(server.cluster_configfile) == REDIS_ERR) {
/* No configuration found. We will just use the random name provided
/* No configuration found. We will just use the random name provided
* by the createClusterNode() function. */
* by the createClusterNode() function. */
...
@@ -2716,6 +2713,15 @@ int clusterDelNodeSlots(clusterNode *node) {
...
@@ -2716,6 +2713,15 @@ int clusterDelNodeSlots(clusterNode *node) {
return deleted;
return deleted;
}
}
/* Clear the migrating / importing state for all the slots.
* This is useful at initialization and when turning a master into slave. */
void clusterCloseAllSlots(void) {
memset(server.cluster->migrating_slots_to,0,
sizeof(server.cluster->migrating_slots_to));
memset(server.cluster->importing_slots_from,0,
sizeof(server.cluster->importing_slots_from));
}
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
* Cluster state evaluation function
* Cluster state evaluation function
* -------------------------------------------------------------------------- */
* -------------------------------------------------------------------------- */
...
...
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