[PATCH] Transaction traceability - txid_status(bigint)
Craig Ringer <craig@2ndquadrant.com>
From: Craig Ringer <craig@2ndquadrant.com>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2016-08-20T13:24:47Z
Lists: pgsql-hackers
Attachments
- 0001-Introduce-txid_status-bigint-to-get-status-of-an-xac.patch (text/x-patch) patch 0001
Hi all Following on from bigint txids vs 'xid' type, new txid_recent(bigint) => xid https://www.postgresql.org/message-id/CAMsr+YFDZMN_iZ7KrRoe+j0KVLQvFVgvZxbcVxR-MLjgtoZugA@mail.gmail.com here's a patch that implements a txid_status(bigint) function to report the commit status of a function. If an application is disconnected while a COMMIT request is in flight, the backend crashes mid-commit, etc, then an application may not be sure whether or not a commit completed successfully or was rolled back. While two-phase commit solves this it does so at a considerable overhead, so introduce a lighter alternative. txid_status(bigint) lets an application determine the status of a a commit based on an xid-with-epoch as returned by txid_current() or similar. Status may be committed, aborted, in-progress (including prepared xacts) or null if the xact is too old for its commit status to still be retained because it has passed the wrap-around epoch boundary. Applications must call txid_current() in their transactions to make much use of this since PostgreSQL does not automatically report an xid to the client when one is assigned. A future protocol enhancement to report txid assignment would be very useful, but quite separate to this. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Commits
-
Add a txid_status function.
- 857ee8e391ff 10.0 landed
-
Track the oldest XID that can be safely looked up in CLOG.
- ea42cc18c353 10.0 landed