pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18014: Releasing catcache entries makes schema_to_xmlschema() fail when parallel workers are used
Date: Thu, 20 Jul 2023 16:28:02 +0900 (JST)
Message-ID: <20230720.162802.905550494964943231.horikyota.ntt@gmail.com> (raw)
In-Reply-To: <b2dcd258-82f1-dfe3-498e-9f652a0c0c4b@gmail.com>
References: <18014-28c81cb79d44295d@postgresql.org>
	<b2dcd258-82f1-dfe3-498e-9f652a0c0c4b@gmail.com>

At Sun, 16 Jul 2023 23:00:01 +0300, Alexander Lakhin <exclusion@gmail.com> wrote in 
> The parallel worker doesn't have a lock on pg_class_oid_index before
> executing the query, so it gets the lock and res == LOCKACQUIRE_OK
> (not
> LOCKACQUIRE_ALREADY_CLEAR as in a regular backend case), after that it
> processes invalidation messages (this can make the backend use a newer
> catalog snapshot), and at the end it does systable_endscan() ->
> index_close() -> UnlockRelationId() -> LockRelease()...
> Thus, on a next iteration it gets the lock anew, with the res ==
> LOCKACQUIRE_OK
> again, and all that ceremony repeated.
> 
> It's not clear to me, whether this parallel worker behavior is
> expected and
> if so, what to fix to avoid the test failure.

That is, the function is not parallel-safe. In fact it is marked as
'r' in pg_proc.proparallel. So, the real question appears to be how it
ended up running in a paralell worker.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center





view thread (24+ messages)  latest in thread

Message-ID: <20230720.162802.905550494964943231.horikyota.ntt@gmail.com>
Permalink:  ../20230720.162802.905550494964943231.horikyota.ntt@gmail.com/
Also on:    postgresql.org/message-id/20230720.162802.905550494964943231.horikyota.ntt@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: horikyota.ntt@gmail.com, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18014: Releasing catcache entries makes schema_to_xmlschema() fail when parallel workers are used
  In-Reply-To: <20230720.162802.905550494964943231.horikyota.ntt@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox