aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/multixact.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2022-04-14 11:10:11 -0400
committerRobert Haas <rhaas@postgresql.org>2022-04-14 11:10:11 -0400
commitd18c913b786c5ea82f7372c88cf2055050e5176a (patch)
tree8c87db7c8e81c860252ce6f8b1e2e10fbb4a2062 /src/backend/access/transam/multixact.c
parent2275d044d0849251c5e0fa10ee16c73124731f5c (diff)
downloadpostgresql-d18c913b786c5ea82f7372c88cf2055050e5176a.tar.gz
postgresql-d18c913b786c5ea82f7372c88cf2055050e5176a.zip
Rethink the delay-checkpoint-end mechanism in the back-branches.
The back-patch of commit bbace5697df12398e87ffd9879171c39d27f5b33 had the unfortunate effect of changing the layout of PGPROC in the back-branches, which could break extensions. This happened because it changed the delayChkpt from type bool to type int. So, change it back, and add a new bool delayChkptEnd field instead. The new field should fall within what used to be padding space within the struct, and so hopefully won't cause any extensions to break. Per report from Markus Wanner and discussion with Tom Lane and others. Patch originally by me, somewhat revised by Markus Wanner per a suggestion from Michael Paquier. A very similar patch was developed by Kyotaro Horiguchi, but I failed to see the email in which that was posted before writing one of my own. Discussion: http://postgr.es/m/CA+Tgmoao-kUD9c5nG5sub3F7tbo39+cdr8jKaOVEs_1aBWcJ3Q@mail.gmail.com Discussion: http://postgr.es/m/20220406.164521.17171257901083417.horikyota.ntt@gmail.com
Diffstat (limited to 'src/backend/access/transam/multixact.c')
-rw-r--r--src/backend/access/transam/multixact.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index 3e6443fd41c..7990b5e5dd9 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3071,8 +3071,8 @@ TruncateMultiXact(MultiXactId newOldestMulti, Oid newOldestMultiDB)
* crash/basebackup, even though the state of the data directory would
* require it.
*/
- Assert((MyProc->delayChkpt & DELAY_CHKPT_START) == 0);
- MyProc->delayChkpt |= DELAY_CHKPT_START;
+ Assert(!MyProc->delayChkpt);
+ MyProc->delayChkpt = true;
/* WAL log truncation */
WriteMTruncateXlogRec(newOldestMultiDB,
@@ -3098,7 +3098,7 @@ TruncateMultiXact(MultiXactId newOldestMulti, Oid newOldestMultiDB)
/* Then offsets */
PerformOffsetsTruncation(oldestMulti, newOldestMulti);
- MyProc->delayChkpt &= ~DELAY_CHKPT_START;
+ MyProc->delayChkpt = false;
END_CRIT_SECTION();
LWLockRelease(MultiXactTruncationLock);