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
d5d92deb
Commit
d5d92deb
authored
Jun 10, 2014
by
antirez
Browse files
Cluster: log configEpoch updates to myself.
parent
8204ab00
Changes
1
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
d5d92deb
...
@@ -512,6 +512,7 @@ void clusterReset(int hard) {
...
@@ -512,6 +512,7 @@ void clusterReset(int hard) {
server.cluster->currentEpoch = 0;
server.cluster->currentEpoch = 0;
server.cluster->lastVoteEpoch = 0;
server.cluster->lastVoteEpoch = 0;
myself->configEpoch = 0;
myself->configEpoch = 0;
redisLog(REDIS_WARNING, "configEpoch set to 0 via CLUSTER RESET HARD");
/* To change the Node ID we need to remove the old name from the
/* To change the Node ID we need to remove the old name from the
* nodes table, change the ID, and re-add back with new name. */
* nodes table, change the ID, and re-add back with new name. */
...
@@ -1427,7 +1428,7 @@ void clusterHandleConfigEpochCollision(clusterNode *sender) {
...
@@ -1427,7 +1428,7 @@ void clusterHandleConfigEpochCollision(clusterNode *sender) {
clusterSaveConfigOrDie(1);
clusterSaveConfigOrDie(1);
redisLog(REDIS_VERBOSE,
redisLog(REDIS_VERBOSE,
"WARNING: configEpoch collision with node %.40s."
"WARNING: configEpoch collision with node %.40s."
"
Updating my
configEpoch to %llu",
" configEpoch
set
to %llu",
sender->name,
sender->name,
(unsigned long long) myself->configEpoch);
(unsigned long long) myself->configEpoch);
}
}
...
@@ -2557,8 +2558,12 @@ void clusterHandleSlaveFailover(void) {
...
@@ -2557,8 +2558,12 @@ void clusterHandleSlaveFailover(void) {
}
}
/* 3) Update my configEpoch to the epoch of the election. */
/* 3) Update my configEpoch to the epoch of the election. */
if (myself->configEpoch < server.cluster->failover_auth_epoch)
if (myself->configEpoch < server.cluster->failover_auth_epoch)
{
myself->configEpoch = server.cluster->failover_auth_epoch;
myself->configEpoch = server.cluster->failover_auth_epoch;
redisLog(REDIS_WARNING,
"configEpoch set to %llu after successful failover",
(unsigned long long) myself->configEpoch);
}
/* 4) Update state and save config. */
/* 4) Update state and save config. */
clusterUpdateState();
clusterUpdateState();
...
@@ -3838,6 +3843,10 @@ void clusterCommand(redisClient *c) {
...
@@ -3838,6 +3843,10 @@ void clusterCommand(redisClient *c) {
addReplyError(c,"Node config epoch is already non-zero");
addReplyError(c,"Node config epoch is already non-zero");
} else {
} else {
myself->configEpoch = epoch;
myself->configEpoch = epoch;
redisLog(REDIS_WARNING,
"configEpoch set to %llu via CLUSTER SET-CONFIG-EPOCH",
(unsigned long long) myself->configEpoch);
if (server.cluster->currentEpoch < epoch)
if (server.cluster->currentEpoch < epoch)
server.cluster->currentEpoch = epoch;
server.cluster->currentEpoch = epoch;
/* No need to fsync the config here since in the unlucky event
/* No need to fsync the config here since in the unlucky event
...
...
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