Thread: pgsql: Make PostgreSQL::Test::Cluster compatible with all live branches

pgsql: Make PostgreSQL::Test::Cluster compatible with all live branches

From
Andrew Dunstan
Date:
Make PostgreSQL::Test::Cluster compatible with all live branches

We do this via a subclass for any branch older than the minimum known
to be compatible with the main package (currently release 12).

This should be useful for constructing cross-version tests.

In theory this could be extended back any number of versions, with
varying degrees of compatibility.

Reviewed by Michael Paquier and Dagfinn Ilmari Mannsåker

Discussion: https://postgr.es/m/a3efd19a-d5c9-fdf2-6094-4cde056a2708@dunslane.net

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fb16d2c6588446b00534d90958e6dc312ae52a2f

Modified Files
--------------
src/test/perl/PostgreSQL/Test/Cluster.pm | 79 ++++++++++++++++++++++++++++----
1 file changed, 70 insertions(+), 9 deletions(-)


Andrew Dunstan <andrew@dunslane.net> writes:
> Make PostgreSQL::Test::Cluster compatible with all live branches

prairiedog is unhappy [1], seemingly as a result of this patch:

t/001_repl_stats....Can't locate parent.pm in @INC (@INC contains: ../../src/test/perl/ .
/usr/local/perl5.8.3/lib/5.8.3/darwin-2level/usr/local/perl5.8.3/lib/5.8.3/darwin-2level /usr/local/perl5.8.3/lib/5.8.3
/usr/local/perl5.8.3/lib/site_perl/5.8.3/darwin-2level/usr/local/perl5.8.3/lib/site_perl/5.8.3/darwin-2level
/usr/local/perl5.8.3/lib/site_perl/5.8.3/usr/local/perl5.8.3/lib/site_perl/5.8.3/darwin-2level
/usr/local/perl5.8.3/lib/site_perl/5.8.3/usr/local/perl5.8.3/lib/site_perl .
/usr/local/perl5.8.3/lib/5.8.3/darwin-2level/usr/local/perl5.8.3/lib/5.8.3
/usr/local/perl5.8.3/lib/site_perl/5.8.3/darwin-2level/usr/local/perl5.8.3/lib/site_perl/5.8.3
/usr/local/perl5.8.3/lib/site_perl.) at ../../src/test/perl//PostgreSQL/Test/Cluster.pm line 2921. 
BEGIN failed--compilation aborted at ../../src/test/perl//PostgreSQL/Test/Cluster.pm line 2921.

I think this means that its old Perl version misinterprets

use parent -norequire, qw(PostgreSQL::Test::Cluster);

as a request to include "parent.pm".  Is there a more
backwards-compatible way to spell that?

            regards, tom lane

[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=prairiedog&dt=2022-03-30%2021%3A23%3A58



Re: pgsql: Make PostgreSQL::Test::Cluster compatible with all live branches

From
Andrew Dunstan
Date:

> On Mar 30, 2022, at 8:19 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Andrew Dunstan <andrew@dunslane.net> writes:
>> Make PostgreSQL::Test::Cluster compatible with all live branches
>
> prairiedog is unhappy [1], seemingly as a result of this patch:
>
> t/001_repl_stats....Can't locate parent.pm in @INC (@INC contains: ../../src/test/perl/ .
/usr/local/perl5.8.3/lib/5.8.3/darwin-2level/usr/local/perl5.8.3/lib/5.8.3/darwin-2level /usr/local/perl5.8.3/lib/5.8.3
/usr/local/perl5.8.3/lib/site_perl/5.8.3/darwin-2level/usr/local/perl5.8.3/lib/site_perl/5.8.3/darwin-2level
/usr/local/perl5.8.3/lib/site_perl/5.8.3/usr/local/perl5.8.3/lib/site_perl/5.8.3/darwin-2level
/usr/local/perl5.8.3/lib/site_perl/5.8.3/usr/local/perl5.8.3/lib/site_perl .
/usr/local/perl5.8.3/lib/5.8.3/darwin-2level/usr/local/perl5.8.3/lib/5.8.3
/usr/local/perl5.8.3/lib/site_perl/5.8.3/darwin-2level/usr/local/perl5.8.3/lib/site_perl/5.8.3
/usr/local/perl5.8.3/lib/site_perl.) at ../../src/test/perl//PostgreSQL/Test/Cluster.pm line 2921. 
> BEGIN failed--compilation aborted at ../../src/test/perl//PostgreSQL/Test/Cluster.pm line 2921.
>
> I think this means that its old Perl version misinterprets
>
> use parent -norequire, qw(PostgreSQL::Test::Cluster);
>
> as a request to include "parent.pm".  Is there a more
> backwards-compatible way to spell that?


