mirror of
https://github.com/postgres/postgres.git
synced 2025-07-20 05:03:10 +03:00
Add assert checking to GUC ("debug_assertions")
Rename settings net_server to tcpip_socket, max_backends to max_connections Add --help and --version to postmaster, reformat help output
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.12 2000/06/22 22:31:15 petere Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.13 2000/07/12 17:38:41 petere Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<Chapter Id="runtime">
|
<Chapter Id="runtime">
|
||||||
@ -671,6 +671,19 @@ env PGOPTIONS='--geqo=off' psql
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term>DEBUG_ASSERTIONS (<type>boolean</type>)</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Turns on various assertion checks. This is a debugging aid. If
|
||||||
|
you are experiencing strange problems or crashes you might
|
||||||
|
want to turn this on, as it might expose programming mistakes.
|
||||||
|
To use this option, the macro <literal>USE_ASSERT_CHECKING</>
|
||||||
|
must be defined when Postgres is built.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>DEBUG_LEVEL (<type>integer</type>)</term>
|
<term>DEBUG_LEVEL (<type>integer</type>)</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
@ -843,13 +856,13 @@ env PGOPTIONS='--geqo=off' psql
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>MAX_BACKENDS (<type>integer</type>)</term>
|
<term>MAX_CONNECTIONS (<type>integer</type>)</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Determines how many concurrent connections the database server
|
Determines how many concurrent connections the database server
|
||||||
will allow. The default is 32. Note that there is also a
|
will allow. The default is 32. There is also a compiled-in
|
||||||
compiled-in hard limit on this option, which is currently
|
hard upper limit on this option, which is currently 1024. This
|
||||||
1024. This parameter can only be set at server start.
|
parameter can only be set at server start.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@ -868,7 +881,7 @@ env PGOPTIONS='--geqo=off' psql
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>NET_SERVER (<type>boolean</type>)</term>
|
<term>TCPIP_SOCKET (<type>boolean</type>)</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
If this is true, then the server will accept TCP/IP
|
If this is true, then the server will accept TCP/IP
|
||||||
@ -922,12 +935,12 @@ env PGOPTIONS='--geqo=off' psql
|
|||||||
This controls the inheritance semantics, in particular whether
|
This controls the inheritance semantics, in particular whether
|
||||||
subtables are included into the consideration of various
|
subtables are included into the consideration of various
|
||||||
commands by default. This was not the case in versions prior
|
commands by default. This was not the case in versions prior
|
||||||
to 7.1. If you need this behaviour you can set this variable
|
to 7.1. If you need the old behaviour you can set this
|
||||||
to off, but in the long run you are encouraged to change your
|
variable to off, but in the long run you are encouraged to
|
||||||
applications to use the <literal>ONLY</literal> keyword to
|
change your applications to use the <literal>ONLY</literal>
|
||||||
exclude subtables. See the SQL language reference and the
|
keyword to exclude subtables. See the SQL language reference
|
||||||
<citetitle>User's Guide</citetitle> for more information about
|
and the <citetitle>User's Guide</citetitle> for more
|
||||||
inheritance.
|
information about inheritance.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@ -971,12 +984,12 @@ env PGOPTIONS='--geqo=off' psql
|
|||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>-i</entry>
|
<entry>-i</entry>
|
||||||
<entry>net_server = on</entry>
|
<entry>tcpip_socket = on</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>-N <replaceable>x</replaceable></entry>
|
<entry>-N <replaceable>x</replaceable></entry>
|
||||||
<entry>max_backends = <replaceable>x</replaceable></entry>
|
<entry>max_connections = <replaceable>x</replaceable></entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.154 2000/07/09 13:14:05 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.155 2000/07/12 17:38:42 petere Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -280,11 +280,6 @@ void GetCharSetByHost(char *, int, char *);
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_ASSERT_CHECKING
|
|
||||||
|
|
||||||
int assert_enabled = 1;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
checkDataDir(const char *DataDir)
|
checkDataDir(const char *DataDir)
|
||||||
@ -387,13 +382,46 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
* will occur.
|
* will occur.
|
||||||
*/
|
*/
|
||||||
opterr = 1;
|
opterr = 1;
|
||||||
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:Ss-:")) != EOF)
|
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:Ss-:?")) != EOF)
|
||||||
{
|
{
|
||||||
if (opt == 'D')
|
switch(opt)
|
||||||
{
|
{
|
||||||
if (DataDir)
|
case 'D':
|
||||||
free(DataDir);
|
if (DataDir)
|
||||||
DataDir = strdup(optarg);
|
free(DataDir);
|
||||||
|
DataDir = strdup(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '-':
|
||||||
|
{
|
||||||
|
char *name, *value;
|
||||||
|
|
||||||
|
ParseLongOption(optarg, &name, &value);
|
||||||
|
if (strcmp(name, "help")==0)
|
||||||
|
{
|
||||||
|
usage(progname);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
else if (strcmp(name, "version")==0)
|
||||||
|
{
|
||||||
|
puts("postmaster (PostgreSQL) " PG_VERSION);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case '?':
|
||||||
|
if (strcmp(argv[optind - 1], "-?") == 0)
|
||||||
|
{
|
||||||
|
usage(progname);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Try -? for help.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,21 +431,15 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
ProcessConfigFile(PGC_POSTMASTER);
|
ProcessConfigFile(PGC_POSTMASTER);
|
||||||
|
|
||||||
IgnoreSystemIndexes(false);
|
IgnoreSystemIndexes(false);
|
||||||
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:Ss-:")) != EOF)
|
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:Ss-:?")) != EOF)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
case 'A':
|
case 'A':
|
||||||
#ifndef USE_ASSERT_CHECKING
|
#ifndef USE_ASSERT_CHECKING
|
||||||
fprintf(stderr, "Assert checking is not enabled\n");
|
fprintf(stderr, "Assert checking is not compiled in\n");
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/*
|
|
||||||
* Pass this option also to each backend.
|
|
||||||
*/
|
|
||||||
assert_enabled = atoi(optarg);
|
assert_enabled = atoi(optarg);
|
||||||
strcat(ExtraOptions, " -A ");
|
|
||||||
strcat(ExtraOptions, optarg);
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
@ -525,13 +547,23 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
free(value);
|
free(value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* usage() never returns */
|
/* shouldn't get here */
|
||||||
usage(progname);
|
fprintf(stderr, "Try -? for help.\n");
|
||||||
break;
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Non-option switch arguments don't exist.
|
||||||
|
*/
|
||||||
|
if (optind < argc)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s: invalid argument -- %s\n", progname, argv[optind]);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for invalid combinations of switches
|
* Check for invalid combinations of switches
|
||||||
*/
|
*/
|
||||||
@ -543,7 +575,7 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
* for lack of buffers. The specific choices here are somewhat
|
* for lack of buffers. The specific choices here are somewhat
|
||||||
* arbitrary.
|
* arbitrary.
|
||||||
*/
|
*/
|
||||||
fprintf(stderr, "%s: -B must be at least twice -N and at least 16.\n",
|
fprintf(stderr, "%s: The number of buffers (-B) must be at least twice the number of allowed connections (-N) and at least 16.\n",
|
||||||
progname);
|
progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -717,30 +749,43 @@ pmdaemonize(int argc, char *argv[])
|
|||||||
on_proc_exit(UnlinkPidFile, NULL);
|
on_proc_exit(UnlinkPidFile, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Print out help message
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
usage(const char *progname)
|
usage(const char *progname)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: %s [options]\n", progname);
|
printf("%s is the PostgreSQL server.\n\n", progname);
|
||||||
|
printf("Usage:\n %s [options]\n\n", progname);
|
||||||
|
printf("Options:\n");
|
||||||
#ifdef USE_ASSERT_CHECKING
|
#ifdef USE_ASSERT_CHECKING
|
||||||
fprintf(stderr, "\t-A [1|0]\tenable/disable runtime assert checking\n");
|
printf(" -A 1|0 enable/disable runtime assert checking\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr, "\t-B nbufs\tset number of shared buffers\n");
|
printf(" -B <buffers> number of shared buffers\n");
|
||||||
fprintf(stderr, "\t-D datadir\tset data directory\n");
|
printf(" -d 1-5 debugging level\n");
|
||||||
fprintf(stderr, "\t-S \t\tsilent mode (disassociate from tty)\n");
|
printf(" -D <directory> database directory\n");
|
||||||
fprintf(stderr, "\t-a system\tuse this authentication system\n");
|
printf(" -F turn fsync off\n");
|
||||||
fprintf(stderr, "\t-b backend\tuse a specific backend server executable\n");
|
printf(" -i listen on TCP/IP sockets\n");
|
||||||
fprintf(stderr, "\t-d [1-5]\tset debugging level\n");
|
|
||||||
fprintf(stderr, "\t-i \t\tlisten on TCP/IP sockets as well as Unix domain socket\n");
|
|
||||||
#ifdef USE_SSL
|
#ifdef USE_SSL
|
||||||
fprintf(stderr, " \t-l \t\tfor TCP/IP sockets, listen only on SSL connections\n");
|
printf(" -l listen only on SSL connections (EXPERIMENTAL)\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr, "\t-N nprocs\tset max number of backends (1..%d, default %d)\n",
|
printf(" -N <number> maximum number of allowed connections (1..%d, default %d)\n",
|
||||||
MAXBACKENDS, DEF_MAXBACKENDS);
|
MAXBACKENDS, DEF_MAXBACKENDS);
|
||||||
fprintf(stderr, "\t-n \t\tdon't reinitialize shared memory after abnormal exit\n");
|
printf(" -o <option> pass `option' to each backend server\n");
|
||||||
fprintf(stderr, "\t-o option\tpass 'option' to each backend servers\n");
|
printf(" -p <port> port number to listen on\n");
|
||||||
fprintf(stderr, "\t-p port\tspecify port for postmaster to listen on\n");
|
printf(" -S silent mode (dissociate from tty)\n");
|
||||||
fprintf(stderr, "\t-s \t\tsend SIGSTOP to all backend servers if one dies\n");
|
|
||||||
exit(1);
|
printf("\nDeveloper options:\n");
|
||||||
|
printf(" -n don't reinitialize shared memory after abnormal exit\n");
|
||||||
|
printf(" -s send SIGSTOP to all backend servers if one dies\n");
|
||||||
|
|
||||||
|
printf("\nPlease read the documentation for the complete list of runtime\n"
|
||||||
|
"configuration settings and how to set them on the command line or in\n"
|
||||||
|
"the configuration file.\n\n");
|
||||||
|
|
||||||
|
printf("Report bugs to <pgsql-bugs@postgresql.org>.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1231,7 +1276,7 @@ reset_shared(int port)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set flag is SIGHUP was detected so config file can be reread in
|
* Set flag if SIGHUP was detected so config file can be reread in
|
||||||
* main loop
|
* main loop
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.168 2000/07/11 14:30:27 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.169 2000/07/12 17:38:45 petere Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* this is the "main" module of the postgres backend and
|
||||||
@ -907,14 +907,10 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
|||||||
switch (flag)
|
switch (flag)
|
||||||
{
|
{
|
||||||
case 'A':
|
case 'A':
|
||||||
/* ----------------
|
|
||||||
* enable/disable assert checking.
|
|
||||||
* ----------------
|
|
||||||
*/
|
|
||||||
#ifdef USE_ASSERT_CHECKING
|
#ifdef USE_ASSERT_CHECKING
|
||||||
assert_enabled = atoi(optarg);
|
assert_enabled = atoi(optarg);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "Assert checking is not enabled\n");
|
fprintf(stderr, "Assert checking is not compiled in\n");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1415,7 +1411,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
|||||||
if (!IsUnderPostmaster)
|
if (!IsUnderPostmaster)
|
||||||
{
|
{
|
||||||
puts("\nPOSTGRES backend interactive interface ");
|
puts("\nPOSTGRES backend interactive interface ");
|
||||||
puts("$Revision: 1.168 $ $Date: 2000/07/11 14:30:27 $\n");
|
puts("$Revision: 1.169 $ $Date: 2000/07/12 17:38:45 $\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Support for grand unified configuration scheme, including SET
|
* Support for grand unified configuration scheme, including SET
|
||||||
* command, configuration file, and command line options.
|
* command, configuration file, and command line options.
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.5 2000/07/03 20:46:05 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.6 2000/07/12 17:38:48 petere Exp $
|
||||||
*
|
*
|
||||||
* Copyright 2000 by PostgreSQL Global Development Group
|
* Copyright 2000 by PostgreSQL Global Development Group
|
||||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||||
@ -37,6 +37,9 @@ extern bool Log_connections;
|
|||||||
/*
|
/*
|
||||||
* Debugging options
|
* Debugging options
|
||||||
*/
|
*/
|
||||||
|
#ifdef USE_ASSERT_CHECKING
|
||||||
|
bool assert_enabled;
|
||||||
|
#endif
|
||||||
bool Debug_print_query = false;
|
bool Debug_print_query = false;
|
||||||
bool Debug_print_plan = false;
|
bool Debug_print_plan = false;
|
||||||
bool Debug_print_parse = false;
|
bool Debug_print_parse = false;
|
||||||
@ -150,13 +153,17 @@ ConfigureNamesBool[] =
|
|||||||
{"ksqo", PGC_USERSET, &_use_keyset_query_optimizer, false},
|
{"ksqo", PGC_USERSET, &_use_keyset_query_optimizer, false},
|
||||||
{"geqo", PGC_USERSET, &enable_geqo, true},
|
{"geqo", PGC_USERSET, &enable_geqo, true},
|
||||||
|
|
||||||
{"net_server", PGC_POSTMASTER, &NetServer, false},
|
{"tcpip_socket", PGC_POSTMASTER, &NetServer, false},
|
||||||
{"fsync", PGC_USERSET, &enableFsync, true},
|
{"fsync", PGC_USERSET, &enableFsync, true},
|
||||||
|
|
||||||
{"log_connections", PGC_SIGHUP, &Log_connections, false},
|
{"log_connections", PGC_SIGHUP, &Log_connections, false},
|
||||||
{"log_timestamp", PGC_SIGHUP, &Log_timestamp, false},
|
{"log_timestamp", PGC_SIGHUP, &Log_timestamp, false},
|
||||||
{"log_pid", PGC_SIGHUP, &Log_pid, false},
|
{"log_pid", PGC_SIGHUP, &Log_pid, false},
|
||||||
|
|
||||||
|
#ifdef USE_ASSERT_CHECKING
|
||||||
|
{"debug_assertions", PGC_USERSET, &assert_enabled, false},
|
||||||
|
#endif
|
||||||
|
|
||||||
{"debug_print_query", PGC_USERSET, &Debug_print_query, false},
|
{"debug_print_query", PGC_USERSET, &Debug_print_query, false},
|
||||||
{"debug_print_parse", PGC_USERSET, &Debug_print_parse, false},
|
{"debug_print_parse", PGC_USERSET, &Debug_print_parse, false},
|
||||||
{"debug_print_rewritten", PGC_USERSET, &Debug_print_rewritten, false},
|
{"debug_print_rewritten", PGC_USERSET, &Debug_print_rewritten, false},
|
||||||
@ -216,7 +223,7 @@ ConfigureNamesInt[] =
|
|||||||
* make sure the buffers are at least twice the number of
|
* make sure the buffers are at least twice the number of
|
||||||
* backends, so the constraints here are partially unused.
|
* backends, so the constraints here are partially unused.
|
||||||
*/
|
*/
|
||||||
{"max_backends", PGC_POSTMASTER, &MaxBackends,
|
{"max_connections", PGC_POSTMASTER, &MaxBackends,
|
||||||
DEF_MAXBACKENDS, 1, MAXBACKENDS},
|
DEF_MAXBACKENDS, 1, MAXBACKENDS},
|
||||||
{"shmem_buffers", PGC_POSTMASTER, &NBuffers,
|
{"shmem_buffers", PGC_POSTMASTER, &NBuffers,
|
||||||
DEF_NBUFFERS, 16, INT_MAX},
|
DEF_NBUFFERS, 16, INT_MAX},
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: c.h,v 1.76 2000/07/07 21:12:47 tgl Exp $
|
* $Id: c.h,v 1.77 2000/07/12 17:38:53 petere Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -706,7 +706,7 @@ typedef struct Exception
|
|||||||
#define AssertState(condition) \
|
#define AssertState(condition) \
|
||||||
Trap(!(condition), BadState)
|
Trap(!(condition), BadState)
|
||||||
|
|
||||||
extern int assert_enabled;
|
extern bool assert_enabled;
|
||||||
|
|
||||||
#endif /* USE_ASSERT_CHECKING */
|
#endif /* USE_ASSERT_CHECKING */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user