pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add "ABI_compatibility" regions to wait_event_names.txt
Date: Fri, 05 Apr 2024 00:04:37 +0000
Message-ID: <E1rsX4O-000YRu-HK@gemulon.postgresql.org> (raw)

Add "ABI_compatibility" regions to wait_event_names.txt

The current design behind the automatic generation of the C code and
documentation related to wait events introduced in fa88928470b5 does not
offer a way to attach new wait events without breaking ABI
compatibility, as all the events are forcibly reordered for each section
in the input file wait_event_names.txt.  Adding new wait events to
stable branches is something that has happened in the past, 0b6517a3b79a
being a recent example of that with VERSION_FILE_SYNC, so we need a way
to generate any C code for wait events while maintaining compatibility
on stable branches already released.

This commit solves this issue by adding a new region called
"ABI_compatibility" (keyword could be updated to something else if
someone had a better idea) to each section of wait_event_names.txt, so
as one can add new wait events to stable branches in
wait_event_names.txt while keeping the code ABI-compatible.
"ABI_compatibility" has no impact on the documentation generated: all
the wait events of one section are still alphabetically ordered.  LWLock
and Lock sections generate their C code elsewhere, so they do not need
an "ABI_compatibility" region.

For example, let's imagine a wait_event_names.txt like that:
Section: ClassName - Foo
FOO_1   "Waiting in Foo 1"
FOO_2   "Waiting in Foo 2"
ABI_compatibility:
NEW_FOO_1       "Waiting in New Foo 1"
NEW_BAR_1       "Waiting in New Bar 1"

This results in the following enum, where the events in the ABI region
are listed last with the same ordering as in wait_event_names.txt:
typedef enum
{
    WAIT_EVENT_FOO_1,
    WAIT_EVENT_FOO_2,
    WAIT_EVENT_NEW_FOO_1,
    WAIT_EVENT_NEW_BAR_1
} WaitEventFoo;

New wait events added in stable branches should be added at the end of
each ABI_compatibility region, and ABI_compatibility should remain empty
on HEAD and unreleased stable branches.

This design has been suggested by Noah Misch and me.

Reported-by: Noah Misch
Author: Bertrand Drouvot
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/20240317183114.16@rfd.leadboat.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f98dbdeb51d1175c07258cd2bd4b56f560dfc3cf

Modified Files
--------------
.../utils/activity/generate-wait_event_types.pl    | 28 +++++++++++++++++++++-
src/backend/utils/activity/wait_event_names.txt    | 18 ++++++++++++++
2 files changed, 45 insertions(+), 1 deletion(-)



Message-ID: <E1rsX4O-000YRu-HK@gemulon.postgresql.org>
Permalink:  ../E1rsX4O-000YRu-HK@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rsX4O-000YRu-HK@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: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add "ABI_compatibility" regions to wait_event_names.txt
  In-Reply-To: <E1rsX4O-000YRu-HK@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