From: Andres Freund Date: Tue, 13 Jan 2015 20:02:47 +0000 (+0100) Subject: Make logging_collector=on work with non-windows EXEC_BACKEND again. X-Git-Tag: REL9_2_10~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7a70b0d31ff9771ce98f99af63eaa9ab0cc3cba0;p=postgresql Make logging_collector=on work with non-windows EXEC_BACKEND again. Commit b94ce6e80 reordered postmaster's startup sequence so that the tempfile directory is only cleaned up after all the necessary state for pg_ctl is collected. Unfortunately the chosen location is after the syslogger has been started; which normally is fine, except for !WIN32 EXEC_BACKEND builds, which pass information to children via files in the temp directory. Move the call to RemovePgTempFiles() to just before the syslogger has started. That's the first child we fork. Luckily EXEC_BACKEND is pretty much only used by endusers on windows, which has a separate method to pass information to children. That means the real world impact of this bug is very small. Discussion: 20150113182344.GF12272@alap3.anarazel.de Backpatch to 9.1, just as the previous commit was. --- diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 4981152e37..d3f089e65b 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -1064,6 +1064,12 @@ PostmasterMain(int argc, char *argv[]) progname, external_pid_file, strerror(errno)); } + /* + * Remove old temporary files. At this point there can be no other + * Postgres processes running in this directory, so this should be safe. + */ + RemovePgTempFiles(); + /* * If enabled, start up syslogger collection subprocess */ @@ -1103,12 +1109,6 @@ PostmasterMain(int argc, char *argv[]) } load_ident(); - /* - * Remove old temporary files. At this point there can be no other - * Postgres processes running in this directory, so this should be safe. - */ - RemovePgTempFiles(); - #ifdef HAVE_PTHREAD_IS_THREADED_NP /* @@ -4949,7 +4949,7 @@ read_backend_variables(char *id, Port *port) fp = AllocateFile(id, PG_BINARY_R); if (!fp) { - write_stderr("could not read from backend variables file \"%s\": %s\n", + write_stderr("could not open backend variables file \"%s\": %s\n", id, strerror(errno)); exit(1); }