From: Pieter Noordhuis Date: Mon, 30 Aug 2010 14:51:39 +0000 (+0200) Subject: Don't build a reply when replaying the AOF X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/57b0738011007e47ebe25d5c81acfe333c561e02 Don't build a reply when replaying the AOF --- diff --git a/src/aof.c b/src/aof.c index 8f2dc96f..1ed2363a 100644 --- a/src/aof.c +++ b/src/aof.c @@ -272,12 +272,14 @@ int loadAppendOnlyFile(char *filename) { fakeClient->argc = argc; fakeClient->argv = argv; cmd->proc(fakeClient); - /* Discard the reply objects list from the fake client */ - while(listLength(fakeClient->reply)) - listDelNode(fakeClient->reply,listFirst(fakeClient->reply)); + + /* The fake client should not have a reply */ + redisAssert(fakeClient->bufpos == 0 && listLength(fakeClient->reply) == 0); + /* Clean up, ready for the next command */ for (j = 0; j < argc; j++) decrRefCount(argv[j]); zfree(argv); + /* Handle swapping while loading big datasets when VM is on */ force_swapout = 0; if ((zmalloc_used_memory() - server.vm_max_memory) > 1024*1024*32) diff --git a/src/networking.c b/src/networking.c index 464d5e02..971cbfc1 100644 --- a/src/networking.c +++ b/src/networking.c @@ -62,6 +62,7 @@ redisClient *createClient(int fd) { } int _ensureFileEvent(redisClient *c) { + if (c->fd <= 0) return REDIS_ERR; if (c->bufpos == 0 && listLength(c->reply) == 0 && (c->replstate == REDIS_REPL_NONE || c->replstate == REDIS_REPL_ONLINE) &&