mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Fix stale comment in parallel_vacuum_main().
The comment claimed that a parallel vacuum worker has only the PROC_IN_VACUUM flag because parallel vacuum is not supported for autovacuum, but commit1ff3180ca0allowed autovacuum to use parallel vacuum workers. The assertion itself still holds: the leader, whether a backend running VACUUM or an autovacuum worker, sets PROC_IN_VACUUM before taking its snapshot, and a parallel worker inherits the flag when importing the leader's snapshot. The leader's other flags don't reach the worker, since the snapshot import copies only the PROC_XMIN_FLAGS bits and PROC_IS_AUTOVACUUM is never set on parallel workers, which run as regular background workers. Reword the comment to explain that. Oversight in commit1ff3180ca0. Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/CALj2ACVwQ4WABqq8Lnf+VZEJ45jcTFhyFLFr_ctfS4=QLL-r5w@mail.gmail.com Backpatch-through: 19
This commit is contained in:
@@ -1209,8 +1209,16 @@ parallel_vacuum_main(dsm_segment *seg, shm_toc *toc)
|
|||||||
ErrorContextCallback errcallback;
|
ErrorContextCallback errcallback;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A parallel vacuum worker must have only PROC_IN_VACUUM flag since we
|
* A parallel vacuum worker carries only the PROC_IN_VACUUM flag. The
|
||||||
* don't support parallel vacuum for autovacuum as of now.
|
* leader, whether it's a backend running a VACUUM command or an
|
||||||
|
* autovacuum worker, sets PROC_IN_VACUUM when it starts vacuuming the
|
||||||
|
* table, and the worker inherits the flag by importing the leader's
|
||||||
|
* snapshot (see ProcArrayInstallRestoredXmin). The leader's other flags
|
||||||
|
* don't reach the worker: the snapshot import copies only the
|
||||||
|
* PROC_XMIN_FLAGS bits, so PROC_VACUUM_FOR_WRAPAROUND isn't carried
|
||||||
|
* over, and PROC_IS_AUTOVACUUM is never set on the worker in the first
|
||||||
|
* place since parallel workers run as regular background workers, not
|
||||||
|
* autovacuum workers.
|
||||||
*/
|
*/
|
||||||
Assert(MyProc->statusFlags == PROC_IN_VACUUM);
|
Assert(MyProc->statusFlags == PROC_IN_VACUUM);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user