Re: [PATCH] Allow Postgres to pick an unused port to listen

Поиск
Список
Период
Сортировка
От Denis Laxalde
Тема Re: [PATCH] Allow Postgres to pick an unused port to listen
Дата
Msg-id e2caf80c-5c5e-90c2-cb41-1a7379c59b9c@dalibo.com
обсуждение исходный текст
Ответ на Re: [PATCH] Allow Postgres to pick an unused port to listen  (Yurii Rashkovskii <yrashk@gmail.com>)
Ответы Re: [PATCH] Allow Postgres to pick an unused port to listen
Список pgsql-hackers
Hi,

Yurii Rashkovskii a écrit :
> On Wed, Apr 19, 2023 at 11:44 PM Aleksander Alekseev <
> aleksander@timescale.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: shveta malik
Дата:
Сообщение: Re: Support logical replication of DDLs
Следующее
От: "Kumar, Sachin"
Дата:
Сообщение: RE: Initial Schema Sync for Logical Replication