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.