DB API refactoring. The changes were designed together with Pieter Noordhuis.

This commit is contained in:
antirez
2011-06-14 15:34:27 +02:00
parent 3e2a0bf44a
commit f85cd526c1
7 changed files with 75 additions and 81 deletions

View File

@ -918,7 +918,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 +981,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);