Commit Graph

289 Commits

Author SHA1 Message Date
Peter Eisentraut 51f195580f Save source of GUC settings, allowing different sources to be processed in
any order without affecting results.
2002-02-23 01:31:37 +00:00
Tom Lane 2220a2b5d7 Add casts to suppress gcc warnings on Solaris (where apparently pid_t
is different from int).
2002-02-19 20:45:04 +00:00
Tom Lane 6e546c286c Arrange to call localtime() during postmaster startup. On most Unixen,
the first call of localtime() in a process will read /usr/lib/tztab or
local equivalent.  Better to do this once in the postmaster and inherit
the data by fork() than to have to do it during every backend start.
2002-02-19 19:53:35 +00:00
Tom Lane 0cc9917bb6 pgstat's truncation of query string needs to be multibyte-aware.
Patch from sugita@sra.co.jp.
2002-02-07 22:20:26 +00:00
Tom Lane 92a2598f97 The result of getopt() should be compared to -1, not EOF, per
pgsql-hackers discussion of this date.
2002-01-10 01:11:45 +00:00
Tom Lane a510bf4326 If we fail to fork a new backend process, (try to) report the failure
to the client before closing the connection.  Before 7.2 this was done
correctly, but new code would simply close the connection with no report
to the client.
2002-01-06 21:40:02 +00:00
Tom Lane 0e9e888ebd Suppress data directory access-permissions check when __CYGWIN__,
per recent pghackers discussions.  Improving this should be a TODO
for 7.3.
2001-12-04 16:17:48 +00:00
Tom Lane c3cf68de6b Fix latent bug in checking for failure of hashtable creation. 2001-12-03 19:02:58 +00:00
Tom Lane 8e75b36aeb Fix unportable, non-spec-compliant use of offsetof() with a nonconstant
member offset.
2001-11-26 22:31:08 +00:00
Tom Lane 9371325042 Remove a bunch more no-longer-used stuff in libpq-be.h. 2001-11-12 05:43:25 +00:00
Tom Lane 15c21bf8e1 Defend against possibility that SSL error reporting mechanism returns
a NULL pointer.  Per report from Stephen Pillinger 8-Nov-01.
2001-11-11 02:09:05 +00:00
Tom Lane 0c1669c806 Restructure child-exit logging messages for easier translation,
per suggestion from Peter.
2001-11-10 23:06:12 +00:00
Tom Lane d22e9456a7 Clean up formatting of child process exit-status reports so that they
are correct, consistent, and complete ... motivated by gripe from
Oliver Elphick, but I see someone had already made an incomplete stab
at this.
2001-11-06 18:02:48 +00:00
Bruce Momjian ea08e6cd55 New pgindent run with fixes suggested by Tom. Patch manually reviewed,
initdb/regression tests pass.
2001-11-05 17:46:40 +00:00
Tom Lane 430cd88a18 Fix now-obsolete comment. 2001-11-04 20:12:57 +00:00
Tom Lane fb5f1b2c13 Merge three existing ways of signaling postmaster from child processes,
so that only one signal number is used not three.  Flags in shared
memory tell the reason(s) for the current signal.  This method is
extensible to handle more signal reasons without chewing up even more
signal numbers, but the immediate reason is to keep pg_pwd reloads
separate from SIGHUP processing in the postmaster.
Also clean up some problems in the postmaster with delayed response to
checkpoint status changes --- basically, it wouldn't schedule a checkpoint
if it wasn't getting connection requests on a regular basis.
2001-11-04 19:55:31 +00:00
Tom Lane 8a069abd18 Fix pg_pwd caching mechanism, which was broken by changes to fork
postmaster children before client auth step.  Postmaster now rereads
pg_pwd on receipt of SIGHUP, the same way that pg_hba.conf is handled.
No cycles need be expended to validate password cache validity during
connection startup.
2001-11-02 18:39:57 +00:00
Bruce Momjian 6783b2372e Another pgindent run. Fixes enum indenting, and improves #endif
spacing.  Also adds space for one-line comments.
2001-10-28 06:26:15 +00:00
Bruce Momjian b81844b173 pgindent run on all C files. Java run to follow. initdb/regression
tests pass.
2001-10-25 05:50:21 +00:00
Tom Lane 94daee3cb7 Further cleanup of ps_status setup code. On platforms where the
environment strings need to be moved around, do so when called from
initial startup (main.c), not in init_ps_status.  This eliminates the
former risk of invalidating saved environment-string pointers, since
no code has yet had a chance to grab any such pointers when main.c
is running.
2001-10-22 19:41:38 +00:00
Tom Lane b2e92a712e Fix getopt-vs-init_ps_display problem by copying original argv[] info,
per suggestion from Peter.  Simplify several APIs by transmitting the
original argv location directly from main.c to ps_status.c, instead of
passing it down through several levels of subroutines.
2001-10-21 03:25:36 +00:00
Tom Lane 379268aa62 Proper fix for glibc getopt() botch. Surprising we did not see this
before.
2001-10-19 20:47:09 +00:00
Tom Lane 861a679fc1 Set optreset on platforms that have it before launching postmaster
subprocesses; perhaps this will fix portability problem just noted by
Lockhart.  Also, move test for bad permissions of DataDir to a more
logical place.
2001-10-19 18:19:41 +00:00
Tom Lane 6430e6e283 Ensure that all startup paths (postmaster, standalone postgres, or
bootstrap) check for a valid PG_VERSION file before looking at anything
else in the data directory.  This fixes confusing error report when
trying to start current sources in a pre-7.1 data directory.
Per trouble report from Rich Shepard 10/18/01.
2001-10-19 17:03:08 +00:00
Tom Lane eb133197b6 Move init_ps_display from postgres.c to postmaster.c, putting it
just after receipt of the startup packet.  Now, postmaster children
that are waiting for client authentication response will show as
'postgres: user database host authentication'.  Also, do an
init_ps_display for startup/shutdown/checkpoint subprocesses,
so that they are readily identifiable as well.  Fix an obscure race
condition that could lead to Assert failure in the postmaster ---
attempting to start a checkpoint process before any connections have
been received led to calling PostmasterRandom before setting random_seed.
2001-10-19 00:44:08 +00:00
Tom Lane b207081056 Make sure to clean out old activity string when recycling a backend entry. 2001-10-16 22:35:27 +00:00
Tom Lane 8a52b893b3 Further cleanup of dynahash.c API, in pursuit of portability and
readability.  Bizarre '(long *) TRUE' return convention is gone,
in favor of just raising an error internally in dynahash.c when
we detect hashtable corruption.  HashTableWalk is gone, in favor
of using hash_seq_search directly, since it had no hope of working
with non-LONGALIGNable datatypes.  Simplify some other code that was
made undesirably grotty by promixity to HashTableWalk.
2001-10-05 17:28:13 +00:00
Tom Lane fcd2e372a7 Consistently use gcc's __attribute__((format)) to check sprintf-style
format strings wherever possible.  Remarkably, this exercise didn't
turn up any inconsistencies, but it seems a good idea for the future.
2001-10-03 21:58:28 +00:00
Tom Lane 87fd2dbe7c Clean up a little more carefully around fork of pgstat subprocess.
Partial support for BEOS (not sure whether second fork of grandchild
process needs these extra calls or not; someone who has BEOS will need
to test it).
2001-10-01 16:48:37 +00:00
Tom Lane 5999e78fc4 Another round of cleanups for dynahash.c (maybe it's finally clean of
portability issues).  Caller-visible data structures are now allocated
on MAXALIGN boundaries, allowing safe use of datatypes wider than 'long'.
Rejigger hash_create API so that caller specifies size of key and
total size of entry, not size of key and size of rest of entry.
This simplifies life considerably since each number is just a sizeof(),
and padding issues etc. are taken care of automatically.
2001-10-01 05:36:17 +00:00
Tom Lane e43d51fddc ISTM that IsUnderPostmaster should mean we are a child process of the
postmaster ... it should not be set in the postmaster itself.
2001-09-30 20:08:18 +00:00
Tom Lane c1c888a9de Code review for MD5 authorization patch. Clean up some breakage
(salts were always zero!?), add much missing documentation.
2001-09-21 20:31:49 +00:00
Tom Lane 35b7601b04 Add an overall timeout on the client authentication cycle, so that
a hung client or lost connection can't indefinitely block a postmaster
child (not to mention the possibility of deliberate DoS attacks).
Timeout is controlled by new authentication_timeout GUC variable,
which I set to 60 seconds by default ... does that seem reasonable?
2001-09-21 17:06:12 +00:00
Tom Lane 02b1a7fd51 Clean up some confusion about where and how to set whereToSendOutput.
We will no longer try to send elog messages to the client before we have
initialized backend libpq (oops); however, reporting bogus commandline
switches via elog does work now (not irrelevant, because of PGOPTIONS).
Fix problem with inappropriate sending of checkpoint-process messages
to stderr.
2001-09-08 01:10:21 +00:00
Jan Wieck 7e26a8241d Enable SIGTERM and SIGQUIT during client authentication so
the postmaster can kill the forked off processes when shutdown
is requested.

