Re: [HACKERS] Patching dblink.c to avoid warning about open

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joe Conway <mail(at)joeconway(dot)com>, David Fetter <david(at)fetter(dot)org>, Jonathan Beit-Aharon <jbeitaharon(at)intrusic(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Patching dblink.c to avoid warning about open
Date: 2005-10-07 15:50:27
Message-ID: 200510071550.j97FoRp03730@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Well, as I said in the patch email:
>
> > The reported problem is that dblink_open/dblink_close() (for cursor
> > reads) do a BEGIN/COMMIT regardless of the transaction state of the
> > remote connection. There was code in dblink.c to track the remote
> > transaction state (rconn), but it was not being maintained or used.
>
> You should lose the remoteXactOpen flag entirely, in favor of just
> testing PQtransactionStatus() on-the-fly when necessary. Simpler,
> more reliable, not notably slower.
>
> With that change, the separate remoteConn struct could be dropped
> altogether in favor of just using the PGconn pointer. This would
> make things notationally simpler, and in fact perhaps allow undoing
> the bulk of the edits in your patch. As-is I think the patch is
> pretty risky to apply during beta.

The problem with not using rconn is that we are not saving the
transaction status at the _start_ of the cursor open. If we don't do
that, we have no way of knowing on close if _we_ opened the transaction
or whether it was opened by the user.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-10-07 15:56:50 Re: Vote needed: revert beta2 changes or not?
Previous Message Tom Lane 2005-10-07 15:47:28 Re: [HACKERS] Patching dblink.c to avoid warning about open transaction

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-10-07 15:59:53 Re: [HACKERS] Patching dblink.c to avoid warning about open transaction
Previous Message Tom Lane 2005-10-07 15:47:28 Re: [HACKERS] Patching dblink.c to avoid warning about open transaction