DEL is now a vararg, IMPORTANT: memory leak fixed in loading DB code

This commit is contained in:
antirez 2009-05-09 12:18:32 +02:00
parent efc296a1d6
commit 5109cdff83
4 changed files with 34 additions and 14 deletions

View File

@ -1,3 +1,11 @@
2009-05-09 doc changes
2009-05-09 CPP client added thanks to Brian Hammond
2009-05-06 Infinite number of arguments for MGET and all the other commands
2009-05-04 Warns if /proc/sys/vm/overcommit_memory is set to 0 on Linux. Also make sure to don't resize the hash tables while the child process is saving in order to avoid copy-on-write of memory pages
2009-04-30 zmalloc fix, return NULL or real malloc failure
2009-04-30 more fixes for dict.c and the 150 million keys limit
2009-04-30 dict.c modified to be able to handle more than 150,000,000 keys
2009-04-29 fuzz stresser implemented in redis-test
2009-04-29 fixed for HT resize check 32bits overflow
2009-04-29 Check for fork() failure in background saving
2009-04-29 fix for the LZF off-by-one bug added

14
TODO
View File

@ -1,18 +1,15 @@
BEFORE REDIS 1.0.0-rc1
- Contrib dir with RHL for Centos and other contributions like init scripts
- Update the FAQ with max number of keys in a DB and the overcommit thing
- SDIFF, SDIFFSTORE
- Add number of keys for every DB in INFO
- maxmemory support in config file.
- Resize the expires hash tables if needed as well
- TTL command that returns -1 if a key is not volatile otherwise the time to live of a volatile key.
- Remove max number of args limit
- maxmemory support
- maxclients support
- Resize the expires and Sets hash tables if needed as well? For Sets the right moment to check for this is probably in SREM
- TTL command that returns -1 if a key is not volatile otherwise the time to live of a volatile key in seconds.
- What happens if the saving child gets killed or segfaults instead of ending normally? Handle this.
- Make sinterstore / unionstore / sdiffstore returning the cardinality of the resulting set.
- maxclients directive
- check 'server.dirty' everywere
- Shutdown must kill other background savings before to start saving. Otherwise the DB can get replaced by the child that rename(2) after the parent for some reason. Child should trap the signal and remove the temp file name.
- Document replication
- Objects sharing configuration, add the directive "objectsharingpool <size>"
- Make sure to convert all the fstat() calls to 64bit versions.
- SINTERCOUNT, SUNIONCOUNT, SDIFFCOUNT
@ -25,6 +22,7 @@ AFTER 1.0 stable release
- Write the hash table size of every db in the dump, so that Redis can resize the hash table just one time when loading a big DB.
- Elapsed time in logs for SAVE when saving is going to take more than 2 seconds
- replication automated tests
- LOCK / TRYLOCK / UNLOCK as described many times in the google group
FUTURE HINTS

View File

@ -60,7 +60,7 @@ static struct redisCommand cmdTable[] = {
{"get",2,REDIS_CMD_INLINE},
{"set",3,REDIS_CMD_BULK},
{"setnx",3,REDIS_CMD_BULK},
{"del",2,REDIS_CMD_INLINE},
{"del",-2,REDIS_CMD_INLINE},
{"exists",2,REDIS_CMD_INLINE},
{"incr",2,REDIS_CMD_INLINE},
{"decr",2,REDIS_CMD_INLINE},

24
redis.c
View File

@ -367,7 +367,7 @@ static struct redisCommand cmdTable[] = {
{"get",getCommand,2,REDIS_CMD_INLINE},
{"set",setCommand,3,REDIS_CMD_BULK},
{"setnx",setnxCommand,3,REDIS_CMD_BULK},
{"del",delCommand,2,REDIS_CMD_INLINE},
{"del",delCommand,-2,REDIS_CMD_INLINE},
{"exists",existsCommand,2,REDIS_CMD_INLINE},
{"incr",incrCommand,2,REDIS_CMD_INLINE},
{"decr",decrCommand,2,REDIS_CMD_INLINE},
@ -2012,6 +2012,7 @@ static robj *rdbLoadLzfStringObject(FILE*fp, int rdbver) {
if ((val = sdsnewlen(NULL,len)) == NULL) goto err;
if (fread(c,clen,1,fp) == 0) goto err;
if (lzf_decompress(c,clen,val,len) == 0) goto err;
zfree(c);
return createObject(REDIS_STRING,val);
err:
zfree(c);
@ -2305,11 +2306,24 @@ static void decrbyCommand(redisClient *c) {
/* ========================= Type agnostic commands ========================= */
static void delCommand(redisClient *c) {
if (deleteKey(c->db,c->argv[1])) {
server.dirty++;
addReply(c,shared.cone);
} else {
int deleted = 0, j;
for (j = 1; j < c->argc; j++) {
if (deleteKey(c->db,c->argv[j])) {
server.dirty++;
deleted++;
}
}
switch(deleted) {
case 0:
addReply(c,shared.czero);
break;
case 1:
addReply(c,shared.cone);
break;
default:
addReplySds(c,sdscatprintf(sdsempty(),":%d\r\n",deleted));
break;
}
}