Avoid diskelss-load if modules did not declare they handle read errors

This commit is contained in:
Oran Agra
2019-07-30 15:11:57 +03:00
parent d7d028a7a7
commit 4339706e07
4 changed files with 45 additions and 21 deletions

View File

@ -1115,8 +1115,12 @@ void restartAOFAfterSYNC() {
static int useDisklessLoad() {
/* compute boolean decision to use diskless load */
return server.repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB ||
int enabled = server.repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB ||
(server.repl_diskless_load == REPL_DISKLESS_LOAD_WHEN_DB_EMPTY && dbTotalServerKeyCount()==0);
/* Check all modules handle read errors, otherwise it's not safe to use diskless load. */
if (enabled && !moduleAllDatatypesHandleErrors())
enabled = 0;
return enabled;
}
/* Helper function for readSyncBulkPayload() to make backups of the current