Re: Postgres perl module namespace

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
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>, Michael Paquier <michael(at)paquier(dot)xyz>, Erik Rijkers <er(at)xs4all(dot)nl>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Postgres perl module namespace
Date: 2022-04-18 20:19:31
Message-ID: 0a3f69a9-19dd-2ae9-26f7-e65daea48141@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2022-04-18 Mo 15:46, Mark Dilger wrote:
>
>> On Apr 18, 2022, at 10:59 AM, Andrew Dunstan <andrew(at)dunslane(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2022-04-18 20:20:52 Re: Dump/Restore of non-default PKs
Previous Message Peter Geoghegan 2022-04-18 20:12:33 Re: Why does pg_class.reltuples count only live tuples in indexes (after VACUUM runs)?