summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2019-03-21 17:15:55 +0100
committerGitHub <noreply@github.com>2019-03-21 17:15:55 +0100
commit544373ea66def918b50e6619f299cea28b8563e0 (patch)
treefcf04489d0c3650f5a45f56d18efb1f9f68c8784
parentd75c36ee4830137bf06d4a979c7a23d2d79e9b29 (diff)
parentc9e2900efc1ed33727356df114fb716442ae2ce6 (diff)
downloadredis-544373ea66def918b50e6619f299cea28b8563e0.tar.gz
Merge pull request #3829 from oranagra/restart_aof_pr
bugfix to restartAOF, exit will never happen
-rw-r--r--src/replication.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/replication.c b/src/replication.c
index f2adc7995..59e42e561 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -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);
}