From 679cb44e4b563a1af6049a482db56aa02809d80c Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Wed, 31 Oct 2018 14:47:41 -0700 Subject: Disallow starting server with insufficient wal_level for existing slot. Previously it was possible to create a slot, change wal_level, and restart, even if the new wal_level was insufficient for the slot. That's a problem for both logical and physical slots, because the necessary WAL records are not generated. This removes a few tests in newer versions that, somewhat inexplicably, whether restarting with a too low wal_level worked (a buggy behaviour!). Reported-By: Joshua D. Drake Author: Andres Freund Discussion: https://postgr.es/m/20181029191304.lbsmhshkyymhw22w@alap3.anarazel.de Backpatch: 9.4-, where replication slots where introduced --- src/backend/replication/logical/logical.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/backend/replication/logical/logical.c') diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c index 855f0035410..77a73bd3d1e 100644 --- a/src/backend/replication/logical/logical.c +++ b/src/backend/replication/logical/logical.c @@ -74,6 +74,11 @@ CheckLogicalDecodingRequirements(void) { CheckSlotRequirements(); + /* + * NB: Adding a new requirement likely means that RestoreSlotFromDisk() + * needs the same check. + */ + if (wal_level < WAL_LEVEL_LOGICAL) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), -- cgit v1.2.3