Jan
2001-09-07 16:12:49 +00:00
Tom Lane e67bb7af5a Missed a few places that referred to a compile-time limit on
max_connections.
2001-09-07 00:46:42 +00:00
Tom Lane 863aceb54f Get rid of PID entries in shmem hash table; there is no longer any need
for them, and making them just wastes time during backend startup/shutdown.
Also, remove compile-time MAXBACKENDS limit per long-ago proposal.
You can now set MaxBackends as high as your kernel can stand without
any reconfiguration/recompilation.
2001-09-07 00:27:30 +00:00
Peter Eisentraut 68e5360018 Convert some fprintf's to elog's. 2001-08-30 19:02:42 +00:00
Tom Lane 7326e78c42 Ensure that all TransactionId comparisons are encapsulated in macros
(TransactionIdPrecedes, TransactionIdFollows, etc).  First step on the
way to transaction ID wrap solution ...
2001-08-23 23:06:38 +00:00
Bruce Momjian da45a0bdb7 Add 4-byte MD5 salt. 2001-08-17 02:59:20 +00:00
Tom Lane e8f1097361 Endeavor to make pgstats buffer process (a) safe and (b) useful.
Make sure it exits immediately when collector process dies --- in old code,
buffer process would hang around and compete with the new buffer process
for packets.  Make sure it doesn't block on writing the pipe when the
collector falls more than a pipeload behind.  Avoid leaking pgstats FDs
into every backend.
2001-08-05 02:06:50 +00:00
Tom Lane dad8e410d0 Fix handling of SIGCHLD, per recent pghackers discussion: on some
platforms system(2) gets confused unless the signal handler is set to
SIG_DFL, not SIG_IGN.  pgstats.c now uses pqsignal() as it should,
not signal().  Also, arrange for the stats collector process to show
a reasonable ID in 'ps', rather than looking like a postmaster.
2001-08-04 00:14:43 +00:00
Tom Lane 77896d1fc9 Cleanup code for preparsing pg_hba.conf and pg_ident.conf. Store line
number in the data structure so that we can give at least a minimally
useful idea of where the mistake is when we issue syntax error messages.
Move the ClientAuthentication() call to where it should have been in
the first place, so that postmaster memory releasing can happen in a
reasonable place also.  Update obsolete comments, correct one real bug
(auth_argument was not picked up correctly).
2001-07-31 22:55:45 +00:00
Bruce Momjian 462b7d46d1 Load pg_hba.conf and pg_ident.conf on startup and SIGHUP into List of
Lists, and use that for user validation.

