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

2023-08-02 Thread Daniel Gustafsson
> On 10 Jul 2023, at 14:27, Daniel Gustafsson wrote: > This patch is Waiting on Author in the current commitfest with no new patch > presented following the discussion here. Is there an update ready or should > we > close it in this CF in favour of a future one? Since the thread stalled here

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

2023-07-10 Thread Daniel Gustafsson
> On 11 May 2023, at 13:24, Yurii Rashkovskii wrote: > > On Thu, May 11, 2023 at 10:36 AM Alvaro Herrera > wrote: > On 2023-May-11, Yurii Rashkovskii wrote: > > > ``` > > 127.0.0.1=5432 ::1=54321 > > ``` > > > > Basically, a space-delimited set of address/port

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

2023-05-18 Thread Aleksander Alekseev
Hi, > I think either a specific pg_ctl command to return the port like Greg had > initially mentioned or simply a separate file to store the port numbers would > be ideal. +1, if we are going to do this we definitely need a pg_ctl command and/or a file. > The standalone file being the simpler

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

2023-05-17 Thread Tristen Raab
The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, passed Spec compliant: not tested Documentation:tested, passed Hello Yurii, I've retested your latest patch and tested

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

2023-05-11 Thread Yurii Rashkovskii
On Thu, May 11, 2023 at 10:36 AM Alvaro Herrera wrote: > On 2023-May-11, Yurii Rashkovskii wrote: > > > ``` > > 127.0.0.1=5432 ::1=54321 > > ``` > > > > Basically, a space-delimited set of address/port pairs (delimited by `=` > to > > allow IPv6 addresses to use a colon). > > This seems a bit

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

2023-05-11 Thread Alvaro Herrera
On 2023-May-11, Yurii Rashkovskii wrote: > Relying on a variable number of lines may be counter-productive here if we > want postmaster.pid to be easily readable by shell scripts. Oh, I was thinking in Peter E's proposal to list the interface/port number pairs in a separate file named 'ports' or

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

2023-05-11 Thread Yurii Rashkovskii
Alvaro, Tom, On Mon, May 8, 2023 at 4:49 PM Tom Lane wrote: > Alvaro Herrera writes: > > This made me wonder if storing the unadorned port number is really the > > best way. Suppose we did extend things so that we listen on different > > ports on different interfaces; how would this scheme

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

2023-05-11 Thread Yurii Rashkovskii
Hi Denis, Great catch. I've amended the patch to fix this issue with the documentation (V3). On Tue, May 9, 2023 at 2:25 PM Denis Laxalde wrote: > The documentation fails to build for me: > > $ ninja docs > [1/2] Generating doc/src/sgml/postgres-full.xml with a custom command > FAILED:

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

2023-05-09 Thread Denis Laxalde
The documentation fails to build for me: $ ninja docs [1/2] Generating doc/src/sgml/postgres-full.xml with a custom command FAILED: doc/src/sgml/postgres-full.xml /usr/bin/python3 ../postgresql/doc/src/sgml/xmltools_dep_wrapper --targetname doc/src/sgml/postgres-full.xml --depfile

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

2023-05-08 Thread Tom Lane
Alvaro Herrera writes: > This made me wonder if storing the unadorned port number is really the > best way. Suppose we did extend things so that we listen on different > ports on different interfaces; how would this scheme work at all? Yeah, the probability that that will happen someday is one

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

2023-05-08 Thread Alvaro Herrera
On 2023-Apr-19, Yurii Rashkovskii wrote: > If we consider this path, then (if we assume the format of the file is > still to be private), we can make the port line accept multiple ports using > a delimiter like `:` so that the next line still remains the same. This made me wonder if storing the

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

2023-05-08 Thread Robert Haas
On Mon, Apr 24, 2023 at 10:16 AM Peter Eisentraut wrote: > Right. I'm perfectly content with just allowing port number 0 and > leaving it at that. That seems fine to me, too. If somebody wants to add a pg_ctl feature to extract this or any other information from the postmaster.pid file, that

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

2023-05-07 Thread Yurii Rashkovskii
Hi Cary, Thank you so much for the review. It's very valuable, and you caught an important issue with it that I somehow missed (not updating the .pid file with the selected port number). I'm not sure how it escaped me (perhaps I was focusing too much on the log file to validate the behaviour).

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

2023-05-05 Thread Cary Huang
The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, failed Spec compliant: not tested Documentation:not tested Hello This is one of those features that is beneficial to a handful

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

2023-04-24 Thread Peter Eisentraut
On 19.04.23 06:21, Stephen Frost wrote: I don't think involving pg_ctl is necessary or desirable, since it would make any future changes like that even more complicated. I'm a bit confused by this- if pg_ctl is invoked then we have more-or-less full control over parsing and reporting out the

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

2023-04-20 Thread Yurii Rashkovskii
Aleksander, On Thu, Apr 20, 2023 at 1:22 PM Aleksander Alekseev < aleksan...@timescale.com> wrote: > 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

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

2023-04-20 Thread Aleksander Alekseev
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

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

2023-04-20 Thread Denis Laxalde
Hi, Yurii Rashkovskii a écrit : On Wed, Apr 19, 2023 at 11:44 PM Aleksander Alekseev < aleksan...@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

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

2023-04-19 Thread Yurii Rashkovskii
Alexander, On Wed, Apr 19, 2023 at 11:44 PM Aleksander Alekseev < aleksan...@timescale.com> wrote: > Hi, > > Here are my two cents. > > > > 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. > > >

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

2023-04-19 Thread Aleksander Alekseev
Hi, Here are my two cents. > > 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. > > I think this is a bad idea, mainly because this: > > > Instead, with this patch, one can specify `port` as `0` (the

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

2023-04-18 Thread Yurii Rashkovskii
Stephen, > You could just drop another file into the data directory that just > contains > > the port number ($PGDATA/port). However, if we ever do multiple ports, > that > > would still require a change in the format of that file, so I don't know > if > > that's actually better than a). > I

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

2023-04-18 Thread Stephen Frost
Greetings, * Peter Eisentraut (peter.eisentr...@enterprisedb.com) wrote: > On 13.04.23 04:45, Yurii Rashkovskii wrote: > > But getting your agreement is important to get this in; I am willing to > > play along and resolve both (1) and (2) in one go. As for the > > implementation approach for (2),

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

2023-04-18 Thread Peter Eisentraut
On 13.04.23 04:45, Yurii Rashkovskii wrote: But getting your agreement is important to get this in; I am willing to play along and resolve both (1) and (2) in one go. As for the implementation approach for (2), which of the following options would you prefer? a) Document postmaster.pid as it

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

2023-04-12 Thread Yurii Rashkovskii
Hi Tom, On Thu, Apr 13, 2023 at 9:17 AM Tom Lane wrote: > Yurii Rashkovskii writes: > > Thank you all for the feedback. It's quite useful. I think it is > important > > to separate this into two concerns: > > > 1. Letting Postgres pick an unused port. > > 2. Retrieving the port it picked. > >

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

2023-04-12 Thread Tom Lane
Yurii Rashkovskii writes: > Thank you all for the feedback. It's quite useful. I think it is important > to separate this into two concerns: > 1. Letting Postgres pick an unused port. > 2. Retrieving the port it picked. Yeah, those are distinguishable implementation concerns, but ... > The

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

2023-04-12 Thread Yurii Rashkovskii
Tom, Robert, Greg, Andrew, On Thu, Apr 13, 2023 at 12:56 AM Tom Lane wrote: > Robert Haas writes: > > On Wed, Apr 12, 2023 at 1:31 PM Greg Stark wrote: > >> I don't object to using the pid file as the mechanism -- but it is a > >> bit of an awkward UI for shell scripting. I imagine it would

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

2023-04-12 Thread Michael Paquier
On Wed, Apr 12, 2023 at 02:24:30PM -0400, Tom Lane wrote: > I don't really want external code knowing that line 4 is the port, > because I foresee us breaking that someday --- what will happen > when we want to allow one postmaster to support multiple ports? > Maybe we'll decide that we don't have

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

2023-04-12 Thread Tom Lane
Robert Haas writes: > On Wed, Apr 12, 2023 at 1:56 PM Tom Lane wrote: >> Yeah. My main concern here is with limiting our ability to change >> the pidfile format in future. If we can keep the dependencies on that >> localized to code we control, it'd be much better. > I don't know if it's

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

2023-04-12 Thread Robert Haas
On Wed, Apr 12, 2023 at 1:56 PM Tom Lane wrote: > Yeah. My main concern here is with limiting our ability to change > the pidfile format in future. If we can keep the dependencies on that > localized to code we control, it'd be much better. I don't know if it's considered officially supported,

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

2023-04-12 Thread Tom Lane
Robert Haas writes: > On Wed, Apr 12, 2023 at 1:31 PM Greg Stark wrote: >> I don't object to using the pid file as the mechanism -- but it is a >> bit of an awkward UI for shell scripting. I imagine it would be handy >> if pg_ctl had an option to just print the port number so you could get >> it

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

2023-04-12 Thread Robert Haas
On Wed, Apr 12, 2023 at 1:31 PM Greg Stark wrote: > I don't object to using the pid file as the mechanism -- but it is a > bit of an awkward UI for shell scripting. I imagine it would be handy > if pg_ctl had an option to just print the port number so you could get > it with a simple port=`pg_ctl

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

2023-04-12 Thread Greg Stark
On Wed, 12 Apr 2023 at 11:02, Robert Haas wrote: > > I mostly just wanted to say that I disagreed with Tom about the > particular point on postmaster.pid, without really expressing an > opinion about anything else. I don't object to using the pid file as the mechanism -- but it is a bit of an

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

2023-04-12 Thread Jacob Champion
On Fri, Apr 7, 2023 at 5:07 AM Andrew Dunstan wrote: > For TAP tests we have pretty much resolved the port collisions issue for TCP > ports too. See commit 9b4eafcaf4 The Cirrus config still has the following for the Windows tests: # Avoids port conflicts between concurrent tap test runs

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

2023-04-12 Thread Mark Dilger
> On Apr 12, 2023, at 8:01 AM, Robert Haas wrote: > > "hey, I'd like that too" I like the idea in principle. I have been developing a testing infrastructure in my spare time and would rather not duplicate Andrew's TAP logic. If we get this pushed down into the server itself, all the test

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

2023-04-12 Thread Andrew Dunstan
On 2023-04-12 We 11:01, Robert Haas wrote: On Tue, Apr 11, 2023 at 10:17 PM Yurii Rashkovskii wrote: I appreciate your support on the pid file concern. What questions do you have about this feature with regard to its desirability and/or implementation? I'd love to learn from your insight

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

2023-04-12 Thread Robert Haas
On Tue, Apr 11, 2023 at 10:17 PM Yurii Rashkovskii wrote: > I appreciate your support on the pid file concern. What questions do you have > about this feature with regard to its desirability and/or implementation? I'd > love to learn from your insight and address any of those if I can. I don't

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

2023-04-11 Thread Yurii Rashkovskii
Hi Robert, On Tue, Apr 11, 2023 at 12:54 AM Robert Haas wrote: > On Fri, Apr 7, 2023 at 5:34 PM Yurii Rashkovskii wrote: > > I'm trying to understand what's wrong with reading port from the pid > file (if Postgres writes information there, it's surely so that somebody > can read it, otherwise,

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

2023-04-10 Thread Robert Haas
On Fri, Apr 7, 2023 at 5:34 PM Yurii Rashkovskii wrote: > I'm trying to understand what's wrong with reading port from the pid file (if > Postgres writes information there, it's surely so that somebody can read it, > otherwise, why write it in the first placd)? The proposed solution uses >

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

2023-04-07 Thread Yurii Rashkovskii
Hi Andrew, On Fri, Apr 7, 2023, 7:07 p.m. Andrew Dunstan wrote: > > On 2023-03-29 We 07:55, Tom Lane wrote: > > Yurii Rashkovskii writes: > > 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. > > I

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

2023-04-07 Thread Andrew Dunstan
On 2023-03-29 We 07:55, Tom Lane wrote: Yurii Rashkovskii writes: 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. I think this is a bad idea, mainly because this: Instead, with this patch, one can

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

2023-04-06 Thread Yurii Rashkovskii
Hi Tom, On Wed, Mar 29, 2023 at 6:55 PM Tom Lane wrote: > Yurii Rashkovskii writes: > > 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. > > I think this is a bad idea, mainly because this: > > >

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

2023-03-29 Thread Yurii Rashkovskii
Hi Tom, Thank you for your feedback. Below are my comments. On Wed, Mar 29, 2023 at 6:55 PM Tom Lane wrote: > Yurii Rashkovskii writes: > > 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. > > I

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

2023-03-29 Thread Tom Lane
Yurii Rashkovskii writes: > 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. I think this is a bad idea, mainly because this: > Instead, with this patch, one can specify `port` as `0` (the "wildcard"

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

2023-03-28 Thread Yurii Rashkovskii
Hi, 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. The main motivation is running colocated instances of Postgres (such as test benches) without having to coordinate port allocation in an unnecessarily