]> git.saurik.com Git - redis.git/blobdiff - src/debug.c
Helpers to move around in encoded sorted set
[redis.git] / src / debug.c
index 49f7ab2ac46c9fda45c25053926d1648ed1ce6c5..c1fc26cf671312786f789daae33d72ee1ace8dc7 100644 (file)
@@ -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;