some question about _bt_getbuf - Mailing list pgsql-hackers

From 自己
Subject some question about _bt_getbuf
Date
Msg-id 48875502.f4a0.1635f0c27b0.Coremail.zoulx1982@163.com
Whole thread Raw
Responses Re: some question about _bt_getbuf  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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;
}



 

pgsql-hackers by date:

Previous
From: Stas Kelvich
Date:
Subject: Re: Global snapshots
Next
From: Tom Lane
Date:
Subject: Re: SPI/backend equivalent of extended-query Describe(statement)?