pgsql: Lock the TOAST table early in REPACK (CONCURRENTLY) - Mailing list pgsql-committers

From Álvaro Herrera
Subject pgsql: Lock the TOAST table early in REPACK (CONCURRENTLY)
Date
Msg-id E1xBD31-00000001cLC-3hs1@gemulon.postgresql.org
Whole thread
List pgsql-committers
Lock the TOAST table early in REPACK (CONCURRENTLY)

The decoding worker records the relfilenumber of the TOAST table when it
starts, and skips changes stored under any other one, but the TOAST
table was not locked until the data copy began.  If VACUUM FULL rewrote
it while the worker was starting, concurrent updates of TOASTed columns
were silently lost.

Fix by locking the TOAST table in cluster_rel() in the concurrent case,
before the worker starts.

Author: Shihao Zhong <zhong950419@gmail.com>
Reported-by: Thom Brown <thom@linux.com>
Backpatch-through: 19
Discussion: https://postgr.es/m/CAA-aLv5MF6BLL+BWvix2Yw+CBardtH43AofPReQunhDZPNBtuA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1813f951cad59ea7f86063831d0222c429989c91

Modified Files
--------------
src/backend/commands/repack.c                      |  34 ++++-
src/backend/commands/repack_worker.c               |   5 +-
.../injection_points/expected/repack_toast.out     | 152 ++++++++++++++++++++-
.../injection_points/specs/repack_toast.spec       |  45 ++++++
4 files changed, 229 insertions(+), 7 deletions(-)


pgsql-committers by date:

Previous
From: Amit Kapila
Date:
Subject: pgsql: Update .abi-compliance-history for change in struct LogicalRepRe
Next
From: Álvaro Herrera
Date:
Subject: Re: pgsql: Lock the TOAST table early in REPACK (CONCURRENTLY)