Commit ee2da67c authored by oranagra's avatar oranagra Committed by antirez
Browse files

bugfix to restartAOF, exit will never happen since retry will get negative.

also reduce an excess sleep
parent 78022492
...@@ -1090,12 +1090,13 @@ void replicationCreateMasterClient(int fd, int dbid) { ...@@ -1090,12 +1090,13 @@ void replicationCreateMasterClient(int fd, int dbid) {
} }
void restartAOF() { void restartAOF() {
int retry = 10; unsigned int tries, max_tries = 10;
while (retry-- && startAppendOnly() == C_ERR) { 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."); 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."); 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); exit(1);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment