Re: Postgres perl module namespace

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Noah Misch <noah(at)leadboat(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Erik Rijkers <er(at)xs4all(dot)nl>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Postgres perl module namespace
Date: 2022-04-20 19:56:17
Message-ID: f49c0f56-a215-1ea9-0268-dce85ca64226@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-04-20 20:11:20 Re: Replace open mode with PG_BINARY_R/W/A macros
Previous Message Robert Haas 2022-04-20 19:35:47 Re: pg14 psql broke \d datname.nspname.relname