Hi, hackers

The VariableCacheData says nextOid and oidCount are protected by
OidGenLock.  However, we update them without holding the lock on
OidGenLock in BootStrapXLOG().  Same as nextXid, for other fields
that are protected by XidGenLock, it holds the lock, see
SetTransactionIdLimit().

void
BootStrapXLOG(void)
{
    [...]

    ShmemVariableCache->nextXid = checkPoint.nextXid;
    ShmemVariableCache->nextOid = checkPoint.nextOid;
    ShmemVariableCache->oidCount = 0;

    [...]

    SetTransactionIdLimit(checkPoint.oldestXid, checkPoint.oldestXidDB);

    [...]
}

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.

-- 
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.


Reply via email to