Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fd4d93d

Browse filesBrowse 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
Copy full SHA for fd4d93d

File tree

1 file changed

+9
-0
lines changed
Filter options

1 file changed

+9
-0
lines changed

‎src/test/modules/worker_spi/worker_spi.c

Copy file name to clipboardExpand all lines: src/test/modules/worker_spi/worker_spi.c
+9Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.