pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.
@ 2022-03-24 19:32 Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Robert Haas @ 2022-03-24 19:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/412ad7a55639516f284cd0ef9757d6ae5c7abd43

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.
@ 2022-03-24 19:32 Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Robert Haas @ 2022-03-24 19:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.
@ 2022-03-24 19:32 Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Robert Haas @ 2022-03-24 19:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1ce14b6b2fe4af9ac7d7f90eb46c77b2e6deb2de

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.
@ 2022-03-24 19:32 Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Robert Haas @ 2022-03-24 19:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3821d66a7b3e913d750a3314fd8a560d374af575

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           | 26 +++++++++++++++++++++-
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              | 38 +++++++++++++++++++++++++++++++--
src/include/storage/procarray.h         |  5 +++--
11 files changed, 117 insertions(+), 29 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.
@ 2022-03-24 19:32 Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Robert Haas @ 2022-03-24 19:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/118f1a332b0094a04264c2aedc428c826ac24b7f

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           | 26 +++++++++++++++++++++-
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              | 38 +++++++++++++++++++++++++++++++--
src/include/storage/procarray.h         |  5 +++--
11 files changed, 117 insertions(+), 29 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.
@ 2022-03-24 19:32 Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Robert Haas @ 2022-03-24 19:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/57f618310f837101ba13757baf95bae37e3766ac

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           | 26 +++++++++++++++++++++-
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              | 38 +++++++++++++++++++++++++++++++--
src/include/storage/procarray.h         |  5 +++--
11 files changed, 117 insertions(+), 29 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2022-03-24 19:32 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 19:32 pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. Robert Haas <rhaas@postgresql.org>
2022-03-24 19:32 pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. Robert Haas <rhaas@postgresql.org>
2022-03-24 19:32 pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. Robert Haas <rhaas@postgresql.org>
2022-03-24 19:32 pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. Robert Haas <rhaas@postgresql.org>
2022-03-24 19:32 pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. Robert Haas <rhaas@postgresql.org>
2022-03-24 19:32 pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. Robert Haas <rhaas@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox