From: | Denis Laxalde <denis(dot)laxalde(at)dalibo(dot)com> |
---|---|
To: | Yurii Rashkovskii <yrashk(at)gmail(dot)com>, Aleksander Alekseev <aleksander(at)timescale(dot)com> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: [PATCH] Allow Postgres to pick an unused port to listen |
Date: | 2023-04-20 09:03:24 |
Message-ID: | e2caf80c-5c5e-90c2-cb41-1a7379c59b9c@dalibo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Yurii Rashkovskii a écrit :
> On Wed, Apr 19, 2023 at 11:44 PM Aleksander Alekseev <
> aleksander(at)timescale(dot)com> wrote:
>>>> I would like to suggest a patch against master (although it may be
>> worth
>>>> backporting it) that makes it possible to listen on any unused port.
[...]
>> A bullet-proof approach would be (approximately) for the test
>> framework to lease the ports on the given machine, for instance by
>> using a KV value with CAS support like Consul or etcd (or another
>> PostgreSQL instance), as this is done for leader election in
>> distributed systems (so called leader lease). After leasing the port
>> the framework knows no other testing process on the given machine will
>> use it (and also it keeps telling the KV storage that the port is
>> still leased) and specifies it in postgresql.conf as usual.
>>
>
> The approach you suggest introduces a significant amount of complexity but
> seemingly fails to address one of the core issues: using a KV store to
> lease a port does not guarantee the port's availability. I don't believe
> this is a sound way to address this issue, let alone a bulletproof one.
>
> Also, I don't think there's a case for distributed systems here because
> we're only managing a single computer's resource: the allocation of local
> ports.
For this (local computer) use case, a tool such as
https://github.com/kmike/port-for/ would do the job if I understand
correctly (the lease thing, locally). And it would work for "anything",
not just Postgres.
I am curious, Yurii, is Postgres the only service that need an unused
port for listening in your testing/application environment? Otherwise,
how is this handled in other software?
Cheers,
Denis
From | Date | Subject | |
---|---|---|---|
Next Message | Kumar, Sachin | 2023-04-20 10:07:47 | RE: Initial Schema Sync for Logical Replication |
Previous Message | shveta malik | 2023-04-20 08:58:36 | Re: Support logical replication of DDLs |