Reading from a replica after a write, and the lie it tells

A form that saves and redirects to a page that reads, with a replica that is 200 ms behind and a redirect that takes 40.

// the wrong fix: always read the primary after a write
// the right one: read the primary for THIS request

DB::beginTransaction();
$order->save();
DB::commit();

// the connection is now sticky for the rest of the request
DB::connection()->recordsHaveBeenModified();

// which does not help the NEXT request, after the redirect.

Sticky-per-request covers the common case and not the redirect, which is the case users actually hit. The options are a short primary-affinity cookie, passing the write position and waiting for the replica to reach it, or accepting staleness where it is harmless. We used the cookie for five seconds after a write, which is crude, understandable and has not caused a support ticket.