From 7659619824755b929251faff457d3873b9742f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=90=83=E7=8A=B6=E9=97=AA=E7=94=B5?= Date: Tue, 12 Jun 2018 15:28:28 +0800 Subject: [PATCH 1/3] Update geohash.c fix geohasEncode bug when step > 31 --- src/geohash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/geohash.c b/src/geohash.c index 1ae7a7e0..b40282e7 100644 --- a/src/geohash.c +++ b/src/geohash.c @@ -144,8 +144,8 @@ int geohashEncode(const GeoHashRange *long_range, const GeoHashRange *lat_range, (longitude - long_range->min) / (long_range->max - long_range->min); /* convert to fixed point based on the step size */ - lat_offset *= (1 << step); - long_offset *= (1 << step); + lat_offset *= (1ULL << step); + long_offset *= (1ULL << step); hash->bits = interleave64(lat_offset, long_offset); return 1; } From 963002d71e64ffd1491b398eea3f57a34d928464 Mon Sep 17 00:00:00 2001 From: "zhaozhao.zz" Date: Wed, 13 Jun 2018 20:35:40 +0800 Subject: [PATCH 2/3] optimize reply list memory usage --- src/networking.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/networking.c b/src/networking.c index 00558974..02e77307 100644 --- a/src/networking.c +++ b/src/networking.c @@ -247,7 +247,7 @@ void _addReplyStringToList(client *c, const char *s, size_t len) { /* Append to this object when possible. If tail == NULL it was * set via addDeferredMultiBulkLength(). */ - if (tail && sdslen(tail)+len <= PROTO_REPLY_CHUNK_BYTES) { + if (tail && (sdsavail(tail) >= len || sdslen(tail)+len <= PROTO_REPLY_CHUNK_BYTES)) { tail = sdscatlen(tail,s,len); listNodeValue(ln) = tail; c->reply_bytes += len; From 2ffa533f8556b3c642b1099b98ba8b59889b1250 Mon Sep 17 00:00:00 2001 From: "zhaozhao.zz" Date: Thu, 14 Jun 2018 01:30:07 +0800 Subject: [PATCH 3/3] fix exists command on slave --- src/db.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/db.c b/src/db.c index 16928aa0..3307cdee 100644 --- a/src/db.c +++ b/src/db.c @@ -467,8 +467,7 @@ void existsCommand(client *c) { int j; for (j = 1; j < c->argc; j++) { - expireIfNeeded(c->db,c->argv[j]); - if (dbExists(c->db,c->argv[j])) count++; + if (lookupKeyRead(c->db,c->argv[j])) count++; } addReplyLongLong(c,count); }