Skip to content
This repository

Bug fix: slaves being pinged every second #576

Merged
merged 1 commit into from almost 2 years ago

2 participants

Saj Goonatilleke Salvatore Sanfilippo
Saj Goonatilleke
saj commented

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.

Saj Goonatilleke saj 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.
9edfe63
Salvatore Sanfilippo antirez merged commit 24bc807 into from
Salvatore Sanfilippo
Owner

Thank you, merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jul 05, 2012
Saj Goonatilleke saj 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.
9edfe63
This page is out of date. Refresh to see the latest.

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

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.