Database / ScyllaDB Interview questions
Explain the execution flow of a lightweight transaction in ScyllaDB?
A lightweight transaction (LWT) needs every replica involved to agree on both the current value and the outcome of the conditional check before anything is applied, so it runs a Paxos round instead of the normal single-phase write path.
The coordinator first runs a Paxos "prepare" phase, proposing a ballot number to the replicas and asking them to promise not to accept any older proposal, while also learning the current value each replica holds. It then evaluates the IF condition against that value; if it holds, it runs the "propose" phase, asking replicas to accept the new value, and once a majority accepts, a final commit message applies it everywhere. This extra round-trip machinery, compared to a normal write's single pass, is exactly what guarantees the compare-and-swap is linearizable even if multiple clients race to update the same row simultaneously - only one will see its condition succeed.
More Related questions...