8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/storage/ipc/shmem.c,v 1.82 2004/12/31 22:00:56 pgsql Exp $
11
+ * $PostgreSQL: pgsql/src/backend/storage/ipc/shmem.c,v 1.83 2005/04/04 04:34:41 neilc Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
53
53
* cannot be redistributed to other tables. We could build a simple
54
54
* hash bucket garbage collector if need be. Right now, it seems
55
55
* unnecessary.
56
- *
57
- * See InitSem() in sem.c for an example of how to use the
58
- * shmem index.
59
56
*/
60
57
61
58
#include "postgres.h"
@@ -85,8 +82,6 @@ NON_EXEC_STATIC void *ShmemIndexAlloc = NULL; /* Memory actually
85
82
86
83
static HTAB * ShmemIndex = NULL ; /* primary index hashtable for shmem */
87
84
88
- static bool ShmemBootstrap = false; /* bootstrapping shmem index? */
89
-
90
85
91
86
/*
92
87
* InitShmemAllocation() --- set up shared-memory allocation.
@@ -213,10 +208,10 @@ InitShmemIndex(void)
213
208
/*
214
209
* Since ShmemInitHash calls ShmemInitStruct, which expects the
215
210
* ShmemIndex hashtable to exist already, we have a bit of a
216
- * circularity problem in initializing the ShmemIndex itself. We set
217
- * ShmemBootstrap to tell ShmemInitStruct to fake it.
211
+ * circularity problem in initializing the ShmemIndex itself. The
212
+ * special "ShmemIndex" hash table name will tell ShmemInitStruct
213
+ * to fake it.
218
214
*/
219
- ShmemBootstrap = true;
220
215
221
216
/* create the shared memory shmem index */
222
217
info .keysize = SHMEM_INDEX_KEYSIZE ;
@@ -245,12 +240,11 @@ InitShmemIndex(void)
245
240
(errcode (ERRCODE_OUT_OF_MEMORY ),
246
241
errmsg ("out of shared memory" )));
247
242
248
- Assert (ShmemBootstrap && !found );
243
+ Assert (!found );
249
244
250
245
result -> location = MAKE_OFFSET (ShmemIndex -> hctl );
251
246
result -> size = SHMEM_INDEX_SIZE ;
252
247
253
- ShmemBootstrap = false;
254
248
}
255
249
256
250
/* now release the lock acquired in ShmemInitStruct */
@@ -349,11 +343,10 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
349
343
350
344
if (!ShmemIndex )
351
345
{
346
+ Assert (strcmp (name , "ShmemIndex" ) == 0 );
352
347
if (IsUnderPostmaster )
353
348
{
354
349
/* Must be initializing a (non-standalone) backend */
355
- Assert (strcmp (name , "ShmemIndex" ) == 0 );
356
- Assert (ShmemBootstrap );
357
350
Assert (ShmemIndexAlloc );
358
351
* foundPtr = TRUE;
359
352
}
@@ -366,8 +359,6 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
366
359
* Notice that the ShmemIndexLock is held until the shmem index
367
360
* has been completely initialized.
368
361
*/
369
- Assert (strcmp (name , "ShmemIndex" ) == 0 );
370
- Assert (ShmemBootstrap );
371
362
* foundPtr = FALSE;
372
363
ShmemIndexAlloc = ShmemAlloc (size );
373
364
}
0 commit comments