unnecessary code in_bt_split

From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: unnecessary code in_bt_split
Date: 2008-08-03 21:19:01
Message-ID: 489620C5.5020504@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-08-03 23:44:33 Re: unnecessary code in_bt_split
Previous Message Simon Riggs 2008-08-03 20:44:01 Re: Mini improvement: statement_cost_limit