summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-06-05 10:48:05 +0200
committerantirez <antirez@gmail.com>2014-06-05 10:50:31 +0200
commit430bec3461299b1be92029281e81697ddd33254d (patch)
treec9bf344654adf6ad71ad9e1be4fad27a4511a2b6
parent3a30be51aa8fe15412d57f6a50015aec98f1612f (diff)
downloadredis-430bec3461299b1be92029281e81697ddd33254d.tar.gz
Don't process min-slaves-to-write for slaves.
Replication is totally broken when a slave has this option, since it stops accepting updates from masters. This fixes issue #1434.
-rw-r--r--src/redis.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/redis.c b/src/redis.c
index 21ac59968..5462067a4 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -2037,7 +2037,8 @@ int processCommand(redisClient *c) {
/* Don't accept write commands if there are not enough good slaves and
* user configured the min-slaves-to-write option. */
- if (server.repl_min_slaves_to_write &&
+ if (server.masterhost == NULL &&
+ server.repl_min_slaves_to_write &&
server.repl_min_slaves_max_lag &&
c->cmd->flags & REDIS_CMD_WRITE &&
server.repl_good_slaves_count < server.repl_min_slaves_to_write)