Re: StandbyRecoverPreparedTransactions recovers subtrans links incorrectly

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2017-04-25T15:28:48Z
Lists: pgsql-hackers
Simon Riggs <simon@2ndquadrant.com> writes:
> I can't see any reason now why overwriteOK should exist at all. I'm
> guessing that the whole "overwriteOK" idea was an incorrect response
> to xids appearing where they shouldn't have done because of the
> mistake you just corrected. So I will now remove the parameter from
> the call.

Seems reasonable, but I don't like the logic change you made in
SubTransSetParent; you broke the former invariant, for non-Assert
builds, that the target pg_subtrans entry is guaranteed to have
the correct value on exit.  I do like fixing it to not dirty the
page unnecessarily, but I'd suggest that we write it like

	if (*ptr != parent)
	{
		Assert(*ptr == InvalidTransactionId);
		*ptr = parent;
		SubTransCtl->shared->page_dirty[slotno] = true;
	}

			regards, tom lane


Commits

  1. Rework handling of subtransactions in 2PC recovery

  2. Fix order of arguments to SubTransSetParent().

  3. Speedup 2PC recovery by skipping two phase state files in normal path