diff options
author | antirez <antirez@gmail.com> | 2020-03-04 12:55:49 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2020-03-05 12:51:15 +0100 |
commit | a20303c62339fcaa07bd7872df7fe05d9fe54b1f (patch) | |
tree | 73eec538383b5e2db75aba2b9412eec511bad3a0 | |
parent | 7a23b94559cca33c219dbdc717005ef14a55a6cf (diff) | |
download | redis-a20303c62339fcaa07bd7872df7fe05d9fe54b1f.tar.gz |
Check that the file exists in removeRDBUsedToSyncReplicas().
-rw-r--r-- | src/replication.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/replication.c b/src/replication.c index acecdd098..20666bd20 100644 --- a/src/replication.c +++ b/src/replication.c @@ -944,10 +944,14 @@ void removeRDBUsedToSyncReplicas(void) { } } if (delrdb) { - serverLog(LL_NOTICE,"Removing the RDB file used to feed replicas " - "in a persistence-less instance"); - RDBGeneratedByReplication = 0; - bg_unlink(server.rdb_filename); + struct stat sb; + if (lstat(server.rdb_filename,&sb) != -1) { + RDBGeneratedByReplication = 0; + serverLog(LL_NOTICE, + "Removing the RDB file used to feed replicas " + "in a persistence-less instance"); + bg_unlink(server.rdb_filename); + } } } } |