fix code review comments.
This commit is contained in:
@@ -219,9 +219,7 @@ void randomkeyCommand(redisClient *c) {
|
||||
|
||||
static void addToReply(void *context, robj *keyobj) {
|
||||
redisClient *c = (redisClient *)context;
|
||||
if (expireIfNeeded(c->db,keyobj) == 0) {
|
||||
addReplyBulk(c,keyobj);
|
||||
}
|
||||
addReplyBulk(c,keyobj);
|
||||
}
|
||||
|
||||
static void addToList(void *context, robj *keyobj) {
|
||||
@@ -267,7 +265,8 @@ void keysCommand(redisClient *c) {
|
||||
|
||||
void keystolistCommand(redisClient *c) {
|
||||
sds pattern = c->argv[1]->ptr;
|
||||
robj *lobj = lookupKeyWrite(c->db,c->argv[2]);
|
||||
robj *key = c->argv[2];
|
||||
robj *lobj = lookupKeyWrite(c->db,key);
|
||||
unsigned long numkeys;
|
||||
|
||||
if (lobj != NULL) {
|
||||
@@ -275,14 +274,14 @@ void keystolistCommand(redisClient *c) {
|
||||
addReply(c,shared.wrongtypeerr);
|
||||
return;
|
||||
}
|
||||
dbDelete(c->db,c->argv[2]);
|
||||
dbDelete(c->db,key);
|
||||
}
|
||||
lobj = createZiplistObject();
|
||||
dbAdd(c->db,c->argv[2],lobj);
|
||||
dbAdd(c->db,key,lobj);
|
||||
|
||||
numkeys = scanKeys(c->db,pattern,addToList,lobj);
|
||||
addReplyLongLong(c,numkeys);
|
||||
touchWatchedKey(c->db,c->argv[2]);
|
||||
touchWatchedKey(c->db,key);
|
||||
server.dirty++;
|
||||
}
|
||||
|
||||
|
||||
+8
-5
@@ -1328,7 +1328,7 @@ void freeMemoryIfNeeded(void) {
|
||||
if (tryFreeOneObjectFromFreelist() == REDIS_OK) continue;
|
||||
for (j = 0; j < server.dbnum; j++) {
|
||||
int minttl = -1;
|
||||
robj *minkey = NULL;
|
||||
sds minkey = NULL;
|
||||
struct dictEntry *de;
|
||||
|
||||
if (dictSize(server.db[j].expires)) {
|
||||
@@ -1346,10 +1346,11 @@ void freeMemoryIfNeeded(void) {
|
||||
}
|
||||
}
|
||||
|
||||
dictDelete(server.db[j].expires,minkey);
|
||||
dictDelete(server.db[j].dict,minkey);
|
||||
server.db[j].expired_count++;
|
||||
server.db[j].prematurely_expired_count++;
|
||||
if (dictDelete(server.db[j].expires,minkey) == DICT_OK &&
|
||||
dictDelete(server.db[j].dict,minkey) == DICT_OK) {
|
||||
server.db[j].expired_count++;
|
||||
server.db[j].prematurely_expired_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!freed) return; /* nothing to free... */
|
||||
@@ -1547,6 +1548,8 @@ void setupSigTermAction(void) {
|
||||
#else /* HAVE_BACKTRACE */
|
||||
void setupSigSegvAction(void) {
|
||||
}
|
||||
void setupSigTermAction(void) {
|
||||
}
|
||||
#endif /* HAVE_BACKTRACE */
|
||||
|
||||
/* The End */
|
||||
|
||||
@@ -685,6 +685,7 @@ void zslInsert(zskiplist *zsl, double score, robj *obj);
|
||||
void freeMemoryIfNeeded(void);
|
||||
int processCommand(redisClient *c);
|
||||
void setupSigSegvAction(void);
|
||||
void setupSigTermAction(void);
|
||||
struct redisCommand *lookupCommand(char *name);
|
||||
void call(redisClient *c, struct redisCommand *cmd);
|
||||
int prepareForShutdown();
|
||||
|
||||
Reference in New Issue
Block a user