pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Mark Dilger <mark.dilger@enterprisedb.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Noah Misch <noah@leadboat.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Erik Rijkers <er@xs4all.nl>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Postgres perl module namespace
Date: Mon, 18 Apr 2022 16:19:31 -0400
Message-ID: <0a3f69a9-19dd-2ae9-26f7-e65daea48141@dunslane.net> (raw)
In-Reply-To: <5197DC22-47D2-44E9-B5DA-CF22B0E0325C@enterprisedb.com>
References: <da8a9278-3366-4871-4823-b929b3b5e91a@dunslane.net>
	<YTWiXYixl/bM0Gft@paquier.xyz>
	<780f82bb-3a25-0c6f-154a-9f24b9324dba@dunslane.net>
	<615a96e7-6f8c-7bfb-216c-3ed0d619c04a@dunslane.net>
	<2bb5f5b2-5210-5c98-2be6-405283d6f817@xs4all.nl>
	<YW+LkgkbLkq7tdyf@paquier.xyz>
	<a1c22c37-316c-7c57-abcf-99ee9cda80e4@dunslane.net>
	<072a3088-7988-1c49-4d30-df47cf8e6415@dunslane.net>
	<YXZm2CYR5Z3H9IWL@paquier.xyz>
	<20220418141530.nfxtkohefvwnzncl@alap3.anarazel.de>
	<20220418155224.GA1149931@rfd.leadboat.com>
	<d74da58b-cfee-4fea-a31a-439921c0feb0@dunslane.net>
	<2361941.1650303832@sss.pgh.pa.us>
	<02188900-ba1e-8c6c-c7dd-98294f39c23f@dunslane.net>
	<5197DC22-47D2-44E9-B5DA-CF22B0E0325C@enterprisedb.com>


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






view thread (63+ messages)  latest in thread

Message-ID: <0a3f69a9-19dd-2ae9-26f7-e65daea48141@dunslane.net>
Permalink:  ../0a3f69a9-19dd-2ae9-26f7-e65daea48141@dunslane.net/
Also on:    postgresql.org/message-id/0a3f69a9-19dd-2ae9-26f7-e65daea48141@dunslane.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: andrew@dunslane.net, mark.dilger@enterprisedb.com, tgl@sss.pgh.pa.us, noah@leadboat.com, andres@anarazel.de, michael@paquier.xyz, er@xs4all.nl, robertmhaas@gmail.com, alvherre@alvh.no-ip.org, pgsql-hackers@lists.postgresql.org
  Subject: Re: Postgres perl module namespace
  In-Reply-To: <0a3f69a9-19dd-2ae9-26f7-e65daea48141@dunslane.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox