]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Prevent excess SimpleLruTruncate() deletion.
authorNoah Misch <noah@leadboat.com>
Sat, 16 Jan 2021 20:21:35 +0000 (12:21 -0800)
committerNoah Misch <noah@leadboat.com>
Sat, 16 Jan 2021 20:21:39 +0000 (12:21 -0800)
commit9afba9b0e28259e71e70db7f919c39f050ddd05d
tree1d7ff8026ae7e03deb08cb6a3a1f45e963ded9e2
parentc22539756ee5492547badc821023e7fdf4bee4ef
Prevent excess SimpleLruTruncate() deletion.

Every core SLRU wraps around.  With the exception of pg_notify, the wrap
point can fall in the middle of a page.  Account for this in the
PagePrecedes callback specification and in SimpleLruTruncate()'s use of
said callback.  Update each callback implementation to fit the new
specification.  This changes SerialPagePrecedesLogically() from the
style of asyncQueuePagePrecedes() to the style of CLOGPagePrecedes().
(Whereas pg_clog and pg_serial share a key space, pg_serial is nothing
like pg_notify.)  The bug fixed here has the same symptoms and user
followup steps as 592a589a04bd456410b853d86bd05faa9432cbbb.  Back-patch
to 9.5 (all supported versions).

Reviewed by Andrey Borodin and (in earlier versions) by Tom Lane.

Discussion: https://postgr.es/m/20190202083822.GC32531@gust.leadboat.com
src/backend/access/transam/clog.c
src/backend/access/transam/commit_ts.c
src/backend/access/transam/multixact.c
src/backend/access/transam/slru.c
src/backend/access/transam/subtrans.c
src/backend/commands/async.c
src/backend/storage/lmgr/predicate.c
src/include/access/slru.h