0

I run two redis commands:

A: hmset k1,v1,k2,v2,k3,v3....(hundreds keys) at 11:03:05,450

B: hmset k1,v1.1 at 11:03:05,727

But the final data I get for k1 is v1.

I consider there are several possible reasons:

  1. clocks on different machines are not accurate, so command B happens before A in fact. But I have other logic to prevent B run before A, and I'm 99 percent sure about that, so I don't want to trace this unless there are no other possible reasons.

  2. I'm not sure if A is an atomic command, but I think so, as redis is single thread. So is it possible A started before A but finished after B?

  3. May be related with the slave sync, but I can't figure out how?

I want to know if there are other possible reasons? And any suggestions how to check to make sure what happens?

I'm using redis cluster with several masters and slaves, and jedis 2.9.0.

Mobility
  • 3,117
  • 18
  • 31
  • How did you run these two commands? Run `A` until it finishes, i.e. `hmset` returns, and then run `B`? Or run `A`, and then run `B` before A finishes? It seems that you ran these two commands on 2 machines. If so, did you run `B` after you send `A`, but before you got the result of `A`? – for_stack Jan 18 '18 at 09:25
  • @for_stack A and B run totally independently on 2 machines . From the log, I can see A finished(the jedis funtion finished, not sure if the command really finished) before B start. And I have other logic that B will accurately not run if k1 not exist(which can only be inited by command A). So I think I'm sure that A ran before B. – Mobility Jan 23 '18 at 07:59

0 Answers0