Обсуждение: pgsql: reindexdb: Add the index-level REINDEX with multiple jobs

Поиск
Список
Период
Сортировка

pgsql: reindexdb: Add the index-level REINDEX with multiple jobs

От
Alexander Korotkov
Дата:
reindexdb: Add the index-level REINDEX with multiple jobs

Straight-forward index-level REINDEX is not supported with multiple jobs as
we cannot control the concurrent processing of multiple indexes depending on
the same relation.  Instead, we dedicate the whole table to certain reindex
job.  Thus, if indexes in the lists belong to different tables, that gives us
a fair level of parallelism.

This commit teaches get_parallel_object_list() to fetch table names for
indexes in the case of index-level REINDEX.  The same tables are grouped
together in the output order, and the list of indexes is also rebuilt to
match that order.  Later during processingof that list, we push indexes
belonging to the same table into the same job.

Discussion: https://postgr.es/m/CACG%3DezZU_VwDi-1PN8RUSE6mcYG%2BYx1NH_rJO4%2BKe-mKqLp%3DNw%40mail.gmail.com
Author: Maxim Orlov, Svetlana Derevyanko, Alexander Korotkov
Reviewed-by: Michael Paquier

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/47f99a407de224df6f9c43697d0a9c0a5598b250

Modified Files
--------------
doc/src/sgml/ref/reindexdb.sgml    |   3 +-
src/bin/scripts/reindexdb.c        | 146 +++++++++++++++++++++++++++++++------
src/bin/scripts/t/090_reindexdb.pl |   8 +-
3 files changed, 130 insertions(+), 27 deletions(-)


Re: pgsql: reindexdb: Add the index-level REINDEX with multiple jobs

От
David Rowley
Дата:
On Mon, 25 Mar 2024 at 13:07, Alexander Korotkov
<akorotkov@postgresql.org> wrote:
> reindexdb: Add the index-level REINDEX with multiple jobs

This seems to cause a new compiler warning:

reindexdb.c: In function ‘reindex_one_database’:
reindexdb.c:437:45: warning: ‘indices_tables_cell’ may be used
uninitialized [-Wmaybe-uninitialized]
  437 |                         indices_tables_cell = indices_tables_cell->next;
      |                         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
reindexdb.c:280:31: note: ‘indices_tables_cell’ was declared here
  280 |         SimpleStringListCell *indices_tables_cell;
      |                               ^~~~~~~~~~~~~~~~~~~

which is causing problems in -Werror buildfarm members like mamba [1]

David

 [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=mamba&dt=2024-03-25%2001%3A03%3A35