-1

Is it possible - when executing ZADD in redis cluster environment - that all the added keys end up not being available at the same time to everyone ?

We use a (scala) redis client to add batch of keys with ZADD. The keys are then requested after a timeout of X milliseconds. It appears that 1 batch key is sometimes (rarely) missing and is only available few milliseconds later. I thought that, in Redis consistency model, either all keys are replicated enough and thus available, or not and therefore none shows. Thus I don't understand how 1 single key could be missing.

Is that normal Redis / ZADD behavior in a cluster environment ?

Or is that definitely not normal and this could only be explained by a source code issue that has nothing to do with Redis (redis client / or our own) ?

Azzip
  • 122
  • 10

1 Answers1

-1

Redis replication is asynchronous, so if it is a big batched ZADD, it indeed might take a few milliseconds for it to replicate. You should use the WAIT command after invoking the ZADD if you want to ensure that the replica slave(s) received the transaction.

Not_a_Golfer
  • 47,012
  • 14
  • 126
  • 92
  • My issue is not, "will it take time for the data to replicate and then be available". But, "will all keys added with a single ZADD command be available at the same time to everyone in a cluster" ? Or is it possible that some key will be visible before another (to some user) ? Or maybe is it the way I retrieve the amount of data (ZRANGE) which is not cluster safe / consistent ? – Azzip Oct 20 '17 at 19:04
  • All your keys will be available as one transaction. Your question is poorly phrased and it was hard to understand m – Not_a_Golfer Oct 20 '17 at 20:35