]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.
authorRobert Haas <rhaas@postgresql.org>
Thu, 24 Mar 2022 18:49:08 +0000 (14:49 -0400)
committerRobert Haas <rhaas@postgresql.org>
Thu, 24 Mar 2022 18:49:08 +0000 (14:49 -0400)
commit118f1a332b0094a04264c2aedc428c826ac24b7f
tree8e46a3915cbbeab4fb67a3ed3b542688be67d2a2
parent2121d58091a3d6b53299d774f318cbdfb96076be
Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.

If TRUNCATE causes some buffers to be invalidated and thus the
checkpoint does not flush them, TRUNCATE must also ensure that the
corresponding files are truncated on disk. Otherwise, a replay
from the checkpoint might find that the buffers exist but have
the wrong contents, which may cause replay to fail.

Report by Teja Mupparti. Patch by Kyotaro Horiguchi, per a design
suggestion from Heikki Linnakangas, with some changes to the
comments by me. Review of this and a prior patch that approached
the issue differently by Heikki Linnakangas, Andres Freund, Álvaro
Herrera, Masahiko Sawada, and Tom Lane.

Discussion: http://postgr.es/m/BYAPR06MB6373BF50B469CA393C614257ABF00@BYAPR06MB6373.namprd06.prod.outlook.com
src/backend/access/transam/multixact.c
src/backend/access/transam/twophase.c
src/backend/access/transam/xact.c
src/backend/access/transam/xlog.c
src/backend/access/transam/xloginsert.c
src/backend/catalog/storage.c
src/backend/storage/buffer/bufmgr.c
src/backend/storage/ipc/procarray.c
src/backend/storage/lmgr/proc.c
src/include/storage/proc.h
src/include/storage/procarray.h