1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-16 16:42:29 +03:00

Simplify printing of LSNs

Add a macro LSN_FORMAT_ARGS for use in printf-style printing of LSNs.
Convert all applicable code to use it.

Reviewed-by: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/flat/CAExHW5ub5NaTELZ3hJUCE6amuvqAtsSxc7O+uK7y4t9Rrk23cw@mail.gmail.com
This commit is contained in:
Peter Eisentraut
2021-02-23 10:14:38 +01:00
parent ade89ba5f4
commit 6f6f284c7e
36 changed files with 212 additions and 308 deletions

View File

@@ -344,7 +344,7 @@ main(int argc, char **argv)
findCommonAncestorTimeline(&divergerec, &lastcommontliIndex);
pg_log_info("servers diverged at WAL location %X/%X on timeline %u",
(uint32) (divergerec >> 32), (uint32) divergerec,
LSN_FORMAT_ARGS(divergerec),
targetHistory[lastcommontliIndex].tli);
/*
@@ -401,8 +401,7 @@ main(int argc, char **argv)
findLastCheckpoint(datadir_target, divergerec, lastcommontliIndex,
&chkptrec, &chkpttli, &chkptredo, restore_command);
pg_log_info("rewinding from last common checkpoint at %X/%X on timeline %u",
(uint32) (chkptrec >> 32), (uint32) chkptrec,
chkpttli);
LSN_FORMAT_ARGS(chkptrec), chkpttli);
/* Initialize the hash table to track the status of each file */
filehash_init();
@@ -859,8 +858,8 @@ getTimelineHistory(ControlFileData *controlFile, int *nentries)
entry = &history[i];
pg_log_debug("%d: %X/%X - %X/%X", entry->tli,
(uint32) (entry->begin >> 32), (uint32) (entry->begin),
(uint32) (entry->end >> 32), (uint32) (entry->end));
LSN_FORMAT_ARGS(entry->begin),
LSN_FORMAT_ARGS(entry->end));
}
}
@@ -954,8 +953,8 @@ createBackupLabel(XLogRecPtr startpoint, TimeLineID starttli, XLogRecPtr checkpo
"BACKUP FROM: standby\n"
"START TIME: %s\n",
/* omit LABEL: line */
(uint32) (startpoint >> 32), (uint32) startpoint, xlogfilename,
(uint32) (checkpointloc >> 32), (uint32) checkpointloc,
LSN_FORMAT_ARGS(startpoint), xlogfilename,
LSN_FORMAT_ARGS(checkpointloc),
strfbuf);
if (len >= sizeof(buf))
pg_fatal("backup label buffer too small"); /* shouldn't happen */