pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve test_lwlock_tranches
Date: Sun, 05 Apr 2026 18:11:33 +0000
Message-ID: <E1w9Rwa-00376C-2O@gemulon.postgresql.org> (raw)

Improve test_lwlock_tranches

While working on refactoring how shmem is allocated, I made a mistake
where the main LWLock array did not reserve space for the LWLocks
allocated with RequestNamedLWLockTranche(), and the test still
passed. Matthias van de Meent spotted that before it got committed,
but in order to catch such mistakes in the future, add checks in
test_lwlock_tranches that the locks allocated with
RequestNamedLWLockTranche() can be acquired and released.

Another change is to stop requesting multiple tranches with the same
name with RequestNamedLWLockTranche(). As soon as I started to test
using the locks I realized that's bogus, and the next commit will
forbid it. Keep test coverage for duplicates requested with
LWLockNewTrancheId() for now, but make it more clear that that's what
the test does.

Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://www.postgresql.org/message-id/463a28db-0c0b-4af6-bac6-3891828bbbfe@iki.fi
Discussion: https://www.postgresql.org/message-id/CAEze2WjgCROMMXY0+j8FFdm3iFcr7By-+6Mwiz=PgGSEydiW3A@mail.gmail...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/92a685e4070d01653daac1d60de6c155723a5c68

Modified Files
--------------
.../expected/test_lwlock_tranches.out              | 61 +++++++++++----
.../sql/test_lwlock_tranches.sql                   | 44 +++++++++--
.../test_lwlock_tranches--1.0.sql                  |  7 +-
.../test_lwlock_tranches/test_lwlock_tranches.c    | 90 +++++++++++++---------
4 files changed, 146 insertions(+), 56 deletions(-)



Message-ID: <E1w9Rwa-00376C-2O@gemulon.postgresql.org>
Permalink:  ../E1w9Rwa-00376C-2O@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w9Rwa-00376C-2O@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: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Improve test_lwlock_tranches
  In-Reply-To: <E1w9Rwa-00376C-2O@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