From ef9c1bd07439f74a274da6a3e66c879ab69da15f Mon Sep 17 00:00:00 2001 From: malavan Date: Tue, 16 Nov 2021 02:13:36 +0000 Subject: [PATCH] fix dataloss on aof load with storage provider Former-commit-id: 447c8601b5203346fdd4b956ad1ac87c4a6073c8 --- src/aof.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/aof.cpp b/src/aof.cpp index 326c30ba2..f99a90b2e 100644 --- a/src/aof.cpp +++ b/src/aof.cpp @@ -870,6 +870,11 @@ int loadAppendOnlyFile(char *filename) { fakeClient = createAOFClient(); startLoadingFile(fp, filename, RDBFLAGS_AOF_PREAMBLE); + for (int idb = 0; idb < cserver.dbnum; ++idb) + { + g_pserver->db[idb]->trackChanges(true); + } + /* Check if this AOF file has an RDB preamble. In that case we need to * load the RDB file and later continue loading the AOF tail. */ char sig[5]; /* "REDIS" */ @@ -892,11 +897,6 @@ int loadAppendOnlyFile(char *filename) { } } - for (int idb = 0; idb < cserver.dbnum; ++idb) - { - g_pserver->db[idb]->trackChanges(true); - } - /* Read the actual AOF file, in REPL format, command by command. */ while(1) { int argc, j;