From bd99b26bc52c3a10eda45efa4652cda5ceeb334d Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 4 May 2015 12:50:44 +0200 Subject: [PATCH] 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. --- src/sentinel.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/sentinel.c b/src/sentinel.c index 55ee1522..dfd901bc 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -1270,10 +1270,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);