X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/591f29e0f5493f1e375c06ae225dc5aafe5b37fb..f1907057221cc1601a914c7626d896483999fb39:/src/rdb.c diff --git a/src/rdb.c b/src/rdb.c index f98d8579..cfbec3e8 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -413,11 +413,6 @@ int rdbSave(char *filename) { int j; time_t now = time(NULL); - if (server.ds_enabled) { - cacheForcePointInTime(); - return dsRdbSave(filename); - } - snprintf(tmpfile,256,"temp-%d.rdb", (int) getpid()); fp = fopen(tmpfile,"w"); if (!fp) { @@ -484,16 +479,10 @@ int rdbSaveBackground(char *filename) { pid_t childpid; long long start; - if (server.bgsavechildpid != -1 || - server.bgsavethread != (pthread_t) -1) return REDIS_ERR; + if (server.bgsavechildpid != -1) return REDIS_ERR; server.dirty_before_bgsave = server.dirty; - if (server.ds_enabled) { - cacheForcePointInTime(); - return dsRdbSaveBackground(filename); - } - start = ustime(); if ((childpid = fork()) == 0) { int retval; @@ -918,7 +907,7 @@ void stopLoading(void) { int rdbLoad(char *filename) { FILE *fp; uint32_t dbid; - int type, retval, rdbver; + int type, rdbver; redisDb *db = server.db+0; char buf[1024]; time_t expiretime, now = time(NULL); @@ -981,11 +970,8 @@ int rdbLoad(char *filename) { continue; } /* Add the new object in the hash table */ - retval = dbAdd(db,key,val); - if (retval == REDIS_ERR) { - redisLog(REDIS_WARNING,"Loading DB, duplicated key (%s) found! Unrecoverable error, exiting now.", key->ptr); - exit(1); - } + dbAdd(db,key,val); + /* Set the expire time if needed */ if (expiretime != -1) setExpire(db,key,expiretime); @@ -1016,15 +1002,13 @@ void backgroundSaveDoneHandler(int exitcode, int bysignal) { rdbRemoveTempFile(server.bgsavechildpid); } server.bgsavechildpid = -1; - server.bgsavethread = (pthread_t) -1; - server.bgsavethread_state = REDIS_BGSAVE_THREAD_UNACTIVE; /* 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 || server.bgsavethread != (pthread_t)-1) { + if (server.bgsavechildpid != -1) { addReplyError(c,"Background save already in progress"); return; } @@ -1036,7 +1020,7 @@ void saveCommand(redisClient *c) { } void bgsaveCommand(redisClient *c) { - if (server.bgsavechildpid != -1 || server.bgsavethread != (pthread_t)-1) { + if (server.bgsavechildpid != -1) { addReplyError(c,"Background save already in progress"); } else if (server.bgrewritechildpid != -1) { addReplyError(c,"Can't BGSAVE while AOF log rewriting is in progress");