Re: Re: [COMMITTERS] pgsql: Rework subtransaction commit protocol for hot standby.

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Rework subtransaction commit protocol for hot standby.
Date: 2008-10-23 18:37:35
Message-ID: 1224787055.27145.682.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers


On Thu, 2008-10-23 at 04:38 +0100, Simon Riggs wrote:

> > That means that out of the four state transitions that are
> > disallowed by the original coding of that Assert, you are now having to
> > consider two as legal. I don't like that, and I like even less that
> > it's not even trying to determine whether this is a replay-driven
> > change.

Possible state changes

TRANSACTION_STATUS_IN_PROGRESS to
TRANSACTION_STATUS_IN_PROGRESS is allowed
TRANSACTION_STATUS_COMMITTED is allowed
TRANSACTION_STATUS_ABORTED is allowed
TRANSACTION_STATUS_SUB_COMMITTED is allowed

TRANSACTION_STATUS_SUB_COMMITTED to
TRANSACTION_STATUS_IN_PROGRESS is allowed (but should not be)
TRANSACTION_STATUS_COMMITTED is allowed
TRANSACTION_STATUS_ABORTED is allowed
TRANSACTION_STATUS_SUB_COMMITTED is allowed

TRANSACTION_STATUS_COMMITTED to
TRANSACTION_STATUS_IN_PROGRESS is disallowed
TRANSACTION_STATUS_COMMITTED is allowed
TRANSACTION_STATUS_ABORTED is disallowed
TRANSACTION_STATUS_SUB_COMMITTED is ignored in redo only

TRANSACTION_STATUS_ABORTED to
TRANSACTION_STATUS_IN_PROGRESS is disallowed
TRANSACTION_STATUS_COMMITTED is disallowed
TRANSACTION_STATUS_ABORTED is allowed
TRANSACTION_STATUS_SUB_COMMITTED is disallowed

So out of 16 possible state change requests 10 were previously allowed,
one of which was allowed but should not have been.

This patch allows 1 additional legal state change request, now in redo
only.

There are still 5 disallowed state changes, plus another one disallowed
in normal running. That seems fine.

> Presumably you would like to see an additional parameter to allow that
> test to be more strictly determined?
>
> Bug fix v2 patch enclosed, mostly API changes.

I suggest a third version with these changes:

* Write the SUBCOMMITTED to COMMIT transition as a no-op during redo
rather than as an Assert. This prevents a transition from COMMIT to
SUBCOMMIT to ABORT. By making it a no-op the attempt to set COMMIT to
SUBCOMMIT never causes a failure, but it doesn't take place either.

* Disallow SUBCOMMITTED to IN_PROGRESS transition via an Assert.

What do you think?

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Magnus Hagander 2008-10-24 11:48:30 pgsql: Remove large parts of the old SSL readme, that consisted of a
Previous Message Magnus Hagander 2008-10-23 16:17:22 pgsql: Fix memory leak when using gsslib parameter in libpq connections

Browse pgsql-hackers by date

  From Date Subject
Next Message Kris Jurka 2008-10-23 19:59:56 Re: Any reason to have heap_(de)formtuple?
Previous Message Simon Riggs 2008-10-23 17:32:06 Re: Block level concurrency during recovery