minor fixes - mainly signalModifiedKey, and GEORADIUS

This commit is contained in:
oranagra 2016-05-09 09:12:38 +03:00
parent 3b644e82b0
commit 9682b616a2
6 changed files with 19 additions and 16 deletions

View File

@ -465,6 +465,7 @@ void georadiusGeneric(client *c, int type) {
double radius_meters = 0, conversion = 1; double radius_meters = 0, conversion = 1;
if ((radius_meters = extractDistanceOrReply(c, c->argv + base_args - 2, if ((radius_meters = extractDistanceOrReply(c, c->argv + base_args - 2,
&conversion)) < 0) { &conversion)) < 0) {
addReplyError(c,"radius must be >= 0");
return; return;
} }

View File

@ -55,13 +55,13 @@ static inline int sdsHdrSize(char type) {
} }
static inline char sdsReqType(size_t string_size) { static inline char sdsReqType(size_t string_size) {
if (string_size < 32) if (string_size < 1<<5)
return SDS_TYPE_5; return SDS_TYPE_5;
if (string_size < 0xff) if (string_size < 1<<8)
return SDS_TYPE_8; return SDS_TYPE_8;
if (string_size < 0xffff) if (string_size < 1<<16)
return SDS_TYPE_16; return SDS_TYPE_16;
if (string_size < 0xffffffff) if (string_size < 1ll<<32)
return SDS_TYPE_32; return SDS_TYPE_32;
return SDS_TYPE_64; return SDS_TYPE_64;
} }

View File

@ -675,7 +675,7 @@ int htNeedsResize(dict *dict) {
size = dictSlots(dict); size = dictSlots(dict);
used = dictSize(dict); used = dictSize(dict);
return (size && used && size > DICT_HT_INITIAL_SIZE && return (size > DICT_HT_INITIAL_SIZE &&
(used*100/size < HASHTABLE_MIN_FILL)); (used*100/size < HASHTABLE_MIN_FILL));
} }

View File

@ -475,7 +475,7 @@ typedef struct redisObject {
/* Macro used to obtain the current LRU clock. /* Macro used to obtain the current LRU clock.
* If the current resolution is lower than the frequency we refresh the * If the current resolution is lower than the frequency we refresh the
* LRU clock (as it should be in production servers) we return the * LRU clock (as it should be in production servers) we return the
* precomputed value, otherwise we need to resort to a function call. */ * precomputed value, otherwise we need to resort to a system call. */
#define LRU_CLOCK() ((1000/server.hz <= LRU_CLOCK_RESOLUTION) ? server.lruclock : getLRUClock()) #define LRU_CLOCK() ((1000/server.hz <= LRU_CLOCK_RESOLUTION) ? server.lruclock : getLRUClock())
/* Macro used to initialize a Redis object allocated on the stack. /* Macro used to initialize a Redis object allocated on the stack.
@ -1359,7 +1359,6 @@ void serverLogFromHandler(int level, const char *msg);
void usage(void); void usage(void);
void updateDictResizePolicy(void); void updateDictResizePolicy(void);
int htNeedsResize(dict *dict); int htNeedsResize(dict *dict);
void oom(const char *msg);
void populateCommandTable(void); void populateCommandTable(void);
void resetCommandTableStats(void); void resetCommandTableStats(void);
void adjustOpenFilesLimit(void); void adjustOpenFilesLimit(void);

View File

@ -351,9 +351,6 @@ void smoveCommand(client *c) {
dbDelete(c->db,c->argv[1]); dbDelete(c->db,c->argv[1]);
notifyKeyspaceEvent(NOTIFY_GENERIC,"del",c->argv[1],c->db->id); notifyKeyspaceEvent(NOTIFY_GENERIC,"del",c->argv[1],c->db->id);
} }
signalModifiedKey(c->db,c->argv[1]);
signalModifiedKey(c->db,c->argv[2]);
server.dirty++;
/* Create the destination set when it doesn't exist */ /* Create the destination set when it doesn't exist */
if (!dstset) { if (!dstset) {
@ -361,6 +358,10 @@ void smoveCommand(client *c) {
dbAdd(c->db,c->argv[2],dstset); dbAdd(c->db,c->argv[2],dstset);
} }
signalModifiedKey(c->db,c->argv[1]);
signalModifiedKey(c->db,c->argv[2]);
server.dirty++;
/* An extra key has changed when ele was successfully added to dstset */ /* An extra key has changed when ele was successfully added to dstset */
if (setTypeAdd(dstset,ele->ptr)) { if (setTypeAdd(dstset,ele->ptr)) {
server.dirty++; server.dirty++;
@ -547,6 +548,8 @@ void spopWithCountCommand(client *c) {
* the alsoPropagate() API. */ * the alsoPropagate() API. */
decrRefCount(propargv[0]); decrRefCount(propargv[0]);
preventCommandPropagation(c); preventCommandPropagation(c);
signalModifiedKey(c->db,c->argv[1]);
server.dirty++;
} }
void spopCommand(client *c) { void spopCommand(client *c) {

View File

@ -2327,16 +2327,13 @@ void zunionInterGenericCommand(client *c, robj *dstkey, int op) {
serverPanic("Unknown operator"); serverPanic("Unknown operator");
} }
if (dbDelete(c->db,dstkey)) { if (dbDelete(c->db,dstkey))
signalModifiedKey(c->db,dstkey);
touched = 1; touched = 1;
server.dirty++;
}
if (dstzset->zsl->length) { if (dstzset->zsl->length) {
zsetConvertToZiplistIfNeeded(dstobj,maxelelen); zsetConvertToZiplistIfNeeded(dstobj,maxelelen);
dbAdd(c->db,dstkey,dstobj); dbAdd(c->db,dstkey,dstobj);
addReplyLongLong(c,zsetLength(dstobj)); addReplyLongLong(c,zsetLength(dstobj));
if (!touched) signalModifiedKey(c->db,dstkey); signalModifiedKey(c->db,dstkey);
notifyKeyspaceEvent(NOTIFY_ZSET, notifyKeyspaceEvent(NOTIFY_ZSET,
(op == SET_OP_UNION) ? "zunionstore" : "zinterstore", (op == SET_OP_UNION) ? "zunionstore" : "zinterstore",
dstkey,c->db->id); dstkey,c->db->id);
@ -2344,8 +2341,11 @@ void zunionInterGenericCommand(client *c, robj *dstkey, int op) {
} else { } else {
decrRefCount(dstobj); decrRefCount(dstobj);
addReply(c,shared.czero); addReply(c,shared.czero);
if (touched) if (touched) {
signalModifiedKey(c->db,dstkey);
notifyKeyspaceEvent(NOTIFY_GENERIC,"del",dstkey,c->db->id); notifyKeyspaceEvent(NOTIFY_GENERIC,"del",dstkey,c->db->id);
server.dirty++;
}
} }
zfree(src); zfree(src);
} }