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

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

Bruce Momjian wrote:
> There was also a problem in that if two cursors were opened, the first
> close would close the transaction. I have fixed that code by changing
> the xact variable in to a counter that keeps track of the number of
> opened cursors and commits only when they are all closed.
>
> Both the dblink.c patch and the regression patch are at:
>
> ftp://candle.pha.pa.us/pub/postgresql/mypatches
>

OK, I'll take a look, but I won't have time for a couple of days (I'm
not at home -- visiting my dad for his 80th birthday -- and have no
broadband access).

Joe


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

Joe Conway wrote:
> Bruce Momjian wrote:
> > There was also a problem in that if two cursors were opened, the first
> > close would close the transaction. I have fixed that code by changing
> > the xact variable in to a counter that keeps track of the number of
> > opened cursors and commits only when they are all closed.
> >
> > Both the dblink.c patch and the regression patch are at:
> >
> > ftp://candle.pha.pa.us/pub/postgresql/mypatches
> >
>
> OK, I'll take a look, but I won't have time for a couple of days (I'm
> not at home -- visiting my dad for his 80th birthday -- and have no
> broadband access).

No problem -- thanks. I have slimmed down the patch by applying the
cosmetic parts to CVS. Use the URL above to get the newest versions of
the dblink.c and regression changes.

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


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

Bruce Momjian wrote:
> No problem -- thanks. I have slimmed down the patch by applying the
> cosmetic parts to CVS. Use the URL above to get the newest versions of
> the dblink.c and regression changes.
>

Here is my counter-proposal to Bruce's dblink patch. Any comments?

Is it too late to apply this for 8.1? I tend to agree with calling this
a bugfix.

Thanks,

Joe

Attachment Content-Type Size
current.dblink.diff text/x-patch 15.8 KB

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

Joe Conway <mail(at)joeconway(dot)com> writes:
> Here is my counter-proposal to Bruce's dblink patch. Any comments?

Minor coding suggestion: to me it seems messy to do

> + int *openCursorCount = NULL;
> + bool *newXactForCursor = NULL;

> ! openCursorCount = &pconn->openCursorCount;
> ! newXactForCursor = &pconn->newXactForCursor;

> ! *newXactForCursor = TRUE;

This looks a bit cluttered already, and would get more so if you need to
add more fields to a remoteConn. Plus it confuses the reader (at least
this reader) who is left wondering if you intend that those variables
might sometimes point to something other than two fields of the same
remoteConn. I think it would be shorter and clearer to write

remoteConn *remconn = NULL;
...
remconn = rconn;
...
remconn->newXactForCursor = TRUE;

Also, you might be able to combine this variable with the existing
rconn local variable and thus simplify the code even more.

> Is it too late to apply this for 8.1? I tend to agree with calling this
> a bugfix.

I think it's reasonable to fix now, yes.

regards, tom lane


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

Tom Lane wrote:
> I think it would be shorter and clearer to write
>
> remoteConn *remconn = NULL;
> ...
> remconn = rconn;
> ...
> remconn->newXactForCursor = TRUE;
>
> Also, you might be able to combine this variable with the existing
> rconn local variable and thus simplify the code even more.

Thanks for the review Tom -- as usual, great suggestions. The attached
(simpler) patch makes use of your advice. If there are no objections,
I'll apply this tomorrow evening.

Joe

Attachment Content-Type Size
current.dblink.2.diff text/x-patch 15.2 KB

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

Joe Conway wrote:
> Tom Lane wrote:
> > I think it would be shorter and clearer to write
> >
> > remoteConn *remconn = NULL;
> > ...
> > remconn = rconn;
> > ...
> > remconn->newXactForCursor = TRUE;
> >
> > Also, you might be able to combine this variable with the existing
> > rconn local variable and thus simplify the code even more.
>
> Thanks for the review Tom -- as usual, great suggestions. The attached
> (simpler) patch makes use of your advice. If there are no objections,
> I'll apply this tomorrow evening.

Looks good. Thanks.

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


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

Bruce Momjian wrote:
> Joe Conway wrote:
>>Thanks for the review Tom -- as usual, great suggestions. The attached
>>(simpler) patch makes use of your advice. If there are no objections,
>>I'll apply this tomorrow evening.
>
> Looks good. Thanks.
>

Committed.

Joe