Don't lock tables in get_tables_to_repack()
commit : 133eba078f776268d24f82a2b3d5bf9ca31dd4c3
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 10 Jul 2026 16:10:36 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 10 Jul 2026 16:10:36 +0200
Click here for diff
When doing a whole database repack, we build a list of tables to process
taking a lock on each. But because it's a regular transaction-scoped
lock, it's automatically released immediately after building the list
anyway, which makes it not very useful. (Also, we have three ways to
obtain a list of tables to repack, and only one of them acquired this
lock.) Remove that lock acquisition, as it's useless and inconsistent.
We acquire a lock properly afterwards (and recheck that the table can
still be repacked as indicated), so we don't need to do anything other
than drop that initial lock acquisition and harden the code in
repack_is_permitted_for_relation() against possible concurrent drops.
This is similar to how vacuum does it in get_all_vacuum_rels().
In order for this to work reliably, also change
repack_is_permitted_for_relation() to cope with the possibility of the
table going away partway through. Similarly, in ExecRepack(), be
prepared for what we believed to be a table or matview to now be
something else, and skip it without erroring out, by changing
try_table_open() to try_relation_open() and testing the relkind
separately.
While at it, replace one relation_close() call in get_tables_to_repack()
with table_close() to match the table_open() that opened the catalog.
Author: ChangAo Chen <cca5507@qq.com>
Backpatch-through: 19
Discussion: https://postgr.es/m/tencent_9F290B256A3F52B66542F1140E32ECC64309@qq.com
M src/backend/commands/repack.c
Don't lock tables in get_tables_to_repack()
commit : c71d43025d7aaf12fe461ec635bd2eda220c9f4a
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 10 Jul 2026 16:10:36 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 10 Jul 2026 16:10:36 +0200
Click here for diff
When doing a whole database repack, we build a list of tables to process
taking a lock on each. But because it's a regular transaction-scoped
lock, it's automatically released immediately after building the list
anyway, which makes it not very useful. (Also, we have three ways to
obtain a list of tables to repack, and only one of them acquired this
lock.) Remove that lock acquisition, as it's useless and inconsistent.
We acquire a lock properly afterwards (and recheck that the table can
still be repacked as indicated), so we don't need to do anything other
than drop that initial lock acquisition and harden the code in
repack_is_permitted_for_relation() against possible concurrent drops.
This is similar to how vacuum does it in get_all_vacuum_rels().
In order for this to work reliably, also change
repack_is_permitted_for_relation() to cope with the possibility of the
table going away partway through. Similarly, in ExecRepack(), be
prepared for what we believed to be a table or matview to now be
something else, and skip it without erroring out, by changing
try_table_open() to try_relation_open() and testing the relkind
separately.
While at it, replace one relation_close() call in get_tables_to_repack()
with table_close() to match the table_open() that opened the catalog.
Author: ChangAo Chen <cca5507@qq.com>
Backpatch-through: 19
Discussion: https://postgr.es/m/tencent_9F290B256A3F52B66542F1140E32ECC64309@qq.com
M src/backend/commands/repack.c
Stamp 14.23.
commit : 4e1a23c0ea0be0214c6806baa212886cee8f14a6
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 15:51:39 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 15:51:39 -0400
Click here for diff
M configure
M configure.ac
Last-minute updates for release notes.
commit : 93741c9db09709ebe05d5f59ee7852c3ad4981a9
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 14:54:40 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 14:54:40 -0400
Click here for diff
Stamp 15.18.
commit : 005c1971a2926fbb9caf5a1ad634cd17a42bfd3c
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 15:49:58 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 15:49:58 -0400
Click here for diff
M configure
M configure.ac
Last-minute updates for release notes.
commit : 78f1b471f991307cea4aa0d95f2d957601a1b8cd
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 14:54:40 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 14:54:40 -0400
Click here for diff
Stamp 16.14.
commit : 0d1c00c624fa7367d4a895f44381887757289682
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 15:48:18 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 15:48:18 -0400
Click here for diff
M configure
M configure.ac
M meson.build
Last-minute updates for release notes.
commit : 878e171244f7c1280201a04aa420b78c4a2d08d3
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 14:54:40 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 14:54:40 -0400
Click here for diff
Stamp 17.10.
commit : 25c49f3a4a742ba283f5cc43cc7f1d361552e917
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 15:46:41 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 15:46:41 -0400
Click here for diff
M configure
M configure.ac
M meson.build
Last-minute updates for release notes.
commit : 25d938dbcb19ba172068159c0f22826d7cc681ea
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 14:54:40 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 14:54:40 -0400
Click here for diff
Stamp 18.4.
commit : f5cc81719e6da4cbdb1f797c48b693e91018153a
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 15:44:35 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 15:44:35 -0400
Click here for diff
M configure
M configure.ac
M meson.build
Last-minute updates for release notes.
commit : bbd12e8010561dab2c745d2ece0e94d102bef2ea
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 14:54:40 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 11 May 2026 14:54:40 -0400
Click here for diff
Stamp 14.22.
commit : 966473719c7f8067848dc79b58da0fb17ed136b1
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 23 Feb 2026 17:03:30 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 23 Feb 2026 17:03:30 -0500
Click here for diff
M configure
M configure.ac
Translation updates
commit : 7917762558545fbe16c0c9e9b97b83a30c11eaa8
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 23 Feb 2026 14:06:33 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 23 Feb 2026 14:06:33 +0100
Click here for diff
Stamp 15.17.
commit : 3eb6f61958ac5027a18791a828a0c7a47accf211
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 23 Feb 2026 17:01:47 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 23 Feb 2026 17:01:47 -0500
Click here for diff
M configure
M configure.ac
Translation updates
commit : 7063b9e92b25caaa27c8cc4ec37ef85fe9e63cb7
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 23 Feb 2026 14:03:47 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 23 Feb 2026 14:03:47 +0100
Click here for diff
Stamp 16.13.
commit : 776479eed63aac4185e57adaf7db1ce0810a4d3e
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 23 Feb 2026 17:00:20 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 23 Feb 2026 17:00:20 -0500
Click here for diff
M configure
M configure.ac
M meson.build
Translation updates
commit : 96802648aa2fc114f1d8728540494e422059b9ab
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 23 Feb 2026 14:02:22 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 23 Feb 2026 14:02:22 +0100
Click here for diff