@@ -377,19 +377,17 @@ static void GetSingleProcBlockerStatusData(PGPROC *blocked_proc,
377
377
378
378
379
379
/*
380
- * InitLocks -- Initialize the lock manager's data structures.
380
+ * Initialize the lock manager's shmem data structures.
381
381
*
382
- * This is called from CreateSharedMemoryAndSemaphores(), which see for
383
- * more comments. In the normal postmaster case, the shared hash tables
384
- * are created here, as well as a locallock hash table that will remain
385
- * unused and empty in the postmaster itself. Backends inherit the pointers
386
- * to the shared tables via fork(), and also inherit an image of the locallock
387
- * hash table, which they proceed to use. In the EXEC_BACKEND case, each
388
- * backend re-executes this code to obtain pointers to the already existing
389
- * shared hash tables and to create its locallock hash table.
382
+ * This is called from CreateSharedMemoryAndSemaphores(), which see for more
383
+ * comments. In the normal postmaster case, the shared hash tables are
384
+ * created here, and backends inherit pointers to them via fork(). In the
385
+ * EXEC_BACKEND case, each backend re-executes this code to obtain pointers to
386
+ * the already existing shared hash tables. In either case, each backend must
387
+ * also call InitLockManagerAccess() to create the locallock hash table.
390
388
*/
391
389
void
392
- InitLocks (void )
390
+ LockManagerShmemInit (void )
393
391
{
394
392
HASHCTL info ;
395
393
long init_table_size ,
@@ -444,18 +442,19 @@ InitLocks(void)
444
442
sizeof (FastPathStrongRelationLockData ), & found );
445
443
if (!found )
446
444
SpinLockInit (& FastPathStrongRelationLocks -> mutex );
445
+ }
447
446
447
+ /*
448
+ * Initialize the lock manager's backend-private data structures.
449
+ */
450
+ void
451
+ InitLockManagerAccess (void )
452
+ {
448
453
/*
449
454
* Allocate non-shared hash table for LOCALLOCK structs. This stores lock
450
455
* counts and resource owner information.
451
- *
452
- * The non-shared table could already exist in this process (this occurs
453
- * when the postmaster is recreating shared memory after a backend crash).
454
- * If so, delete and recreate it. (We could simply leave it, since it
455
- * ought to be empty in the postmaster, but for safety let's zap it.)
456
456
*/
457
- if (LockMethodLocalHash )
458
- hash_destroy (LockMethodLocalHash );
457
+ HASHCTL info ;
459
458
460
459
info .keysize = sizeof (LOCALLOCKTAG );
461
460
info .entrysize = sizeof (LOCALLOCK );
@@ -3571,7 +3570,7 @@ PostPrepare_Locks(TransactionId xid)
3571
3570
* Estimate shared-memory space used for lock tables
3572
3571
*/
3573
3572
Size
3574
- LockShmemSize (void )
3573
+ LockManagerShmemSize (void )
3575
3574
{
3576
3575
Size size = 0 ;
3577
3576
long max_table_size ;
0 commit comments