GitHub user nhancdt2602 created a discussion: Does Kvrocks guarantee atomicity property in case of crash?
Hey team, I'm posting this question to verify my understanding of the atomicity guarantees provided by Lua scripts in Kvrocks. By **atomicity**, I mean the property that all write operations within a Lua script either succeed together or fail together in case Kvrocks crashes during execution. Based on this PR: https://github.com/apache/kvrocks/pull/1287, my understanding is that RocksDB's `WriteBatch` prevents any partial writes from being persisted. In other words, if Kvrocks crashes while executing a Lua script, none of the writes that have already been executed in the script will be visible after the server restarts. For example, assuming the current value of `A` is `10`: ```lua -- Current value: A = 10 redis.call('SET', 'A', 20) -- Kvrocks crashes here. B is never set, but A has already been updated in memory. ❌ redis.call('SET', 'B', 100) ``` After Kvrocks restarts, my expectation is that `A` will still be `10` because the `WriteBatch` was never committed. Is my understanding correct? GitHub link: https://github.com/apache/kvrocks/discussions/3546 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
