From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Replace pg_controldata output fields with macros for better code manageability |
Date: | 2022-02-02 23:02:39 |
Message-ID: | YfsNj+FOz9669xVd@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Jan 29, 2022 at 08:00:53PM +0530, Bharath Rupireddy wrote:
> Hi,
>
> While working on another pg_control patch, I observed that the
> pg_controldata output fields such as "Latest checkpoint's
> TimeLineID:", "Latest checkpoint's NextOID:'' and so on, are being
> used in pg_resetwal.c, pg_controldata.c and pg_upgrade/controldata.c.
> Direct usage of these fields in many places doesn't look good and can
> be error prone if we try to change the text in one place and forget in
> another place. I'm thinking of having those fields as macros in
> pg_control.h, something like [1] and use it all the places. This will
> be a good idea for better code manageability IMO.
>
> Thoughts?
>
> [1]
> #define PG_CONTROL_FIELD_VERSION_NUMBER "pg_control version number:"
> #define PG_CONTROL_FIELD_CATALOG_NUMBER "Catalog version number:"
> #define PG_CONTROL_FIELD_CHECKPOINT_TLI "Latest checkpoint's TimeLineID:"
> #define PG_CONTROL_FIELD_CHECKPOINT_PREV_TLI "Latest checkpoint's
> PrevTimeLineID:"
> #define PG_CONTROL_FIELD_CHECKPOINT_OLDESTXID "Latest checkpoint's oldestXID:"
> #define PG_CONTROL_FIELD_CHECKPOINT_OLDESTXID_DB "Latest checkpoint's
> oldestXID's DB:"
> and so on.
That seems like a very good idea.
--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com
If only the physical world exists, free will is an illusion.
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Smith | 2022-02-03 00:31:00 | Re: row filtering for logical replication |
Previous Message | Tom Lane | 2022-02-02 22:52:56 | Re: Server-side base backup: why superuser, not pg_write_server_files? |