[COMMITTERS] pgsql: Reduce pg_ctl's reaction time when waiting for postmasterstart/ - Mailing list pgsql-committers

From Tom Lane
Subject [COMMITTERS] pgsql: Reduce pg_ctl's reaction time when waiting for postmasterstart/
Date
Msg-id E1dPZRx-00069d-3f@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Reduce pg_ctl's reaction time when waiting for postmaster start/stop.

pg_ctl has traditionally waited one second between probes for whether
the start or stop request has completed.  That behavior was embodied
in the original shell script written in 1999 (commit 5b912b089) and
I doubt anyone's questioned it since.  Nowadays, machines are a lot
faster, and the shell script is long since replaced by C code, so it's
fair to reconsider how long we ought to wait.

This patch adjusts the coding so that the wait time can be any even
divisor of 1 second, and sets the actual probe rate to 10 per second.
That's based on experimentation with the src/test/recovery TAP tests,
which include a lot of postmaster starts and stops.  This patch alone
reduces the (non-parallelized) runtime of those tests from ~4m30s to
~3m5s on my machine.  Increasing the probe rate further doesn't help
much, so this seems like a good number.

In the real world this probably won't have much impact, since people
don't start/stop production postmasters often, and the shutdown checkpoint
usually takes nontrivial time too.  But it makes development work and
testing noticeably snappier, and that's good enough reason for me.

Also, by reducing the dead time in postmaster restart sequences, this
change has made it easier to reproduce some bugs that have been lurking
for awhile.  Patches for those will follow.

Discussion: https://postgr.es/m/18444.1498428798@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c61559ec3a41ad72a13c18d95b1eee8251de94c6

Modified Files
--------------
src/bin/pg_ctl/pg_ctl.c | 63 +++++++++++++++++++++++++++++--------------------
1 file changed, 37 insertions(+), 26 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: [COMMITTERS] pgsql: Improve wait logic in TAP tests for streaming replication.
Next
From: Tom Lane
Date:
Subject: [COMMITTERS] pgsql: Ignore old stats file timestamps when starting the statscollect