worker_spi: Fix test failure with BGWORKER_BYPASS_ROLELOGINCHECK
authorMichael Paquier <michael@paquier.xyz>
Mon, 16 Oct 2023 04:45:39 +0000 (13:45 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 16 Oct 2023 04:45:39 +0000 (13:45 +0900)
This is a consequence of 4817da51f69a that has bumped up
max_worker_processes, where now the last worker started by the test
would be able to start by itself a parallel worker because there are
more slots available.  This did not show up before as the number of
bgworkers reached exactly 8, as known as the previous limit, at the end
of the test.

Per report from buildfarm member crake, reproducible with
debug_parallel_query = regress in the same fashion as fd4d93d269c0.

src/test/modules/worker_spi/worker_spi.c

index c26ffe1766e9aeb119932b061fc65b6133ef7952..1348181216a737d5617bc98ce5faa185482388eb 100644 (file)
@@ -174,11 +174,11 @@ worker_spi_main(Datum main_arg)
                                                                                         worker_spi_role, flags);
 
        /*
-        * Disable parallel query for workers started with BYPASS_ALLOWCONN so as
-        * these don't attempt connections to the database that may not allow
-        * that.
+        * Disable parallel query for workers started with BYPASS_ALLOWCONN or
+        * BGWORKER_BYPASS_ALLOWCONN so as these don't attempt connections using a
+        * database or a role that may not allow that.
         */
-       if (flags & BGWORKER_BYPASS_ALLOWCONN)
+       if ((flags & (BGWORKER_BYPASS_ALLOWCONN | BGWORKER_BYPASS_ROLELOGINCHECK)))
                SetConfigOption("max_parallel_workers_per_gather", "0",
                                                PGC_USERSET, PGC_S_OVERRIDE);