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.

Regards,
Bharath Rupireddy.


Reply via email to