Re: Question about SSI, subxacts, and aborted read-only xacts - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Question about SSI, subxacts, and aborted read-only xacts
Date
Msg-id 1347342297.22899.33.camel@jdavis
Whole thread Raw
In response to Re: Question about SSI, subxacts, and aborted read-only xacts  (Dan Ports <drkp@csail.mit.edu>)
Responses Re: Question about SSI, subxacts, and aborted read-only xacts  (Dan Ports <drkp@csail.mit.edu>)
List pgsql-hackers
On Mon, 2012-09-10 at 21:59 -0400, Dan Ports wrote:
> It might be worth noting that serializable mode will not cause
> read-only transactions to fail to commit

For the archives, and for those not following the paper in detail, there
is one situation in which SSI will abort a read-only transaction.

When there are three transactions forming a dangerous pattern where T1
(read-only) has a conflict out to T2, and T2 has a conflict out to T3;
and T3 is committed and T2 is prepared (for two-phase commit). In that
situation, SSI can't roll back the committed or prepared transactions,
so it must roll back the read-only transaction (T1).

Even in that case, SSI will ordinarily prevent T2 from preparing. It's
only if T1 takes its snapshot after T2 prepares and before T2 commits
that the situation can happen (I think).

Fortunately, for two-phase commit, that's not a big problem because the
window between PREPARE TRANSACTION and COMMIT PREPARED is supposed to be
narrow (and if it's not, you have bigger problems anyway). As long as
the window is narrow, than it's reasonable to retry the transaction T1,
and expect it to succeed after a short interval.

Regards,Jeff Davis




pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: 64-bit API for large object
Next
From: johnlumby
Date:
Subject: prefetching and asynchronous io