Skip to content

Commit 3cfb572

Browse files
committed
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 3bbf668 (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.
1 parent 7a5a59d commit 3cfb572

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/backend/access/heap/heapam.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6824,7 +6824,11 @@ newt:;
68246824
ItemPointerGetBlockNumber(&(xlrec->newtid)),
68256825
false);
68266826
if (!BufferIsValid(nbuffer))
6827+
{
6828+
if (BufferIsValid(obuffer))
6829+
UnlockReleaseBuffer(obuffer);
68276830
return;
6831+
}
68286832
page = (Page) BufferGetPage(nbuffer);
68296833

68306834
if (lsn <= PageGetLSN(page)) /* changes are applied */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy