Re: unnecessary code in_bt_split - Mailing list pgsql-hackers

From Zdenek Kotala
Subject Re: unnecessary code in_bt_split
Date
Msg-id 4896CA77.7070909@sun.com
Whole thread Raw
In response to Re: unnecessary code in_bt_split  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: unnecessary code in_bt_split  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane napsal(a):
> Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
>> I found that _bt_split function calls PageGetTempPage, but next call is 
>> _bt_page_init which clear all contents anyway. Is there any reason to call 
>> PageGetTempPage instead of palloc?
> 
> Not violating a perfectly good abstraction?

OK. Abstraction is nice, but what I see in the PageGetTempPage It is more like 
code which makes everything but usability is zero. It is used only in two places 
and in both it is used for different purpose. _bt_split() needs only allocate 
empty temp page and gistplacetopage() .

 By my opinion It would be better to have three functions:

PageCreateTempPage - only allocate memory and call pageinit
PageCloneSpecial - copy special section from source page
PageRestoreTempPage - no change.

    Zdenek




pgsql-hackers by date:

Previous
From: daveg
Date:
Subject: Re: Mini improvement: statement_cost_limit
Next
From: Gregory Stark
Date:
Subject: Re: Mini improvement: statement_cost_limit