Not that I know of. Googling tells me it was a core module from 5.10.1. I can revert tomorrow if necessary :-(

Cheers

Andrew



Andrew Dunstan <andrew@dunslane.net> writes:
>> On Mar 30, 2022, at 8:19 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I think this means that its old Perl version misinterprets
>> use parent -norequire, qw(PostgreSQL::Test::Cluster);
>> as a request to include "parent.pm".  Is there a more
>> backwards-compatible way to spell that?

> Not that I know of. Googling tells me it was a core module from 5.10.1. I can revert tomorrow if necessary :-(

Hmm.  I checked not too long ago, and these are the buildfarm
animals that would be broken:

 prairiedog    | 2022-03-23 05:04:02 | configure: using perl 5.8.3
 anole         | 2022-03-24 10:40:08 | configure: using perl 5.8.8
 gharial       | 2022-03-24 18:32:22 | configure: using perl 5.8.8
 locust        | 2022-03-19 22:17:53 | configure: using perl 5.8.8
 gaur          | 2022-03-19 15:00:54 | configure: using perl 5.8.9

I could update prairiedog and gaur (... probably), but hard to say
about the others.

It seems kind of sad for a backwards-compatibility patch to force a
major move of our minimum Perl version.  OTOH, if there's no other
good way to do it, maybe we gotta.

Another possibility is that maybe parent.pm could be successfully
installed into a 5.8.x installation.  I can't speak for those
other animals, but mine at least are already frankencritters.

            regards, tom lane



Re: pgsql: Make PostgreSQL::Test::Cluster compatible with all live branches

From
Andrew Dunstan
Date:


On Mar 30, 2022, at 9:12 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Andrew Dunstan <andrew@dunslane.net> writes:
On Mar 30, 2022, at 8:19 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I think this means that its old Perl version misinterprets
use parent -norequire, qw(PostgreSQL::Test::Cluster);
as a request to include "parent.pm".  Is there a more
backwards-compatible way to spell that?

Not that I know of. Googling tells me it was a core module from 5.10.1. I can revert tomorrow if necessary :-(

Hmm.  I checked not too long ago, and these are the buildfarm
animals that would be broken:

prairiedog    | 2022-03-23 05:04:02 | configure: using perl 5.8.3
anole         | 2022-03-24 10:40:08 | configure: using perl 5.8.8
gharial       | 2022-03-24 18:32:22 | configure: using perl 5.8.8
locust        | 2022-03-19 22:17:53 | configure: using perl 5.8.8
gaur          | 2022-03-19 15:00:54 | configure: using perl 5.8.9

I could update prairiedog and gaur (... probably), but hard to say
about the others.

It seems kind of sad for a backwards-compatibility patch to force a
major move of our minimum Perl version.  OTOH, if there's no other
good way to do it, maybe we gotta.

Another possibility is that maybe parent.pm could be successfully
installed into a 5.8.x installation.  I can't speak for those
other animals, but mine at least are already frankencritters.




Cheers

Andrew

Re: pgsql: Make PostgreSQL::Test::Cluster compatible with all live branches

From
Andrew Dunstan
Date:
On 3/30/22 21:12, Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>>> On Mar 30, 2022, at 8:19 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> I think this means that its old Perl version misinterprets
>>> use parent -norequire, qw(PostgreSQL::Test::Cluster);
>>> as a request to include "parent.pm".  Is there a more
>>> backwards-compatible way to spell that?
>> Not that I know of. Googling tells me it was a core module from 5.10.1. I can revert tomorrow if necessary :-(



I must have been half asleep when I posted this.

There are three ways out of this that I can see:

. carry a copy of parent.pm in src/test/perl (It's very small)

. use the older and heavier 'base' module which goes back to 5.004, and
does much the same thing (and a lot more)

. just do directly what parent.pm's import() does, as in the attached,
which I have tested down to version 10.

On the whole I think I prefer the last.


cheers


andrew

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

Attachment
Andrew Dunstan <andrew@dunslane.net> writes:
> There are three ways out of this that I can see:
> . carry a copy of parent.pm in src/test/perl (It's very small)
> . use the older and heavier 'base' module which goes back to 5.004, and
> does much the same thing (and a lot more)
> . just do directly what parent.pm's import() does, as in the attached,
> which I have tested down to version 10.

> On the whole I think I prefer the last.

I like #3 too, given that it's such a small patch.  I've verified
that it allows regression tests to run on perl 5.8.8, which is the
oldest I have handy other than prairiedog's 5.8.3 (but that machine
is tied up and I don't feel like trying to test this concurrently
with a buildfarm run).

            regards, tom lane



Re: pgsql: Make PostgreSQL::Test::Cluster compatible with all live branches

From
Andrew Dunstan
Date:
On 3/31/22 12:50, Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> There are three ways out of this that I can see:
>> . carry a copy of parent.pm in src/test/perl (It's very small)
>> . use the older and heavier 'base' module which goes back to 5.004, and
>> does much the same thing (and a lot more)
>> . just do directly what parent.pm's import() does, as in the attached,
>> which I have tested down to version 10.
>> On the whole I think I prefer the last.
> I like #3 too, given that it's such a small patch.  I've verified
> that it allows regression tests to run on perl 5.8.8, which is the
> oldest I have handy other than prairiedog's 5.8.3 (but that machine
> is tied up and I don't feel like trying to test this concurrently
> with a buildfarm run).
>
>             



I think it's safe enough. Pushed.


cheers


andrew


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