Clean up NamedLWLockTranche stuff

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Clean up NamedLWLockTranche stuff
Дата
Msg-id 47aaf57e-1b7b-4e12-bda2-0316081ff50e@iki.fi
обсуждение исходный текст
Ответы Re: Clean up NamedLWLockTranche stuff
Список pgsql-hackers
While working on the new shmem allocation functions, I looked at how the 
NamedLWLockTranche stuff works now in lwlock.c, and I have to say it's a 
bit of a mess.

What is a "named tranche"? It usually means tranches requested with 
RequestNamedLWLockTranche() at postmaster startup. But all tranches have 
a name. LWLockTrancheNames includes all user-defined tranches, also ones 
assigned with LWLockNewTrancheId(), and MAX_NAMED_TRANCHES is the 
maximum for all of them.

At postmaster startup, NamedLWLockTrancheRequests points to a 
backend-private array. But after startup, and always in backends, it 
points to a copy in shared memory and 
LocalNamedLWLockTrancheRequestArray is used to hold the original. It 
took me a while to realize that NamedLWLockTrancheRequests in shared 
memory is *not* updated when you call LWLockNewTrancheId(), it only 
holds the requests made with RequestNamedLWLockTranche() before startup.

I propose the attached refactorings to make this less confusing. See 
commit messages for details.

- Heikki

Вложения

В списке pgsql-hackers по дате отправления: