mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Rename PGPROC->vacuumFlags to statusFlags
With more flags associated to a PGPROC entry that are not related to vacuum (currently existing or planned), the name "statusFlags" describes its purpose better. (The same is done to the mirroring PROC_HDR->vacuumFlags.) No functional changes in this commit. This was suggested first by Hari Babu Kommi in [1] and then by Michael Paquier at [2]. [1] https://postgr.es/m/CAJrrPGcsDC-oy1AhqH0JkXYa0Z2AgbuXzHPpByLoBGMxfOZMEQ@mail.gmail.com [2] https://postgr.es/m/20200820060929.GB3730@paquier.xyz Author: Dmitry Dolgov <9erthalion6@gmail.com> Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://postgr.es/m/20201116182446.qcg3o6szo2zookyr@localhost
This commit is contained in:
@@ -618,7 +618,7 @@ FindLockCycleRecurseMember(PGPROC *checkProc,
|
||||
* that an autovacuum won't be canceled with less than
|
||||
* deadlock_timeout grace period.
|
||||
*
|
||||
* Note we read vacuumFlags without any locking. This is
|
||||
* Note we read statusFlags without any locking. This is
|
||||
* OK only for checking the PROC_IS_AUTOVACUUM flag,
|
||||
* because that flag is set at process start and never
|
||||
* reset. There is logic elsewhere to avoid canceling an
|
||||
@@ -628,7 +628,7 @@ FindLockCycleRecurseMember(PGPROC *checkProc,
|
||||
* ProcArrayLock.
|
||||
*/
|
||||
if (checkProc == MyProc &&
|
||||
proc->vacuumFlags & PROC_IS_AUTOVACUUM)
|
||||
proc->statusFlags & PROC_IS_AUTOVACUUM)
|
||||
blocking_autovacuum_proc = proc;
|
||||
|
||||
/* We're done looking at this proclock */
|
||||
|
@@ -111,7 +111,7 @@ ProcGlobalShmemSize(void)
|
||||
|
||||
size = add_size(size, mul_size(TotalProcs, sizeof(*ProcGlobal->xids)));
|
||||
size = add_size(size, mul_size(TotalProcs, sizeof(*ProcGlobal->subxidStates)));
|
||||
size = add_size(size, mul_size(TotalProcs, sizeof(*ProcGlobal->vacuumFlags)));
|
||||
size = add_size(size, mul_size(TotalProcs, sizeof(*ProcGlobal->statusFlags)));
|
||||
|
||||
return size;
|
||||
}
|
||||
@@ -210,8 +210,8 @@ InitProcGlobal(void)
|
||||
MemSet(ProcGlobal->xids, 0, TotalProcs * sizeof(*ProcGlobal->xids));
|
||||
ProcGlobal->subxidStates = (XidCacheStatus *) ShmemAlloc(TotalProcs * sizeof(*ProcGlobal->subxidStates));
|
||||
MemSet(ProcGlobal->subxidStates, 0, TotalProcs * sizeof(*ProcGlobal->subxidStates));
|
||||
ProcGlobal->vacuumFlags = (uint8 *) ShmemAlloc(TotalProcs * sizeof(*ProcGlobal->vacuumFlags));
|
||||
MemSet(ProcGlobal->vacuumFlags, 0, TotalProcs * sizeof(*ProcGlobal->vacuumFlags));
|
||||
ProcGlobal->statusFlags = (uint8 *) ShmemAlloc(TotalProcs * sizeof(*ProcGlobal->statusFlags));
|
||||
MemSet(ProcGlobal->statusFlags, 0, TotalProcs * sizeof(*ProcGlobal->statusFlags));
|
||||
|
||||
for (i = 0; i < TotalProcs; i++)
|
||||
{
|
||||
@@ -393,10 +393,10 @@ InitProcess(void)
|
||||
MyProc->tempNamespaceId = InvalidOid;
|
||||
MyProc->isBackgroundWorker = IsBackgroundWorker;
|
||||
MyProc->delayChkpt = false;
|
||||
MyProc->vacuumFlags = 0;
|
||||
MyProc->statusFlags = 0;
|
||||
/* NB -- autovac launcher intentionally does not set IS_AUTOVACUUM */
|
||||
if (IsAutoVacuumWorkerProcess())
|
||||
MyProc->vacuumFlags |= PROC_IS_AUTOVACUUM;
|
||||
MyProc->statusFlags |= PROC_IS_AUTOVACUUM;
|
||||
MyProc->lwWaiting = false;
|
||||
MyProc->lwWaitMode = 0;
|
||||
MyProc->waitLock = NULL;
|
||||
@@ -574,7 +574,7 @@ InitAuxiliaryProcess(void)
|
||||
MyProc->tempNamespaceId = InvalidOid;
|
||||
MyProc->isBackgroundWorker = IsBackgroundWorker;
|
||||
MyProc->delayChkpt = false;
|
||||
MyProc->vacuumFlags = 0;
|
||||
MyProc->statusFlags = 0;
|
||||
MyProc->lwWaiting = false;
|
||||
MyProc->lwWaitMode = 0;
|
||||
MyProc->waitLock = NULL;
|
||||
@@ -1310,7 +1310,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
|
||||
if (deadlock_state == DS_BLOCKED_BY_AUTOVACUUM && allow_autovacuum_cancel)
|
||||
{
|
||||
PGPROC *autovac = GetBlockingAutoVacuumPgproc();
|
||||
uint8 vacuumFlags;
|
||||
uint8 statusFlags;
|
||||
|
||||
LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
|
||||
|
||||
@@ -1318,9 +1318,9 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
|
||||
* Only do it if the worker is not working to protect against Xid
|
||||
* wraparound.
|
||||
*/
|
||||
vacuumFlags = ProcGlobal->vacuumFlags[autovac->pgxactoff];
|
||||
if ((vacuumFlags & PROC_IS_AUTOVACUUM) &&
|
||||
!(vacuumFlags & PROC_VACUUM_FOR_WRAPAROUND))
|
||||
statusFlags = ProcGlobal->statusFlags[autovac->pgxactoff];
|
||||
if ((statusFlags & PROC_IS_AUTOVACUUM) &&
|
||||
!(statusFlags & PROC_VACUUM_FOR_WRAPAROUND))
|
||||
{
|
||||
int pid = autovac->pid;
|
||||
StringInfoData locktagbuf;
|
||||
|
Reference in New Issue
Block a user