X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/69bfffb4a7aec38e5079ec10b0acc8629c1ee82b..4c5f0966b2e582981d9fdaf3b511c6cf4ac4d4d5:/src/debug.c diff --git a/src/debug.c b/src/debug.c index 49f7ab2a..c1fc26cf 100644 --- a/src/debug.c +++ b/src/debug.c @@ -181,7 +181,13 @@ void debugCommand(redisClient *c) { if (!server.ds_enabled) { addReplyError(c, "DEBUG FLUSHCACHE called with diskstore off."); return; + } else if (server.bgsavethread != (pthread_t) -1) { + addReplyError(c, "Can't flush cache while BGSAVE is in progress."); + return; } else { + /* To flush the whole cache we need to wait for everything to + * be flushed on disk... */ + cacheForcePointInTime(); emptyDb(); addReply(c,shared.ok); return;