Re: Lock on ShmemVariableCache fields?
От | Japin Li |
---|---|
Тема | Re: Lock on ShmemVariableCache fields? |
Дата | |
Msg-id | MEYP282MB16695B0701EA4D7A4471A74AB6379@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM обсуждение исходный текст |
Ответ на | Re: Lock on ShmemVariableCache fields? (Zhang Mingli <zmlpostgres@gmail.com>) |
Ответы |
Re: Lock on ShmemVariableCache fields?
|
Список | pgsql-hackers |
On Mon, 31 Oct 2022 at 14:15, Zhang Mingli <zmlpostgres@gmail.com> wrote: > HI, > > On Oct 31, 2022, 10:48 +0800, Japin Li <japinli@hotmail.com>, wrote: >> >> I also find a similar code in StartupXLOG(). Why we don't hold the lock >> on OidGenLock when updating ShmemVariableCache->nextOid and >> ShmemVariableCache->oidCount? >> >> If the lock is unnecessary, I think adding some comments is better. >> > As its name BootStrapXLOG, it’s used in BootStrap mode to initialize the template database. > The process doesn’t speak SQL and the database is not ready. > There won’t be concurrent access to variables. > Thanks for your explanation. I got your mind. So, in theory, we can also update everything in ShmemVariableCache without a lock? For example, since SetCommitTsLimit() is only used in BootStrapXLog() and StartupXLOG(), we can safely remove the code of acquiring/releasing lock? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.
В списке pgsql-hackers по дате отправления: