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
test 1: mget number1 number3 should return 4 15.
redis 127.0.0.1:6370> get number3
"15"
redis 127.0.0.1:6370> multi
OK
redis 127.0.0.1:6370> mget number1 number3
QUEUED
redis 127.0.0.1:6370> set number3 20
QUEUED
redis 127.0.0.1:6370> exec
"4"
"20"
OK
test 2: dbsize in transaction should return 11, not 12.
redis 127.0.0.1:6370> dbsize
(integer) 11
redis 127.0.0.1:6370> multi
OK
redis 127.0.0.1:6370> dbsize
QUEUED
redis 127.0.0.1:6370> set number2 1
QUEUED
redis 127.0.0.1:6370> exec
(integer) 12
OK
the reason is the commands are sent sequently, but not executed sequently.
The text was updated successfully, but these errors were encountered:
I think a good way to fix this will be to have the MULTI/EXEC list of commands get put inside a simple Lua script that we can generate when EXEC is called. The Lua script will just call redis.call sequentially and build a list (Lua table) of responses. If we do this, I think will simplify a lot of the current code around transactions since in Scala we only ever deal with one command being run (EVAL/EVVALSHA).
What do you think? The other option is to rewrite the current transaction code to go from "send commands -> await all replies" to "send command -> await reply -> send command -> await reply -> etc".
There might be some overhead compiling/running the Lua script, but it will simplify the code a lot.
I don't know much about Lua script, i will look at it later. In your second solution, your don't need to send all commands sequently, the problem is commands with multi key and some commands like dbsize executed by clientNode may conflict with other commands, but implementing this is more complicated.
And there are other problems about the transaction, i will post it later.
test 1: mget number1 number3 should return 4 15.
redis 127.0.0.1:6370> get number3
"15"
redis 127.0.0.1:6370> multi
OK
redis 127.0.0.1:6370> mget number1 number3
QUEUED
redis 127.0.0.1:6370> set number3 20
QUEUED
redis 127.0.0.1:6370> exec
test 2: dbsize in transaction should return 11, not 12.
redis 127.0.0.1:6370> dbsize
(integer) 11
redis 127.0.0.1:6370> multi
OK
redis 127.0.0.1:6370> dbsize
QUEUED
redis 127.0.0.1:6370> set number2 1
QUEUED
redis 127.0.0.1:6370> exec
the reason is the commands are sent sequently, but not executed sequently.
The text was updated successfully, but these errors were encountered: