Re: StandbyRecoverPreparedTransactions recovers subtrans links incorrectly
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nikhil Sontakke <nikhils@2ndquadrant.com>
Cc: Simon Riggs <simon@2ndquadrant.com>, Andres Freund <andres@anarazel.de>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2017-04-26T14:28:46Z
Lists: pgsql-hackers
Nikhil Sontakke <nikhils@2ndquadrant.com> writes: > A SELECT query on the newly promoted master on any of the tables involved > in the 2PC hangs. The hang is due to a loop in > SubTransGetTopmostTransaction(). Due to incorrect linkages, we get a > circular reference in parentxid <-> subxid inducing the infinite loop. I'm inclined to propose that (1) SubTransSetParent should contain an assert that Assert(TransactionIdFollows(xid, parent)); There is a similar assertion near one of the call sites, but that's obviously too far away from the action. (2) SubTransGetTopmostTransaction ought to contain an actual runtime test and ereport (not just Assert) that the parent XID it got from pg_subtrans precedes the child XID that was looked up. This would protect us against similar infinite loops in the future. Even without bugs, such a loop could arise due to corrupted data. regards, tom lane
Commits
-
Rework handling of subtransactions in 2PC recovery
- 49e928154978 10.0 landed
-
Fix order of arguments to SubTransSetParent().
- f5885488dacb 9.6.3 landed
- 0874d4f3e183 10.0 landed
- 952e33b05275 9.2.21 landed
- a66e01bbcc88 9.5.7 landed
- 8565808733ec 9.3.17 landed
- 2e14541c4992 9.4.12 landed
-
Speedup 2PC recovery by skipping two phase state files in normal path
- 728bd991c3c4 10.0 cited