Fix failure to save RDB on shutdown
Former-commit-id: 1a8331c88a17deaa5faf34c7ea65957c57530546
This commit is contained in:
parent
9e4233207e
commit
2ee97b5bb5
@ -2301,6 +2301,9 @@ void redisDbPersistentData::commitChanges(const changelist &vec)
|
||||
|
||||
redisDbPersistentData::~redisDbPersistentData()
|
||||
{
|
||||
if (m_pdbSnapshotASYNC)
|
||||
endSnapshot(m_pdbSnapshotASYNC);
|
||||
|
||||
serverAssert(m_spdbSnapshotHOLDER == nullptr);
|
||||
//serverAssert(m_pdbSnapshot == nullptr);
|
||||
serverAssert(m_refCount == 0);
|
||||
|
13
src/rdb.cpp
13
src/rdb.cpp
@ -2644,14 +2644,23 @@ void backgroundSaveDoneHandler(int exitcode, bool fCancelled) {
|
||||
}
|
||||
|
||||
/* Kill the RDB saving child using SIGUSR1 (so that the parent will know
|
||||
* the child did not exit for an error, but because we wanted), and performs
|
||||
* the child did not exit for sn error, but because we wanted), and performs
|
||||
* the cleanup needed. */
|
||||
void killRDBChild(void) {
|
||||
void killRDBChild(bool fSynchronous) {
|
||||
serverAssert(GlobalLocksAcquired());
|
||||
g_pserver->rdbThreadVars.fRdbThreadCancel = true;
|
||||
rdbRemoveTempFile(g_pserver->rdbThreadVars.tmpfileNum);
|
||||
closeChildInfoPipe();
|
||||
updateDictResizePolicy();
|
||||
if (fSynchronous)
|
||||
{
|
||||
aeReleaseLock();
|
||||
serverAssert(!GlobalLocksAcquired());
|
||||
void *result;
|
||||
pthread_join(g_pserver->rdbThreadVars.rdb_child_thread, &result);
|
||||
g_pserver->rdbThreadVars.fRdbThreadCancel = false;
|
||||
aeAcquireLock();
|
||||
}
|
||||
}
|
||||
|
||||
struct rdbSaveSocketThreadArgs
|
||||
|
@ -3960,7 +3960,7 @@ int prepareForShutdown(int flags) {
|
||||
overwrite the synchronous saving did by SHUTDOWN. */
|
||||
if (g_pserver->FRdbSaveInProgress()) {
|
||||
serverLog(LL_WARNING,"There is a child saving an .rdb. Killing it!");
|
||||
killRDBChild();
|
||||
killRDBChild(true);
|
||||
}
|
||||
|
||||
/* Kill module child if there is one. */
|
||||
|
@ -2767,7 +2767,7 @@ int writeCommandsDeniedByDiskError(void);
|
||||
|
||||
/* RDB persistence */
|
||||
#include "rdb.h"
|
||||
void killRDBChild(void);
|
||||
void killRDBChild(bool fSynchronous = false);
|
||||
|
||||
/* AOF persistence */
|
||||
void flushAppendOnlyFile(int force);
|
||||
|
Loading…
x
Reference in New Issue
Block a user