Bounded Rollouts and Guarded Writes

Lesson 4 of 4

Rebase, Then Watch the Refusals

Estimated time: 10 minutes

Rebase, then watch the refusals

When a write is rejected because the version moved, the answer is not to resend the same record. Re-read the current row, reapply only the field this run owns, and write with the fresh version.

That keeps each writer responsible for its own field and leaves every other field alone. It also turns a race into a small orderly retry instead of a silent overwrite.

Keep a count of writes rejected for a version mismatch. That number is the volume of updates that would otherwise have been lost, and a rising count is a signal that several runs are editing the same record at once.

def apply_owned_field(store, record_id, field, value):
    cur = store.get(record_id)
    cur[field] = value
    return save(store, cur, cur["version"])

A record that sees frequent mismatches wants one owner, or a queue in front of it. The count is what tells you where that work belongs.