Widen Object ID counter to 8 bytes This commit adds a new routine called GetNewObjectId8() in varsup.c, which is able to retrieve a 8-byte OID, based on the next OID retrieved from the control file. GetNewObjectId() is kept compatible with its origin, where we still check that the lower 32 bits of the counter do not wraparound, while handling the FirstNormalObjectId case.
This change is combined with an update of the control file, with CheckPoint.nextOid enlarged from Oid to Oid8. pg_control_checkpoint(), pg_resetwal and pg_upgrade are updated to adapt to this change, to make sure that the value is not truncated due to 32-bit limitations when used, making an upgrade to a newer version where 8-byte is supported a transparent operation. A couple of comments in the xlog redo logic referred to wraparound issues, which is not the case anymore with this change in place, so refresh these. This change is required to be able to support external TOAST pointers based on Oid8, under discussion, and can be used for other purposes. Tests are added for pg_upgrade (2^32 value carried across upgrades), pg_resetwal and pg_control_checkpoint(), hence across all the tools that need to be covered by this change. Bump catalog version. Bump PG_CONTROL_VERSION. Bump XLOG_PAGE_MAGIC, due to XLOG_NEXTOID. Author: Michael Paquier <[email protected]> Reviewed-by: Greg Burd <[email protected]> Reviewed-by: Bharath Rupireddy <[email protected]> Reviewed-by: Yugo Nagata <[email protected]> Discussion: https://postgr.es/m/[email protected] Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/cb298616463d6e4f2c360e8d07b83b526fad375f Modified Files -------------- doc/src/sgml/func/func-info.sgml | 2 +- doc/src/sgml/ref/pg_resetwal.sgml | 10 +++--- src/backend/access/rmgrdesc/xlogdesc.c | 8 ++--- src/backend/access/transam/varsup.c | 59 +++++++++++++++++++++---------- src/backend/access/transam/xlog.c | 26 +++++++------- src/backend/access/transam/xlogrecovery.c | 2 +- src/backend/utils/misc/pg_controldata.c | 2 +- src/bin/pg_controldata/pg_controldata.c | 2 +- src/bin/pg_resetwal/pg_resetwal.c | 10 +++--- src/bin/pg_resetwal/t/001_basic.pl | 17 +++++++++ src/bin/pg_upgrade/controldata.c | 2 +- src/bin/pg_upgrade/pg_upgrade.c | 2 +- src/bin/pg_upgrade/pg_upgrade.h | 2 +- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 25 +++++++++++++ src/include/access/transam.h | 8 +++-- src/include/access/xlog.h | 2 +- src/include/access/xlog_internal.h | 2 +- src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_control.h | 4 +-- src/include/catalog/pg_proc.dat | 2 +- 20 files changed, 129 insertions(+), 60 deletions(-)
