summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororanagra <oran@redislabs.com>2016-05-09 09:12:38 +0300
committeroranagra <oran@redislabs.com>2016-05-09 12:05:33 +0300
commit9682b616a21b5e675a1ca82109a11d6f4de1d2de (patch)
tree9f3c4cddb8b4877970d3f2252bb29ff5e6a326d6
parent3b644e82b0cc96113e29672d1551248c9e9db893 (diff)
downloadredis-9682b616a21b5e675a1ca82109a11d6f4de1d2de.tar.gz
minor fixes - mainly signalModifiedKey, and GEORADIUS
-rw-r--r--src/geo.c1
-rw-r--r--src/sds.c8
-rw-r--r--src/server.c2
-rw-r--r--src/server.h3
-rw-r--r--src/t_set.c9
-rw-r--r--src/t_zset.c12
6 files changed, 19 insertions, 16 deletions
diff --git a/src/geo.c b/src/geo.c
index 2d351d8e0..bcedd4637 100644
--- a/src/geo.c
+++ b/src/geo.c
@@ -465,6 +465,7 @@ void georadiusGeneric(client *c, int type) {
double radius_meters = 0, conversion = 1;
if ((radius_meters = extractDistanceOrReply(c, c->argv + base_args - 2,
&conversion)) < 0) {
+ addReplyError(c,"radius must be >= 0");
return;
}
diff --git a/src/sds.c b/src/sds.c
index e3dd67352..26e90a6db 100644
--- a/src/sds.c
+++ b/src/sds.c
@@ -55,13 +55,13 @@ static inline int sdsHdrSize(char type) {
}
static inline char sdsReqType(size_t string_size) {
- if (string_size < 32)
+ if (string_size < 1<<5)
return SDS_TYPE_5;
- if (string_size < 0xff)
+ if (string_size < 1<<8)
return SDS_TYPE_8;
- if (string_size < 0xffff)
+ if (string_size < 1<<16)
return SDS_TYPE_16;
- if (string_size < 0xffffffff)
+ if (string_size < 1ll<<32)
return SDS_TYPE_32;
return SDS_TYPE_64;
}
diff --git a/src/server.c b/src/server.c
index 3e0ed8dfa..810928a5a 100644
--- a/src/server.c
+++ b/src/server.c
@@ -675,7 +675,7 @@ int htNeedsResize(dict *dict) {
size = dictSlots(dict);
used = dictSize(dict);
- return (size && used && size > DICT_HT_INITIAL_SIZE &&
+ return (size > DICT_HT_INITIAL_SIZE &&
(used*100/size < HASHTABLE_MIN_FILL));
}
diff --git a/src/server.h b/src/server.h
index c840cf1f3..fc1533f31 100644
--- a/src/server.h
+++ b/src/server.h
@@ -475,7 +475,7 @@ typedef struct redisObject {
/* Macro used to obtain the current LRU clock.
* If the current resolution is lower than the frequency we refresh 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())
/* 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 updateDictResizePolicy(void);
int htNeedsResize(dict *dict);
-void oom(const char *msg);
void populateCommandTable(void);
void resetCommandTableStats(void);
void adjustOpenFilesLimit(void);
diff --git a/src/t_set.c b/src/t_set.c
index 7a2a77ff6..db5c544b6 100644
--- a/src/t_set.c
+++ b/src/t_set.c
@@ -351,9 +351,6 @@ void smoveCommand(client *c) {
dbDelete(c->db,c->argv[1]);
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 */
if (!dstset) {
@@ -361,6 +358,10 @@ void smoveCommand(client *c) {
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 */
if (setTypeAdd(dstset,ele->ptr)) {
server.dirty++;
@@ -547,6 +548,8 @@ void spopWithCountCommand(client *c) {
* the alsoPropagate() API. */
decrRefCount(propargv[0]);
preventCommandPropagation(c);
+ signalModifiedKey(c->db,c->argv[1]);
+ server.dirty++;
}
void spopCommand(client *c) {
diff --git a/src/t_zset.c b/src/t_zset.c
index c65ec6d43..5df6b51b9 100644
--- a/src/t_zset.c
+++ b/src/t_zset.c
@@ -2327,16 +2327,13 @@ void zunionInterGenericCommand(client *c, robj *dstkey, int op) {
serverPanic("Unknown operator");
}
- if (dbDelete(c->db,dstkey)) {
- signalModifiedKey(c->db,dstkey);
+ if (dbDelete(c->db,dstkey))
touched = 1;
- server.dirty++;
- }
if (dstzset->zsl->length) {
zsetConvertToZiplistIfNeeded(dstobj,maxelelen);
dbAdd(c->db,dstkey,dstobj);
addReplyLongLong(c,zsetLength(dstobj));
- if (!touched) signalModifiedKey(c->db,dstkey);
+ signalModifiedKey(c->db,dstkey);
notifyKeyspaceEvent(NOTIFY_ZSET,
(op == SET_OP_UNION) ? "zunionstore" : "zinterstore",
dstkey,c->db->id);
@@ -2344,8 +2341,11 @@ void zunionInterGenericCommand(client *c, robj *dstkey, int op) {
} else {
decrRefCount(dstobj);
addReply(c,shared.czero);
- if (touched)
+ if (touched) {
+ signalModifiedKey(c->db,dstkey);
notifyKeyspaceEvent(NOTIFY_GENERIC,"del",dstkey,c->db->id);
+ server.dirty++;
+ }
}
zfree(src);
}