pgsql: Simplify reindexdb coding

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Simplify reindexdb coding
Date: 2025-03-18 13:23:06
Message-ID: E1tuWuQ-0036CC-0i@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Simplify reindexdb coding

get_parallel_object_list() was trying to serve two masters, and it was
doing a bad job at both. In particular, it treated the given user_list
as an output argument, but only sometimes. This was confusing, and the
two paths through it didn't really have all that much in common, so the
complexity wasn't buying us much. Split it in two:
get_parallel_tables_list() handles the straightforward cases for
schemas, databases and tables, takes one list as argument and returns
another list.

A new function get_parallel_tabidx_list() handles the case for indexes.
This takes a list as argument and outputs two lists, just like
get_parallel_object_list used to do, but now the API is clearer (IMO
anyway). Another difference is that accompanying the list of indexes
now we have a list of tables as an OID list rather than a
fully-qualified table name list. This makes some comparisons easier,
and we don't really need the names of the tables, just their OIDs.
(This requires atooid, which requires <stdlib.h>).

Author: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Author: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Discussion: https://postgr.es/m/CAEudQArfqr0-s0VVPSEh=0kgOgBJvFNdGW=xSL5rBcr0WDMQYQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f76892c9ff7e5f2dcb4073310d1a5273f47d1d9d

Modified Files
--------------
src/bin/scripts/reindexdb.c | 275 +++++++++++++++++++------------------
src/bin/scripts/t/090_reindexdb.pl | 2 +
2 files changed, 141 insertions(+), 136 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2025-03-18 13:30:24 pgsql: Add some new hooks so extensions can add details to EXPLAIN.
Previous Message Melanie Plageman 2025-03-18 13:08:47 pgsql: Increase default maintenance_io_concurrency to 16