Thread: psycopg and two phase commit

psycopg and two phase commit

From
Pavel Stehule
Date:
Hello

who is psycopg maintainer, please? Can somebody explains to me, why
psycopg doesn't support twophase commit still, although some
implementation was done in summer 2008?

Now two phase commit is part of DB-API, so can be implemented.

There are some bariers?

Regards

Pavel Stehule


Re: psycopg and two phase commit

From
Devrim GÜNDÜZ
Date:
On Sat, 2010-09-18 at 18:01 +0200, Pavel Stehule wrote:
> who is psycopg maintainer, please?

Why don't you ask it to psycopg2 mailing list?

http://www.initd.org/ (I know, mailing lists are down nowadays. See
website)
--
Devrim GÜNDÜZ
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
PostgreSQL RPM Repository: http://yum.pgrpms.org
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz

Re: psycopg and two phase commit

From
Daniele Varrazzo
Date:
On Sat, Sep 18, 2010 at 5:01 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> Hello
>
> who is psycopg maintainer, please?

Here is one. The others can be usually mailed on the psycopg mailing
list, which is currently down and being recovered.

> Can somebody explains to me, why
> psycopg doesn't support twophase commit still, although some
> implementation was done in summer 2008?

Probably because nobody has asked before and it has been nobody's itch
to scratch.

The work you probably refer to seems Jason Henstridge's. I didn't know
anything about it, but I've bcc'd him so he can provide details.
 https://code.launchpad.net/~jamesh/psycopg/two-phase-commit

> Now two phase commit is part of DB-API, so can be implemented.
>
> There are some bariers?

I see none at a first glance. I just don't get the intricacies of the
.xid() method suggested in the dbapi
(http://www.python.org/dev/peps/pep-0249/) while a regular string
would do - and the xid has to be converted in a string anyway to be
passed to the Postgres TPC statements. So I'm tempted to allow the
tpc_*() methods to accept a simple string too as parameter; also
because otherwise psycopg wouldn't be able to manipulate a transaction
prepared by other tools (e.g. retrieving a xid using tpc_recover() and
passing it to tpc_commit()/tpc_rollback(), a limitation that can be
avoided.

I can work on the feature, first I'd like to review James's code and
possibly hear from him his impressions.

-- Daniele


Re: psycopg and two phase commit

From
Pavel Stehule
Date:
Hello

2010/9/19 Daniele Varrazzo <daniele.varrazzo@gmail.com>:
> On Sat, Sep 18, 2010 at 5:01 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>> Hello
>>
>> who is psycopg maintainer, please?
>
> Here is one. The others can be usually mailed on the psycopg mailing
> list, which is currently down and being recovered.
>
>> Can somebody explains to me, why
>> psycopg doesn't support twophase commit still, although some
>> implementation was done in summer 2008?
>
> Probably because nobody has asked before and it has been nobody's itch
> to scratch.
>
> The work you probably refer to seems Jason Henstridge's. I didn't know
> anything about it, but I've bcc'd him so he can provide details.
>
>  https://code.launchpad.net/~jamesh/psycopg/two-phase-commit
>
>> Now two phase commit is part of DB-API, so can be implemented.
>>
>> There are some bariers?
>
> I see none at a first glance. I just don't get the intricacies of the
> .xid() method suggested in the dbapi
> (http://www.python.org/dev/peps/pep-0249/) while a regular string
> would do - and the xid has to be converted in a string anyway to be
> passed to the Postgres TPC statements. So I'm tempted to allow the
> tpc_*() methods to accept a simple string too as parameter; also
> because otherwise psycopg wouldn't be able to manipulate a transaction
> prepared by other tools (e.g. retrieving a xid using tpc_recover() and
> passing it to tpc_commit()/tpc_rollback(), a limitation that can be
> avoided.
>

These are a good news. I hope so I'll a some time on begin of October,
when I can to play with this topic. But this must not be a too much
hard work.

Thank you

Pavel Stehule

> I can work on the feature, first I'd like to review James's code and
> possibly hear from him his impressions.
>
> -- Daniele
>


Re: psycopg and two phase commit

From
Daniele Varrazzo
Date:
On Sun, Sep 19, 2010 at 6:38 PM, Daniele Varrazzo
<daniele.varrazzo@gmail.com> wrote:
> On Sat, Sep 18, 2010 at 5:01 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:

>> There are some bariers?
>
> I see none at a first glance. I just don't get the intricacies of the
> .xid() method suggested in the dbapi
> (http://www.python.org/dev/peps/pep-0249/) while a regular string
> would do - and the xid has to be converted in a string anyway to be
> passed to the Postgres TPC statements. So I'm tempted to allow the
> tpc_*() methods to accept a simple string too as parameter; also
> because otherwise psycopg wouldn't be able to manipulate a transaction
> prepared by other tools (e.g. retrieving a xid using tpc_recover() and
> passing it to tpc_commit()/tpc_rollback(), a limitation that can be
> avoided.

I've read the XA specification, which have inspired the DBAPI
extension for TPC, and the discussion in the Python DB-SIG leading to
such extensions
(http://mail.python.org/pipermail/db-sig/2008-January/thread.html).
The methods proposed in the DBAPI don't map 1-1 with the PG TPC
statements so it will be necessary some work in the driver to
implement the proposed interface. But being TPC all about
interoperability I think it is a necessary complication.

-- Daniele


Re: psycopg and two phase commit

From
Daniele Varrazzo
Date:
On Sat, Sep 18, 2010 at 5:01 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> Hello
>
> who is psycopg maintainer, please? Can somebody explains to me, why
> psycopg doesn't support twophase commit still, although some
> implementation was done in summer 2008?

Hello Pavel,

Just wanted to warn you that I have implemented the 2pc protocol in psycopg.

I have this and other patches ready to be merged in the trunk: more
details are available in
http://initd.org/psycopg/articles/2010/11/02/new-features-upcoming-psycopg-release/

I will try to have the patches released soon: definitely before the
PyCon. If you fancy some testing you are welcome.

Best regards,

-- Daniele


Re: psycopg and two phase commit

From
Pavel Stehule
Date:
2010/11/4 Daniele Varrazzo <daniele.varrazzo@gmail.com>:
> On Sat, Sep 18, 2010 at 5:01 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>> Hello
>>
>> who is psycopg maintainer, please? Can somebody explains to me, why
>> psycopg doesn't support twophase commit still, although some
>> implementation was done in summer 2008?
>
> Hello Pavel,
>
> Just wanted to warn you that I have implemented the 2pc protocol in psycopg.
>
> I have this and other patches ready to be merged in the trunk: more
> details are available in
> http://initd.org/psycopg/articles/2010/11/02/new-features-upcoming-psycopg-release/
>
> I will try to have the patches released soon: definitely before the
> PyCon. If you fancy some testing you are welcome.
>

Hello,

it's very good news. A lot of people looking for it.

Regards

Pavel

I read a notice, but I didn't find a link for download, where is it, please?

Thank you

Pavel

> Best regards,
>
> -- Daniele
>


Re: psycopg and two phase commit

From
Daniele Varrazzo
Date:
On Fri, Nov 5, 2010 at 5:16 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> 2010/11/4 Daniele Varrazzo <daniele.varrazzo@gmail.com>:

>> Just wanted to warn you that I have implemented the 2pc protocol in psycopg.
>
> I read a notice, but I didn't find a link for download, where is it, please?

We have just released a beta package including this and other
features. All the details at
<http://initd.org/psycopg/articles/2010/11/06/psycopg-230-beta1-released/>.

Cheers

-- Daniele