some question about _bt_getbuf
zoulx1982 <zoulx1982@163.com>
From: 自己 <zoulx1982@163.com>
To: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2018-05-14T14:27:02Z
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;
}
Commits
-
Avoid emitting a bogus WAL record when recycling an all-zero btree page.
- e8fe3bb23003 9.3.24 landed
- d80ec868fa3a 9.4.19 landed
- cfcfbd39b182 11.0 landed
- 7ddac4e8feba 9.5.14 landed
- 59b2dcbf45ab 10.5 landed
- 568995be6703 9.6.10 landed
- 0905fe8911ea 12.0 landed