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

Commitc6043fc

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 parent28af91b commitc6043fc

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
@@ -947,6 +947,7 @@ ProcArrayClearTransaction(PGPROC *proc)
947947

948948
Assert(!(proc->statusFlags&PROC_VACUUM_STATE_MASK));
949949
Assert(!proc->delayChkpt);
950+
Assert(!proc->delayChkptEnd);
950951

951952
/*
952953
* Need to increment completion count even though transaction hasn't

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ InitProcess(void)
394394
MyProc->roleId=InvalidOid;
395395
MyProc->tempNamespaceId=InvalidOid;
396396
MyProc->isBackgroundWorker=IsBackgroundWorker;
397-
MyProc->delayChkpt=0;
397+
MyProc->delayChkpt= false;
398+
MyProc->delayChkptEnd= false;
398399
MyProc->statusFlags=0;
399400
/* NB -- autovac launcher intentionally does not set IS_AUTOVACUUM */
400401
if (IsAutoVacuumWorkerProcess())
@@ -579,7 +580,8 @@ InitAuxiliaryProcess(void)
579580
MyProc->roleId=InvalidOid;
580581
MyProc->tempNamespaceId=InvalidOid;
581582
MyProc->isBackgroundWorker=IsBackgroundWorker;
582-
MyProc->delayChkpt=0;
583+
MyProc->delayChkpt= false;
584+
MyProc->delayChkptEnd= false;
583585
MyProc->statusFlags=0;
584586
MyProc->lwWaiting= false;
585587
MyProc->lwWaitMode=0;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp