Skip to content

Commit a43ea12

Browse files
committed
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.
1 parent cb29f66 commit a43ea12

File tree

8 files changed

+210
-165
lines changed

8 files changed

+210
-165
lines changed

doc/src/sgml/func.sgml

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.278 2005/08/12 15:57:48 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.279 2005/08/12 18:23:53 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -9072,13 +9072,13 @@ SELECT set_config('log_statement_stats', 'off', false);
90729072

90739073
<para>
90749074
The functions shown in <xref
9075-
linkend="functions-admin-signal-table"> sends control signals to
9076-
other server processes. Use of this function is restricted
9075+
linkend="functions-admin-signal-table"> send control signals to
9076+
other server processes. Use of these functions is restricted
90779077
to superusers.
90789078
</para>
90799079

90809080
<table id="functions-admin-signal-table">
9081-
<title>Backend Signalling Functions</title>
9081+
<title>Server Signalling Functions</title>
90829082
<tgroup cols="3">
90839083
<thead>
90849084
<row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry>
@@ -9088,7 +9088,7 @@ SELECT set_config('log_statement_stats', 'off', false);
90889088
<tbody>
90899089
<row>
90909090
<entry>
9091-
<literal><function>pg_cancel_backend</function>(<parameter>pid</parameter>)</literal>
9091+
<literal><function>pg_cancel_backend</function>(<parameter>pid</parameter> <type>int</>)</literal>
90929092
</entry>
90939093
<entry><type>int</type></entry>
90949094
<entry>Cancel a backend's current query</entry>
@@ -9098,7 +9098,7 @@ SELECT set_config('log_statement_stats', 'off', false);
90989098
<literal><function>pg_reload_conf</function>()</literal>
90999099
</entry>
91009100
<entry><type>int</type></entry>
9101-
<entry>Causes server processes to reload their configuration files</entry>
9101+
<entry>Cause server processes to reload their configuration files</entry>
91029102
</row>
91039103
</tbody>
91049104
</tgroup>
@@ -9113,8 +9113,8 @@ SELECT set_config('log_statement_stats', 'off', false);
91139113
</para>
91149114
<para>
91159115
<function>pg_reload_conf</> sends a SIGHUP signal to the
9116-
postmaster, causing the reload of the configuration files
9117-
in all backend processes.
9116+
postmaster, causing reload of the configuration files
9117+
in all server processes.
91189118
</para>
91199119

91209120
<indexterm zone="functions-admin">
@@ -9144,7 +9144,7 @@ SELECT set_config('log_statement_stats', 'off', false);
91449144
<tbody>
91459145
<row>
91469146
<entry>
9147-
<literal><function>pg_start_backup</function>(<parameter>label_text</parameter>)</literal>
9147+
<literal><function>pg_start_backup</function>(<parameter>label</> <type>text</>)</literal>
91489148
</entry>
91499149
<entry><type>text</type></entry>
91509150
<entry>Set up for performing on-line backup</entry>
@@ -9219,64 +9219,64 @@ SELECT set_config('log_statement_stats', 'off', false);
92199219

92209220
<tbody>
92219221
<row>
9222-
<entry><function>pg_column_size</function>(<parameter>any</parameter>)</entry>
9222+
<entry><function>pg_column_size</function>(<type>any</type>)</entry>
92239223
<entry><type>integer</type></entry>
92249224
<entry>Number of bytes used to store a particular value (possibly compressed)</entry>
92259225
</row>
92269226
<row>
92279227
<entry>
9228-
<literal><function>pg_tablespace_size</function>(<parameter>oid</parameter>)</literal>
9228+
<literal><function>pg_tablespace_size</function>(<type>oid</type>)</literal>
92299229
</entry>
92309230
<entry><type>bigint</type></entry>
92319231
<entry>Total disk space used by the tablespace with the specified OID</entry>
92329232
</row>
92339233
<row>
92349234
<entry>
9235-
<literal><function>pg_tablespace_size</function>(<parameter>name</parameter>)</literal>
9235+
<literal><function>pg_tablespace_size</function>(<type>name</type>)</literal>
92369236
</entry>
92379237
<entry><type>bigint</type></entry>
92389238
<entry>Total disk space used by the tablespace with the specified name</entry>
92399239
</row>
92409240
<row>
92419241
<entry>
9242-
<literal><function>pg_database_size</function>(<parameter>oid</parameter>)</literal>
9242+
<literal><function>pg_database_size</function>(<type>oid</type>)</literal>
92439243
</entry>
92449244
<entry><type>bigint</type></entry>
92459245
<entry>Total disk space used by the database with the specified OID</entry>
92469246
</row>
92479247
<row>
92489248
<entry>
9249-
<literal><function>pg_database_size</function>(<parameter>name</parameter>)</literal>
9249+
<literal><function>pg_database_size</function>(<type>name</type>)</literal>
92509250
</entry>
92519251
<entry><type>bigint</type></entry>
92529252
<entry>Total disk space used by the database with the specified name</entry>
92539253
</row>
92549254
<row>
92559255
<entry>
9256-
<literal><function>pg_relation_size</function>(<parameter>oid</parameter>)</literal>
9256+
<literal><function>pg_relation_size</function>(<type>oid</type>)</literal>
92579257
</entry>
92589258
<entry><type>bigint</type></entry>
92599259
<entry>Disk space used by the table or index with the specified OID</entry>
92609260
</row>
92619261
<row>
92629262
<entry>
9263-
<literal><function>pg_relation_size</function>(<parameter>text</parameter>)</literal>
9263+
<literal><function>pg_relation_size</function>(<type>text</type>)</literal>
92649264
</entry>
92659265
<entry><type>bigint</type></entry>
92669266
<entry>Disk space used by the table or index with the specified name.
92679267
The name may be qualified with a schema name</entry>
92689268
</row>
92699269
<row>
92709270
<entry>
9271-
<literal><function>pg_complete_relation_size</function>(<parameter>oid</parameter>)</literal>
9271+
<literal><function>pg_complete_relation_size</function>(<type>oid</type>)</literal>
92729272
</entry>
92739273
<entry><type>bigint</type></entry>
92749274
<entry>Total disk space used by the table with the specified OID,
92759275
including indexes and toasted data</entry>
92769276
</row>
92779277
<row>
92789278
<entry>
9279-
<literal><function>pg_complete_relation_size</function>(<parameter>text</parameter>)</literal>
9279+
<literal><function>pg_complete_relation_size</function>(<type>text</type>)</literal>
92809280
</entry>
92819281
<entry><type>bigint</type></entry>
92829282
<entry>Total disk space used by the table with the specified name,
@@ -9285,7 +9285,7 @@ SELECT set_config('log_statement_stats', 'off', false);
92859285
</row>
92869286
<row>
92879287
<entry>
9288-
<literal><function>pg_size_pretty</function>(<parameter>bigint</parameter>)</literal>
9288+
<literal><function>pg_size_pretty</function>(<type>bigint</type>)</literal>
92899289
</entry>
92909290
<entry><type>text</type></entry>
92919291
<entry>Converts a size in bytes into a human-readable format with size units</entry>
@@ -9325,11 +9325,11 @@ SELECT set_config('log_statement_stats', 'off', false);
93259325
<para>
93269326
The functions shown in <xref
93279327
linkend="functions-admin-genfile"> provide native file access to
9328-
files on the machine hosting the server. Only files relative to
9329-
the cluster directory are allowed, and the <varname>log_directory</>,
9330-
because the log file directory might be stored outside the
9331-
cluster directory. Use of these functions is restricted to
9332-
superusers.
9328+
files on the machine hosting the server. Only files within the
9329+
database cluster directory and the <varname>log_directory</> may be
9330+
accessed. Use a relative path for files within the cluster directory,
9331+
and a path matching the <varname>log_directory</> configuration setting
9332+
for log files. Use of these functions is restricted to superusers.
93339333
</para>
93349334

93359335
<table id="functions-admin-genfile">
@@ -9343,17 +9343,17 @@ SELECT set_config('log_statement_stats', 'off', false);
93439343
<tbody>
93449344
<row>
93459345
<entry>
9346-
<literal><function>pg_file_length</function>(<parameter>filename_text</parameter>)</literal>
9346+
<literal><function>pg_file_length</function>(<parameter>filename</> <type>text</>)</literal>
93479347
<indexterm zone="functions-admin">
93489348
<primary>pg_file_length</primary>
93499349
</indexterm>
93509350
</entry>
93519351
<entry><type>int8</type></entry>
9352-
<entry>Returns the file length</entry>
9352+
<entry>Return the file length</entry>
93539353
</row>
93549354
<row>
93559355
<entry>
9356-
<literal><function>pg_ls_dir</function>(<parameter>dirname_text</parameter>,<parameter>fullpath_bool</parameter>)</literal>
9356+
<literal><function>pg_ls_dir</function>(<parameter>dirname</> <type>text</>)</literal>
93579357
<indexterm zone="functions-admin">
93589358
<primary>pg_ls_dir</primary>
93599359
</indexterm>
@@ -9363,18 +9363,17 @@ SELECT set_config('log_statement_stats', 'off', false);
93639363
</row>
93649364
<row>
93659365
<entry>
9366-
<literal><function>pg_read_file</function>(<parameter>filename_text</parameter>,
9367-
<parameter>offset_int8</parameter>,<parameter>length_int8</parameter>)</literal>
9366+
<literal><function>pg_read_file</function>(<parameter>filename</> <type>text</>, <parameter>offset</> <type>int8</>, <parameter>length</> <type>int8</>)</literal>
93689367
</entry>
93699368
<entry><type>text</type></entry>
9370-
<entry>Returns the contents of a text file</entry>
9369+
<entry>Return the contents of a text file</entry>
93719370
</row>
93729371
<row>
93739372
<entry>
9374-
<literal><function>pg_stat_file</function>(<parameter>filename_text</parameter>)</literal>
9373+
<literal><function>pg_stat_file</function>(<parameter>filename</> <type>text</>)</literal>
93759374
</entry>
93769375
<entry><type>record</type></entry>
9377-
<entry>Returns information about the file</entry>
9376+
<entry>Return information about the file</entry>
93789377
</row>
93799378
</tbody>
93809379
</tgroup>
@@ -9385,8 +9384,9 @@ SELECT set_config('log_statement_stats', 'off', false);
93859384
</indexterm>
93869385
<para>
93879386
<function>pg_read_file()</> returns part of a textfile, starting
9388-
at the given offset, returning length bytes. If offset is negative,
9389-
it is treated relative to the end of the file.
9387+
at the given offset, returning at most length bytes (less if the
9388+
end of file is reached first). If offset is negative,
9389+
it is relative to the end of the file.
93909390
</para>
93919391

93929392
<indexterm zone="functions-admin">
@@ -9396,18 +9396,25 @@ SELECT set_config('log_statement_stats', 'off', false);
93969396
<function>pg_stat_file()</> returns a record containing the
93979397
length, last accessed timestamp, last modified timestamp,
93989398
creation timestamp, and a flag indicating if it is a directory.
9399+
Use it like this:
9400+
<programlisting>
9401+
SELECT *
9402+
FROM pg_stat_file('filename')
9403+
AS s(length int8, atime timestamptz, mtime timestamptz,
9404+
ctime timestamptz, isdir bool);
9405+
</programlisting>
93999406
</para>
94009407

94019408
<para>
94029409
The function shown in <xref
94039410
linkend="functions-admin-logfile"> forces the server
9404-
logfile to be rotated if <varname>redirect_stderr</>
9405-
is used for logging. Use of this functions is restricted
9411+
logfile to be rotated. This works only when <varname>redirect_stderr</>
9412+
is used for logging. Use of this function is restricted
94069413
to superusers.
94079414
</para>
94089415

94099416
<table id="functions-admin-logfile">
9410-
<title>Backend Logfile Functions</title>
9417+
<title>Server Logfile Functions</title>
94119418
<tgroup cols="3">
94129419
<thead>
94139420
<row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry>
@@ -9423,7 +9430,7 @@ SELECT set_config('log_statement_stats', 'off', false);
94239430
</indexterm>
94249431
</entry>
94259432
<entry><type>int</type></entry>
9426-
<entry>Rotate logfile</entry>
9433+
<entry>Rotate server's logfile</entry>
94279434
</row>
94289435
</tbody>
94299436
</tgroup>

src/backend/postmaster/postmaster.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.463 2005/08/12 03:23:51 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.464 2005/08/12 18:23:53 tgl Exp $
4141
*
4242
* NOTES
4343
*
@@ -3382,20 +3382,22 @@ sigusr1_handler(SIGNAL_ARGS)
33823382
}
33833383
}
33843384

3385-
if (PgArchPID != 0 && Shutdown == NoShutdown)
3385+
if (CheckPostmasterSignal(PMSIGNAL_WAKEN_ARCHIVER) &&
3386+
PgArchPID != 0 && Shutdown == NoShutdown)
33863387
{
3387-
if (CheckPostmasterSignal(PMSIGNAL_WAKEN_ARCHIVER))
3388-
{
3389-
/*
3390-
* Send SIGUSR1 to archiver process, to wake it up and begin
3391-
* archiving next transaction log file.
3392-
*/
3393-
kill(PgArchPID, SIGUSR1);
3394-
}
3388+
/*
3389+
* Send SIGUSR1 to archiver process, to wake it up and begin
3390+
* archiving next transaction log file.
3391+
*/
3392+
kill(PgArchPID, SIGUSR1);
33953393
}
33963394

3397-
if (CheckPostmasterSignal(PMSIGNAL_ROTATE_LOGFILE) && SysLoggerPID != 0)
3395+
if (CheckPostmasterSignal(PMSIGNAL_ROTATE_LOGFILE) &&
3396+
SysLoggerPID != 0)
3397+
{
3398+
/* Tell syslogger to rotate logfile */
33983399
kill(SysLoggerPID, SIGUSR1);
3400+
}
33993401

34003402
PG_SETMASK(&UnBlockSig);
34013403

0 commit comments

Comments
 (0)