Re: Helper functions for wait_for_catchup() in Cluster.pm

From: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Helper functions for wait_for_catchup() in Cluster.pm
Date: 2023-01-26 19:43:25
Message-ID: f525c9ba-9886-e54c-cf64-84cd5c9e79af@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 1/26/23 10:42 AM, Alvaro Herrera wrote:
> On 2023-Jan-26, Drouvot, Bertrand wrote:
>
>> On 1/24/23 7:27 PM, Alvaro Herrera wrote:
>
>>> 1. I don't think wait_for_write_catchup is necessary, because
>>> calling wait_for_catchup() and omitting the 'mode' and 'lsn' arguments
>>> would already do the same thing.

Having a closer look, it does not seem to be the case. The default mode
in wait_for_catchup() is 'replay' and the default mode for the lsn is 'write'.

But in wait_for_write_catchup() we are making use of 'write' for both.

>
>>> 2. Because wait_for_replay_catchup is an instance method, passing the
>>> second node as argument is needlessly noisy, because that's already
>>> known as $self. So we can just say
>>>
>>> $primary_node->wait_for_replay_catchup($standby_node);
>>
>> Yeah, but same here, there is places where the node passed as the second argument is not the "$self":
>>
>> src/bin/pg_rewind/t/007_standby_source.pl:$node_b->wait_for_replay_catchup('node_c', $node_a);
>> src/test/recovery/t/001_stream_rep.pl:$node_standby_1->wait_for_replay_catchup($node_standby_2, $node_primary);
>> src/test/recovery/t/001_stream_rep.pl:$node_standby_1->wait_for_replay_catchup($node_standby_2, $node_primary);
>> src/test/recovery/t/001_stream_rep.pl: $node_standby_1->wait_for_replay_catchup($node_standby_2, $node_primary);
>>
>> So it looks like there is still a need for wait_for_replay_catchup() with 2 parameters.
>
> Ah, cascading replication. In that case, let's make the second
> parameter optional. If it's not given, $self is used.
>

Good point, done in V3 attached.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v3-0001-wait_for_catchup_helper_functions.patch text/plain 14.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-01-26 19:43:29 Something is wrong with wal_compression
Previous Message Robert Haas 2023-01-26 19:42:05 Re: improving user.c error messages