Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug fix: slaves being pinged every second

REDIS_REPL_PING_SLAVE_PERIOD controls how often the master should
transmit a heartbeat (PING) to its slaves.  This period, which defaults
to 10, is measured in seconds.

Redis 2.4 masters used to ping their slaves every ten seconds, just like
it says on the tin.

The Redis 2.6 masters I have been experimenting with, on the other hand,
ping their slaves *every second*.  (master_last_io_seconds_ago never
approaches 10.)  I think the ping period was inadvertently slashed to
one-tenth of its nominal value around the time REDIS_HZ was introduced.
This commit reintroduces correct ping schedule behaviour.
  • Loading branch information...
commit 9edfe63553314fc2258392db94bfce8a4144b303 1 parent 36def8f
Saj Goonatilleke authored

Showing 2 changed files with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. +1 1  src/redis.h
  2. +1 1  src/replication.c
2  src/redis.h
@@ -670,7 +670,7 @@ struct redisServer {
670 670 char *masterauth; /* AUTH with this password with master */
671 671 char *masterhost; /* Hostname of master */
672 672 int masterport; /* Port of master */
673   - int repl_ping_slave_period; /* Master pings the salve every N seconds */
  673 + int repl_ping_slave_period; /* Master pings the slave every N seconds */
674 674 int repl_timeout; /* Timeout after N seconds of master idle */
675 675 redisClient *master; /* Client that is master for this slave */
676 676 int repl_syncio_timeout; /* Timeout for synchronous I/O calls */
2  src/replication.c
@@ -668,7 +668,7 @@ void replicationCron(void) {
668 668 * So slaves can implement an explicit timeout to masters, and will
669 669 * be able to detect a link disconnection even if the TCP connection
670 670 * will not actually go down. */
671   - if (!(server.cronloops % (server.repl_ping_slave_period*10))) {
  671 + if (!(server.cronloops % (server.repl_ping_slave_period * REDIS_HZ))) {
672 672 listIter li;
673 673 listNode *ln;
674 674

0 comments on commit 9edfe63

Please sign in to comment.
Something went wrong with that request. Please try again.