diff options
author | Salvatore Sanfilippo <antirez@gmail.com> | 2020-02-06 10:27:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-06 10:27:05 +0100 |
commit | 44266d6d9288c3d48e6fb8c198c34561329c1cef (patch) | |
tree | aa717924853e358668ff72bd2d4c8fec779bd770 | |
parent | 58a3a3fa6836dcaa4dcaa5b4a0f8f6d50194586f (diff) | |
parent | aac6a4cf135aa136b339e84c23db3cfc06b4a776 (diff) | |
download | redis-44266d6d9288c3d48e6fb8c198c34561329c1cef.tar.gz |
Merge pull request #6850 from oranagra/restart_aof_unset_master
move restartAOFAfterSYNC from replicaofCommand to replicationUnsetMaster
-rw-r--r-- | src/replication.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/replication.c b/src/replication.c index b7e77184a..5499ebc57 100644 --- a/src/replication.c +++ b/src/replication.c @@ -2399,6 +2399,10 @@ void replicationUnsetMaster(void) { moduleFireServerEvent(REDISMODULE_EVENT_REPLICATION_ROLE_CHANGED, REDISMODULE_EVENT_REPLROLECHANGED_NOW_MASTER, NULL); + + /* Restart the AOF subsystem in case we shut it down during a sync when + * we were still a slave. */ + if (server.aof_enabled && server.aof_state == AOF_OFF) restartAOFAfterSYNC(); } /* This function is called when the slave lose the connection with the @@ -2436,9 +2440,6 @@ void replicaofCommand(client *c) { serverLog(LL_NOTICE,"MASTER MODE enabled (user request from '%s')", client); sdsfree(client); - /* Restart the AOF subsystem in case we shut it down during a sync when - * we were still a slave. */ - if (server.aof_enabled && server.aof_state == AOF_OFF) restartAOFAfterSYNC(); } } else { long port; |