Re: race condition in pg_class

From: Noah Misch <noah(at)leadboat(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Smolkin Grigory <smallkeen(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: race condition in pg_class
Date: 2024-05-13 18:54:03
Message-ID: 20240513185403.d7@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2024-05-13 18:58:25 Re: cataloguing NOT NULL constraints
Previous Message Tom Lane 2024-05-13 18:22:06 Re: Is there any chance to get some kind of a result set sifting mechanism in Postgres?