About Lua atomicity in Kvrocks #3051
-
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).
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? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@yp963 It's not a performance consideration, because read-write Lua script is a single-thread mode in Kvrocks. We could enhance this by enabling the transaction mode for Lua like |
Beta Was this translation helpful? Give feedback.
-
Sorry I cannot get your point. In computer programs, an infinite loop indicates that the following code is all unreachable. For example, a program
is equal to
regardless of whether |
Beta Was this translation helpful? Give feedback.
We have an experimental config option
txn-context-enabled
for this.