Skip to content
Snippets Groups Projects
Commit 1b315c53 authored by Heikki Linnakangas's avatar Heikki Linnakangas
Browse files

Fix buffer pin leak in heap update redo routine.

In a heap update, if the old and new tuple were on different pages, and the
new page no longer existed (because it was subsequently truncated away by
vacuum), heap_xlog_update forgot to release the pin on the old buffer. This
bug was introduced by the "Fix multiple problems in WAL replay" patch,
commit 3bbf668d (on master branch).

With full_page_writes=off, this triggered an "incorrect local pin count"
error later in replay, if the old page was vacuumed.

This fixes bug #7969, reported by Yunong Xiao. Backpatch to 9.0, like the
commit that introduced this bug.
parent 96103c6a
No related branches found
No related tags found
No related merge requests found
...@@ -5367,7 +5367,11 @@ newt:; ...@@ -5367,7 +5367,11 @@ newt:;
ItemPointerGetBlockNumber(&(xlrec->newtid)), ItemPointerGetBlockNumber(&(xlrec->newtid)),
false); false);
if (!BufferIsValid(nbuffer)) if (!BufferIsValid(nbuffer))
{
if (BufferIsValid(obuffer))
UnlockReleaseBuffer(obuffer);
return; return;
}
page = (Page) BufferGetPage(nbuffer); page = (Page) BufferGetPage(nbuffer);
if (XLByteLE(lsn, PageGetLSN(page))) /* changes are applied */ if (XLByteLE(lsn, PageGetLSN(page))) /* changes are applied */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment