Locks, leases, fencing tokens, FizzBee
surfingcomplexity.blog
surfingcomplexity.blog
You can often rephrase and algorithm without a commit step into one that has one, although sometimes it can feel more complicated. E.g. instead of doing A and B in a critical section, commit an intent to do A and B, and then let an idempotent process execute that intent.
Also won't fencing token require some kind of token manager, that ensures you must present the highest token to do the action, and that you have to ask to get a new token, and that when you fail because your token is too old you must re-request one, is this modelled?
The algorithm we're checking is using Redis, and the atomic read/write in the example is a behaviour Redis gives you.
The Kleppman critique about efficiency vs correctness is exactly right. Redis for efficiency is great as a work-saving optimization. Redis for correctness (assuming it is possible) asks a remote system to enforce behavior at a far remove from the place where correctness is evident, which is system state, usually data in a datastore.
If it is just linearizability (atomic key-value storage) then write-through caches work simply and correctly. You reap the benefits on the read side.