Bruce Momjian
2001-07-30 14:50:24 +00:00
Jan Wieck 6497a7fd71 Added GUC configuration options to control access statistics.
Jan
2001-07-05 15:19:40 +00:00
Tom Lane 31c1fea6a8 Start the stats collector at a less randomly chosen time. Bad idea
to start it before we have acquired the data directory lock; also a
bad idea to start it before we have set up to catch SIGCHLD signals.
2001-07-03 16:52:12 +00:00
Tom Lane 109d50dd35 Under new theory of operation wherein postmaster forks children
immediately, we will fork a child even if the database state does not
permit connections to be accepted (eg, we are in recovery mode).
The child process will correctly reject the connection and exit as
soon as it's finished collecting the connection request message.
However, this means that reaper() must be prepared to see child
process exit signals even while it's waiting for startup or shutdown
process to finish.  As was, a connection request arriving during a
database recovery or shutdown would cause postmaster abort.
2001-07-01 00:06:23 +00:00
Peter Eisentraut 55f8fc3bc6 portability enhancements 2001-06-30 19:01:27 +00:00
Jan Wieck 1d4ee0cc1e Turned high-frequently called pgstat functions into macros
for speed.

Jan
2001-06-29 16:29:37 +00:00
Tom Lane f889b12be9 Fix erroneous GUC variable references from commandline-GUC patch. 2001-06-29 16:05:57 +00:00