diff options
author | Andres Freund <andres@anarazel.de> | 2018-10-31 14:47:41 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2018-10-31 15:46:40 -0700 |
commit | c33a01c7979dc267c81ece612af783ecacf22bc0 (patch) | |
tree | 0e01efb5b4f25b8dff372cf6d5f419e0b334e72b /src/test | |
parent | 2493e2c2d167ce7ad7d034c7c7de17d79e806c7a (diff) |
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
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/recovery/t/006_logical_decoding.pl | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/test/recovery/t/006_logical_decoding.pl b/src/test/recovery/t/006_logical_decoding.pl index e3a5fe9bc01..884b0aedd1e 100644 --- a/src/test/recovery/t/006_logical_decoding.pl +++ b/src/test/recovery/t/006_logical_decoding.pl @@ -7,7 +7,7 @@ use strict; use warnings; use PostgresNode; use TestLib; -use Test::More tests => 16; +use Test::More tests => 10; use Config; # Initialize master node @@ -135,26 +135,5 @@ is($node_master->psql('postgres', 'DROP DATABASE otherdb'), is($node_master->slot('otherdb_slot')->{'slot_name'}, undef, 'logical slot was actually dropped with DB'); -# Restarting a node with wal_level = logical that has existing -# slots must succeed, but decoding from those slots must fail. -$node_master->safe_psql('postgres', 'ALTER SYSTEM SET wal_level = replica'); -is($node_master->safe_psql('postgres', 'SHOW wal_level'), - 'logical', 'wal_level is still logical before restart'); -$node_master->restart; -is($node_master->safe_psql('postgres', 'SHOW wal_level'), - 'replica', 'wal_level is replica'); -isnt($node_master->slot('test_slot')->{'catalog_xmin'}, - '0', 'restored slot catalog_xmin is nonzero'); -is( $node_master->psql( - 'postgres', - qq[SELECT pg_logical_slot_get_changes('test_slot', NULL, NULL);]), - 3, - 'reading from slot with wal_level < logical fails'); -is( $node_master->psql( - 'postgres', q[SELECT pg_drop_replication_slot('test_slot')]), - 0, - 'can drop logical slot while wal_level = replica'); -is($node_master->slot('test_slot')->{'catalog_xmin'}, '', 'slot was dropped'); - # done with the node $node_master->stop; |