reindexdb: Fix the index-level REINDEX with multiple jobs
authorAlexander Korotkov <akorotkov@postgresql.org>
Sun, 16 Mar 2025 11:28:22 +0000 (13:28 +0200)
committerAlexander Korotkov <akorotkov@postgresql.org>
Sun, 16 Mar 2025 11:29:15 +0000 (13:29 +0200)
commit682c5be25c28192c56e9d5e2a9ca14673a2fcf4b
tree22a1a9915e4de606541dbefc4f41688ac683903b
parent83e5763d4dddd9b24b738d8335b3cbfc2742e4ac
reindexdb: Fix the index-level REINDEX with multiple jobs

47f99a407d introduced a parallel index-level REINDEX.  The code was written
assuming that running run_reindex_command() with 'async == true' can schedule
a number of queries for a connection.  That's not true, and the second query
sent using run_reindex_command() will wait for the completion of the previous
one.

This commit fixes that by putting REINDEX commands for the same table into a
single query.

Also, this commit removes the 'async' argument from run_reindex_command(),
as only its call always passes 'async == true'.

Reported-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/202503071820.j25zn3lo4hvn%40alvherre.pgsql
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Backpatch-through: 17
src/bin/scripts/reindexdb.c