accesspatterns.dev

No silent clobbers

A version check lets an update land only if nobody changed the item since you read it.

Why

Two people open the same itinerary. Without a guard, the second to save silently overwrites the first. A version attribute fixes that: every write carries the version it expects and bumps it atomically with ADD.

Update with the version you read and it lands, taking version from 3 to 4. Run the stale update and the condition version = 3 no longer holds, so the engine rejects it with a ConditionalCheckFailedException. The stale writer must re-read and retry. No update is ever lost.

A version attribute plus a condition gives optimistic concurrency: a stale write bounces instead of silently overwriting a newer one.

Itineraries

These rows are real and already here. Running an operation against them downloads a DynamoDB-compatible engine, about 850 KB, and executes it in this tab.

Try an example

The Kyoto itinerary is at version 3. You must know the version before you can lock on it.

pk(pk)
sk(sk)
title
days
version
DOC#kyoto
vS
Kyoto autumnS
6N
3N
DOC#patagonia
vS
Patagonia trekS
11N
7N
DOC#lisbon
vS
Lisbon weekendS
3N
1N
DOC#nile
vS
Nile cruiseS
8N
2N
DOC#iceland
vS
Iceland ring roadS
9N
5N

Run an operation to see the raw engine response.

table Itinerarieskeys pk / skitems 5