Manystead

Worked case · Waking up elsewhere

Retrying a write when the answer was lost

What changes when the same write is sent twice because the first answer never arrived?

The situation

You send a write named r1. The answer never arrives. You do not know whether the write happened, so you send r1 again.

  1. write r1answer lost
  2. write r1 againreceipt for A
  3. 1 · Aedition
  4. view: Aposition 1
A write response disappearsBefore the answerWith the answer
The changes

Replay these in your head or in your own code, starting from the saved position. They are synthetic. There is nothing to install and nothing to send.

{
  "initial": {
    "read_bookmark": 0,
    "visible": [],
    "withdrawn": [],
    "logical_writes": 0
  },
  "steps": [
    {
      "delivery": "response_lost",
      "operation": "r1"
    },
    {
      "delivery": "retry",
      "response": {
        "kind": "write_receipt",
        "operation": "r1",
        "id": "A"
      }
    },
    {
      "delivery": "changes",
      "events": [
        {
          "seq": 1,
          "kind": "edition",
          "id": "A"
        }
      ],
      "continuation": 1
    }
  ]
}
Expected view

Work it out before you look.

Reveal the expected viewHide the expected view

Nothing happens twice. The retry carries the same operation name, r1, so it returns the receipt for the same edition, A. One edition is visible and one write is counted.

{
  "read_bookmark": 1,
  "visible": [
    "A"
  ],
  "withdrawn": [],
  "logical_writes": 1
}