Skip to content

Commit 7a70b0d

Browse files
committed
Make logging_collector=on work with non-windows EXEC_BACKEND again.
Commit b94ce6e 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.
1 parent 4bb45b9 commit 7a70b0d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,12 @@ PostmasterMain(int argc, char *argv[])
10641064
progname, external_pid_file, strerror(errno));
10651065
}
10661066

1067+
/*
1068+
* Remove old temporary files. At this point there can be no other
1069+
* Postgres processes running in this directory, so this should be safe.
1070+
*/
1071+
RemovePgTempFiles();
1072+
10671073
/*
10681074
* If enabled, start up syslogger collection subprocess
10691075
*/
@@ -1103,12 +1109,6 @@ PostmasterMain(int argc, char *argv[])
11031109
}
11041110
load_ident();
11051111

1106-
/*
1107-
* Remove old temporary files. At this point there can be no other
1108-
* Postgres processes running in this directory, so this should be safe.
1109-
*/
1110-
RemovePgTempFiles();
1111-
11121112
#ifdef HAVE_PTHREAD_IS_THREADED_NP
11131113

11141114
/*
@@ -4949,7 +4949,7 @@ read_backend_variables(char *id, Port *port)
49494949
fp = AllocateFile(id, PG_BINARY_R);
49504950
if (!fp)
49514951
{
4952-
write_stderr("could not read from backend variables file \"%s\": %s\n",
4952+
write_stderr("could not open backend variables file \"%s\": %s\n",
49534953
id, strerror(errno));
49544954
exit(1);
49554955
}

0 commit comments

Comments
 (0)