diff options
author | Robert Haas <rhaas@postgresql.org> | 2016-02-04 16:43:04 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2016-02-04 16:43:04 -0500 |
commit | c1772ad9225641c921545b35c84ee478c326b95e (patch) | |
tree | 879865789b951bddfe02131401c7035be44780a6 /src/backend/postmaster/postmaster.c | |
parent | 5ef244a28266ce8e5666b23baed33a4c238542ff (diff) | |
download | postgresql-c1772ad9225641c921545b35c84ee478c326b95e.tar.gz postgresql-c1772ad9225641c921545b35c84ee478c326b95e.zip |
Change the way that LWLocks for extensions are allocated.
The previous RequestAddinLWLocks() method had several disadvantages.
First, the locks would be in the main tranche; we've recently decided
that it's useful for LWLocks used for separate purposes to have
separate tranche IDs. Second, there wasn't any correlation between
what code called RequestAddinLWLocks() and what code called
LWLockAssign(); when multiple modules are in use, it could become
quite difficult to troubleshoot problems where LWLockAssign() ran out
of locks. To fix, create a concept of named LWLock tranches which
can be used either by extension or by core code.
Amit Kapila and Robert Haas
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
-rw-r--r-- | src/backend/postmaster/postmaster.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index d983a50ee1d..b16fc28a27d 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -485,6 +485,8 @@ typedef struct #ifndef HAVE_SPINLOCKS PGSemaphore SpinlockSemaArray; #endif + int NamedLWLockTrancheRequests; + NamedLWLockTranche *NamedLWLockTrancheArray; LWLockPadded *MainLWLockArray; slock_t *ProcStructLock; PROC_HDR *ProcGlobal; @@ -5800,6 +5802,8 @@ save_backend_variables(BackendParameters *param, Port *port, #ifndef HAVE_SPINLOCKS param->SpinlockSemaArray = SpinlockSemaArray; #endif + param->NamedLWLockTrancheRequests = NamedLWLockTrancheRequests; + param->NamedLWLockTrancheArray = NamedLWLockTrancheArray; param->MainLWLockArray = MainLWLockArray; param->ProcStructLock = ProcStructLock; param->ProcGlobal = ProcGlobal; @@ -6031,6 +6035,8 @@ restore_backend_variables(BackendParameters *param, Port *port) #ifndef HAVE_SPINLOCKS SpinlockSemaArray = param->SpinlockSemaArray; #endif + NamedLWLockTrancheRequests = param->NamedLWLockTrancheRequests; + NamedLWLockTrancheArray = param->NamedLWLockTrancheArray; MainLWLockArray = param->MainLWLockArray; ProcStructLock = param->ProcStructLock; ProcGlobal = param->ProcGlobal; |