summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-12-02 16:57:23 +0100
committerantirez <antirez@gmail.com>2014-12-02 17:01:55 +0100
commit0e40124d0fd886d1eb76a37be125ab04d839d78f (patch)
treef49a52c8009b01b33662b72de465cb2d2bc55004
parentd0cc96f0534eb4c2313a454f161c3e75b0a996be (diff)
downloadredis-0e40124d0fd886d1eb76a37be125ab04d839d78f.tar.gz
Mark PFCOUNT as read-only, even if not true.
PFCOUNT is technically speaking a write command, since the cached value of the HLL is exposed in the data structure (design error, mea culpa), and can be modified by PFCOUNT. However if we flag PFCOUNT as "w", read only slaves can't execute the command, which is a problem since there are environments where slaves are used to scale PFCOUNT reads. Nor it is possible to just prevent PFCOUNT to modify the data structure in slaves, since without the cache we lose too much efficiency. So while this commit allows slaves to create a temporary inconsistency (the strings representing the HLLs in the master and slave can be different in certain moments) it is actually harmless. In the long run this should be probably fixed by turning the HLL into a more opaque representation, for example by storing the cached value in the part of the string which is not exposed (this should be possible with SDS strings).
-rw-r--r--src/redis.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/redis.c b/src/redis.c
index bb4513979..bf1209199 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -271,7 +271,7 @@ struct redisCommand redisCommandTable[] = {
{"command",commandCommand,0,"rlt",0,NULL,0,0,0,0,0},
{"pfselftest",pfselftestCommand,1,"r",0,NULL,0,0,0,0,0},
{"pfadd",pfaddCommand,-2,"wmF",0,NULL,1,1,1,0,0},
- {"pfcount",pfcountCommand,-2,"w",0,NULL,1,1,1,0,0},
+ {"pfcount",pfcountCommand,-2,"r",0,NULL,1,1,1,0,0},
{"pfmerge",pfmergeCommand,-2,"wm",0,NULL,1,-1,1,0,0},
{"pfdebug",pfdebugCommand,-3,"w",0,NULL,0,0,0,0,0},
{"latency",latencyCommand,-2,"arslt",0,NULL,0,0,0,0,0}