mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Cluster: fix gossip section ping/pong times encoding.
The gossip section times are 32 bit, so cannot store the milliseconds time but just the seconds approximation, which is good enough for our uses. At the same time however, when comparing the gossip section times of other nodes with our node's view, we need to convert back to milliseconds. Related to #3929. Without this change the patch to reduce the traffic in the bus message does not work.
This commit is contained in:
parent
6878a3fedd
commit
8c829d9e43
@ -1362,7 +1362,8 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) {
|
|||||||
node->ping_sent == 0 &&
|
node->ping_sent == 0 &&
|
||||||
clusterNodeFailureReportsCount(node) == 0)
|
clusterNodeFailureReportsCount(node) == 0)
|
||||||
{
|
{
|
||||||
uint32_t pongtime = ntohl(g->pong_received);
|
mstime_t pongtime = ntohl(g->pong_received);
|
||||||
|
pongtime *= 1000; /* Convert back to milliseconds. */
|
||||||
if (pongtime > node->pong_received) {
|
if (pongtime > node->pong_received) {
|
||||||
node->pong_received = pongtime;
|
node->pong_received = pongtime;
|
||||||
}
|
}
|
||||||
@ -2353,8 +2354,8 @@ void clusterSendPing(clusterLink *link, int type) {
|
|||||||
freshnodes--;
|
freshnodes--;
|
||||||
gossip = &(hdr->data.ping.gossip[gossipcount]);
|
gossip = &(hdr->data.ping.gossip[gossipcount]);
|
||||||
memcpy(gossip->nodename,this->name,CLUSTER_NAMELEN);
|
memcpy(gossip->nodename,this->name,CLUSTER_NAMELEN);
|
||||||
gossip->ping_sent = htonl(this->ping_sent);
|
gossip->ping_sent = htonl(this->ping_sent/1000);
|
||||||
gossip->pong_received = htonl(this->pong_received);
|
gossip->pong_received = htonl(this->pong_received/1000);
|
||||||
memcpy(gossip->ip,this->ip,sizeof(this->ip));
|
memcpy(gossip->ip,this->ip,sizeof(this->ip));
|
||||||
gossip->port = htons(this->port);
|
gossip->port = htons(this->port);
|
||||||
gossip->cport = htons(this->cport);
|
gossip->cport = htons(this->cport);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user