From 88441bf18f554b965eaf83cfce5eeaeff35c3ed4 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 30 May 2013 12:18:31 +0200 Subject: [PATCH] New INFO field "min_slaves_good_slaves". When min-slaves-to-write feature is active, this field reports the number of slaves considered good (online state, lag within the specified range). --- src/redis.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/redis.c b/src/redis.c index d3b40a1aa..b974d5ef7 100644 --- a/src/redis.c +++ b/src/redis.c @@ -2326,9 +2326,20 @@ sds genRedisInfoString(char *section) { server.slave_priority, server.repl_slave_ro); } + info = sdscatprintf(info, "connected_slaves:%lu\r\n", listLength(server.slaves)); + + /* If min-slaves-to-write is active, write the number of slaves + * currently considered 'good'. */ + if (server.repl_min_slaves_to_write && + server.repl_min_slaves_max_lag) { + info = sdscatprintf(info, + "min_slaves_good_slaves:%d\r\n", + server.repl_good_slaves_count); + } + if (listLength(server.slaves)) { int slaveid = 0; listNode *ln;