From 240e0dbacd390a8465552e27c5af11f67d747adb Mon Sep 17 00:00:00 2001 From: Amit Kapila Date: Mon, 21 Nov 2022 08:54:43 +0530 Subject: Add additional checks while creating the initial decoding snapshot. As per one of the CI reports, there is an assertion failure which indicates that we were trying to use an unenforced xmin horizon for decoding snapshots. Though, we couldn't figure out the reason for assertion failure these checks would help us in finding the reason if the problem happens again in the future. Author: Amit Kapila based on suggestions by Andres Freund Reviewd by: Andres Freund Discussion: https://postgr.es/m/CAA4eK1L8wYcyTPxNzPGkhuO52WBGoOZbT0A73Le=ZUWYAYmdfw@mail.gmail.com --- src/backend/replication/walsender.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/backend/replication/walsender.c') diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index a81ef6a2014..c11bb3716f4 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -1099,6 +1099,11 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd) /*- translator: %s is a CREATE_REPLICATION_SLOT statement */ (errmsg("%s must be called in REPEATABLE READ isolation mode transaction", "CREATE_REPLICATION_SLOT ... (SNAPSHOT 'use')"))); + if (!XactReadOnly) + ereport(ERROR, + /*- translator: %s is a CREATE_REPLICATION_SLOT statement */ + (errmsg("%s must be called in a read only transaction", + "CREATE_REPLICATION_SLOT ... (SNAPSHOT 'use')"))); if (FirstSnapshotSet) ereport(ERROR, -- cgit v1.2.3