]> granicus.if.org Git - postgresql/commit
Avoid emitting a bogus WAL record when recycling an all-zero btree page.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 9 Jul 2018 23:26:19 +0000 (19:26 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 9 Jul 2018 23:26:19 +0000 (19:26 -0400)
commitcfcfbd39b182c989b59c7b3787e7d528ef9b29ce
treeb8b5c69345a3b4330aa1ec2bfff6c6c5d07f60b6
parent52b4854a9afd82fa4d7a707f589a5740e854b42a
Avoid emitting a bogus WAL record when recycling an all-zero btree page.

Commit fafa374f2 caused _bt_getbuf() to possibly emit a WAL record for
a page that it was about to recycle.  However, it failed to distinguish
all-zero pages from dead pages, which is important because only the
latter have valid btpo.xact values, or indeed any special space at all.
Recycling an all-zero page with XLogStandbyInfoActive() enabled therefore
led to an Assert failure, or to emission of a WAL record containing a
bogus cutoff XID, which might lead to unnecessary query cancellations
on hot standby servers.

Per reports from Antonin Houska and 自己.  Amit Kapila was first to
propose this fix, and Robert Haas, myself, and Kyotaro Horiguchi
reviewed it at various times.

This is an old bug, so back-patch to all supported branches.

Discussion: https://postgr.es/m/2628.1474272158@localhost
Discussion: https://postgr.es/m/48875502.f4a0.1635f0c27b0.Coremail.zoulx1982@163.com
src/backend/access/nbtree/nbtpage.c