Sunday, August 3, 2008

[HACKERS] unnecessary code in_bt_split

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?

Original code:

00796 leftpage = PageGetTempPage(origpage, sizeof(BTPageOpaqueData));
00797 rightpage = BufferGetPage(rbuf);
00798
00799 _bt_pageinit(leftpage, BufferGetPageSize(buf));

Suggested code:

00796 leftpage = palloc(PageGetSize(origpage));
00797 rightpage = BufferGetPage(rbuf);
00798
00799 _bt_pageinit(leftpage, BufferGetPageSize(buf));


Any idea?

thanks Zdenek

--
Zdenek Kotala Sun Microsystems
Prague, Czech Republic http://sun.com/postgresql


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