GitHub user yp963 edited a discussion: About Lua atomicity in Kvrocks
I’ve observed an interesting behavior regarding Lua script execution in
Kvrocks. When a Lua script contains an infinite loop, operations before the
loop (e.g., SET) are persisted, while subsequent operations are not executed.
After a restart, I can still retrieve the values set before the loop (e.g., GET
'a' returns 10 in the example below).
```
redis.call('SET', 'a', '10')
local a_value = redis.call('GET', 'a')
if a_value == '10' then
while true do
redis.log(redis.LOG_WARNING, "Looping indefinitely...")
end
redis.call('SET', 'a', '20')
else
redis.call('SET', 'a', '30')
end
return "Script finished (should not happen if 'a' was 10)"
```
This differs from Redis.
I’m curious about the design choices behind this behavior. Why wasn't RocksDB's
transaction feature used to enforce full atomicity? Was this a performance
optimization, or were there other trade-offs?
GitHub link: https://github.com/apache/kvrocks/discussions/3051
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]