Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit37236ca

Browse files
committed
Fix missing initializations of MyProc.delayChkptEnd
This commit fixes an oversight introduced in10520f4, that has addeddelayChkptEnd to PGPROC to avoid ABI breakages on stable branches, wheretwo spots have missed to initialize this variable (delayChkpt wasswitched back from int to bool, and it was initialized as 0 so there wasno consequences for it):- InitProcess(), where the per-process data structures of a backend areinitialized.- InitAuxiliaryProcess(), same but for auxiliary processes.An interruption during relation truncation while this flag is set couldcause an assertion failure when a follow-up process does a relationtruncation while reusing the same PGPROC entry. A second effect couldbe incorrect checkpoint end delays.While on it, add an assertion in ProcArrayClearTransaction() fordelayChkptEnd to be in line with5788e25. This is needed only for v14.This issue affects v11~v14, but not v15~, as we use a single fieldcalled delayChkptFlags to delay checkpoints there.Author: suyu.cmj (mengjuan.cmj@alibaba-inc.com)Reviewed-by: Kyotaro Horiguchi, Michael PaquierDiscussion:https://postgr.es/m/9c3d2a49-db5f-43cb-840b-d58f9a684295.mengjuan.cmj@alibaba-inc.comBackpatch-through: 11
1 parenta9231fe commit37236ca

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

‎src/backend/storage/ipc/procarray.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ ProcArrayClearTransaction(PGPROC *proc)
644644
/* redundant, but just in case */
645645
pgxact->vacuumFlags &= ~PROC_VACUUM_STATE_MASK;
646646
proc->delayChkpt= false;
647+
proc->delayChkptEnd= false;
647648

648649
/* Clear the subtransaction-XID cache too */
649650
pgxact->nxids=0;

‎src/backend/storage/lmgr/proc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,8 @@ InitProcess(void)
396396
MyProc->roleId=InvalidOid;
397397
MyProc->tempNamespaceId=InvalidOid;
398398
MyProc->isBackgroundWorker=IsBackgroundWorker;
399-
MyProc->delayChkpt=0;
399+
MyProc->delayChkpt= false;
400+
MyProc->delayChkptEnd= false;
400401
MyPgXact->vacuumFlags=0;
401402
/* NB -- autovac launcher intentionally does not set IS_AUTOVACUUM */
402403
if (IsAutoVacuumWorkerProcess())
@@ -578,7 +579,8 @@ InitAuxiliaryProcess(void)
578579
MyProc->roleId=InvalidOid;
579580
MyProc->tempNamespaceId=InvalidOid;
580581
MyProc->isBackgroundWorker=IsBackgroundWorker;
581-
MyProc->delayChkpt=0;
582+
MyProc->delayChkpt= false;
583+
MyProc->delayChkptEnd= false;
582584
MyPgXact->vacuumFlags=0;
583585
MyProc->lwWaiting= false;
584586
MyProc->lwWaitMode=0;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp