Re: [HACKERS] Cutting initdb's runtime (Perl question embedded)
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>, John Naylor <jcnaylor@gmail.com>, Andres Freund <andres@anarazel.de>, Andreas Karlsson <andreas@proxel.se>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2018-05-10T16:18:19Z
Lists: pgsql-hackers
Attachments
- check-etc-localtime-symlink-for-zone-name-1.patch (text/x-diff) patch
I wrote: > ... I'll > take a look at whipping up something that checks /etc/localtime. Here's a draft patch. It seems to do what I expect on a couple of different macOS releases as well as recent Fedora. Googling finds some suggestions that there might be other locations for the symlink, for instance it's alleged that glibc can be configured to look at /usr/local/etc/localtime instead of /etc/localtime. But AFAICS none of the alternative locations are used on enough systems that it'd be worth the cycles to check them. Likewise, there seem to be some systems with conventions about storing the zone name in a text file someplace, but not really enough of them to make it worth our time to support that. The initdb speedup on the other boxes I checked seems to be in the vicinity of 50 ms out of circa-1-sec total, which is less than I'd have expected from my measurements on my RHEL6 box :-(. Still, I think it's worth doing, not least because (if it works) this fixes the problem that you may get an unexpected alias for your system timezone, as in this complaint awhile back: https://www.postgresql.org/message-id/flat/4D7016AA.2090609%40agliodbs.com I also changed initdb so that it reports what zone name it picked. I have a vague recollection that it might've done that long ago, and we suppressed it in a burst of enthusiasm about making initdb less chatty. That seems like something to undo, since we're tweaking what are still basically heuristic rules for choosing the zone. Next question is what to do with this. Do we want to sit on it till v12, or sneak it in now? regards, tom lane
Commits
-
Attempt to identify system timezone by reading /etc/localtime symlink.
- 995b4fe0b14f 11.4 landed
- 8de574aa8bf7 10.9 landed
- 77dc741a1727 9.5.18 landed
- 75b0f21e1b19 9.6.14 landed
- 37011bcb30a9 9.4.23 landed
- 23bd3cec6eb1 12.0 landed
-
Make sure to run one initdb TAP test with no TZ set
- 033b969edde6 10.0 landed
-
Use one transaction while reading postgres.bki, not one per line.
- 85a0781334a2 10.0 landed
-
Move bootstrap-time lookup of regproc OIDs into genbki.pl.
- 5e39f06cfe65 10.0 landed