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.
<row>
<entry><literal>%c</literal></entry>
<entry>Session ID: see below</entry>
- <entry>yes</entry>
+ <entry>no</entry>
</row>
<row>
<entry><literal>%l</literal></entry>
<row>
<entry><literal>%s</literal></entry>
<entry>Session start time stamp</entry>
- <entry>yes</entry>
+ <entry>no</entry>
</row>
<row>
<entry><literal>%x</literal></entry>
*/
MyProcPid = getpid();
+ MyStartTime = time(NULL);
+
/*
* Fire up essential subsystems: error and memory management
*
/* reset MyProcPid */
MyProcPid = getpid();
+ /* record Start Time for logging */
+ MyStartTime = time(NULL);
+
/* Identify myself via ps */
init_ps_display("autovacuum launcher process", "", "", "");
/* reset MyProcPid */
MyProcPid = getpid();
+ /* record Start Time for logging */
+ MyStartTime = time(NULL);
+
/* Identify myself via ps */
init_ps_display("autovacuum worker process", "", "", "");
MyProcPid = getpid(); /* reset MyProcPid */
+ MyStartTime = time(NULL); /* record Start Time for logging */
+
/*
* If possible, make this process a group leader, so that the postmaster
* can signal any child processes too.
MyProcPid = getpid(); /* reset MyProcPid */
+ MyStartTime = time(NULL); /* record Start Time for logging */
+
/*
* If possible, make this process a group leader, so that the postmaster
* can signal any child processes too. (pgstat probably never has
MyProcPid = PostmasterPid = getpid();
+ MyStartTime = time(NULL);
+
IsPostmasterEnvironment = true;
/*
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.
*/
MyProcPid = getpid(); /* reset MyProcPid */
+ MyStartTime = time(NULL);
+
/* We don't want the postmaster's proc_exit() handlers */
on_exit_reset();
/* 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 = "";
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
MyProcPid = getpid(); /* reset MyProcPid */
+ MyStartTime = time(NULL); /* set our start time in case we call elog */
+
#ifdef EXEC_BACKEND
syslogger_parseArgs(argc, argv);
#endif /* EXEC_BACKEND */
*/
MyProcPid = getpid();
+ MyStartTime = time(NULL);
+
/*
* Fire up essential subsystems: error and memory management
*
}
break;
case 'c':
- if (MyProcPort)
- {
- appendStringInfo(buf, "%lx.%x",
- (long) (MyProcPort->session_start),
- MyProcPid);
- }
+ appendStringInfo(buf, "%lx.%x", (long)(MyStartTime),MyProcPid);
break;
case 'p':
appendStringInfo(buf, "%d", MyProcPid);
}
break;
case 's':
- if (MyProcPort)
{
char strfbuf[128];
#else
"%Y-%m-%d %H:%M:%S",
#endif
- localtime(&MyProcPort->session_start));
+ localtime(&MyStartTime));
appendStringInfoString(buf, strfbuf);
}
break;
volatile uint32 CritSectionCount = 0;
int MyProcPid;
+time_t MyStartTime;
struct Port *MyProcPort;
long MyCancelKey;
* other members of this struct, we may as well keep it here.
*/
TimestampTz SessionStartTime; /* backend start time */
- time_t session_start; /* same, in time_t format */
/*
* TCP keepalive settings.
#ifndef MISCADMIN_H
#define MISCADMIN_H
+#include <time.h> /* for time_t */
+
#define PG_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n"
extern int MaxConnections;
extern PGDLLIMPORT int MyProcPid;
+extern PGDLLIMPORT time_t MyStartTime;
extern PGDLLIMPORT struct Port *MyProcPort;
extern long MyCancelKey;