diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-08-10 12:20:30 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-08-10 12:22:21 -0400 |
commit | 4dab3d5ae1498eb4246e54225a48cf667ab693da (patch) | |
tree | c2d8c7d4bbfad019a14422ddb20f82aa540d1434 /src/backend/access/transam/xlog.c | |
parent | 1f1b70a7cf957b88433f871f3732ad5701b6ad8b (diff) | |
download | postgresql-4dab3d5ae1498eb4246e54225a48cf667ab693da.tar.gz postgresql-4dab3d5ae1498eb4246e54225a48cf667ab693da.zip |
Change the autovacuum launcher to use WaitLatch instead of a poll loop.
In pursuit of this (and with the expectation that WaitLatch will be needed
in more places), convert the latch field that was already added to PGPROC
for sync rep into a generic latch that is activated for all PGPROC-owning
processes, and change many of the standard backend signal handlers to set
that latch when a signal happens. This will allow WaitLatch callers to be
wakened properly by these signals.
In passing, fix a whole bunch of signal handlers that had been hacked to do
things that might change errno, without adding the necessary save/restore
logic for errno. Also make some minor fixes in unix_latch.c, and clean
up bizarre and unsafe scheme for disowning the process's latch. Much of
this has to be back-patched into 9.1.
Peter Geoghegan, with additional work by Tom
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 222b403889d..11035e6b4cd 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -9957,34 +9957,50 @@ startupproc_quickdie(SIGNAL_ARGS) static void StartupProcSigUsr1Handler(SIGNAL_ARGS) { + int save_errno = errno; + latch_sigusr1_handler(); + + errno = save_errno; } /* SIGUSR2: set flag to finish recovery */ static void StartupProcTriggerHandler(SIGNAL_ARGS) { + int save_errno = errno; + promote_triggered = true; WakeupRecovery(); + + errno = save_errno; } /* SIGHUP: set flag to re-read config file at next convenient time */ static void StartupProcSigHupHandler(SIGNAL_ARGS) { + int save_errno = errno; + got_SIGHUP = true; WakeupRecovery(); + + errno = save_errno; } /* SIGTERM: set flag to abort redo and exit */ static void StartupProcShutdownHandler(SIGNAL_ARGS) { + int save_errno = errno; + if (in_restore_command) proc_exit(1); else shutdown_requested = true; WakeupRecovery(); + + errno = save_errno; } /* Handle SIGHUP and SIGTERM signals of startup process */ |