From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use conditional variable to wait for next MultiXact offset
Date: Sun, 07 Apr 2024 18:34:24 +0000
Message-ID: <E1rtXLT-0010Uy-Ft@gemulon.postgresql.org> (raw)
Use conditional variable to wait for next MultiXact offset
In one multixact.c edge case, we need a mechanism to wait for one
multixact offset to be written before being allowed to read the next
one. We used to handle this case by sleeping for one millisecond and
retrying, but such sleeps have been reported as problematic in
production cases. We can avoid the problem by using a condition
variable: readers sleep on it and then every creator of multixacts
broadcasts into the CV when creation is sufficiently far along.
Author: Kyotaro Horiguchi <horikyotajntt@gmail.com>
Reviewed-by: Andrey Borodin <amborodin@acm.org>
Discussion: https://postgr.es/m/47A598F4-B4E7-4029-8FEC-A06A6C3CB4B5@yandex-team.ru
Discussion: https://postgr.es/m/20200515.090333.24867479329066911.horikyota.ntt
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a0e0fb1ba56ff4323542c75ce997a41d31ad28a0
Modified Files
--------------
src/backend/access/transam/multixact.c | 30 +++++++++++++++++++++++--
src/backend/utils/activity/wait_event_names.txt | 1 +
2 files changed, 29 insertions(+), 2 deletions(-)
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-committers@postgresql.org
Cc: alvherre@alvh.no-ip.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Use conditional variable to wait for next MultiXact offset
In-Reply-To: <E1rtXLT-0010Uy-Ft@gemulon.postgresql.org>
* 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