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

Commit8d061ac

Browse files
committed
Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS
This is a slight, convenient semantics change from what commit0f0cfb4 ("Fix parallel operations that prevent oldest xmin fromadvancing") introduced that lets us simplify the coding in the one placewhere it is used.Backpatch to 13. This is related to commit6fea655 ("TightenComputeXidHorizons' handling of walsenders") rewriting the code sitewhere this is used, which has not yet been backpatched, but it may wellbe in the future.Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>Discussion:https://postgr.es/m/202204191637.eldwa2exvguw@alvherre.pgsql
1 parenta1e7616 commit8d061ac

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2685,17 +2685,14 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc)
26852685
TransactionIdIsNormal(xid)&&
26862686
TransactionIdPrecedesOrEquals(xid,xmin))
26872687
{
2688-
/* Install xmin */
2688+
/*
2689+
* Install xmin and propagate the statusFlags that affect how the
2690+
* value is interpreted by vacuum.
2691+
*/
26892692
MyProc->xmin=TransactionXmin=xmin;
2690-
2691-
/* walsender cheats by passing proc == MyProc, don't check its flags */
2692-
if (proc!=MyProc)
2693-
{
2694-
/* Flags being copied must be valid copy-able flags. */
2695-
Assert((proc->statusFlags& (~PROC_COPYABLE_FLAGS))==0);
2696-
MyProc->statusFlags=proc->statusFlags;
2697-
ProcGlobal->statusFlags[MyProc->pgxactoff]=MyProc->statusFlags;
2698-
}
2693+
MyProc->statusFlags= (MyProc->statusFlags& ~PROC_XMIN_FLAGS) |
2694+
(proc->statusFlags&PROC_XMIN_FLAGS);
2695+
ProcGlobal->statusFlags[MyProc->pgxactoff]=MyProc->statusFlags;
26992696

27002697
result= true;
27012698
}

‎src/include/storage/proc.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,10 @@ struct XidCache
6969
(PROC_IN_VACUUM | PROC_IN_SAFE_IC | PROC_VACUUM_FOR_WRAPAROUND)
7070

7171
/*
72-
* Flags that are valid to copy from another proc, the parallel leader
73-
* process in practice. Currently, flags that are set during parallel
74-
* vacuum and parallel index creation are allowed.
72+
* Xmin-related flags. Make sure any flags that affect how the process' Xmin
73+
* value is interpreted by VACUUM are included here.
7574
*/
76-
#definePROC_COPYABLE_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC)
75+
#definePROC_XMIN_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC)
7776

7877
/*
7978
* We allow a small number of "weak" relation locks (AccessShareLock,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp