stephenmcd / curiodb

Distributed NoSQL Database
http://curiodb.jupo.org
BSD 2-Clause "Simplified" License
511 stars 47 forks source link

fix list blocking operations #21

Open meteorgan opened 8 years ago

meteorgan commented 8 years ago

about list blocking operations, still have some problems:

  1. not support multi keys. supporting multi keys in multi keyNode needs much more works.
  2. the scheduler in the block function may has race conditions with unblock. Is sending an unblock message in the scheduler a better solution?
meteorgan commented 8 years ago

@stephenmcd do you have any advice for this PR?

stephenmcd commented 8 years ago

Sorry I didn't have time to look at it yet, the other recent changes were very quick to review.

It might save some time if you can provide a set of commands or a script that reproduces the problem.

meteorgan commented 8 years ago

OK, I will do it at this night.

meteorgan commented 8 years ago
  1. blpop only blocks 1s no matter how much timeout is setted. Executing blocking operations should not set timeout. redis 127.0.0.1:6370> lrange list2 0 -1 (empty list or set) redis 127.0.0.1:6370> blpop list2 5 (error) ERR Timeout on blpop list2 5 (1.01s)
  2. this is because in unblock change command to the former block command, but does not change back,so there is no response back. a. redis 127.0.0.1:6370> blpop list2 30 1) "list2" 2) "xxx" (6.98s) b. block forever redis 127.0.0.1:6370> lpush list2 xxx
  3. timeout 0 does not work. redis 127.0.0.1:6370> blpop list2 0 (nil)
  4. scheduler setted in block function is not cancelled in unblock function.