RE: Fix a test case in 035_standby_logical_decoding.pl

From: "Yu Shi (Fujitsu)" <shiy(dot)fnst(at)fujitsu(dot)com>
To: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Fix a test case in 035_standby_logical_decoding.pl
Date: 2023-04-27 09:41:22
Message-ID: OSZPR01MB6310F63EE52F979ACF90ACCBFD6A9@OSZPR01MB6310.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 27, 2023 4:47 PM Drouvot, Bertrand <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>
> Hi,
>
> On 4/27/23 10:11 AM, Yu Shi (Fujitsu) wrote:
> > Hi hackers,
> >
> > In 035_standby_logical_decoding.pl, I think that the check in the following test
> > case should be performed on the standby node, instead of the primary node,
> as
> > the slot is created on the standby node.
>
> Oh right, the current test is not done on the right node, thanks!
>
> > The test currently passes because it
> > only checks the return value of psql. It might be more appropriate to check the
> > error message.
>
> Agree, and it's consistent with what is being done in 006_logical_decoding.pl.
>
> > Please see the attached patch.
> >
>
> +
> +($result, $stdout, $stderr) = $node_standby->psql(
> 'otherdb',
> "SELECT lsn FROM pg_logical_slot_peek_changes('behaves_ok_activeslot',
> NULL, NULL) ORDER BY lsn DESC LIMIT 1;"
> - ),
> - 3,
> - 'replaying logical slot from another database fails');
> + );
> +ok( $stderr =~
> + m/replication slot "behaves_ok_activeslot" was not created in this
> database/,
> + "replaying logical slot from another database fails");
>
>
> That does look good to me.
>
> Nit: I wonder if while at it (as it was already there) we could not remove the "
> ORDER BY lsn DESC LIMIT 1" part of it.
> It does not change anything regarding the test but looks more appropriate to
> me.
>

Thanks for your reply. I agree with you and I removed it in the attached patch.

Regards,
Shi Yu

Attachment Content-Type Size
v2-0001-Fix-a-test-case-in-035_standby_logical_decoding.p.patch application/octet-stream 1.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-04-27 09:53:40 Re: Fix a test case in 035_standby_logical_decoding.pl
Previous Message Daniel Gustafsson 2023-04-27 09:32:29 Re: Should vacuum process config file reload more often