summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFujii Masao2025-04-04 04:09:06 +0000
committerFujii Masao2025-04-04 04:10:21 +0000
commit5570e103bf84af8ce4c71d4fd49920673907bc7f (patch)
tree6d22c5a8cb4199be19994a295fc61f9d97d890c3
parenta4309e85f4614315584e67737ea7b5efa19fb24c (diff)
Fix logical decoding regression tests to correctly check slot existence.
The regression tests for logical decoding verify whether a logical slot exists or has been dropped. Previously, these tests attempted to retrieve "slot_name" from the result of slot(), but since "slot_name" was not included in the result, slot()->{'slot_name'} always returned undef, leading to incorrect behavior. This commit fixes the issue by checking the "plugin" field in the result of slot() instead, ensuring the tests properly verify slot existence. Back-patch to all supported versions. Author: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/OSCPR01MB149667EC4E738769CA80B7EA5F5AE2@OSCPR01MB14966.jpnprd01.prod.outlook.com Backpatch-through: 13
-rw-r--r--src/test/recovery/t/006_logical_decoding.pl8
-rw-r--r--src/test/recovery/t/010_logical_decoding_timelines.pl4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/test/recovery/t/006_logical_decoding.pl b/src/test/recovery/t/006_logical_decoding.pl
index b95d95c06f9..75fd8261ce1 100644
--- a/src/test/recovery/t/006_logical_decoding.pl
+++ b/src/test/recovery/t/006_logical_decoding.pl
@@ -158,8 +158,8 @@ SKIP:
is($node_primary->psql('postgres', 'DROP DATABASE otherdb'),
3, 'dropping a DB with active logical slots fails');
$pg_recvlogical->kill_kill;
- is($node_primary->slot('otherdb_slot')->{'slot_name'},
- undef, 'logical slot still exists');
+ is($node_primary->slot('otherdb_slot')->{'plugin'},
+ 'test_decoding', 'logical slot still exists');
}
$node_primary->poll_query_until('otherdb',
@@ -168,8 +168,8 @@ $node_primary->poll_query_until('otherdb',
is($node_primary->psql('postgres', 'DROP DATABASE otherdb'),
0, 'dropping a DB with inactive logical slots succeeds');
-is($node_primary->slot('otherdb_slot')->{'slot_name'},
- undef, 'logical slot was actually dropped with DB');
+is($node_primary->slot('otherdb_slot')->{'plugin'},
+ '', 'logical slot was actually dropped with DB');
# Test logical slot advancing and its durability.
# Passing failover=true (last arg) should not have any impact on advancing.
diff --git a/src/test/recovery/t/010_logical_decoding_timelines.pl b/src/test/recovery/t/010_logical_decoding_timelines.pl
index afcd5241aa6..7685b98589b 100644
--- a/src/test/recovery/t/010_logical_decoding_timelines.pl
+++ b/src/test/recovery/t/010_logical_decoding_timelines.pl
@@ -94,8 +94,8 @@ is( $node_replica->safe_psql(
'postgres', q[SELECT 1 FROM pg_database WHERE datname = 'dropme']),
'',
'dropped DB dropme on standby');
-is($node_primary->slot('dropme_slot')->{'slot_name'},
- undef, 'logical slot was actually dropped on standby');
+is($node_primary->slot('dropme_slot')->{'plugin'},
+ '', 'logical slot was actually dropped on standby');
# Back to testing failover...
$node_primary->safe_psql('postgres',