Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngXqY-00089F-OS for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Apr 2022 20:19:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ngXqX-0006Hn-2M for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Apr 2022 20:19:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngXqW-0006HN-P1 for pgsql-hackers@lists.postgresql.org; Mon, 18 Apr 2022 20:19:40 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngXqS-0006Ys-HX for pgsql-hackers@lists.postgresql.org; Mon, 18 Apr 2022 20:19:40 +0000 Received: (Authenticated sender: adsend@dunslane.net) by mail.gandi.net (Postfix) with ESMTPSA id 96C6B40005; Mon, 18 Apr 2022 20:19:32 +0000 (UTC) Message-ID: <0a3f69a9-19dd-2ae9-26f7-e65daea48141@dunslane.net> Date: Mon, 18 Apr 2022 16:19:31 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: Postgres perl module namespace Content-Language: en-US To: Mark Dilger Cc: Tom Lane , Noah Misch , Andres Freund , Michael Paquier , Erik Rijkers , Robert Haas , Alvaro Herrera , PostgreSQL Hackers References: <780f82bb-3a25-0c6f-154a-9f24b9324dba@dunslane.net> <615a96e7-6f8c-7bfb-216c-3ed0d619c04a@dunslane.net> <2bb5f5b2-5210-5c98-2be6-405283d6f817@xs4all.nl> <072a3088-7988-1c49-4d30-df47cf8e6415@dunslane.net> <20220418141530.nfxtkohefvwnzncl@alap3.anarazel.de> <20220418155224.GA1149931@rfd.leadboat.com> <2361941.1650303832@sss.pgh.pa.us> <02188900-ba1e-8c6c-c7dd-98294f39c23f@dunslane.net> <5197DC22-47D2-44E9-B5DA-CF22B0E0325C@enterprisedb.com> From: Andrew Dunstan In-Reply-To: <5197DC22-47D2-44E9-B5DA-CF22B0E0325C@enterprisedb.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-04-18 Mo 15:46, Mark Dilger wrote: > >> On Apr 18, 2022, at 10:59 AM, Andrew Dunstan 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