mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Cluster: time field removed from cluster messages header.
The new algorithm does not check replies time as checking for the currentEpoch in the reply ensures that the reply is about the current election process.
This commit is contained in:
parent
2b93a19537
commit
1dedf9aa36
@ -1543,14 +1543,11 @@ void clusterRequestFailoverAuth(void) {
|
||||
clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_FAILOVER_AUTH_REQUEST);
|
||||
totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData);
|
||||
hdr->totlen = htonl(totlen);
|
||||
hdr->time = mstime();
|
||||
clusterBroadcastMessage(buf,totlen);
|
||||
}
|
||||
|
||||
/* Send a FAILOVER_AUTH_ACK message to the specified node.
|
||||
* Reqtime is the time field from the original failover auth request packet,
|
||||
* so that the receiver is able to check the reply age. */
|
||||
void clusterSendFailoverAuth(clusterNode *node, uint64_t reqtime) {
|
||||
/* Send a FAILOVER_AUTH_ACK message to the specified node. */
|
||||
void clusterSendFailoverAuth(clusterNode *node) {
|
||||
unsigned char buf[4096];
|
||||
clusterMsg *hdr = (clusterMsg*) buf;
|
||||
uint32_t totlen;
|
||||
@ -1559,7 +1556,6 @@ void clusterSendFailoverAuth(clusterNode *node, uint64_t reqtime) {
|
||||
clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_FAILOVER_AUTH_ACK);
|
||||
totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData);
|
||||
hdr->totlen = htonl(totlen);
|
||||
hdr->time = reqtime;
|
||||
clusterSendMessage(node->link,buf,totlen);
|
||||
}
|
||||
|
||||
@ -1592,7 +1588,7 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
|
||||
server.cluster_node_timeout * 2) return;
|
||||
|
||||
/* We can vote for this slave. */
|
||||
clusterSendFailoverAuth(node,request->time);
|
||||
clusterSendFailoverAuth(node);
|
||||
server.cluster->last_vote_epoch = server.cluster->currentEpoch;
|
||||
node->slaveof->voted_time = server.unixtime;
|
||||
}
|
||||
|
@ -715,9 +715,6 @@ typedef struct {
|
||||
uint32_t totlen; /* Total length of this message */
|
||||
uint16_t type; /* Message type */
|
||||
uint16_t count; /* Only used for some kind of messages. */
|
||||
uint64_t time; /* Time at which this request was sent (in milliseconds),
|
||||
this field is copied in reply messages so that the
|
||||
original sender knows how old the reply is. */
|
||||
uint64_t currentEpoch; /* The epoch accordingly to the sending node. */
|
||||
uint64_t configEpoch; /* The config epoch if it's a master, or the last epoch
|
||||
advertised by its master if it is a slave. */
|
||||
|
Loading…
Reference in New Issue
Block a user