Re: race condition in pg_class - Mailing list pgsql-hackers

From Noah Misch
Subject Re: race condition in pg_class
Date
Msg-id 20240513185403.d7@rfd.leadboat.com
Whole thread Raw
In response to Re: race condition in pg_class  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Mon, May 13, 2024 at 04:59:59PM +0900, Michael Paquier wrote:
> About inplace050-tests-inj-v1.patch.
> 
> +    /* Check if blocked_pid is in injection_wait(). */
> +    proc = BackendPidGetProc(blocked_pid);
> +    if (proc == NULL)
> +        PG_RETURN_BOOL(false);    /* session gone: definitely unblocked */
> +    wait_event =
> +        pgstat_get_wait_event(UINT32_ACCESS_ONCE(proc->wait_event_info));
> +    if (wait_event && strncmp("INJECTION_POINT(",
> +                              wait_event,
> +                              strlen("INJECTION_POINT(")) == 0)
> +        PG_RETURN_BOOL(true);
> 
> Hmm.  I am not sure that this is the right interface for the job
> because this is not only related to injection points but to the
> monitoring of a one or more wait events when running a permutation
> step.

Could you say more about that?  Permutation steps don't monitor wait events
today.  This patch would be the first instance of that.

> Perhaps this is something that should be linked to the spec
> files with some property area listing the wait events we're expected
> to wait on instead when running a step that we know will wait?

The spec syntax doesn't distinguish contention types at all.  The isolation
tester's needs are limited to distinguishing:

  (a) process is waiting on another test session
  (b) process is waiting on automatic background activity (autovacuum, mainly)

Automatic background activity doesn't make a process enter or leave
injection_wait(), so all injection point wait events fall in (a).  (The tester
ignores (b), since those clear up without intervention.  Failing to ignore
them, as the tester did long ago, made output unstable.)



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Is there any chance to get some kind of a result set sifting mechanism in Postgres?
Next
From: Robert Haas
Date:
Subject: Re: cataloguing NOT NULL constraints