Re: two phase commit - Mailing list pgsql-general

From Jeff Davis
Subject Re: two phase commit
Date
Msg-id 1184884970.16532.125.camel@dogma.ljc.laika.com
Whole thread Raw
In response to two phase commit  (Ben <bench@silentmedia.com>)
List pgsql-general
On Thu, 2007-07-19 at 15:13 -0700, Ben wrote:
> I'm reading the description of PREPARE TRANSACTION, and I see this:
>
> "...its state is fully stored on disk, and there is a very high
> probability that it can be committed successfully..."
>
> What corner case reduces 2pc from "guaranteed" to "very high probability"?
> Is the worry if somebody leaves transactions in a prepared state for
> weeks, only to find that deadlock issues has arrisen at final commit time?
>

You won't get a deadlock on COMMIT, because COMMIT doesn't acquire more
locks.

The failure cases for a 2PC transaction are (as I understand it)
catastrophic. That means either the transaction can be committed, or you
probably need to restore onto new hardware anyway.

2PC is useful when multiple databases are involved and your application
crashes. When the application comes back you can look at the prepared
transactions and decide whether to COMMIT PREPARED or ROLLBACK PREPARED
based on the information in the other databases involved.

    Regards,
        Jeff Davis


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: two phase commit
Next
From: Ben
Date:
Subject: Re: two phase commit