The source Lua example preserves owner-b when a stale owner-a requests deletion, deletes on an owner-b match, and returns zero for an absent key. An unhandled redis.call error preserves earlier writes but stops later statements; confirmed NOSCRIPT concerns missing code.

Redis Lua scripts run without interleaving

A Redis Lua script can read data, make a decision, and update it without another client’s command interleaving between those steps. It does not mean every statement succeeds, that earlier writes are undone after an error, or that the result is automatically durable. ...

January 11, 2028 · 7 min · XB Field Notes
The source stock example rejects a watched stale queue after a rival changes stock from 2 to 1; the marker remains absent. A new watched attempt reads 1 and commits 0 with the marker. MULTI/EXEC alone cannot repair an earlier stale read.

WATCH protects Redis read-modify-write decisions

MULTI/EXEC prevents another client’s commands from interleaving while the queued commands execute. That alone does not protect a value read earlier in the application. If two buyers read the same stock count and later write their own calculated value, wrapping each SET in a transaction can still lose an update. ...

July 22, 2027 · 7 min · XB Field Notes