Merge pull request #3829 from oranagra/restart_aof_pr

bugfix to restartAOF, exit will never happen
This commit is contained in:
Salvatore Sanfilippo 2019-03-21 17:15:55 +01:00 committed by GitHub
commit 544373ea66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1091,12 +1091,13 @@ void replicationCreateMasterClient(int fd, int dbid) {
}
void restartAOF() {
int retry = 10;
while (retry-- && startAppendOnly() == C_ERR) {
unsigned int tries, max_tries = 10;
for (tries = 0; tries < max_tries; ++tries) {
if (tries) sleep(1);
if (startAppendOnly() == C_OK) break;
serverLog(LL_WARNING,"Failed enabling the AOF after successful master synchronization! Trying it again in one second.");
sleep(1);
}
if (!retry) {
if (tries == max_tries) {
serverLog(LL_WARNING,"FATAL: this replica instance finished the synchronization with its master, but the AOF can't be turned on. Exiting now.");
exit(1);
}