From: Álvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Adjust signature of cluster_rel() and its subroutines
Date: Fri, 10 Jan 2025 12:14:58 +0000
Message-ID: <E1tWDuk-000pGa-FX@gemulon.postgresql.org> (raw)
Adjust signature of cluster_rel() and its subroutines
cluster_rel() receives the OID of the relation to process, which it
opens and locks; but then its subroutine copy_table_data() also receives
the relation OID and opens it by itself. This is a bit wasteful. It's
better to have cluster_rel() receive the relation already open, and pass
it down to its subroutines as necessary; then cluster_rel closes the rel
before returning. This simplifies things.
But a better motivation to make this change is that a future command to
do logical-decoding-based "concurrent VACUUM FULL" will need to release
all locks on the relation (and possibly on the clustering index) at some
point. Since it makes little sense to keep the relation reference
without the lock, the cluster_rel() function will also close it (and
the index). With this arrangement, neither the function nor its
subroutines need open extra references, which, again, makes things simpler.
Author: Antonin Houska <ah@cybertec.at>
Discussion: https://postgr.es/m/82651.1720540558@antos
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/cc811f92bac5c80253c8a22e43409722cab4c05b
Modified Files
--------------
src/backend/commands/cluster.c | 135 +++++++++++++++++++++--------------------
src/backend/commands/matview.c | 2 +-
src/backend/commands/vacuum.c | 9 ++-
src/include/commands/cluster.h | 2 +-
4 files changed, 75 insertions(+), 73 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: alvherre@alvh.no-ip.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Adjust signature of cluster_rel() and its subroutines
In-Reply-To: <E1tWDuk-000pGa-FX@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox