Infinite number of arguments for MGET and all the other commands

This commit is contained in:
antirez 2009-05-06 23:54:57 +02:00
parent 0bc0337896
commit 93ea375904
2 changed files with 31 additions and 9 deletions

13
TODO
View File

@ -1,15 +1,16 @@
BEFORE REDIS 1.0.0-rc1
- Update the FAQ with max number of keys in a DB and the overcommit thing
- Add number of keys for every DB in INFO
- maxmemory support in config file.
- Resize the expires hash tables if needed as well
- Elapsed time in logs for SAVE when saving is going to take more than 2 seconds
- 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
- 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
- replication automated tests
- 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.
- 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.
@ -17,8 +18,12 @@ BEFORE REDIS 1.0.0-rc1
AFTER 1.0 stable release
- Use partial qsort for SORT + LIMIT
- Use partial qsort for SORT + LIMIT. Don't copy the list into a vector when BY argument is constant.
- Locking primitives
- MDEL (or vararg DEL)
- 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
FUTURE HINTS

27
redis.c
View File

@ -67,7 +67,7 @@
#define REDIS_MAXIDLETIME (60*5) /* default client timeout */
#define REDIS_IOBUF_LEN 1024
#define REDIS_LOADBUF_LEN 1024
#define REDIS_MAX_ARGS 16
#define REDIS_STATIC_ARGS 4
#define REDIS_DEFAULT_DBNUM 16
#define REDIS_CONFIGLINE_MAX 1024
#define REDIS_OBJFREELIST_MAX 1000000 /* Max number of objects to cache */
@ -183,7 +183,7 @@ typedef struct redisClient {
redisDb *db;
int dictid;
sds querybuf;
robj *argv[REDIS_MAX_ARGS];
robj **argv;
int argc;
int bulklen; /* bulk read len. -1 if not in bulk read mode */
list *reply;
@ -1078,6 +1078,7 @@ static void freeClient(redisClient *c) {
server.master = NULL;
server.replstate = REDIS_REPL_CONNECT;
}
zfree(c->argv);
zfree(c);
}
@ -1257,8 +1258,17 @@ static int processCommand(redisClient *c) {
static void replicationFeedSlaves(list *slaves, struct redisCommand *cmd, int dictid, robj **argv, int argc) {
listNode *ln;
robj *outv[REDIS_MAX_ARGS*4]; /* enough room for args, spaces, newlines */
int outc = 0, j;
robj **outv;
/* (args*2)+1 is enough room for args, spaces, newlines */
robj *static_outv[REDIS_STATIC_ARGS*2+1];
if (argc <= REDIS_STATIC_ARGS) {
outv = static_outv;
} else {
outv = zmalloc(sizeof(robj*)*(argc*2+1));
if (!outv) oom("replicationFeedSlaves");
}
for (j = 0; j < argc; j++) {
if (j != 0) outv[outc++] = shared.space;
@ -1312,6 +1322,7 @@ static void replicationFeedSlaves(list *slaves, struct redisCommand *cmd, int di
for (j = 0; j < outc; j++) addReply(slave,outv[j]);
}
for (j = 0; j < outc; j++) decrRefCount(outv[j]);
if (outv != static_outv) zfree(outv);
}
static void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask) {
@ -1369,9 +1380,14 @@ again:
return;
}
argv = sdssplitlen(query,sdslen(query)," ",1,&argc);
sdsfree(query);
if (argv == NULL) oom("sdssplitlen");
for (j = 0; j < argc && j < REDIS_MAX_ARGS; j++) {
sdsfree(query);
if (c->argv) zfree(c->argv);
c->argv = zmalloc(sizeof(robj*)*argc);
if (c->argv == NULL) oom("allocating arguments list for client");
for (j = 0; j < argc; j++) {
if (sdslen(argv[j])) {
c->argv[c->argc] = createObject(REDIS_STRING,argv[j]);
c->argc++;
@ -1430,6 +1446,7 @@ static redisClient *createClient(int fd) {
c->fd = fd;
c->querybuf = sdsempty();
c->argc = 0;
c->argv = NULL;
c->bulklen = -1;
c->sentlen = 0;
c->flags = 0;