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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Jonathan Beit-Aharon <jbeitaharon(at)intrusic(dot)com>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, Joe Conway <mail(at)joeconway(dot)com>
Subject: Re: [HACKERS] Patching dblink.c to avoid warning about open transaction
Date: 2005-10-07 02:38:54
Message-ID: 200510070238.j972csp00705@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

> I'm not a member of this list (yet), so please CC me on responses and
> discussion. The patch below seems to be completion of work already
> started, because the boolean remoteTrFlag was already defined, and all I
> had to add was its setting and two references. I hope someone will find
> it useful,
>
> Jonathan

I have worked on this issue and have an extensive patch to dblink to fix
it.

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.

This patch fixes that by routing all connections through an rconn
structure and using the transaction status properly. I removed the
global persistent connection and function-local 'conn' structures in
favor of using rconn consistently. This cleans up a lot of error-prone
code that tried to track what type of connection was being used.

I don't know if people want this for 8.1 or 8.2.

--
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

Attachment Content-Type Size
unknown_filename text/plain 27.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-10-07 02:43:54 Re: prefix btree implementation
Previous Message Alvaro Herrera 2005-10-07 02:32:12 Re: Vote needed: revert beta2 changes or not?

Browse pgsql-patches by date

  From Date Subject
Next Message David Fetter 2005-10-07 03:22:04 Re: [HACKERS] Patching dblink.c to avoid warning about open transaction
Previous Message Neil Conway 2005-10-06 21:23:57 Re: [HACKERS] Best practices: MERGE