Monday, August 4, 2008

Re: [HACKERS] unnecessary code in_bt_split

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

No comments: