From: Drouvot, Bertrand <bertranddrouvot.pg@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>
Cc: Yu Shi (Fujitsu) <shiy.fnst@fujitsu.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Add two missing tests in 035_standby_logical_decoding.pl
Date: Tue, 9 May 2023 09:14:09 +0200
Message-ID: <5fa24329-caa0-c226-a0b5-f450ff982924@gmail.com> (raw)
In-Reply-To: <CAA4eK1+3gbYgnbQypVyZYf6t44HEqcodp0OUC1HwqpHUGAYhvw@mail.gmail.com>
References: <2fefa454-5a70-2174-ddbf-4a0e41537139@gmail.com>
<CAA4eK1LQmnSroXZcR+w1JuHsOyQLdj=-QWUw8ExYem3kUpBE3A@mail.gmail.com>
<a3f02689-fd8b-e290-2e62-9f7a5eb6f4d8@gmail.com>
<CAA4eK1+-H9TBSG-qEd7aykdKHhRo3YCsQ_i6mquTdiL2zXVAPw@mail.gmail.com>
<2c544b9f-419d-d18e-47be-f3d6f3d24e4e@gmail.com>
<CAA4eK1KvDAgQC9kzHn41MJBmk-7X226-gBXVDFNubtr7rnSu6A@mail.gmail.com>
<a155f702-a9b0-d473-0c44-06287af600b9@gmail.com>
<CAA4eK1KhmUopfMDR+0ZkBSGerXet1XWGyguhE=ZwV5ZUUcQt7Q@mail.gmail.com>
<3576f684-718d-ddd6-f4b0-f8ad64ad3330@gmail.com>
<CAA4eK1+-uuH+sC42_=wA=xPyzCN+U3VNeW_d-BRGvt-pGkNT+Q@mail.gmail.com>
<2894687f-141d-85a9-e8c3-2151e5b7e662@gmail.com>
<CAA4eK1KD4pmEjqPkPjNdB5rTegJftzJjsZ3xuBndbPANQrueEw@mail.gmail.com>
<7e5f41be-ec0f-b6f2-2e2a-60fd5648ee84@gmail.com>
<CAA4eK1KYtxsvOFaG0C8fMtWFQ5YAdo9dtC4si1UuUccGSYTzCQ@mail.gmail.com>
<213d107f-6c39-c257-040b-df8773fd0064@gmail.com>
<CAA4eK1+3gbYgnbQypVyZYf6t44HEqcodp0OUC1HwqpHUGAYhvw@mail.gmail.com>
Hi,
On 5/9/23 8:02 AM, Amit Kapila wrote:
> On Mon, May 8, 2023 at 1:45 PM Drouvot, Bertrand
> <bertranddrouvot.pg@gmail.com> wrote:
>
> Why not initialize the cascading standby node just before the standby
> promotion test: "Test standby promotion and logical decoding behavior
> after the standby gets promoted."? That way we will avoid any unknown
> side-effects of cascading standby and it will anyway look more logical
> to initialize it where the test needs it.
>
Yeah, that's even better. Moved the physical slot creation on the standby
and the cascading standby initialization where "strictly" needed in V2
attached.
Also ensuring that hsf is set to on on the cascading standby to be on the
safe side of thing.
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.comAttachments:v2-0001-fix-retaining-WAL-test.patch (text/plain, 3.2K) download
From 0292d14a62b72b38197d434d85ee2c6a7f2cec00 Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Date: Tue, 9 May 2023 06:43:59 +0000
Subject: [PATCH v2] fix retaining WAL test
---
.../t/035_standby_logical_decoding.pl | 36 +++++++++----------
1 file changed, 18 insertions(+), 18 deletions(-)
100.0% src/test/recovery/t/
diff --git a/src/test/recovery/t/035_standby_logical_decoding.pl b/src/test/recovery/t/035_standby_logical_decoding.plindex ad1def2474..2b4a688330 100644--- a/src/test/recovery/t/035_standby_logical_decoding.pl+++ b/src/test/recovery/t/035_standby_logical_decoding.pl@@ -276,20 +276,6 @@ $node_standby->append_conf('postgresql.conf',
max_replication_slots = 5]);
$node_standby->start;
$node_primary->wait_for_replay_catchup($node_standby);
-$node_standby->safe_psql('testdb', qq[SELECT * FROM pg_create_physical_replication_slot('$standby_physical_slotname');]);--#######################-# Initialize cascading standby node-#######################-$node_standby->backup($backup_name);-$node_cascading_standby->init_from_backup(- $node_standby, $backup_name,- has_streaming => 1,- has_restoring => 1);-$node_cascading_standby->append_conf('postgresql.conf',- qq[primary_slot_name = '$standby_physical_slotname']);-$node_cascading_standby->start;-$node_standby->wait_for_replay_catchup($node_cascading_standby, $node_primary);
#######################
# Initialize subscriber node
@@ -503,9 +489,6 @@ check_slots_conflicting_status(1);
# Verify that invalidated logical slots do not lead to retaining WAL.
##################################################
-# Wait for the cascading standby to catchup before removing the WAL file(s)-$node_standby->wait_for_replay_catchup($node_cascading_standby, $node_primary);-
# Get the restart_lsn from an invalidated slot
my $restart_lsn = $node_standby->safe_psql('postgres',
"SELECT restart_lsn from pg_replication_slots WHERE slot_name = 'vacuum_full_activeslot' and conflicting is true;"
@@ -777,9 +760,26 @@ $node_standby->reload;
$node_primary->psql('postgres', q[CREATE DATABASE testdb]);
$node_primary->safe_psql('testdb', qq[CREATE TABLE decoding_test(x integer, y text);]);
-# Wait for the standby to catchup before creating the slots+# Wait for the standby to catchup before initializing the cascading standby
$node_primary->wait_for_replay_catchup($node_standby);
+# Create a physical replication slot on the standby.+# Keep this step after the "Verify that invalidated logical slots do not lead+# to retaining WAL" test (as the physical slot on the standby could prevent the+# WAL file removal).+$node_standby->safe_psql('testdb', qq[SELECT * FROM pg_create_physical_replication_slot('$standby_physical_slotname');]);++# Initialize cascading standby node+$node_standby->backup($backup_name);+$node_cascading_standby->init_from_backup(+ $node_standby, $backup_name,+ has_streaming => 1,+ has_restoring => 1);+$node_cascading_standby->append_conf('postgresql.conf',+ qq[primary_slot_name = '$standby_physical_slotname'+ hot_standby_feedback = on]);+$node_cascading_standby->start;+
# create the logical slots
create_logical_slots($node_standby, 'promotion_');
--
2.34.1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: bertranddrouvot.pg@gmail.com, amit.kapila16@gmail.com, vignesh21@gmail.com, shiy.fnst@fujitsu.com
Subject: Re: Add two missing tests in 035_standby_logical_decoding.pl
In-Reply-To: <5fa24329-caa0-c226-a0b5-f450ff982924@gmail.com>
References: <2fefa454-5a70-2174-ddbf-4a0e41537139@gmail.com> <a3f02689-fd8b-e290-2e62-9f7a5eb6f4d8@gmail.com> <CAA4eK1+-H9TBSG-qEd7aykdKHhRo3YCsQ_i6mquTdiL2zXVAPw@mail.gmail.com> <2c544b9f-419d-d18e-47be-f3d6f3d24e4e@gmail.com> <CAA4eK1KvDAgQC9kzHn41MJBmk-7X226-gBXVDFNubtr7rnSu6A@mail.gmail.com> <a155f702-a9b0-d473-0c44-06287af600b9@gmail.com> <CAA4eK1KhmUopfMDR+0ZkBSGerXet1XWGyguhE=ZwV5ZUUcQt7Q@mail.gmail.com> <3576f684-718d-ddd6-f4b0-f8ad64ad3330@gmail.com> <CAA4eK1+-uuH+sC42_=wA=xPyzCN+U3VNeW_d-BRGvt-pGkNT+Q@mail.gmail.com> <2894687f-141d-85a9-e8c3-2151e5b7e662@gmail.com> <CAA4eK1KD4pmEjqPkPjNdB5rTegJftzJjsZ3xuBndbPANQrueEw@mail.gmail.com> <7e5f41be-ec0f-b6f2-2e2a-60fd5648ee84@gmail.com> <CAA4eK1KYtxsvOFaG0C8fMtWFQ5YAdo9dtC4si1UuUccGSYTzCQ@mail.gmail.com> <213d107f-6c39-c257-040b-df8773fd0064@gmail.com> <CAA4eK1+3gbYgnbQypVyZYf6t44HEqcodp0OUC1HwqpHUGAYhvw@mail.gmail.com> <5fa24329-caa0-c226-a0b5-f450ff982924@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox