Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc5b7f67

Browse files
author
Amit Kapila
committed
Fix the race condition in the test case added by commita6e04b1.
The commita6e04b1 added a test to ensure that the invalidated logicalslots don't retain WAL. The test was ensuring that the checkpoint removesthe WAL files corresponding to invalidated logical slots on the standbynode but missed the point that the standby node also had a physical slotwhich led to the prevention of WAL file removal. Move the creation ofphysical slot on the standby and initialization of cascading standby closerto the test case that actually required it so that other tests don't getaffected by the presence of the physical slot on standby.Author: Bertrand DrouvotReviewed-by: Amit KapilaDiscussion:https://postgr.es/m/2fefa454-5a70-2174-ddbf-4a0e41537139@gmail.com
1 parent3d144c6 commitc5b7f67

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

‎src/test/recovery/t/035_standby_logical_decoding.pl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -276,20 +276,6 @@ sub check_for_invalidation
276276
max_replication_slots = 5]);
277277
$node_standby->start;
278278
$node_primary->wait_for_replay_catchup($node_standby);
279-
$node_standby->safe_psql('testdb',qq[SELECT * FROM pg_create_physical_replication_slot('$standby_physical_slotname');]);
280-
281-
#######################
282-
# Initialize cascading standby node
283-
#######################
284-
$node_standby->backup($backup_name);
285-
$node_cascading_standby->init_from_backup(
286-
$node_standby,$backup_name,
287-
has_streaming=> 1,
288-
has_restoring=> 1);
289-
$node_cascading_standby->append_conf('postgresql.conf',
290-
qq[primary_slot_name = '$standby_physical_slotname']);
291-
$node_cascading_standby->start;
292-
$node_standby->wait_for_replay_catchup($node_cascading_standby,$node_primary);
293279

294280
#######################
295281
# Initialize subscriber node
@@ -503,9 +489,6 @@ sub check_for_invalidation
503489
# Verify that invalidated logical slots do not lead to retaining WAL.
504490
##################################################
505491

506-
# Wait for the cascading standby to catchup before removing the WAL file(s)
507-
$node_standby->wait_for_replay_catchup($node_cascading_standby,$node_primary);
508-
509492
# Get the restart_lsn from an invalidated slot
510493
my$restart_lsn =$node_standby->safe_psql('postgres',
511494
"SELECT restart_lsn from pg_replication_slots WHERE slot_name = 'vacuum_full_activeslot' and conflicting is true;"
@@ -777,9 +760,26 @@ sub check_for_invalidation
777760
$node_primary->psql('postgres',q[CREATE DATABASE testdb]);
778761
$node_primary->safe_psql('testdb',qq[CREATE TABLE decoding_test(x integer, y text);]);
779762

780-
# Wait for the standby to catchup beforecreating theslots
763+
# Wait for the standby to catchup beforeinitializing thecascading standby
781764
$node_primary->wait_for_replay_catchup($node_standby);
782765

766+
# Create a physical replication slot on the standby.
767+
# Keep this step after the "Verify that invalidated logical slots do not lead
768+
# to retaining WAL" test (as the physical slot on the standby could prevent the
769+
# WAL file removal).
770+
$node_standby->safe_psql('testdb',qq[SELECT * FROM pg_create_physical_replication_slot('$standby_physical_slotname');]);
771+
772+
# Initialize cascading standby node
773+
$node_standby->backup($backup_name);
774+
$node_cascading_standby->init_from_backup(
775+
$node_standby,$backup_name,
776+
has_streaming=> 1,
777+
has_restoring=> 1);
778+
$node_cascading_standby->append_conf('postgresql.conf',
779+
qq[primary_slot_name = '$standby_physical_slotname'
780+
hot_standby_feedback = on]);
781+
$node_cascading_standby->start;
782+
783783
# create the logical slots
784784
create_logical_slots($node_standby,'promotion_');
785785

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp