summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-05-04 12:50:44 +0200
committerantirez <antirez@gmail.com>2015-05-04 12:55:30 +0200
commite4c54498db482689b81e38886f142edd57de43d4 (patch)
tree96ad00dcf46180f36b9e2ce9712aef88627817b6
parent81a8ebd7f08bc08029929b2eccf01156d777c286 (diff)
downloadredis-e4c54498db482689b81e38886f142edd57de43d4.tar.gz
Sentinel: remove useless sentinelFlushConfig() call
To rewrite the config in the loop that adds slaves back after a master reset, in order to handle switching to another master, is useless: it just adds latency since there is an fsync call in the inner loop, without providing any additional guarantee, but the contrary, since if after the first loop iteration the server crashes we end with just a single slave entry losing all the other informations. It is wiser to rewrite the config at the end when the full new state is configured.
-rw-r--r--src/sentinel.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/sentinel.c b/src/sentinel.c
index e363c6c36..17b273ab0 100644
--- a/src/sentinel.c
+++ b/src/sentinel.c
@@ -1269,10 +1269,7 @@ int sentinelResetMasterAndChangeAddress(sentinelRedisInstance *master, char *ip,
slave = createSentinelRedisInstance(NULL,SRI_SLAVE,slaves[j]->ip,
slaves[j]->port, master->quorum, master);
releaseSentinelAddr(slaves[j]);
- if (slave) {
- sentinelEvent(REDIS_NOTICE,"+slave",slave,"%@");
- sentinelFlushConfig();
- }
+ if (slave) sentinelEvent(REDIS_NOTICE,"+slave",slave,"%@");
}
zfree(slaves);