From: | Robert Haas <rhaas(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. |
Date: | 2022-03-24 19:32:54 |
Message-ID: | E1nXTCX-001DGF-R0@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
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
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/bbace5697df12398e87ffd9879171c39d27f5b33
Modified Files
--------------
src/backend/access/transam/multixact.c | 6 +++---
src/backend/access/transam/twophase.c | 12 ++++++-----
src/backend/access/transam/xact.c | 5 +++--
src/backend/access/transam/xlog.c | 16 ++++++++++++--
src/backend/access/transam/xloginsert.c | 2 +-
src/backend/catalog/storage.c | 29 +++++++++++++++++++++++++-
src/backend/storage/buffer/bufmgr.c | 6 ++++--
src/backend/storage/ipc/procarray.c | 26 ++++++++++++++++-------
src/backend/storage/lmgr/proc.c | 4 ++--
src/include/storage/proc.h | 37 ++++++++++++++++++++++++++++++++-
src/include/storage/procarray.h | 5 +++--
11 files changed, 120 insertions(+), 28 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2022-03-24 20:01:04 | pgsql: Remove unused module imports from TAP tests |
Previous Message | Alvaro Herrera | 2022-03-24 18:32:13 | Re: pgsql: Change fastgetattr and heap_getattr to inline functions |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2022-03-24 19:33:29 | Re: Corruption during WAL replay |
Previous Message | Peter Geoghegan | 2022-03-24 19:28:08 | Re: Removing more vacuumlazy.c special cases, relfrozenxid optimizations |