Re: pgsql: Harden new test case against force_parallel_mode = regress. - Mailing list pgsql-hackers

From Matthias van de Meent
Subject Re: pgsql: Harden new test case against force_parallel_mode = regress.
Date
Msg-id CAEze2Wic6DM3xg6B=E1Ze1xYaxJx2-6N+x-BXYQLF19dgsvTsQ@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: Harden new test case against force_parallel_mode = regress.  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Fri, 3 Mar 2023 at 17:16, Robert Haas <robertmhaas@gmail.com> wrote:
>
> On Thu, Mar 2, 2023 at 5:47 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Harden new test case against force_parallel_mode = regress.
> >
> > Per buildfarm: worker processes can't see a role created in
> > the current transaction.
>
> Now why would that happen? Surely the snapshot for each command is
> passed down from leader to worker, and the worker is not free to
> invent a snapshot from nothing.

Probably because we nitialize which user and database to use in the
backend before we load the parent process' snapshot:

in ParallelWorkerMain (parallel.c, as of HEAD @ b6a0d469):

  /* Restore database connection. */
  BackgroundWorkerInitializeConnectionByOid(fps->database_id,
                                  fps->authenticated_user_id,
                                  0);
[...]

  /* Crank up a transaction state appropriate to a parallel worker. */
  tstatespace = shm_toc_lookup(toc, PARALLEL_KEY_TRANSACTION_STATE, false);
  StartParallelWorkerTransaction(tstatespace);

  /* Restore combo CID state. */
  combocidspace = shm_toc_lookup(toc, PARALLEL_KEY_COMBO_CID, false);
  RestoreComboCIDState(combocidspace);

-Matthias



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgsql: Harden new test case against force_parallel_mode = regress.
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Harden new test case against force_parallel_mode = regress.