You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PFCOUNT currently can't be executed in read only slaves since it's marked as a write command because of the caching performed.
Quoting myself from the mailing list:
I believe we should simply remove the
write flag from the PFCOUNT command, declaring it as a read-only
command. What do you think?
I checked all the code paths where we check if a command is a write
command, and basically I can't find a single one where it is a problem
if PFCOUNT alters the flag.
If we want to stay super correct and guarantee that HLLs are the same
string exactly both in the master and slave side, we can still do this
by checking inside the command if we are executing in the context of a
read-only slave and prevent the caching, but this would trash
performances when people need to scale PFCOUNT using replication, so I
would not mind that there is this one-bit desync in HLLs between
slaves and masters.
@joshula I need a few seconds to consider better the full implications of this.
Right now, the reason why I don't commit the above one char change is that it sounds odd that a sequence of commands like PFADD + APPEND will create a non valid HyperLogLog which is so, basically, just a string, that is desynchronized between masters and slaves. Probably it's not a great issue, and probably the right approach, but I'm still not convinced. Another issue is with DEBUG DIGEST that will report two different hashes.
The problem is that there is a design error here. A cached value is exposed... instead it should be handed as a dual-ported object, with a pointer in the robj structure being NULL or having a type-defined cache. However for the sake of memory efficiency, this was not done.
I think I'll end doing the one char change at, let's say, 90% of probability. But probably I'll also modify DEBUG DIGEST to don't hash the final part of a string that has the HLL prefix.
Activity
joshula commentedon Nov 13, 2014
Agree. This is the only read op that I can't scale right now - you have my full support.
mattsta commentedon Nov 13, 2014
If you need it now, it's just a one character change:
joshula commentedon Nov 13, 2014
@ mattsta, thanks. Any thoughts on when it'll get merged into stable?
antirez commentedon Nov 13, 2014
@joshula I need a few seconds to consider better the full implications of this.
Right now, the reason why I don't commit the above one char change is that it sounds odd that a sequence of commands like PFADD + APPEND will create a non valid HyperLogLog which is so, basically, just a string, that is desynchronized between masters and slaves. Probably it's not a great issue, and probably the right approach, but I'm still not convinced. Another issue is with DEBUG DIGEST that will report two different hashes.
The problem is that there is a design error here. A cached value is exposed... instead it should be handed as a dual-ported object, with a pointer in the
robjstructure being NULL or having a type-defined cache. However for the sake of memory efficiency, this was not done.I think I'll end doing the one char change at, let's say, 90% of probability. But probably I'll also modify DEBUG DIGEST to don't hash the final part of a string that has the HLL prefix.
antirez commentedon Dec 2, 2014
Fixed in 8a7ccc5.
Update RedisTimeSeries to version 8.11.90 (#15969)