Thread: Extend compatibility of PostgreSQL::Test::Cluster

Extend compatibility of PostgreSQL::Test::Cluster

From
Andrew Dunstan
Date:
PFA a patch to extend the compatibility of PostgreSQL::Test::Cluster to
all live branches. It does this by introducing a couple of subclasses
which override a few things. The required class is automatically
detected and used, so users don't need to specify a subclass. Although
this is my work it draws some inspiration from work by Jehan-Guillaume
de Rorthais. The aim here is to provide minimal disruption to the
mainline code, and also to have very small override subroutines.

My hope is to take this further, down to 9.2, which we recently decided
to give limited build support to. However I think the present patch is a
good stake to put into the ground.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Attachment

Re: Extend compatibility of PostgreSQL::Test::Cluster

From
Andrew Dunstan
Date:
On 12/28/21 09:30, Andrew Dunstan wrote:
> PFA a patch to extend the compatibility of PostgreSQL::Test::Cluster to
> all live branches. It does this by introducing a couple of subclasses
> which override a few things. The required class is automatically
> detected and used, so users don't need to specify a subclass. Although
> this is my work it draws some inspiration from work by Jehan-Guillaume
> de Rorthais. The aim here is to provide minimal disruption to the
> mainline code, and also to have very small override subroutines.
>
> My hope is to take this further, down to 9.2, which we recently decided
> to give limited build support to. However I think the present patch is a
> good stake to put into the ground.



This version handles older versions for which we have no subclass more
gracefully.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Attachment

Re: Extend compatibility of PostgreSQL::Test::Cluster

From
Dagfinn Ilmari Mannsåker
Date:
Andrew Dunstan <andrew@dunslane.net> writes:

> +        my $subclass = __PACKAGE__ . "::V_$maj";
> +        bless $node, $subclass;
> +        unless ($node->isa(__PACKAGE__))
> +        {
> +            # It's not a subclass, so re-bless back into the main package
> +            bless($node, __PACKAGE__);
> +            carp "PostgreSQL::Test::Cluster isn't fully compatible with version $ver";
> +        }

The ->isa() method works on package names as well as blessed objects, so
the back-and-forth blessing can be avoided.

    my $subclass = __PACKAGE__ . "::V_$maj";
    if ($subclass->isa(__PACKAGE__))
    {
        bless($node, $subclass);
    }
    else
    {
        carp "PostgreSQL::Test::Cluster isn't fully compatible with version $ver";
    }

- ilmari



Re: Extend compatibility of PostgreSQL::Test::Cluster

From
Andrew Dunstan
Date:
On 12/31/21 11:20, Dagfinn Ilmari Mannsåker wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>
>> +        my $subclass = __PACKAGE__ . "::V_$maj";
>> +        bless $node, $subclass;
>> +        unless ($node->isa(__PACKAGE__))
>> +        {
>> +            # It's not a subclass, so re-bless back into the main package
>> +            bless($node, __PACKAGE__);
>> +            carp "PostgreSQL::Test::Cluster isn't fully compatible with version $ver";
>> +        }
> The ->isa() method works on package names as well as blessed objects, so
> the back-and-forth blessing can be avoided.
>
>     my $subclass = __PACKAGE__ . "::V_$maj";
>     if ($subclass->isa(__PACKAGE__))
>     {
>         bless($node, $subclass);
>     }
>     else
>     {
>         carp "PostgreSQL::Test::Cluster isn't fully compatible with version $ver";
>     }
>

OK, thanks, will fix in next version.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com




Re: Extend compatibility of PostgreSQL::Test::Cluster

