Commit a43ea120 authored by Tom Lane's avatar Tom Lane

Code & docs review for server instrumentation patch. File timestamps

should surely be timestamptz not timestamp; fix some but not all of the
holes in check_and_make_absolute(); other minor cleanup.  Also put in
the missed catversion bump.
parent cb29f669
This diff is collapsed.
......@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.463 2005/08/12 03:23:51 momjian Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.464 2005/08/12 18:23:53 tgl Exp $
*
* NOTES
*
......@@ -3382,20 +3382,22 @@ sigusr1_handler(SIGNAL_ARGS)
}
}
if (PgArchPID != 0 && Shutdown == NoShutdown)
if (CheckPostmasterSignal(PMSIGNAL_WAKEN_ARCHIVER) &&
PgArchPID != 0 && Shutdown == NoShutdown)
{
if (CheckPostmasterSignal(PMSIGNAL_WAKEN_ARCHIVER))
{
/*
* Send SIGUSR1 to archiver process, to wake it up and begin
* archiving next transaction log file.
*/
kill(PgArchPID, SIGUSR1);
}
/*
* Send SIGUSR1 to archiver process, to wake it up and begin
* archiving next transaction log file.
*/
kill(PgArchPID, SIGUSR1);
}
if (CheckPostmasterSignal(PMSIGNAL_ROTATE_LOGFILE) && SysLoggerPID != 0)
if (CheckPostmasterSignal(PMSIGNAL_ROTATE_LOGFILE) &&
SysLoggerPID != 0)
{
/* Tell syslogger to rotate logfile */
kill(SysLoggerPID, SIGUSR1);
}
PG_SETMASK(&UnBlockSig);
......
This diff is collapsed.
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.46 2005/08/12 03:24:08 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.47 2005/08/12 18:23:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -18,26 +18,19 @@
#include <signal.h>
#include <dirent.h>
#include "catalog/pg_tablespace.h"
#include "catalog/pg_type.h"
#include "commands/dbcommands.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "storage/procarray.h"
#include "storage/pmsignal.h"
#include "postmaster/syslogger.h"
#include "storage/fd.h"
#include "storage/pmsignal.h"
#include "storage/procarray.h"
#include "utils/builtins.h"
#include "utils/elog.h"
#include "funcapi.h"
#include "catalog/pg_type.h"
#include "catalog/pg_tablespace.h"
#include "postmaster/syslogger.h"
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
typedef struct
{
char *location;
DIR *dirdesc;
} directory_fctx;
/*
* Check if data is Null
......@@ -150,15 +143,15 @@ pg_rotate_logfile(PG_FUNCTION_ARGS)
if (!Redirect_stderr)
{
ereport(NOTICE,
(errcode(ERRCODE_WARNING),
errmsg("no logfile configured; rotation not supported")));
ereport(WARNING,
(errmsg("rotation not possible because log redirection not active")));
PG_RETURN_INT32(0);
}
SendPostmasterSignal(PMSIGNAL_ROTATE_LOGFILE);
PG_RETURN_INT32(0);
PG_RETURN_INT32(1);
}
#ifdef NOT_USED
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.147 2005/07/30 18:20:44 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.148 2005/08/12 18:23:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -939,7 +939,7 @@ GetCurrentTimestamp(void)
gettimeofday(&tp, NULL);
result = tp.tv_sec -
result = (TimestampTz) tp.tv_sec -
((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY);
#ifdef HAVE_INT64_TIMESTAMP
......@@ -951,6 +951,29 @@ GetCurrentTimestamp(void)
return result;
}
/*
* Convert a time_t to TimestampTz.
*
* We do not use time_t internally in Postgres, but this is provided for use
* by functions that need to interpret, say, a stat(2) result.
*/
TimestampTz
time_t_to_timestamptz(time_t tm)
{
TimestampTz result;
result = (TimestampTz) tm -
((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY);
#ifdef HAVE_INT64_TIMESTAMP
result *= USECS_PER_SEC;
#endif
return result;
}
void
dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
{
......
......@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.296 2005/08/11 21:11:47 tgl Exp $
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.297 2005/08/12 18:23:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 200508111
#define CATALOG_VERSION_NO 200508121
#endif
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.381 2005/08/12 03:24:22 momjian Exp $
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.382 2005/08/12 18:23:55 tgl Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
......@@ -3058,12 +3058,12 @@ DESCR("Rotate log file");
DATA(insert OID = 2623 ( pg_stat_file PGNSP PGUID 12 f f t f v 1 2249 "25" _null_ _null_ _null_ pg_stat_file - _null_ ));
DESCR("Return file information");
DATA(insert OID = 2624 ( pg_file_length PGNSP PGUID 14 f f t f v 1 20 "25" _null_ _null_ _null_ "SELECT len FROM pg_stat_file($1) AS s(len int8, c timestamp, a timestamp, m timestamp, i bool)" - _null_ ));
DATA(insert OID = 2624 ( pg_file_length PGNSP PGUID 14 f f t f v 1 20 "25" _null_ _null_ _null_ "SELECT len FROM pg_stat_file($1) AS s(len int8, a timestamptz, m timestamptz, c timestamptz, i bool)" - _null_ ));
DESCR("Return file length");
DATA(insert OID = 2625 ( pg_read_file PGNSP PGUID 12 f f t f v 3 25 "25 20 20" _null_ _null_ _null_ pg_read_file - _null_ ));
DESCR("Read text from a file");
DATA(insert OID = 2626 ( pg_ls_dir PGNSP PGUID 12 f f t t v 1 25 "25" _null_ _null_ _null_ pg_ls_dir - _null_ ));
DESCR("List all file in a directory");
DESCR("List all files in a directory");
/* Aggregates (moved here from pg_aggregate for 7.3) */
......
......@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.53 2005/07/22 05:08:26 momjian Exp $
* $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.54 2005/08/12 18:23:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -292,6 +292,8 @@ extern Datum pgsql_postmaster_start_time(PG_FUNCTION_ARGS);
extern TimestampTz GetCurrentTimestamp(void);
extern TimestampTz time_t_to_timestamptz(time_t tm);
extern int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *dt);
extern int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm,
fsec_t *fsec, char **tzn, pg_tz *attimezone);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment