Example — failover-demo
Example — failover-demo
Manual primary-failover demo with Transaction Write Replay (TWR) on the proxy side.
Source on GitHub: HeliosDB-Proxy/examples/failover-demo
Demonstrates
- Application connects to the proxy on
:5432and starts a long-running transaction - Operator triggers
pg_promoteon the standby; primary goes down mid-transaction - HeliosProxy detects the failover and, with
tr_mode = "transaction", replays the uncommitted transaction against the new primary — verifying each replayed response against the digest of what the client already saw, and rolling back with SQLSTATE40001on any divergence - The application keeps its connection and the transaction commits on the new primary; had the COMMIT itself been in flight, the client would get SQLSTATE
08007and the COMMIT would not be retried - Had the transaction been opened at
SERIALIZABLEorREPEATABLE READ, it would not have been replayed at all — no replacement backend can reproduce that snapshot - This needs no cargo feature: in-session replay is core.
ha-tris what adds the separate write journal and the/api/replayendpoint below
Run
cd HDB-HeliosDB-Proxy/examples/failover-demo./run-demo.shThe driver script narrates each step. Watch the proxy admin UI’s Topology panel to see the failover in real time. The Time-Travel Replay panel reads the separate ha-tr write journal, which is populated by the write path rather than by the session recovery — it is a different view, not a trace of the replay you just watched.
Why it matters
This is the demo that maps directly to Innovation #6 (Transaction Write Replay) in the HeliosProxy IP portfolio — Oracle TAF/TAC-equivalent failover transparency without per-application code changes.