From ece8c76192fee0b78509688325631ceabca44ff5 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Tue, 14 Dec 2021 10:58:15 +0900 Subject: Remove assertion for replication origins in PREPARE TRANSACTION When using replication origins, pg_replication_origin_xact_setup() is an optional choice to be able to set a LSN and a timestamp to mark the origin, which would be additionally added to WAL for transaction commits or aborts (including 2PC transactions). An assertion in the code path of PREPARE TRANSACTION assumed that this data should always be set, so it would trigger when using replication origins without setting up an origin LSN. Some tests are added to cover more this kind of scenario. Oversight in commit 1eb6d65. Per discussion with Amit Kapila and Masahiko Sawada. Discussion: https://postgr.es/m/YbbBfNSvMm5nIINV@paquier.xyz Backpatch-through: 11 --- src/backend/access/transam/twophase.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/backend/access/transam/twophase.c') diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index 28b153abc3c..eb6ecaef474 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -1129,7 +1129,6 @@ EndPrepare(GlobalTransaction gxact) if (replorigin) { - Assert(replorigin_session_origin_lsn != InvalidXLogRecPtr); hdr->origin_lsn = replorigin_session_origin_lsn; hdr->origin_timestamp = replorigin_session_origin_timestamp; } -- cgit v1.2.3