Re: [PATCH] Allow Postgres to pick an unused port to listen - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: [PATCH] Allow Postgres to pick an unused port to listen
Date
Msg-id CAJ7c6TPBMQ9j8hB-UaHi43Amk=Pgt6V+3NYMjamBTzLg=rycqg@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Allow Postgres to pick an unused port to listen  (Denis Laxalde <denis.laxalde@dalibo.com>)
Responses Re: [PATCH] Allow Postgres to pick an unused port to listen
List pgsql-hackers
Hi,

> 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.
 

I don't suggest building a distributed system but rather using
well-known solutions from this area. For the described case the
"resource manager" will be as simple a single Consul instance (a
single binary file, since Consul is written in Go) running locally.
The "complexity" would be for the test framework to use a few extra
REST queries. Arguably not that complicated.

> using a KV store to lease a port does not guarantee the port's availability

I assume you don't have random processes doing random things (like
listening random ports) on a CI machine. You know that certain ports
are reserved for the tests and are going to be used only for this
purpose using the same leasing protocol.

If there are random things happening on CI you have no control of, you
are having a problem with the CI infrastructure, not with Postgres.

> For example, I'd suggest adding an option to Postgres to receive sockets it should listen [...]

Not sure if I fully understood the idea, but it looks like you are
suggesting to build in certain rather complicated functionality for an
arguably rare use case so that a QA engineer didn't have one extra
small dependency to worry about in this rare case. I'm quite skeptical
that this is going to happen.

> 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?

That's a very good point.

To clarify, there is nothing wrong with the patch per se. It's merely
an unreliable solution for a problem it is supposed to address. I
don't think we should encourage the users to build unreliable systems.

-- 
Best regards,
Aleksander Alekseev



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Initial Schema Sync for Logical Replication
Next
From: vignesh C
Date:
Subject: Re: [PoC] pg_upgrade: allow to upgrade publisher node