diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-28 23:27:57 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-28 23:27:57 +0000 |
commit | c715fdea267843fd7fae4253aee0ae91e941393c (patch) | |
tree | b19e41edd57afe461ebc3dae271c8a5d17eba710 /src/backend/storage/ipc/sinval.c | |
parent | 914822713c9a8ce452860fb895ef79ecfd583746 (diff) | |
download | postgresql-c715fdea267843fd7fae4253aee0ae91e941393c.tar.gz postgresql-c715fdea267843fd7fae4253aee0ae91e941393c.zip |
Significant cleanups in SysV IPC handling (shared mem and semaphores).
IPC key assignment will now work correctly even when multiple postmasters
are using same logical port number (which is possible given -k switch).
There is only one shared-mem segment per postmaster now, not 3.
Rip out broken code for non-TAS case in bufmgr and xlog, substitute a
complete S_LOCK emulation using semaphores in spin.c. TAS and non-TAS
logic is now exactly the same.
When deadlock is detected, "Deadlock detected" is now the elog(ERROR)
message, rather than a NOTICE that comes out before an unhelpful ERROR.
Diffstat (limited to 'src/backend/storage/ipc/sinval.c')
-rw-r--r-- | src/backend/storage/ipc/sinval.c | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/src/backend/storage/ipc/sinval.c b/src/backend/storage/ipc/sinval.c index fb2e4804dd3..c87fcd36602 100644 --- a/src/backend/storage/ipc/sinval.c +++ b/src/backend/storage/ipc/sinval.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.23 2000/11/12 20:51:51 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.24 2000/11/28 23:27:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,52 +27,23 @@ SPINLOCK SInvalLock = (SPINLOCK) NULL; /****************************************************************************/ -/* CreateSharedInvalidationState() Create a buffer segment */ +/* CreateSharedInvalidationState() Initialize SI buffer */ /* */ /* should be called only by the POSTMASTER */ /****************************************************************************/ void -CreateSharedInvalidationState(IPCKey key, int maxBackends) +CreateSharedInvalidationState(int maxBackends) { - int status; - - /* SInvalLock gets set in spin.c, during spinlock init */ - status = SISegmentInit(true, IPCKeyGetSIBufferMemoryBlock(key), - maxBackends); - - if (status == -1) - elog(FATAL, "CreateSharedInvalidationState: failed segment init"); -} - -/****************************************************************************/ -/* AttachSharedInvalidationState(key) Attach to existing buffer segment */ -/* */ -/* should be called by each backend during startup */ -/****************************************************************************/ -void -AttachSharedInvalidationState(IPCKey key) -{ - int status; - - if (key == PrivateIPCKey) - { - CreateSharedInvalidationState(key, 16); - return; - } - /* SInvalLock gets set in spin.c, during spinlock init */ - status = SISegmentInit(false, IPCKeyGetSIBufferMemoryBlock(key), 0); - - if (status == -1) - elog(FATAL, "AttachSharedInvalidationState: failed segment init"); + /* SInvalLock must be initialized already, during spinlock init */ + SIBufferInit(maxBackends); } /* - * InitSharedInvalidationState + * InitBackendSharedInvalidationState * Initialize new backend's state info in buffer segment. - * Must be called after AttachSharedInvalidationState(). */ void -InitSharedInvalidationState(void) +InitBackendSharedInvalidationState(void) { SpinAcquire(SInvalLock); if (!SIBackendInit(shmInvalBuffer)) |