agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve handling of concurrent checksum requests
Date: Thu, 30 Apr 2026 11:46:34 +0000
Message-ID: <E1wIPqk-003SOf-0z@gemulon.postgresql.org> (raw)
Improve handling of concurrent checksum requests
When pg_{enable|disable}_data_checksums is called while checksums are
being enabled or disabled, the already running launcher is detected
and the new desired state is recorded. Processing will then pick up
the new state and change its operation to fulfill the new request.
If the same state is requested but with different cost values, the
new cost values will take effect on the next relation processed.
The previous coding had a complex logic of starting a new launcher
for this, which is now avoided with the shared mem structure instead
used to signal current processing.
This makes the logic more robust, and fixes a bug where the launcher
would erroneously revert back to the "off" state.
Access to the shared memory is also protected with LWLocks in all
cases. Since the shmem structure is used for signalling between
the worker and the launcher, and there can be only one of each,
there were no concurrency issues detected but it's better to stick
to proper locking protocol should this ever be updated to handle
multiple workers.
Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Tomas Vondra <tomas@vondra.me>
Reviewed-by: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Discussion: https://postgr.es/m/9197F930-DDEB-4CAC-82A2-16FEC715CCE8@yesql.se
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/bf25e5571b325875e0e48bac2e59a820918f2d6a
Modified Files
--------------
src/backend/access/transam/xlog.c | 33 ++++++++-
src/backend/postmaster/datachecksum_state.c | 100 ++++++++++++++++++++++------
src/include/access/xlog.h | 2 +
3 files changed, 112 insertions(+), 23 deletions(-)
Message-ID: <E1wIPqk-003SOf-0z@gemulon.postgresql.org>
Permalink: ../E1wIPqk-003SOf-0z@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1wIPqk-003SOf-0z@gemulon.postgresql.org
reply
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: dgustafsson@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Improve handling of concurrent checksum requests
In-Reply-To: <E1wIPqk-003SOf-0z@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox