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
8f52173b
Commit
8f52173b
authored
Mar 27, 2014
by
antirez
Browse files
Cluster: last_vote_epoch -> lastVoteEpoch.
Use cammel case for epochs that are persisted on disk.
parent
7fb14b73
Changes
2
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
8f52173b
...
@@ -128,8 +128,8 @@ int clusterLoadConfig(char *filename) {
...
@@ -128,8 +128,8 @@ int clusterLoadConfig(char *filename) {
if (strcasecmp(argv[j],"currentEpoch") == 0) {
if (strcasecmp(argv[j],"currentEpoch") == 0) {
server.cluster->currentEpoch =
server.cluster->currentEpoch =
strtoull(argv[j+1],NULL,10);
strtoull(argv[j+1],NULL,10);
} else if (strcasecmp(argv[j],"last
_v
ote
_e
poch") == 0) {
} else if (strcasecmp(argv[j],"last
V
ote
E
poch") == 0) {
server.cluster->last
_v
ote
_e
poch =
server.cluster->last
V
ote
E
poch =
strtoull(argv[j+1],NULL,10);
strtoull(argv[j+1],NULL,10);
} else {
} else {
redisLog(REDIS_WARNING,
redisLog(REDIS_WARNING,
...
@@ -281,11 +281,11 @@ int clusterSaveConfig(int do_fsync) {
...
@@ -281,11 +281,11 @@ int clusterSaveConfig(int do_fsync) {
int fd;
int fd;
/* Get the nodes description and concatenate our "vars" directive to
/* Get the nodes description and concatenate our "vars" directive to
* save currentEpoch and last
_v
ote
_e
poch. */
* save currentEpoch and last
V
ote
E
poch. */
ci = clusterGenNodesDescription(REDIS_NODE_HANDSHAKE);
ci = clusterGenNodesDescription(REDIS_NODE_HANDSHAKE);
ci = sdscatprintf(ci,"vars currentEpoch %llu last
_v
ote
_e
poch %llu\n",
ci = sdscatprintf(ci,"vars currentEpoch %llu last
V
ote
E
poch %llu\n",
(unsigned long long) server.cluster->currentEpoch,
(unsigned long long) server.cluster->currentEpoch,
(unsigned long long) server.cluster->last
_v
ote
_e
poch);
(unsigned long long) server.cluster->last
V
ote
E
poch);
content_size = sdslen(ci);
content_size = sdslen(ci);
if ((fd = open(server.cluster_configfile,O_WRONLY|O_CREAT,0644))
if ((fd = open(server.cluster_configfile,O_WRONLY|O_CREAT,0644))
...
@@ -339,7 +339,7 @@ void clusterInit(void) {
...
@@ -339,7 +339,7 @@ void clusterInit(void) {
server.cluster->failover_auth_count = 0;
server.cluster->failover_auth_count = 0;
server.cluster->failover_auth_rank = 0;
server.cluster->failover_auth_rank = 0;
server.cluster->failover_auth_epoch = 0;
server.cluster->failover_auth_epoch = 0;
server.cluster->last
_v
ote
_e
poch = 0;
server.cluster->last
V
ote
E
poch = 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->slots,0, sizeof(server.cluster->slots));
memset(server.cluster->slots,0, sizeof(server.cluster->slots));
...
@@ -2134,7 +2134,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
...
@@ -2134,7 +2134,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
if (requestCurrentEpoch < server.cluster->currentEpoch) return;
if (requestCurrentEpoch < server.cluster->currentEpoch) return;
/* I already voted for this epoch? Return ASAP. */
/* I already voted for this epoch? Return ASAP. */
if (server.cluster->last
_v
ote
_e
poch == server.cluster->currentEpoch) return;
if (server.cluster->last
V
ote
E
poch == server.cluster->currentEpoch) return;
/* Node must be a slave and its master down.
/* Node must be a slave and its master down.
* The master can be non failing if the request is flagged
* The master can be non failing if the request is flagged
...
@@ -2166,7 +2166,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
...
@@ -2166,7 +2166,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
/* We can vote for this slave. */
/* We can vote for this slave. */
clusterSendFailoverAuth(node);
clusterSendFailoverAuth(node);
server.cluster->last
_v
ote
_e
poch = server.cluster->currentEpoch;
server.cluster->last
V
ote
E
poch = server.cluster->currentEpoch;
node->slaveof->voted_time = mstime();
node->slaveof->voted_time = mstime();
}
}
...
...
src/cluster.h
View file @
8f52173b
...
@@ -118,7 +118,7 @@ typedef struct clusterState {
...
@@ -118,7 +118,7 @@ typedef struct clusterState {
int
mf_can_start
;
/* If non-zero signal that the manual failover
int
mf_can_start
;
/* If non-zero signal that the manual failover
can start requesting masters vote. */
can start requesting masters vote. */
/* The followign fields are uesd by masters to take state on elections. */
/* The followign fields are uesd by masters to take state on elections. */
uint64_t
last
_v
ote
_e
poch
;
/* Epoch of the last vote granted. */
uint64_t
last
V
ote
E
poch
;
/* Epoch of the last vote granted. */
int
todo_before_sleep
;
/* Things to do in clusterBeforeSleep(). */
int
todo_before_sleep
;
/* Things to do in clusterBeforeSleep(). */
long
long
stats_bus_messages_sent
;
/* Num of msg sent via cluster bus. */
long
long
stats_bus_messages_sent
;
/* Num of msg sent via cluster bus. */
long
long
stats_bus_messages_received
;
/* Num of msg rcvd via cluster bus.*/
long
long
stats_bus_messages_received
;
/* Num of msg rcvd via cluster bus.*/
...
...
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