]> git.saurik.com Git - redis.git/blobdiff - src/rdb.c
Precision of getClientOutputBufferMemoryUsage() greatily improved, see issue #327...
[redis.git] / src / rdb.c
index e98ce996e8271de67e1855f24e2509cd6d06bb08..77e2a04809113a0018a64b0613d3acea06b299c9 100644 (file)
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -36,7 +36,7 @@ time_t rdbLoadTime(rio *rdb) {
     return (time_t)t32;
 }
 
-int rdbSaveMillisecondTime(rio *rdb, time_t t) {
+int rdbSaveMillisecondTime(rio *rdb, long long t) {
     int64_t t64 = (int64_t) t;
     return rdbWriteRaw(rdb,&t64,8);
 }
@@ -253,7 +253,7 @@ int rdbSaveRawString(rio *rdb, unsigned char *s, size_t len) {
 
     /* Try LZF compression - under 20 bytes it's unable to compress even
      * aaaaaaaaaaaaaaaaaa so skip it */
-    if (server.rdbcompression && len > 20) {
+    if (server.rdb_compression && len > 20) {
         n = rdbSaveLzfStringObject(rdb,s,len);
         if (n == -1) return -1;
         if (n > 0) return n;
@@ -597,7 +597,7 @@ int rdbSave(char *filename) {
     dictEntry *de;
     char tmpfile[256];
     int j;
-    time_t now = mstime();
+    long long now = mstime();
     FILE *fp;
     rio rdb;
 
@@ -670,7 +670,7 @@ int rdbSaveBackground(char *filename) {
     pid_t childpid;
     long long start;
 
-    if (server.bgsavechildpid != -1) return REDIS_ERR;
+    if (server.rdb_child_pid != -1) return REDIS_ERR;
 
     server.dirty_before_bgsave = server.dirty;
 
@@ -692,7 +692,7 @@ int rdbSaveBackground(char *filename) {
             return REDIS_ERR;
         }
         redisLog(REDIS_NOTICE,"Background saving started by pid %d",childpid);
-        server.bgsavechildpid = childpid;
+        server.rdb_child_pid = childpid;
         updateDictResizePolicy();
         return REDIS_OK;
     }
@@ -997,7 +997,7 @@ int rdbLoad(char *filename) {
             if ((expiretime = rdbLoadTime(&rdb)) == -1) goto eoferr;
             /* We read the time so we need to read the object type again. */
             if ((type = rdbLoadType(&rdb)) == -1) goto eoferr;
-            /* the EXPIREITME opcode specifies time in seconds, so convert
+            /* the EXPIRETIME opcode specifies time in seconds, so convert
              * into milliesconds. */
             expiretime *= 1000;
         } else if (type == REDIS_RDB_OPCODE_EXPIRETIME_MS) {
@@ -1062,20 +1062,20 @@ void backgroundSaveDoneHandler(int exitcode, int bysignal) {
     } else {
         redisLog(REDIS_WARNING,
             "Background saving terminated by signal %d", bysignal);
-        rdbRemoveTempFile(server.bgsavechildpid);
+        rdbRemoveTempFile(server.rdb_child_pid);
     }
-    server.bgsavechildpid = -1;
+    server.rdb_child_pid = -1;
     /* Possibly there are slaves waiting for a BGSAVE in order to be served
      * (the first stage of SYNC is a bulk transfer of dump.rdb) */
     updateSlavesWaitingBgsave(exitcode == 0 ? REDIS_OK : REDIS_ERR);
 }
 
 void saveCommand(redisClient *c) {
-    if (server.bgsavechildpid != -1) {
+    if (server.rdb_child_pid != -1) {
         addReplyError(c,"Background save already in progress");
         return;
     }
-    if (rdbSave(server.dbfilename) == REDIS_OK) {
+    if (rdbSave(server.rdb_filename) == REDIS_OK) {
         addReply(c,shared.ok);
     } else {
         addReply(c,shared.err);
@@ -1083,11 +1083,11 @@ void saveCommand(redisClient *c) {
 }
 
 void bgsaveCommand(redisClient *c) {
-    if (server.bgsavechildpid != -1) {
+    if (server.rdb_child_pid != -1) {
         addReplyError(c,"Background save already in progress");
-    } else if (server.bgrewritechildpid != -1) {
+    } else if (server.aof_child_pid != -1) {
         addReplyError(c,"Can't BGSAVE while AOF log rewriting is in progress");
-    } else if (rdbSaveBackground(server.dbfilename) == REDIS_OK) {
+    } else if (rdbSaveBackground(server.rdb_filename) == REDIS_OK) {
         addReplyStatus(c,"Background saving started");
     } else {
         addReply(c,shared.err);