Two-phase commit

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Two-phase commit
Date: 2004-02-04 20:22:16
Message-ID: Pine.OSF.4.58.0402042200330.238747@kosh.hut.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

I've been very slowly continuing my work on two-phase commits for a couple
months now, and I now have my original patch updated so that it applies to
the current CVS tip, with some improvements.

The patch introduces three new commands, PREPCOMMIT, COMMITPREPARED and
ABORTPREPARED.

To start a 2PC transaction, you first do a BEGIN and your updates as
usual. At the end of the transaction, you call PREPCOMMIT 'foobar' instead
of COMMIT. Now the transaction is in prepared state, ready to commit at a
later time. 'foobar' is the global transaction identifier assigned for the
transaction.

Later, when you want to finish the second phase, you call
COMMITPREPARED 'foobar';

There is a system view pg_prepared_xacts that gives you all transactions
that are in prepared state waiting for COMMITPREPARED or ABORTPREPARED.

I have also done some work on XA-enabling the JDBC drivers, now that we
have what it takes in the server side. I have succesfully executed
2PC transactions with JBossMQ and Postgres, using JBoss as the
transaction manager, so the basic stuff seems to be working.

Please have a look and comment, the patches can be found here:
http://www.iki.fi/hlinnaka/pgsql/

What is the schedule for 7.5? Any chance of getting this in?

- Heikki

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2004-02-04 20:26:47 Re: Recursive queries?
Previous Message Josh Berkus 2004-02-04 20:08:13 Re: Recursive queries?

Browse pgsql-patches by date

  From Date Subject
Next Message Magnus Hagander 2004-02-04 22:09:00 win32 signals, part 4
Previous Message Christopher Browne 2004-02-04 14:33:02 Re: pg_generate_sequence and info_schema patch (Was: SELECT