Skip to content

A conflict retry re-saves a same-key relocate after the put, so a retried delivery can end with a stub #3489

Open

Description

@kriszyp

Summary

In a replicated source transaction that writes a put and a relocate to the same key, the relocate saves as soon as it is added (it is not a chained or deferred write), so on a clean commit it runs before the deferred put and the put's full record wins. A conflict retry re-saves the transaction's writes in array order, which puts the relocate after the put; with a residency list that excludes the receiving node, the relocate then writes its INVALIDATED stub over the put's staged record. The same delivery therefore ends with the full record on a clean first commit and with a stub after a retried one, so receivers can diverge.

Trigger

A source transaction containing both a put and a relocate for one key, plus a write conflict that forces a coordinated retry. _recordRelocate commits a relocate in its own transaction, so no known producer emits both in one origin transaction; this was found by code review of the #3476 follow-up and has not been reproduced.

The behavior is the same on main before #3476.

Possible fix

Make _writeRelocate a chained write (chainsStagedState, reading priorStagedWrite and publishing stagedEntry) so it is ordered against earlier same-key writes like put/patch/delete are (harper#2211), and give retries the same order as the first attempt.

Related

#3476 and its follow-up PR (the relocate skip at the committed head), harper#2211 (per-key write ordering).
Review-Deferral: 0f8b86123de7ea9d severity=minor category=data-integrity

🤖 Generated by Claude Code (Claude Opus 5.5); posted via @kriszyp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    P3

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions