some question about _bt_getbuf

From: 自己 <zoulx1982(at)163(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: some question about _bt_getbuf
Date: 2018-05-14 14:27:02
Message-ID: 48875502.f4a0.1635f0c27b0.Coremail.zoulx1982@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
i run test using pg10.0 on my machine, and the program crashed on _bt_getbuf.
And i found the following code:
the routine _bt_page_recyclable say maybe the page is all-zero page, if so
then the code run (BTPageOpaque) PageGetSpecialPointer(page); it will be failed because
it access invalid memory.
I don't know whether it is so. Look forward t your reply, thanks.

if (_bt_page_recyclable(page))
{
/*
* If we are generating WAL for Hot Standby then create a
* WAL record that will allow us to conflict with queries
* running on standby.
*/
if (XLogStandbyInfoActive() && RelationNeedsWAL(rel))
{
BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page); /* if page is all-zero, this will failed */
_bt_log_reuse_page(rel, blkno, opaque->btpo.xact);
}

/* Okay to use page. Re-initialize and return it */
_bt_pageinit(page, BufferGetPageSize(buf));
return buf;
}

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-05-14 15:29:46 Re: SPI/backend equivalent of extended-query Describe(statement)?
Previous Message Stas Kelvich 2018-05-14 12:39:10 Re: Global snapshots