88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/storage/ipc/sinval.c,v 1.83 2008/01/01 19:45:51 momjian Exp $
11+ * $PostgreSQL: pgsql/src/backend/storage/ipc/sinval.c,v 1.84 2008/03/16 19:47:33 alvherre Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -48,38 +48,6 @@ static volatile int catchupInterruptOccurred = 0;
4848static void ProcessCatchupEvent (void );
4949
5050
51- /****************************************************************************/
52- /*CreateSharedInvalidationState() Initialize SI buffer*/
53- /**/
54- /*should be called only by the POSTMASTER*/
55- /****************************************************************************/
56- void
57- CreateSharedInvalidationState (void )
58- {
59- /* SInvalLock must be initialized already, during LWLock init */
60- SIBufferInit ();
61- }
62-
63- /*
64- * InitBackendSharedInvalidationState
65- *Initialize new backend's state info in buffer segment.
66- */
67- void
68- InitBackendSharedInvalidationState (void )
69- {
70- int flag ;
71-
72- LWLockAcquire (SInvalLock ,LW_EXCLUSIVE );
73- flag = SIBackendInit (shmInvalBuffer );
74- LWLockRelease (SInvalLock );
75- if (flag < 0 )/* unexpected problem */
76- elog (FATAL ,"shared cache invalidation initialization failed" );
77- if (flag == 0 )/* expected problem: MaxBackends exceeded */
78- ereport (FATAL ,
79- (errcode (ERRCODE_TOO_MANY_CONNECTIONS ),
80- errmsg ("sorry, too many clients already" )));
81- }
82-
8351/*
8452 * SendSharedInvalidMessage
8553 *Add a shared-cache-invalidation message to the global SI message queue.
@@ -89,9 +57,7 @@ SendSharedInvalidMessage(SharedInvalidationMessage *msg)
8957{
9058bool insertOK ;
9159
92- LWLockAcquire (SInvalLock ,LW_EXCLUSIVE );
93- insertOK = SIInsertDataEntry (shmInvalBuffer ,msg );
94- LWLockRelease (SInvalLock );
60+ insertOK = SIInsertDataEntry (msg );
9561if (!insertOK )
9662elog (DEBUG4 ,"SI buffer overflow" );
9763}
@@ -123,19 +89,7 @@ ReceiveSharedInvalidMessages(
12389 */
12490catchupInterruptOccurred = 0 ;
12591
126- /*
127- * We can run SIGetDataEntry in parallel with other backends running
128- * SIGetDataEntry for themselves, since each instance will modify only
129- * fields of its own backend's ProcState, and no instance will look at
130- * fields of other backends' ProcStates. We express this by grabbing
131- * SInvalLock in shared mode. Note that this is not exactly the
132- * normal (read-only) interpretation of a shared lock! Look closely at
133- * the interactions before allowing SInvalLock to be grabbed in shared
134- * mode for any other reason!
135- */
136- LWLockAcquire (SInvalLock ,LW_SHARED );
137- getResult = SIGetDataEntry (shmInvalBuffer ,MyBackendId ,& data );
138- LWLockRelease (SInvalLock );
92+ getResult = SIGetDataEntry (MyBackendId ,& data );
13993
14094if (getResult == 0 )
14195break ;/* nothing more to do */
@@ -155,11 +109,7 @@ ReceiveSharedInvalidMessages(
155109
156110/* If we got any messages, try to release dead messages */
157111if (gotMessage )
158- {
159- LWLockAcquire (SInvalLock ,LW_EXCLUSIVE );
160- SIDelExpiredDataEntries (shmInvalBuffer );
161- LWLockRelease (SInvalLock );
162- }
112+ SIDelExpiredDataEntries (false);
163113}
164114
165115