mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Rename delayChkpt to delayChkptFlags.
Before commit 412ad7a556
, delayChkpt
was a Boolean. Now it's an integer. Extensions using it need to be
appropriately updated, so let's rename the field to make sure that
a hard compilation failure occurs.
Replacing delayChkpt with delayChkptFlags made a few comments extend
past 80 characters, so I reflowed them and changed some wording very
slightly.
The back-branches will need a different change to restore compatibility
with existing minor releases; this is just for master.
Per suggestion from Tom Lane.
Discussion: http://postgr.es/m/a7880f4d-1d74-582a-ada7-dad168d046d1@enterprisedb.com
This commit is contained in:
@@ -4021,7 +4021,7 @@ MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
|
||||
{
|
||||
XLogRecPtr lsn = InvalidXLogRecPtr;
|
||||
bool dirtied = false;
|
||||
bool delayChkpt = false;
|
||||
bool delayChkptFlags = false;
|
||||
uint32 buf_state;
|
||||
|
||||
/*
|
||||
@@ -4071,9 +4071,9 @@ MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
|
||||
* essential that CreateCheckPoint waits for virtual transactions
|
||||
* rather than full transactionids.
|
||||
*/
|
||||
Assert((MyProc->delayChkpt & DELAY_CHKPT_START) == 0);
|
||||
MyProc->delayChkpt |= DELAY_CHKPT_START;
|
||||
delayChkpt = true;
|
||||
Assert((MyProc->delayChkptFlags & DELAY_CHKPT_START) == 0);
|
||||
MyProc->delayChkptFlags |= DELAY_CHKPT_START;
|
||||
delayChkptFlags = true;
|
||||
lsn = XLogSaveBufferForHint(buffer, buffer_std);
|
||||
}
|
||||
|
||||
@@ -4105,8 +4105,8 @@ MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
|
||||
buf_state |= BM_DIRTY | BM_JUST_DIRTIED;
|
||||
UnlockBufHdr(bufHdr, buf_state);
|
||||
|
||||
if (delayChkpt)
|
||||
MyProc->delayChkpt &= ~DELAY_CHKPT_START;
|
||||
if (delayChkptFlags)
|
||||
MyProc->delayChkptFlags &= ~DELAY_CHKPT_START;
|
||||
|
||||
if (dirtied)
|
||||
{
|
||||
|
@@ -700,7 +700,7 @@ ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
|
||||
proc->xmin = InvalidTransactionId;
|
||||
|
||||
/* be sure this is cleared in abort */
|
||||
proc->delayChkpt = 0;
|
||||
proc->delayChkptFlags = 0;
|
||||
|
||||
proc->recoveryConflictPending = false;
|
||||
|
||||
@@ -742,7 +742,7 @@ ProcArrayEndTransactionInternal(PGPROC *proc, TransactionId latestXid)
|
||||
proc->xmin = InvalidTransactionId;
|
||||
|
||||
/* be sure this is cleared in abort */
|
||||
proc->delayChkpt = 0;
|
||||
proc->delayChkptFlags = 0;
|
||||
|
||||
proc->recoveryConflictPending = false;
|
||||
|
||||
@@ -929,7 +929,7 @@ ProcArrayClearTransaction(PGPROC *proc)
|
||||
proc->recoveryConflictPending = false;
|
||||
|
||||
Assert(!(proc->statusFlags & PROC_VACUUM_STATE_MASK));
|
||||
Assert(!proc->delayChkpt);
|
||||
Assert(!proc->delayChkptFlags);
|
||||
|
||||
/*
|
||||
* Need to increment completion count even though transaction hasn't
|
||||
@@ -3059,19 +3059,20 @@ GetOldestSafeDecodingTransactionId(bool catalogOnly)
|
||||
* delaying checkpoint because they have critical actions in progress.
|
||||
*
|
||||
* Constructs an array of VXIDs of transactions that are currently in commit
|
||||
* critical sections, as shown by having specified delayChkpt bits set in their
|
||||
* PGPROC.
|
||||
* critical sections, as shown by having specified delayChkptFlags bits set
|
||||
* in their PGPROC.
|
||||
*
|
||||
* Returns a palloc'd array that should be freed by the caller.
|
||||
* *nvxids is the number of valid entries.
|
||||
*
|
||||
* Note that because backends set or clear delayChkpt without holding any lock,
|
||||
* the result is somewhat indeterminate, but we don't really care. Even in
|
||||
* a multiprocessor with delayed writes to shared memory, it should be certain
|
||||
* that setting of delayChkpt will propagate to shared memory when the backend
|
||||
* takes a lock, so we cannot fail to see a virtual xact as delayChkpt if
|
||||
* it's already inserted its commit record. Whether it takes a little while
|
||||
* for clearing of delayChkpt to propagate is unimportant for correctness.
|
||||
* Note that because backends set or clear delayChkptFlags without holding any
|
||||
* lock, the result is somewhat indeterminate, but we don't really care. Even
|
||||
* in a multiprocessor with delayed writes to shared memory, it should be
|
||||
* certain that setting of delayChkptFlags will propagate to shared memory
|
||||
* when the backend takes a lock, so we cannot fail to see a virtual xact as
|
||||
* delayChkptFlags if it's already inserted its commit record. Whether it
|
||||
* takes a little while for clearing of delayChkptFlags to propagate is
|
||||
* unimportant for correctness.
|
||||
*/
|
||||
VirtualTransactionId *
|
||||
GetVirtualXIDsDelayingChkpt(int *nvxids, int type)
|
||||
@@ -3094,7 +3095,7 @@ GetVirtualXIDsDelayingChkpt(int *nvxids, int type)
|
||||
int pgprocno = arrayP->pgprocnos[index];
|
||||
PGPROC *proc = &allProcs[pgprocno];
|
||||
|
||||
if ((proc->delayChkpt & type) != 0)
|
||||
if ((proc->delayChkptFlags & type) != 0)
|
||||
{
|
||||
VirtualTransactionId vxid;
|
||||
|
||||
@@ -3138,7 +3139,7 @@ HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, int nvxids, int type)
|
||||
|
||||
GET_VXID_FROM_PGPROC(vxid, *proc);
|
||||
|
||||
if ((proc->delayChkpt & type) != 0 &&
|
||||
if ((proc->delayChkptFlags & type) != 0 &&
|
||||
VirtualTransactionIdIsValid(vxid))
|
||||
{
|
||||
int i;
|
||||
|
@@ -393,7 +393,7 @@ InitProcess(void)
|
||||
MyProc->roleId = InvalidOid;
|
||||
MyProc->tempNamespaceId = InvalidOid;
|
||||
MyProc->isBackgroundWorker = IsBackgroundWorker;
|
||||
MyProc->delayChkpt = 0;
|
||||
MyProc->delayChkptFlags = 0;
|
||||
MyProc->statusFlags = 0;
|
||||
/* NB -- autovac launcher intentionally does not set IS_AUTOVACUUM */
|
||||
if (IsAutoVacuumWorkerProcess())
|
||||
@@ -578,7 +578,7 @@ InitAuxiliaryProcess(void)
|
||||
MyProc->roleId = InvalidOid;
|
||||
MyProc->tempNamespaceId = InvalidOid;
|
||||
MyProc->isBackgroundWorker = IsBackgroundWorker;
|
||||
MyProc->delayChkpt = 0;
|
||||
MyProc->delayChkptFlags = 0;
|
||||
MyProc->statusFlags = 0;
|
||||
MyProc->lwWaiting = false;
|
||||
MyProc->lwWaitMode = 0;
|
||||
|
Reference in New Issue
Block a user