Re: [HACKERS] Make pg_regress print a connstring with sockdir
On Mon, Aug 28, 2017 at 7:57 AM, Craig Ringer wrote: > I'm frequently debugging postmasters that are around long enough. Deadlocks, > etc. > > It's also way easier to debug shmem related issues with a live postmaster vs > a core. Yeah. I don't *frequently* debug postmasters that hang during the regression tests, but I definitely have done it, and I think something like this would make it easier. Right now if something wedges and you need to connect to the postmaster to see what's going on, you have to grep for the pid, then lsof to get the socket directory. This would simplify things. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Make pg_regress print a connstring with sockdir
On 28 August 2017 at 19:45, Tom Lane wrote: > Craig Ringer writes: > > It's a pain having to find the postmaster command line to get the port > > pg_regress started a server on. We print the port in the pg_regress > output, > > why not the socket directory / host? > > I'm not following the point here. The test postmaster isn't really > going to be around long enough to connect to it manually. If you > want to do that, you should be using "installcheck", and then the > problem doesn't arise. > > The reason for printing the port number, if memory serves, is to > aid in debugging port selection conflicts. That doesn't really > apply for temporary socket directories; we're expecting libc to > avoid any conflicts there. > I'm frequently debugging postmasters that are around long enough. Deadlocks, etc. It's also way easier to debug shmem related issues with a live postmaster vs a core. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Re: [HACKERS] Make pg_regress print a connstring with sockdir
Craig Ringer writes: > It's a pain having to find the postmaster command line to get the port > pg_regress started a server on. We print the port in the pg_regress output, > why not the socket directory / host? I'm not following the point here. The test postmaster isn't really going to be around long enough to connect to it manually. If you want to do that, you should be using "installcheck", and then the problem doesn't arise. The reason for printing the port number, if memory serves, is to aid in debugging port selection conflicts. That doesn't really apply for temporary socket directories; we're expecting libc to avoid any conflicts there. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Make pg_regress print a connstring with sockdir
Craig Ringer wrote: > On 28 August 2017 at 15:19, Michael Paquier > wrote: > > > On Mon, Aug 28, 2017 at 4:07 PM, Craig Ringer > > wrote: > > > == starting postmaster== > > > running with PID 30235; connect with: > > > psql "host='/tmp/pg_regress-j74yFE' port=50848 dbname='regression'" > > > == creating database "regression" == > > > > Sorry if my words were confusing and have cost you three minutes of > > development. I like better the one-line version :) > > Now a socket path could be quite long. I can live with that personally. > > > > I'm not fussed, I just think we should show it one way or the other. > > One nice thing about the two line form is that you can > double-click/middle-click to open a new psql in the pg_regress session > pretty much instantly. So don't add gettext_noop() around it :-) -- Álvaro Herrerahttps://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Make pg_regress print a connstring with sockdir
On 28 August 2017 at 15:19, Michael Paquier wrote: > On Mon, Aug 28, 2017 at 4:07 PM, Craig Ringer > wrote: > > == starting postmaster== > > running with PID 30235; connect with: > > psql "host='/tmp/pg_regress-j74yFE' port=50848 dbname='regression'" > > == creating database "regression" == > > Sorry if my words were confusing and have cost you three minutes of > development. I like better the one-line version :) > Now a socket path could be quite long. I can live with that personally. > I'm not fussed, I just think we should show it one way or the other. One nice thing about the two line form is that you can double-click/middle-click to open a new psql in the pg_regress session pretty much instantly. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Re: [HACKERS] Make pg_regress print a connstring with sockdir
On Mon, Aug 28, 2017 at 4:07 PM, Craig Ringer wrote: > == starting postmaster== > running with PID 30235; connect with: > psql "host='/tmp/pg_regress-j74yFE' port=50848 dbname='regression'" > == creating database "regression" == Sorry if my words were confusing and have cost you three minutes of development. I like better the one-line version :) Now a socket path could be quite long. I can live with that personally. -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Make pg_regress print a connstring with sockdir
== starting postmaster== running with PID 30235; connect with: psql "host='/tmp/pg_regress-j74yFE' port=50848 dbname='regression'" == creating database "regression" == On 28 August 2017 at 14:08, Michael Paquier wrote: > On Mon, Aug 28, 2017 at 2:28 PM, Craig Ringer > wrote: > > It's a pain having to find the postmaster command line to get the port > > pg_regress started a server on. We print the port in the pg_regress > output, > > why not the socket directory / host? > > > > How about > > running on 'port=50848 host=/tmp/pg_regress-UMrcT3' with PID 16409 > > > > per the attached? > > > > If you'd prefer nicer wording at the expense of two lines, maybe > > > > running with PID 16409 > > connection string: 'port=50848 host=/tmp/blah' > > Yeah, I think that this is a good idea. > -- > Michael > -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services From c3613d4526ba04fb18011e2af1923b9a167effec Mon Sep 17 00:00:00 2001 From: Craig Ringer Date: Mon, 28 Aug 2017 13:28:05 +0800 Subject: [PATCH v2] Show sockdir/hostname in pg_regress startup output --- src/test/regress/pg_regress.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index abb742b..4cccefc 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -2438,8 +2438,10 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc #else #define ULONGPID(x) (unsigned long) (x) #endif - printf(_("running on port %d with PID %lu\n"), - port, ULONGPID(postmaster_pid)); + printf(_("running with PID %lu; connect with:\n"), + ULONGPID(postmaster_pid)); + printf(gettext_noop(" psql \"host='%s' port=%d dbname='%s'\"\n"), + hostname ? hostname : sockdir, port, dblist->str); } else { -- 2.9.5 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Make pg_regress print a connstring with sockdir
On Mon, Aug 28, 2017 at 2:28 PM, Craig Ringer wrote: > It's a pain having to find the postmaster command line to get the port > pg_regress started a server on. We print the port in the pg_regress output, > why not the socket directory / host? > > How about > running on 'port=50848 host=/tmp/pg_regress-UMrcT3' with PID 16409 > > per the attached? > > If you'd prefer nicer wording at the expense of two lines, maybe > > running with PID 16409 > connection string: 'port=50848 host=/tmp/blah' Yeah, I think that this is a good idea. -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
[HACKERS] Make pg_regress print a connstring with sockdir
Hi all It's a pain having to find the postmaster command line to get the port pg_regress started a server on. We print the port in the pg_regress output, why not the socket directory / host? How about running on 'port=50848 host=/tmp/pg_regress-UMrcT3' with PID 16409 per the attached? If you'd prefer nicer wording at the expense of two lines, maybe running with PID 16409 connection string: 'port=50848 host=/tmp/blah' -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services From 5b242d9af911a88c084a74bf49904b94117347c1 Mon Sep 17 00:00:00 2001 From: Craig Ringer Date: Mon, 28 Aug 2017 13:28:05 +0800 Subject: [PATCH v1] Show sockdir/hostname in pg_regress startup output --- src/test/regress/pg_regress.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index abb742b..11931db 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -2438,8 +2438,9 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc #else #define ULONGPID(x) (unsigned long) (x) #endif - printf(_("running on port %d with PID %lu\n"), - port, ULONGPID(postmaster_pid)); + printf(_("running on 'port=%d host=%s' with PID %lu\n"), + port, hostname ? hostname : sockdir, + ULONGPID(postmaster_pid)); } else { -- 2.9.5 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers