diff options
| author | Tom Lane | 2011-08-10 16:20:30 +0000 |
|---|---|---|
| committer | Tom Lane | 2011-08-10 16:22:21 +0000 |
| commit | 4dab3d5ae1498eb4246e54225a48cf667ab693da (patch) | |
| tree | c2d8c7d4bbfad019a14422ddb20f82aa540d1434 /src/include | |
| parent | 1f1b70a7cf957b88433f871f3732ad5701b6ad8b (diff) | |
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/include')
| -rw-r--r-- | src/include/replication/syncrep.h | 4 | ||||
| -rw-r--r-- | src/include/storage/proc.h | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/include/replication/syncrep.h b/src/include/replication/syncrep.h index efbebbcc06..d71047e147 100644 --- a/src/include/replication/syncrep.h +++ b/src/include/replication/syncrep.h @@ -33,8 +33,8 @@ extern char *SyncRepStandbyNames; /* called by user backend */ extern void SyncRepWaitForLSN(XLogRecPtr XactCommitLSN); -/* callback at backend exit */ -extern void SyncRepCleanupAtProcExit(int code, Datum arg); +/* called at backend exit */ +extern void SyncRepCleanupAtProcExit(void); /* called by wal sender */ extern void SyncRepInitConfig(void); diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index a149a55855..8b09b2af64 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -82,6 +82,8 @@ struct PGPROC PGSemaphoreData sem; /* ONE semaphore to sleep on */ int waitStatus; /* STATUS_WAITING, STATUS_OK or STATUS_ERROR */ + Latch procLatch; /* generic latch for process */ + LocalTransactionId lxid; /* local id of top-level transaction currently * being executed by this proc, if running; * else InvalidLocalTransactionId */ @@ -132,7 +134,6 @@ struct PGPROC * syncRepState must not be touched except by owning process or WALSender. * syncRepLinks used only while holding SyncRepLock. */ - Latch waitLatch; /* allow us to wait for sync rep */ XLogRecPtr waitLSN; /* waiting for this LSN or higher */ int syncRepState; /* wait state for sync rep */ SHM_QUEUE syncRepLinks; /* list link if process is in syncrep queue */ |
