Re: Reducing pg_ctl's reaction time
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Jeff Janes <jeff.janes@gmail.com>,
Michael Paquier <michael.paquier@gmail.com>,
PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2017-06-26T20:49:07Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes: > Arguably we could and should improve the logic when the server has > started, right now it's pretty messy because we never treat a standby as > up if hot_standby is disabled... True. If you could tell the difference between "HS disabled" and "HS not enabled yet" from pg_control, that would make pg_ctl's behavior with cold-standby servers much cleaner. Maybe it *is* worth messing with the contents of pg_control at this late hour. My inclination for the least invasive fix is to leave the DBState enum alone and add a separate hot-standby state field with three values (disabled/not-yet-enabled/enabled). Then pg_ctl would start probing the postmaster when it saw either DB_IN_PRODUCTION DBstate or hot-standby-enabled. (It'd almost not have to probe the postmaster at all, except there's a race condition that the startup process will probably change the field a little before the postmaster gets the word to open the gates.) On the other hand, if it saw DB_IN_ARCHIVE_RECOVERY with hot standby disabled, it'd stop waiting. Any objections to that design sketch? Do we need to distinguish between master and slave servers in the when-to-stop-waiting logic? regards, tom lane
Commits
-
Change pg_ctl to detect server-ready by watching status in postmaster.pid.
- f13ea95f9e47 10.0 landed
-
Reduce pg_ctl's reaction time when waiting for postmaster start/stop.
- c61559ec3a41 10.0 landed