Skip to content

Peer write relay: wait until the peer has applied the commit, and return a status handle on timeout #2452

Open

Description

@bplatz

Problem

A query peer forwards a transaction to its transaction server over HTTP, waits for the server's response (up to 300 s), and relays it. Two things are missing from that path:

  • Read-your-writes on the peer. The peer replies as soon as the transaction server has committed, before the peer has applied that commit itself. A client whose next query goes to the same peer can miss its own write unless it sends the receipt's t back as Fluree-Min-T.
  • A handle when the forward times out. A forward that times out returns a bare 504, with nothing for the client to check later. Idempotency-Key with /submissions/:key/*ledger reports a submission's outcome. But it works only when the client sent a key, and a peer answers the status route itself, from an idempotency cache it doesn't have, so through a peer the status is always unknown.

Proposal

On a peer, for every forwarded transaction:

  1. Use the client's Idempotency-Key, or mint one when there is none, and forward with it.
  2. Once the transaction server answers with a commit, wait (bounded by the existing min-t timeout) until the peer's own view of the ledger reaches the receipt's t, then reply. The peer already tracks each ledger's t from the event stream, and min-t waits use the same mechanism.
  3. If the forward times out, or the peer's view doesn't reach t in time, reply 202 Accepted with the idempotency key and the status URL, rather than 504.
  4. Forward /submissions/:key/*ledger to the transaction server, which holds the outcome.

Open questions

  • Whether step 2 is the default or opt-in (for example a header). It adds the peer's apply latency to every forwarded write.
  • How long the transaction server keeps an outcome in its idempotency cache, and what the status route reports once it's gone. The commit log is the fallback.

Context

From the review of #2409, which forwards the nameservice sync routes from peers to the transaction server.

Activity

  1. added
    enhancement
    P2
    area:server
    on Nov 18, 2026
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

    P2area:serverenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions