postgres.git / summary / log / commit / refs

commit    058962fdc98ea05968cd18f7b87610f9f2dd28d2
Author:   Masahiko Sawada <msawada@postgresql.org>
Date:     Thu Aug 27 19:10:46 2026 +0000
First released in: 19.0

    pg_upgrade: Read nextMultiOffset as a 64-bit value.
    
    Commit bd8d9c9bdfa widened MultiXactOffset to 64 bits and widened
    ControlData.chkpnt_nxtmxoff accordingly, but get_control_data() still
    read the "Latest checkpoint's NextMultiOffset" line with str2uint(),
    which returns unsigned int.
    
    This commit adds str2uint64(), mirroring the str2uint() helper used
    for the other control file fields, and reads the offset with it.
    
    Backpatch to v19, where MultiXactOffset was widened.
    
    Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
    Reviewed-by: Chao Li <li.evan.chao@gmail.com>
    Discussion: https://postgr.es/m/CAD21AoCvzerscfU8o4ARQ793yAGHpQ72r2x5apeC_W2-k=SLCQ@mail.gmail.com
    Backpatch-through: 19


src/bin/pg_upgrade/controldata.c | 2 +- src/bin/pg_upgrade/pg_upgrade.h | 1 + src/bin/pg_upgrade/util.c | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/bin/pg_upgrade/controldata.c b/src/bin/pg_upgrade/controldata.c index b3bd4ccde83..7543a988045 100644 --- a/src/bin/pg_upgrade/controldata.c +++ b/src/bin/pg_upgrade/controldata.c @@ -289,7 +289,7 @@ get_control_data(ClusterInfo *cluster) pg_fatal("%d: controldata retrieval problem", __LINE__); p++; /* remove ':' char */ - cluster->controldata.chkpnt_nxtmxoff = str2uint(p); + cluster->controldata.chkpnt_nxtmxoff = str2uint64(p); got_mxoff = true; } else if ((p = strstr(bufin, "First log segment after reset:")) != NULL) diff --git a/src/bin/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h index d6e5bca5792..c80e8fb4031 100644 --- a/src/bin/pg_upgrade/pg_upgrade.h +++ b/src/bin/pg_upgrade/pg_upgrade.h @@ -470,6 +470,7 @@ void cleanup_output_dirs(void); void prep_status(const char *fmt, ...) pg_attribute_printf(1, 2); void prep_status_progress(const char *fmt, ...) pg_attribute_printf(1, 2); unsigned int str2uint(const char *str); +uint64 str2uint64(const char *str); /* version.c */ diff --git a/src/bin/pg_upgrade/util.c b/src/bin/pg_upgrade/util.c index 08d6385b512..e7d7ab56445 100644 --- a/src/bin/pg_upgrade/util.c +++ b/src/bin/pg_upgrade/util.c @@ -353,3 +353,14 @@ str2uint(const char *str) { return strtoul(str, NULL, 10); } + +/* + * str2uint64() + * + * convert string to uint64 + */ +uint64 +str2uint64(const char *str) +{ + return strtou64(str, NULL, 10); +}