pgsql: Change pg_lsn_in_internal() to use soft error reporting

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Change pg_lsn_in_internal() to use soft error reporting
Date: 2025-09-05 04:00:06
Message-ID: E1uuNcM-000ZAo-1d@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Change pg_lsn_in_internal() to use soft error reporting

pg_lsn includes pg_lsn_in_internal() for the purpose of parsing a LSN
position for the GUC recovery_target_lsn (21f428ebde39). It relies on a
boolean called "have_error" that would be set when the LSN parsing
fails, then let its callers handle any errors.

d9f7f5d32f20 has added support for soft error reporting. This commit
removes some boilerplate code and switches the routine to use soft error
reporting directly, giving to the callers of pg_lsn_in_internal()
the possibility to be fed the error message generated on failure.

pg_lsn_in_internal() routine is renamed to pg_lsn_in_safe(), for
consistency with other similar routines that are given an escontext.

Author: Amul Sul <sulamul(at)gmail(dot)com>
Reviewed-by: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAAJ_b96No5h5tRuR+KhcC44YcYUCw8WAHuLoqqyyop8_k3+JDQ@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/access/transam/xlogrecovery.c | 6 +++---
src/backend/utils/adt/pg_lsn.c | 35 +++++++++++++------------------
src/include/utils/pg_lsn.h | 5 ++++-
3 files changed, 22 insertions(+), 24 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-09-05 04:57:21 pgsql: Switch some numeric-related functions to use soft error reportin
Previous Message Nathan Bossart 2025-09-04 20:35:37 pgsql: Revert recent change to RequestNamedLWLockTranche().