move restartAOFAfterSYNC from replicaofCommand to replicationUnsetMaster
replicationUnsetMaster can be called from other places, not just replicaofCOmmand, and all of these need to restart AOF
This commit is contained in:
parent
a8e2bbe8f6
commit
ad1c21283e
@ -2399,6 +2399,10 @@ void replicationUnsetMaster(void) {
|
|||||||
moduleFireServerEvent(REDISMODULE_EVENT_REPLICATION_ROLE_CHANGED,
|
moduleFireServerEvent(REDISMODULE_EVENT_REPLICATION_ROLE_CHANGED,
|
||||||
REDISMODULE_EVENT_REPLROLECHANGED_NOW_MASTER,
|
REDISMODULE_EVENT_REPLROLECHANGED_NOW_MASTER,
|
||||||
NULL);
|
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
|
/* 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')",
|
serverLog(LL_NOTICE,"MASTER MODE enabled (user request from '%s')",
|
||||||
client);
|
client);
|
||||||
sdsfree(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 {
|
} else {
|
||||||
long port;
|
long port;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user