Parallel vacuum workers prevent the oldest xmin from advancing
Masahiko Sawada <sawada.mshk@gmail.com>
From: Masahiko Sawada <sawada.mshk@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-10-06T07:10:50Z
Lists: pgsql-hackers
Attachments
- copy_status_flags.patch (application/octet-stream) patch
Hi all, A customer reported that during parallel index vacuum, the oldest xmin doesn't advance. Normally, the calculation of oldest xmin (ComputeXidHorizons()) ignores xmin/xid of processes having PROC_IN_VACUUM flag in MyProc->statusFlags. But since parallel vacuum workers don’t set their statusFlags, the xmin of the parallel vacuum worker is considered to calculate the oldest xmin. This issue happens from PG13 where the parallel vacuum was introduced. I think it's a bug. Moreover, the same problem happens also in CREATE/REINDEX CONCURRENTLY case in PG14 or later for the same reason (due to lack of PROC_IN_SAFE_IC flag). To fix it, I thought that we change the create index code and the vacuum code so that the individual parallel worker sets its status flags according to the leader’s one. But ISTM it’d be better to copy the leader’s status flags to workers in ParallelWorkerMain(). I've attached a patch for HEAD. Regards, -- Masahiko Sawada EDB: https://www.enterprisedb.com/
Commits
-
Fix parallel operations that prevent oldest xmin from advancing.
- 33b6dd83e26f 13.6 landed
- ead49ebc07a7 14.2 landed
- 0f0cfb494004 15.0 landed