Skip to content

Commit 5cf6232

Browse files
committed
clean the rdb file if failed
Signed-off-by: Ray Cao <zisong.cw@alibaba-inc.com>
1 parent 0be9fb9 commit 5cf6232

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/aof.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,12 @@ int tryRestartAOFAfterSYNCWithRdb(void) {
11081108
if (new_incr_filename) sdsfree(new_incr_filename);
11091109
if (new_incr_filepath) sdsfree(new_incr_filepath);
11101110
if (newfd != -1) close(newfd);
1111+
if (server.rdb_del_sync_files && allPersistenceDisabled()) {
1112+
serverLog(LL_NOTICE, "Removing the RDB file obtained from "
1113+
"the primary. This replica has persistence "
1114+
"disabled");
1115+
bg_unlink(server.rdb_filename);
1116+
}
11111117
return C_ERR;
11121118
}
11131119

0 commit comments

Comments
 (0)