From 8eb701d706e80ce127d5baec93836ce1e84d87aa Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Mon, 7 Apr 2025 16:56:55 +0300 Subject: [PATCH] Save FSM/VM pages on normal shutdown (#11449) ## Problem See https://neondb.slack.com/archives/C03QLRH7PPD/p1743746717119179 We wallow FSM/VM pages when they are written to disk to persist them in PS. But it is not happen during shutdown checkpoint, because writing to WAL during checkpoint cause Postgres panic. ## Summary of changes Move `CheckPointBuffers` call to `PreCheckPointGuts` Postgres PRs: https://github.com/neondatabase/postgres/pull/615 https://github.com/neondatabase/postgres/pull/614 https://github.com/neondatabase/postgres/pull/613 https://github.com/neondatabase/postgres/pull/612 --------- Co-authored-by: Konstantin Knizhnik --- pgxn/neon/pagestore_smgr.c | 1 - vendor/postgres-v14 | 2 +- vendor/postgres-v15 | 2 +- vendor/postgres-v16 | 2 +- vendor/postgres-v17 | 2 +- vendor/revisions.json | 8 ++++---- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pgxn/neon/pagestore_smgr.c b/pgxn/neon/pagestore_smgr.c index a295304a58..eb8df11923 100644 --- a/pgxn/neon/pagestore_smgr.c +++ b/pgxn/neon/pagestore_smgr.c @@ -1900,7 +1900,6 @@ neon_wallog_pagev(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, log_pages = true; } else if (XLogInsertAllowed() && - !ShutdownRequestPending && (forknum == FSM_FORKNUM || forknum == VISIBILITYMAP_FORKNUM)) { log_pages = true; diff --git a/vendor/postgres-v14 b/vendor/postgres-v14 index 8cca70c22e..a0391901a2 160000 --- a/vendor/postgres-v14 +++ b/vendor/postgres-v14 @@ -1 +1 @@ -Subproject commit 8cca70c22e2894dd4645f9a940086ac437b0a11b +Subproject commit a0391901a2af13aa029b905272a5b2024133c926 diff --git a/vendor/postgres-v15 b/vendor/postgres-v15 index 23708b3aca..aeb292eeac 160000 --- a/vendor/postgres-v15 +++ b/vendor/postgres-v15 @@ -1 +1 @@ -Subproject commit 23708b3aca9adf163aa0973eb63d9afc0e4a04c3 +Subproject commit aeb292eeace9072e07071254b6ffc7a74007d4d2 diff --git a/vendor/postgres-v16 b/vendor/postgres-v16 index 746bd9ffe5..d56e79cd5d 160000 --- a/vendor/postgres-v16 +++ b/vendor/postgres-v16 @@ -1 +1 @@ -Subproject commit 746bd9ffe5c29bce030eaea1031054057f3c5d45 +Subproject commit d56e79cd5d6136c159b1d8d98acb7981d4b69364 diff --git a/vendor/postgres-v17 b/vendor/postgres-v17 index c9e4ff5a38..66114c23bc 160000 --- a/vendor/postgres-v17 +++ b/vendor/postgres-v17 @@ -1 +1 @@ -Subproject commit c9e4ff5a38907acd71107634055bf2609aba43a5 +Subproject commit 66114c23bc61205b0e3fb1e77ee76a4abc1eb4b8 diff --git a/vendor/revisions.json b/vendor/revisions.json index 2abfbffccb..d7eddf42b7 100644 --- a/vendor/revisions.json +++ b/vendor/revisions.json @@ -1,18 +1,18 @@ { "v17": [ "17.4", - "c9e4ff5a38907acd71107634055bf2609aba43a5" + "66114c23bc61205b0e3fb1e77ee76a4abc1eb4b8" ], "v16": [ "16.8", - "746bd9ffe5c29bce030eaea1031054057f3c5d45" + "d56e79cd5d6136c159b1d8d98acb7981d4b69364" ], "v15": [ "15.12", - "23708b3aca9adf163aa0973eb63d9afc0e4a04c3" + "aeb292eeace9072e07071254b6ffc7a74007d4d2" ], "v14": [ "14.17", - "8cca70c22e2894dd4645f9a940086ac437b0a11b" + "a0391901a2af13aa029b905272a5b2024133c926" ] }