From acb3b552800c6ee95a36d49b24332b7a6dd93f59 Mon Sep 17 00:00:00 2001 From: Itamar Haber Date: Wed, 17 Oct 2018 16:13:55 +0300 Subject: [PATCH 1/3] Corrects inline documentation of syntax --- src/t_stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t_stream.c b/src/t_stream.c index f1eee6eb..6244c784 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -1892,7 +1892,7 @@ void xackCommand(client *c) { addReplyLongLong(c,acknowledged); } -/* XPENDING [ ] [] +/* XPENDING [ []] * * If start and stop are omitted, the command just outputs information about * the amount of pending messages for the key/group pair, together with From edeaf85cab10b2d9bc151363779f70822d679472 Mon Sep 17 00:00:00 2001 From: Itamar Haber Date: Wed, 17 Oct 2018 19:33:11 +0300 Subject: [PATCH 2/3] Plugs a potential underflow --- src/t_stream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/t_stream.c b/src/t_stream.c index 6244c784..e4c9fed5 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -1921,6 +1921,7 @@ void xpendingCommand(client *c) { if (c->argc >= 6) { if (getLongLongFromObjectOrReply(c,c->argv[5],&count,NULL) == C_ERR) return; + if (count < 0) count = 0; if (streamParseIDOrReply(c,c->argv[3],&startid,0) == C_ERR) return; if (streamParseIDOrReply(c,c->argv[4],&endid,UINT64_MAX) == C_ERR) From 5ddd507624aad7d07558e684a962b7505214ae74 Mon Sep 17 00:00:00 2001 From: "zhaozhao.zz" Date: Fri, 19 Oct 2018 18:16:29 +0800 Subject: [PATCH 3/3] if we read a expired key, misses++ --- src/db.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/db.c b/src/db.c index ec92a2b4..8b7ad521 100644 --- a/src/db.c +++ b/src/db.c @@ -102,7 +102,10 @@ robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags) { /* Key expired. If we are in the context of a master, expireIfNeeded() * returns 0 only when the key does not exist at all, so it's safe * to return NULL ASAP. */ - if (server.masterhost == NULL) return NULL; + if (server.masterhost == NULL) { + server.stat_keyspace_misses++; + return NULL; + } /* However if we are in the context of a slave, expireIfNeeded() will * not really try to expire the key, it only returns information @@ -121,6 +124,7 @@ robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags) { server.current_client->cmd && server.current_client->cmd->flags & CMD_READONLY) { + server.stat_keyspace_misses++; return NULL; } }