summaryrefslogtreecommitdiff
path: root/src/bin/pg_basebackup/pg_receivewal.c
diff options
context:
space:
mode:
authorÁlvaro Herrera <alvherre@kurilemu.de>2025-07-07 13:57:43 +0200
committerÁlvaro Herrera <alvherre@kurilemu.de>2025-07-07 13:57:43 +0200
commit2633dae2e4876a9b7cb90ba025e930a553e5107f (patch)
tree9eff715f0db067c8454a9edf60588e03795f0c2f /src/bin/pg_basebackup/pg_receivewal.c
parent62a17a92833d1eaa60d8ea372663290942a1e8eb (diff)
Standardize LSN formatting by zero padding
This commit standardizes the output format for LSNs to ensure consistent representation across various tools and messages. Previously, LSNs were inconsistently printed as `%X/%X` in some contexts, while others used zero-padding. This often led to confusion when comparing. To address this, the LSN format is now uniformly set to `%X/%08X`, ensuring the lower 32-bit part is always zero-padded to eight hexadecimal digits. Author: Japin Li <japinli@hotmail.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de> Discussion: https://postgr.es/m/ME0P300MB0445CA53CA0E4B8C1879AF84B641A@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM
Diffstat (limited to 'src/bin/pg_basebackup/pg_receivewal.c')
-rw-r--r--src/bin/pg_basebackup/pg_receivewal.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c
index e816cf58101..289ca14dcfe 100644
--- a/src/bin/pg_basebackup/pg_receivewal.c
+++ b/src/bin/pg_basebackup/pg_receivewal.c
@@ -188,14 +188,14 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
/* we assume that we get called once at the end of each segment */
if (verbose && segment_finished)
- pg_log_info("finished segment at %X/%X (timeline %u)",
+ pg_log_info("finished segment at %X/%08X (timeline %u)",
LSN_FORMAT_ARGS(xlogpos),
timeline);
if (!XLogRecPtrIsInvalid(endpos) && endpos < xlogpos)
{
if (verbose)
- pg_log_info("stopped log streaming at %X/%X (timeline %u)",
+ pg_log_info("stopped log streaming at %X/%08X (timeline %u)",
LSN_FORMAT_ARGS(xlogpos),
timeline);
time_to_stop = true;
@@ -211,7 +211,7 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
* timeline, but it's close enough for reporting purposes.
*/
if (verbose && prevtimeline != 0 && prevtimeline != timeline)
- pg_log_info("switched to timeline %u at %X/%X",
+ pg_log_info("switched to timeline %u at %X/%08X",
timeline,
LSN_FORMAT_ARGS(prevpos));
@@ -575,7 +575,7 @@ StreamLog(void)
* Start the replication
*/
if (verbose)
- pg_log_info("starting log streaming at %X/%X (timeline %u)",
+ pg_log_info("starting log streaming at %X/%08X (timeline %u)",
LSN_FORMAT_ARGS(stream.startpos),
stream.timeline);
@@ -689,7 +689,7 @@ main(int argc, char **argv)
basedir = pg_strdup(optarg);
break;
case 'E':
- if (sscanf(optarg, "%X/%X", &hi, &lo) != 2)
+ if (sscanf(optarg, "%X/%08X", &hi, &lo) != 2)
pg_fatal("could not parse end position \"%s\"", optarg);
endpos = ((uint64) hi) << 32 | lo;
break;