From
Andrew Dunstan
Date:
On 12/31/21 11:22, Andrew Dunstan wrote:
> On 12/31/21 11:20, Dagfinn Ilmari Mannsåker wrote:
>> Andrew Dunstan <andrew@dunslane.net> writes:
>>
>>> +        my $subclass = __PACKAGE__ . "::V_$maj";
>>> +        bless $node, $subclass;
>>> +        unless ($node->isa(__PACKAGE__))
>>> +        {
>>> +            # It's not a subclass, so re-bless back into the main package
>>> +            bless($node, __PACKAGE__);
>>> +            carp "PostgreSQL::Test::Cluster isn't fully compatible with version $ver";
>>> +        }
>> The ->isa() method works on package names as well as blessed objects, so
>> the back-and-forth blessing can be avoided.
>>
>>     my $subclass = __PACKAGE__ . "::V_$maj";
>>     if ($subclass->isa(__PACKAGE__))
>>     {
>>         bless($node, $subclass);
>>     }
>>     else
>>     {
>>         carp "PostgreSQL::Test::Cluster isn't fully compatible with version $ver";
>>     }
>>
> OK, thanks, will fix in next version.
>
>

Here's a version that does that and removes some recent bitrot.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Attachment

Re: Extend compatibility of PostgreSQL::Test::Cluster

From
Michael Paquier
Date:
On Tue, Jan 18, 2022 at 06:35:39PM -0500, Andrew Dunstan wrote:
> Here's a version that does that and removes some recent bitrot.

I have been looking at the full set of features of Cluster.pm and the
requirements behind v10 as minimal version supported, and nothing
really stands out.

+   # old versions of walreceiver just set the application name to
+   # `walreceiver'

Perhaps this should mention to which older versions this sentence
applies?
--
Michael

Attachment

Re: Extend compatibility of PostgreSQL::Test::Cluster

From
Andrew Dunstan
Date:
On 1/21/22 02:47, Michael Paquier wrote:
> On Tue, Jan 18, 2022 at 06:35:39PM -0500, Andrew Dunstan wrote:
>> Here's a version that does that and removes some recent bitrot.
> I have been looking at the full set of features of Cluster.pm and the
> requirements behind v10 as minimal version supported, and nothing
> really stands out.
>
> +   # old versions of walreceiver just set the application name to
> +   # `walreceiver'
>
> Perhaps this should mention to which older versions this sentence
> applies?



Will do in the next version. FTR it's versions older than 12.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com




Re: Extend compatibility of PostgreSQL::Test::Cluster

From
Andrew Dunstan
Date:
On 1/21/22 09:59, Andrew Dunstan wrote:
> On 1/21/22 02:47, Michael Paquier wrote:
>> On Tue, Jan 18, 2022 at 06:35:39PM -0500, Andrew Dunstan wrote:
>>> Here's a version that does that and removes some recent bitrot.
>> I have been looking at the full set of features of Cluster.pm and the
>> requirements behind v10 as minimal version supported, and nothing
>> really stands out.
>>
>> +   # old versions of walreceiver just set the application name to
>> +   # `walreceiver'
>>
>> Perhaps this should mention to which older versions this sentence
>> applies?
>
>
> Will do in the next version. FTR it's versions older than 12.
>
>

I'm not sure why this item has been moved to the next CF without any
discussion I could see on the mailing list. It was always my intention
to commit it this time, and I propose to do so tomorrow with the comment
Michael has requested above. The cfbot is still happy with it.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com




Re: Extend compatibility of PostgreSQL::Test::Cluster

From
Michael Paquier
Date:
On Tue, Mar 29, 2022 at 05:56:02PM -0400, Andrew Dunstan wrote:
> I'm not sure why this item has been moved to the next CF without any
> discussion I could see on the mailing list. It was always my intention
> to commit it this time, and I propose to do so tomorrow with the comment
> Michael has requested above. The cfbot is still happy with it.

Thanks for taking care of it!
--
Michael

Attachment

Re: Extend compatibility of PostgreSQL::Test::Cluster

From
Andrew Dunstan
Date:
On 3/30/22 01:55, Michael Paquier wrote:
> On Tue, Mar 29, 2022 at 05:56:02PM -0400, Andrew Dunstan wrote:
>> I'm not sure why this item has been moved to the next CF without any
>> discussion I could see on the mailing list. It was always my intention
>> to commit it this time, and I propose to do so tomorrow with the comment
>> Michael has requested above. The cfbot is still happy with it.
> Thanks for taking care of it!



Committed.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com