Re: Postgres perl module namespace
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Mark Dilger <mark.dilger@enterprisedb.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Noah Misch <noah@leadboat.com>,
Andres Freund <andres@anarazel.de>, Michael Paquier <michael@paquier.xyz>,
Erik Rijkers <er@xs4all.nl>, Robert Haas <robertmhaas@gmail.com>,
Alvaro Herrera <alvherre@alvh.no-ip.org>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-04-18T20:19:31Z
Lists: pgsql-hackers
On 2022-04-18 Mo 15:46, Mark Dilger wrote: > >> On Apr 18, 2022, at 10:59 AM, Andrew Dunstan <andrew@dunslane.net> wrote: >> >> No, I think we could probably just port the whole of src/test/PostreSQL >> back if required, and have it live alongside the old modules. Each TAP >> test is a separate miracle - see comments elsewhere about port >> assignment in parallel TAP tests. > I think $last_port_assigned would need to be shared between the two modules. This global safeguard is already a bit buggy, but not sharing it between modules would be far worse. Currently, if a node which has a port assigned is stopped, and a parallel test creates a new node, this global variable prevents the new node from getting the port already assigned to the old stopped node, except when port assignment wraps around. Without sharing the global, wrap-around need not happen for port collisions. > > Or am I reading the code wrong? > I don't see anything at all in the current code that involves sharing $last_port_assigned (or anything else) between parallel tests. The only reason we don't get lots of collisions there is because each one starts off at a random port. If you want it shared to guarantee non-collision we will need far more infrastructure, AFAICS, but that seems quite separate from the present issue. I have some experience of managing that - the buildfarm code has some shared state, protected by bunch of locks. To the best of my knowledge. each TAP test runs in its own process, a child of prove. And that's just as well because we certainly wouldn't want other package globals (like the node list) shared. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com
Commits
-
Fix PostgreSQL::Test aliasing for Perl v5.10.1.
- fe25c8533c17 12.12 landed
- ca590a4e958f 10.22 landed
- bf92b73beb50 11.17 landed
- aa1845cdd697 13.8 landed
- 4b0d21b06c6b 14.5 landed
-
For PostgreSQL::Test compatibility, alias entire package symbol tables.
- 38790408b020 10.22 landed
- ec26f44d539a 12.12 landed
- e8f037a2df9b 13.8 landed
- c41edb324294 11.17 landed
- 20911775de4a 14.5 landed
-
Make PostgresNode easily subclassable
- 54dacc746628 10.0 cited