Commit Graph

378 Commits

Author SHA1 Message Date
Bruce Momjian c83cd6c1da Update description error text:
(errmsg("no socket configured for listening")));
2004-03-24 04:07:31 +00:00
Bruce Momjian 51b488535e Here's a patch implementing the "thread method" to workaround the bug
with socket calls in signal handlers (APC) on Win32. See details in mail
to pgsql-hackers-win32 a couple of minutes ago.

Magnus Hagander
2004-03-24 04:04:51 +00:00
Tom Lane 2e45c143ef Replace the virtual_host and tcpip_socket parameters with a unified
listen_addresses parameter, as per recent discussion.  The default behavior
is now to listen on localhost, which eliminates the need for the -i
postmaster switch in many scenarios.

Andrew Dunstan
2004-03-23 01:23:48 +00:00
Bruce Momjian 3947f653f9 * postmaster.c: cleanup pmdaemonize under win32; missed failure message
in CreateOptsFile
* s_lock.c: minor comment fix
* findbe.c: variables not used under win32 moved within #ifndef WIN32
case

Claudio Natoli
2004-03-15 16:18:43 +00:00
Bruce Momjian d6b57925ca Remove GUC log_statement, log_pid, log_timestamp, log_source_port.
Functionality superceeded by log_line_prefix.

Andrew Dunstan
2004-03-15 15:56:28 +00:00
Bruce Momjian 60a068b389 Move non-blocking code into its own /port file, for code clarity. 2004-03-10 21:12:49 +00:00
Bruce Momjian 8567bb2d06 Corrects a typo, introduces missing variables, and rearranges the
initialization of stats process under EXEC_BACKEND.

[A cleaner, rationalized approach to stat/backend/SSDataBase child
processes under EXEC_BACKEND is on my TODO list. However this patch
takes care of immediate concerns (ie. stats test now passes under
win32)]

Claudio Natoli
2004-03-09 05:11:53 +00:00
Bruce Momjian 2d3fe86bc4 Add:
#log_line_prefix = ''         # e.g. '<%u%%%d> '
                              # %u=user name %d=database name
                              # %r=remote host and port
                              # %p=PID %t=timestamp %i=command tag
                              # %c=session id %l=session line number
                              # %s=session start timestamp
                              # %x=stop here in non-session processes
                              # %%='%'

Andrew Dunstan
2004-03-09 04:43:07 +00:00
Bruce Momjian d91acf8401 Win32:
* Mostly, casting etc to remove compilation warnings in win32 only code.

* main.c: set _IONBF to stdout/stderr under win32 (under win32, _IOLBF
defaults to full buffering)

* pg_resetxlog/Makefile: ensures dirmod.o gets cleaned (got bitten by
this when, after "make clean"ing, switching compilation between Ming +
Cygwin)

Claudio Natoli
2004-03-05 01:11:04 +00:00
Bruce Momjian c672aa823b For application to HEAD, following community review.
* Changes incorrect CYGWIN defines to __CYGWIN__

* Some localtime returns NULL checks (when unchecked cause SEGVs under
Win32
regression tests)

* Rationalized CreateSharedMemoryAndSemaphores and
AttachSharedMemoryAndSemaphores (Bruce, I finally remembered to do it);
requires attention.

Claudio Natoli
2004-02-25 19:41:23 +00:00
Tom Lane f83356c7f5 Do a direct probe during postmaster startup to determine the maximum
number of openable files and the number already opened.  This eliminates
depending on sysconf(_SC_OPEN_MAX), and allows much saner behavior on
platforms where open-file slots are used up by semaphores.
2004-02-23 20:45:59 +00:00
Bruce Momjian c53611e3e7 This patch brings up to date what I did last year (now unfortunately
bitrotted) to allow the logging of the end of a session, enabled by
the config setting "log_disconnections".

Andrew Dunstan
2004-02-17 03:54:57 +00:00
Tom Lane 0cb117eb33 Repair some problems in bgwriter start/stop logic. In particular, don't
allow the bgwriter to start before the startup subprocess has finished
... it tends to crash otherwise.  (The same problem may have existed for
the checkpointer, I'm not entirely sure.)  Remove some code that was
redundant because the bgwriter is handled as a member of the backend list.
2004-02-11 22:25:02 +00:00
Neil Conway f06e79525a Win32 signals cleanup. Patch by Magnus Hagander, with input from Claudio
Natoli and Bruce Momjian (and some cosmetic fixes from Neil Conway).
Changes:

    - remove duplicate signal definitions from pqsignal.h

    - replace pqkill() with kill() and redefine kill() in Win32

    - use ereport() in place of fprintf() in some error handling in
      pqsignal.c

    - export pg_queue_signal() and make use of it where necessary

    - add a console control handler for Ctrl-C and similar handling
      on Win32

    - do WaitForSingleObjectEx() in CHECK_FOR_INTERRUPTS() on Win32;
      query cancelling should now work on Win32

    - various other fixes and cleanups
2004-02-08 22:28:57 +00:00
Tom Lane 2f0d43b251 Review uses of IsUnderPostmaster, change some tests to look at
whereToSendOutput instead because they are really inquiring about
the correct client communication protocol.  Update some comments.
This is pointing towards supporting regular FE/BE client protocol
in a standalone backend, per discussion a month or so back.
2004-01-28 21:02:40 +00:00
Bruce Momjian 50491963cb Here's the latest win32 signals code, this time in the form of a patch
against the latest shapshot. It also includes the replacement of kill()
with pqkill() and sigsetmask() with pqsigsetmask().

Passes all tests fine on my linux machine once applied. Still doesn't
link completely on Win32 - there are a few things still required. But
much closer than before.

At Bruce's request, I'm goint to write up a README file about the method
of signals delivery chosen and why the others were rejected (basically a
summary of the mailinglist discussions). I'll finish that up once/if the
patch is accepted.


Magnus Hagander
2004-01-27 00:45:26 +00:00
Bruce Momjian eec08b95e7 [all] Removed call to getppid in SendPostmasterSignal, replacing with a
PostmasterPid variable, which gets set (early) in PostmasterMain
getppid would not be the postmaster?

[fork/exec] Implements processCancelRequest by keeping an array of

pid/cancel_key structs in shared mem

[fork/exec] Moves AttachSharedMemoryAndSemaphores call for backends into
SubPostmasterMain

[win32] Implements reaper/waitpid by keeping an arrays of children
pids,handles in postmaster local mem
      - this item is largely untested, for reasons which should be
obvious, but appears sound

[win32/all] Added extern for pgpipe in Win32 case, and changed the second
pipe call (which seems to have been missed earlier) to pgpipe

[win32] #define'd ftruncate to chsize in the Win32 case

[win32] PG_USLEEP for Win32 has a misplaced paren. Fixed.

[win32] DLLIMPORT handling for MingW case


Claudio Natoli
2004-01-26 22:59:54 +00:00
Bruce Momjian ede3b762a3 Back out win32 patch so we can apply it separately. 2004-01-26 22:54:58 +00:00
Bruce Momjian f4921e5ca3 Attached is a patch that fixes some trivial typos and alignment. Please
apply.

Alvaro Herrera
2004-01-26 22:51:56 +00:00
Tom Lane c77f363384 Ensure that close() and fclose() are checked for errors, at least in
cases involving writes.  Per recent discussion about the possibility
of close-time failures on some filesystems.  There is a TODO item for
this, too.
2004-01-26 22:35:32 +00:00
Bruce Momjian 4cdf51e646 Drops in the CreateProcess calls for Win32 (essentially wrapping up the
fork/exec portion of the port), and fixes a handful of whitespace issues

Claudio Natoli
2004-01-11 03:49:31 +00:00
Bruce Momjian 2afa36be9d Remove ereport() from failed connection; already done, per Tom. 2004-01-09 23:27:20 +00:00
Bruce Momjian 9640cc7dfa Fix for cancel key restarting postmaster, from Claudio 2004-01-09 23:11:39 +00:00
Neil Conway 192ad63bd7 More janitorial work: remove the explicit casting of NULL literals to a
pointer type when it is not necessary to do so.

For future reference, casting NULL to a pointer type is only necessary
when (a) invoking a function AND either (b) the function has no prototype
OR (c) the function is a varargs function.
2004-01-07 18:56:30 +00:00
Bruce Momjian 488f2785d0 Final rearrangement of main postgresql child process (ie.
BackendFork/SSDataBase/pgstat) startup, to allow fork/exec calls to
closely mimic (the soon to be provided) Win32 CreateProcess equivalent
calls.

Claudio Natoli
2004-01-06 23:15:22 +00:00
Bruce Momjian aeddc2a60d Continued rearrangement to permit pgstat + BootstrapMain processes to be
fork/exec'd, in the same mode as the previous patch for backends.

Claudio Natoli
2003-12-25 03:52:51 +00:00
Bruce Momjian d75b2ec4eb This patch is the next step towards (re)allowing fork/exec.
Claudio Natoli
2003-12-20 17:31:21 +00:00
Tom Lane 5e2b99db95 Avoid assuming that type key_t is 32 bits, since it reportedly isn't
on 64-bit Solaris.  Use a non-system-dependent datatype for UsedShmemSegID,
namely unsigned long (which we were already assuming could hold a shmem
key anyway, cf RecordSharedMemoryInLockFile).
2003-12-01 22:15:38 +00:00
PostgreSQL Daemon 969685ad44 $Header: -> $PostgreSQL Changes ... 2003-11-29 19:52:15 +00:00
Jan Wieck cfeca62148 Background writer process
This first part of the background writer does no syncing at all.
It's only purpose is to keep the LRU heads clean so that regular
backends seldom to never have to call write().

Jan
2003-11-19 15:55:08 +00:00
Bruce Momjian f612b16dc2 * ioctlsocket_ret
- is not initialized to 1 (at least in the WIN_32 code I started with!)

Claudio Natoli
2003-11-11 01:09:42 +00:00
Peter Eisentraut d84b6ef56b Various message fixes, among those fixes for the previous round of fixes 2003-09-26 15:27:37 +00:00
Peter Eisentraut feb4f44d29 Message editing: remove gratuitous variations in message wording, standardize
terms, add some clarifications, fix some untranslatable attempts at dynamic
message building.
2003-09-25 06:58:07 +00:00
Tom Lane b1d3de6b96 Someone (possibly me) foolishly reduced the response for failing
to create a TCP/IP socket from FATAL to LOG.  This was unwise;
historically we have expected socket conflicts to abort postmaster
startup.  Conflicts on port numbers with another postmaster can only
be detected reliably at the TCP socket level.
2003-09-12 19:33:59 +00:00
Bruce Momjian 188eda0df2 Consistenly lowercase GUC variable names, in docs and error messages. 2003-09-11 18:30:39 +00:00
Bruce Momjian b8245766ab Re-upper case CHECKPOINT_SEGMENTS. 2003-09-04 03:38:55 +00:00
Bruce Momjian cac43aefd8 Lowercase CHECKPOINT_SEGMENTS. 2003-09-04 00:36:46 +00:00
Tom Lane fcb90fdc95 Change some frequently-reached elog(DEBUG...) calls to ereport(DEBUG...)
for speed reasons.  (ereport falls out much more quickly when no output
is needed than elog does.)
2003-08-12 18:23:21 +00:00
Bruce Momjian f3c3deb7d0 Update copyrights to 2003. 2003-08-04 02:40:20 +00:00
Bruce Momjian 089003fb46 pgindent run. 2003-08-04 00:43:34 +00:00
Tom Lane 5b545644cf Postmaster erroneously rejected SSL connections on IPv6. 2003-08-01 23:25:00 +00:00
Tom Lane b556e8200e elog mop-up: bring some straggling fprintf(stderr)'s into the elog world. 2003-07-27 21:49:55 +00:00
Tom Lane df63503dc2 Have a go at fixing various outstanding portability issues in code that
was modified for IPv6.  Use a robust definition of struct sockaddr_storage,
do a proper configure test to see if ss_len exists, don't assume that
getnameinfo() will handle AF_UNIX sockets, don't trust getaddrinfo to
return the protocol we ask for, etc.  This incorporates several outstanding
patches from Kurt Roeckx, but I'm to blame for anything that doesn't
work ...
2003-07-23 23:30:41 +00:00
Bruce Momjian a0cc9f3cb9 Add GUC parameter to control rendezvous name. 2003-07-22 20:29:13 +00:00
Tom Lane b05d3ae1ed Error message editing in backend/libpq, backend/postmaster, backend/tcop.
Along the way, fix some logic problems in pgstat_initstats, notably the
bogus assumption that malloc returns zeroed memory.
2003-07-22 19:00:12 +00:00
Bruce Momjian b4cea00a1f IPv6 cleanups.
Kurt Roeckx
Andrew Dunstan
2003-06-12 07:36:51 +00:00
Bruce Momjian 65fb311a97 Add Rendezvous support to postmaster, from Chris Campbell 2003-06-11 06:56:07 +00:00
Tom Lane 0f3c68aa43 Fix breakage of LINUX_PROFILE code due to recent Windows changes. 2003-05-28 19:36:28 +00:00
Tom Lane aae078198d In bootstrap and standalone-backend modes, do not sort LOG elevel out
of order; the 'server log' output is actually client output in these
scenarios and we ought to treat elevels the same way as in the client
case.  This allows initdb to not send backend stderr to /dev/null anymore,
which makes it much more likely that people will notice problems during
initdb.
2003-05-28 17:25:02 +00:00
Bruce Momjian 98b6f37e47 Make debug_ GUC varables output DEBUG1 rather than LOG, and mention in
docs that CLIENT/LOG_MIN_MESSAGES now controls debug_* output location.
Doc changes included.
2003-05-27 17:49:47 +00:00