Re: Exposing the lock manager's WaitForLockers() to SQL

From: Will Mortensen <will(at)extrahop(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Andres Freund <andres(at)anarazel(dot)de>, Marco Slot <marco(dot)slot(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Yvonne Chen <yvonne(at)extrahop(dot)com>, Jacob Speidel <jacob(at)extrahop(dot)com>
Subject: Re: Exposing the lock manager's WaitForLockers() to SQL
Date: 2024-03-09 04:25:36
Message-ID: CAMpnoC5piX2Z9FsXG27+-ZyyYEL6D6rYvn+tvVQkkFLPiE5VHQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Rebased and fixed conflicts.

FWIW re: Andrey's comment in his excellent CF summary email[0]: we're
currently using vanilla Postgres (via Gentoo) on single nodes, and not
anything fancy like Citus. The Citus relationship is just that we were
inspired by Marco's blog post there. We have a variety of clients
written in different languages that generally don't coordinate their
table modifications, and Marco's scheme merely requires them to use
sequences idiomatically, which we can just about manage. :-)

This feature is then a performance optimization to support this scheme
while avoiding the case where one writer holding a RowExclusiveLock
blocks the reader from taking a ShareLock which in turn prevents other
writers from taking a RowExclusiveLock for a long time. Instead, the
reader can wait for the first writer without taking any locks or
blocking later writers. I've illustrated this difference in the
isolation tests.

Still hoping we can get this into 17. :-)

[0] https://www.postgresql.org/message-id/C8D65462-0888-4484-A72C-C99A94381ECD%40yandex-team.ru

Attachment Content-Type Size
v10-0003-Add-pg_wait_for_lockers-function.patch application/octet-stream 29.4 KB
v10-0001-Refactor-GetLockConflicts-into-more-general-GetL.patch application/octet-stream 11.1 KB
v10-0002-Allow-specifying-single-lockmode-in-WaitForLocke.patch application/octet-stream 7.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-03-09 06:48:59 Re: Add comment to specify timeout unit in ConditionVariableTimedSleep()
Previous Message Yugo NAGATA 2024-03-09 02:57:36 Re: Remove unnecessary code from psql's watch command