1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Move session_start out of MyProcPort stucture and make it a global called MyStartTime,

so that we will be able to create a cookie for all processes for CSVlogs.
It is set wherever MyProcPid is set. Take the opportunity to remove the now
unnecessary session-only restriction on the %s and %c escapes in log_line_prefix.
This commit is contained in:
Andrew Dunstan
2007-08-02 23:39:45 +00:00
parent b34903453f
commit 63872601e8
12 changed files with 45 additions and 24 deletions

View File

@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.536 2007/08/02 23:15:26 adunstan Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.537 2007/08/02 23:39:44 adunstan Exp $
*
* NOTES
*
@ -386,6 +386,8 @@ PostmasterMain(int argc, char *argv[])
MyProcPid = PostmasterPid = getpid();
MyStartTime = time(NULL);
IsPostmasterEnvironment = true;
/*
@ -1103,6 +1105,8 @@ pmdaemonize(void)
MyProcPid = PostmasterPid = getpid(); /* reset PID vars to child */
MyStartTime = time(NULL);
/* GH: If there's no setsid(), we hopefully don't need silent mode.
* Until there's a better solution.
*/
@ -2661,6 +2665,8 @@ BackendStartup(Port *port)
MyProcPid = getpid(); /* reset MyProcPid */
MyStartTime = time(NULL);
/* We don't want the postmaster's proc_exit() handlers */
on_exit_reset();
@ -2803,7 +2809,7 @@ BackendInitialize(Port *port)
/* save process start time */
port->SessionStartTime = GetCurrentTimestamp();
port->session_start = timestamptz_to_time_t(port->SessionStartTime);
MyStartTime = timestamptz_to_time_t(port->SessionStartTime);
/* set these to empty in case they are needed before we set them up */
port->remote_host = "";
@ -3385,6 +3391,8 @@ SubPostmasterMain(int argc, char *argv[])
MyProcPid = getpid(); /* reset MyProcPid */
MyStartTime = time(NULL);
/* make sure stderr is in binary mode before anything can
* possibly be written to it, in case it's actually the syslogger pipe,
* so the pipe chunking protocol isn't disturbed. Non-logpipe data