Re: Postgres perl module namespace - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Postgres perl module namespace
Date
Msg-id f49c0f56-a215-1ea9-0268-dce85ca64226@dunslane.net
Whole thread Raw
In response to Re: Postgres perl module namespace  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Postgres perl module namespace  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On 2022-04-19 Tu 20:30, Michael Paquier wrote:
> On Tue, Apr 19, 2022 at 07:24:58PM -0400, Andrew Dunstan wrote:
>> On 2022-04-19 Tu 18:39, Michael Paquier wrote:
>>> +*generate_ascii_string = *TestLib::generate_ascii_string;
>>> +*slurp_dir = *TestLib::slurp_dir;
>>> +*slurp_file = *TestLib::slurp_file;
>>>
>>> I am not sure if it is possible and my perl-fu is limited in this
>>> area, but could a failure be enforced when loading this path if a new
>>> routine added in TestLib.pm is forgotten in this list?
>> Not very easily that I'm aware of, but maybe some superior perl wizard
>> will know better.
> Okay.  Please do not consider this as a blocker.  I was just wondering
> about ways to ease more the error reports when it comes to
> back-patching, and this would move the error stack a bit earlier.



There are a few other things that could make backpatching harder, and
while they are not related to the namespace issue they do affect a bit
how that is managed.


The following variables are missing in various versions of TestLib:


in version 13 and earlier: $is_msys2, $timeout_default

in version 12 and earlier: $use_unix_sockets


and the following functions are missing:


in version 14 and earlier: pump_until

in version 13 and earlier: dir_symlink

in version 11 and earlier: run_command

in version 10: check_mode_recursive, chmod_recursive,  check_pg_config


(Also in version 10 command_checks_all exists but isn't exported. I'm
inclined just to remedy that along the way)


Turning to PostgresNode, the class-wide function get_free_port is absent
from version 10, and the following instance methods are absent from some
or all of the back branches:

adjust_conf, clean_node, command_fails_like, config_data, connect_fails,
connect_ok, corrupt_page_checksum, group_access, installed_command,
install_path, interactive_psql, logrotate, set_recovery_mode,
set_standby_mode, wait_for_log

We don't export or provide aliases for any of these instance methods in
these patches, but attempts to use them in backpatched code will fail
where they are absent, so I thought it worth mentioning.


Basically I propose just to remove any mention of the Testlib items and
get_free_port from the export and alias lists for versions where they
are absent. If backpatchers need a function they can backport it if
necessary.


cheers


andrew


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




pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: pg14 psql broke \d datname.nspname.relname
Next
From: Peter Eisentraut
Date:
Subject: Re: Replace open mode with PG_BINARY_R/W/A macros