Unix Technical Forum

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

This is a discussion on Re: [HACKERS] Patching dblink.c to avoid warning about within the Pgsql Patches forums, part of the PostgreSQL category; --> Bruce Momjian wrote: > There was also a problem in that if two cursors were opened, the first > ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 12:57 AM
Joe Conway
 
Posts: n/a
Default Re: [HACKERS] Patching dblink.c to avoid warning about

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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 12:57 AM
Bruce Momjian
 
Posts: n/a
Default Re: [HACKERS] Patching dblink.c to avoid warning about open

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@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-18-2008, 12:59 AM
Joe Conway
 
Posts: n/a
Default Re: [HACKERS] Patching dblink.c to avoid warning about

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


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-18-2008, 12:59 AM
Tom Lane
 
Posts: n/a
Default Re: [HACKERS] Patching dblink.c to avoid warning about open transaction

Joe Conway <mail@joeconway.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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-18-2008, 12:59 AM
Joe Conway
 
Posts: n/a
Default Re: [HACKERS] Patching dblink.c to avoid warning about

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


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-18-2008, 12:59 AM
Bruce Momjian
 
Posts: n/a
Default Re: [HACKERS] Patching dblink.c to avoid warning about

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@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-18-2008, 12:59 AM
Joe Conway
 
Posts: n/a
Default Re: [HACKERS] Patching dblink.c to avoid warning about

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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:21 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com