Skip to content

Commit fd4d93d

Browse files
committed
worker_spi: Fix test failure with BGWORKER_BYPASS_ALLOWCONN
A bgworker can spawn parallel workers of its own when executing queries, and if the worker uses BGWORKER_BYPASS_ALLOWCONN while the database it is connected to does not allow connections, a parallel worker would fail to startup. In the case of this module, the step checking for the presence of the schema to create was spawning a worker, failing the last test introduced by 991bb0f. This issue could be reproduced with debug_parallel_query = 'regress', for example. Per buildfarm member crake.
1 parent 991bb0f commit fd4d93d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/test/modules/worker_spi/worker_spi.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,15 @@ worker_spi_main(Datum main_arg)
173173
BackgroundWorkerInitializeConnection(worker_spi_database,
174174
worker_spi_role, flags);
175175

176+
/*
177+
* Disable parallel query for workers started with BYPASS_ALLOWCONN so as
178+
* these don't attempt connections to the database that may not allow
179+
* that.
180+
*/
181+
if (flags & BGWORKER_BYPASS_ALLOWCONN)
182+
SetConfigOption("max_parallel_workers_per_gather", "0",
183+
PGC_USERSET, PGC_S_OVERRIDE);
184+
176185
elog(LOG, "%s initialized with %s.%s",
177186
MyBgworkerEntry->bgw_name, table->schema, table->name);
178187
initialize_worker_spi(table);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy