Fix incorrect keyspace read/write statistics.
This commit is contained in:
@@ -99,6 +99,7 @@ rdb_saves
|
||||
explicit BGSAVE as well as automatic saves due to 'save' configuration
|
||||
parameter thresholds, but not saves to dedicated SYNC file or BGSAVETO.
|
||||
|
||||
|
||||
New/Modified Redis Commands
|
||||
---------------------------
|
||||
|
||||
@@ -157,6 +158,7 @@ SLOWLOG GET
|
||||
is useful if the command operated on keys that don't exist anymore
|
||||
or if the command had more parameters than allowed in the slow log.
|
||||
|
||||
|
||||
Build Tree Changes
|
||||
------------------
|
||||
|
||||
|
||||
@@ -60,11 +60,12 @@ robj *lookupKeyRead(redisDb *db, robj *key) {
|
||||
|
||||
expireIfNeeded(db,key);
|
||||
val = lookupKey(db,key);
|
||||
if (server.current_client != NULL && !(server.current_client->flags & REDIS_MASTER)) {
|
||||
if (server.current_client != NULL && !(server.current_client->flags & REDIS_MASTER) && !server.stat_current_request_recorded) {
|
||||
if (val == NULL)
|
||||
server.stat_keyspace_read_misses++;
|
||||
else
|
||||
server.stat_keyspace_read_hits++;
|
||||
server.stat_current_request_recorded = 1;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@@ -74,11 +75,12 @@ robj *lookupKeyWrite(redisDb *db, robj *key) {
|
||||
|
||||
expireIfNeeded(db,key);
|
||||
val = lookupKey(db,key);
|
||||
if (server.current_client != NULL && !(server.current_client->flags & REDIS_MASTER)) {
|
||||
if (server.current_client != NULL && !(server.current_client->flags & REDIS_MASTER) && !server.stat_current_request_recorded) {
|
||||
if (val == NULL)
|
||||
server.stat_keyspace_write_misses++;
|
||||
else
|
||||
server.stat_keyspace_write_hits++;
|
||||
server.stat_current_request_recorded = 1;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
@@ -1726,6 +1726,7 @@ void call(redisClient *c, int flags) {
|
||||
|
||||
/* Call the command. */
|
||||
server.slowlog_complexity_params_count = 0;
|
||||
server.stat_current_request_recorded = 0;
|
||||
redisOpArrayInit(&server.also_propagate);
|
||||
dirty = server.dirty;
|
||||
c->cmd->proc(c);
|
||||
|
||||
@@ -574,6 +574,7 @@ struct redisServer {
|
||||
unsigned long slowlog_max_len; /* SLOWLOG max number of items logged */
|
||||
struct complexity_param slowlog_complexity_params[REDIS_SLOWLOG_MAX_COMPLEXITY_PARAMS];
|
||||
int slowlog_complexity_params_count;
|
||||
int stat_current_request_recorded;
|
||||
/* The following two are used to track instantaneous "load" in terms
|
||||
* of operations per second. */
|
||||
long long ops_sec_last_sample_time; /* Timestamp of last sample (in ms) */
|
||||
|
||||
Reference in New Issue
Block a user