Hi Tom,
Sorry to clarify it wouldn’t fix the race condition, but it would allow me to achieve my goal of “wait on an advisory lock until a timeout has elapsed” without requiring the use of a non-infinite lock_timeout, thereby avoiding the race condition altogether.
-Mike
From: Tom Lane
Sent: Saturday, November 12, 2022 1:51 PM
To: Mike Adelson
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17686: SELECT pg_advisory_lock(...) with low lock_timeout sometimes times out but the lock is acquired
Mike Adelson <mike.adelson314@gmail.com> writes:
> Glad to have the race condition confirmed. In my view the “real” fix
> here would be to offer an advisory locking function that accepts a
> timeout.
How would that remove the low-level race condition?
regards, tom lane