mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Cluster: last_vote_epoch -> lastVoteEpoch.
Use cammel case for epochs that are persisted on disk.
This commit is contained in:
parent
7fb14b73ba
commit
8f52173b2c
@ -128,8 +128,8 @@ int clusterLoadConfig(char *filename) {
|
||||
if (strcasecmp(argv[j],"currentEpoch") == 0) {
|
||||
server.cluster->currentEpoch =
|
||||
strtoull(argv[j+1],NULL,10);
|
||||
} else if (strcasecmp(argv[j],"last_vote_epoch") == 0) {
|
||||
server.cluster->last_vote_epoch =
|
||||
} else if (strcasecmp(argv[j],"lastVoteEpoch") == 0) {
|
||||
server.cluster->lastVoteEpoch =
|
||||
strtoull(argv[j+1],NULL,10);
|
||||
} else {
|
||||
redisLog(REDIS_WARNING,
|
||||
@ -281,11 +281,11 @@ int clusterSaveConfig(int do_fsync) {
|
||||
int fd;
|
||||
|
||||
/* Get the nodes description and concatenate our "vars" directive to
|
||||
* save currentEpoch and last_vote_epoch. */
|
||||
* save currentEpoch and lastVoteEpoch. */
|
||||
ci = clusterGenNodesDescription(REDIS_NODE_HANDSHAKE);
|
||||
ci = sdscatprintf(ci,"vars currentEpoch %llu last_vote_epoch %llu\n",
|
||||
ci = sdscatprintf(ci,"vars currentEpoch %llu lastVoteEpoch %llu\n",
|
||||
(unsigned long long) server.cluster->currentEpoch,
|
||||
(unsigned long long) server.cluster->last_vote_epoch);
|
||||
(unsigned long long) server.cluster->lastVoteEpoch);
|
||||
content_size = sdslen(ci);
|
||||
|
||||
if ((fd = open(server.cluster_configfile,O_WRONLY|O_CREAT,0644))
|
||||
@ -339,7 +339,7 @@ void clusterInit(void) {
|
||||
server.cluster->failover_auth_count = 0;
|
||||
server.cluster->failover_auth_rank = 0;
|
||||
server.cluster->failover_auth_epoch = 0;
|
||||
server.cluster->last_vote_epoch = 0;
|
||||
server.cluster->lastVoteEpoch = 0;
|
||||
server.cluster->stats_bus_messages_sent = 0;
|
||||
server.cluster->stats_bus_messages_received = 0;
|
||||
memset(server.cluster->slots,0, sizeof(server.cluster->slots));
|
||||
@ -2134,7 +2134,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
|
||||
if (requestCurrentEpoch < server.cluster->currentEpoch) return;
|
||||
|
||||
/* I already voted for this epoch? Return ASAP. */
|
||||
if (server.cluster->last_vote_epoch == server.cluster->currentEpoch) return;
|
||||
if (server.cluster->lastVoteEpoch == server.cluster->currentEpoch) return;
|
||||
|
||||
/* Node must be a slave and its master down.
|
||||
* The master can be non failing if the request is flagged
|
||||
@ -2166,7 +2166,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
|
||||
|
||||
/* We can vote for this slave. */
|
||||
clusterSendFailoverAuth(node);
|
||||
server.cluster->last_vote_epoch = server.cluster->currentEpoch;
|
||||
server.cluster->lastVoteEpoch = server.cluster->currentEpoch;
|
||||
node->slaveof->voted_time = mstime();
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ typedef struct clusterState {
|
||||
int mf_can_start; /* If non-zero signal that the manual failover
|
||||
can start requesting masters vote. */
|
||||
/* The followign fields are uesd by masters to take state on elections. */
|
||||
uint64_t last_vote_epoch; /* Epoch of the last vote granted. */
|
||||
uint64_t lastVoteEpoch; /* Epoch of the last vote granted. */
|
||||
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_received; /* Num of msg rcvd via cluster bus.*/
|
||||
|
Loading…
Reference in New Issue
Block a user