Re: pgsql: Harden new test case against force_parallel_mode = regress.

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgsql: Harden new test case against force_parallel_mode = regress.
Date: 2023-03-03 16:38:08
Message-ID: CAEze2Wic6DM3xg6B=E1Ze1xYaxJx2-6N+x-BXYQLF19dgsvTsQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Fri, 3 Mar 2023 at 17:16, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Thu, Mar 2, 2023 at 5:47 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2023-03-03 16:47:57 Re: pgsql: Harden new test case against force_parallel_mode = regress.
Previous Message Tom Lane 2023-03-03 16:37:56 Re: pgsql: Harden new test case against force_parallel_mode = regress.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-03-03 16:47:57 Re: pgsql: Harden new test case against force_parallel_mode = regress.
Previous Message Tom Lane 2023-03-03 16:37:56 Re: pgsql: Harden new test case against force_parallel_mode = regress.