mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
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
This commit is contained in:
@@ -38,7 +38,10 @@ typedef uint64 XLogRecPtr;
|
||||
/*
|
||||
* Handy macro for printing XLogRecPtr in conventional format, e.g.,
|
||||
*
|
||||
* printf("%X/%X", LSN_FORMAT_ARGS(lsn));
|
||||
* printf("%X/08X", LSN_FORMAT_ARGS(lsn));
|
||||
*
|
||||
* To avoid breaking translatable messages, we're directly applying the
|
||||
* LSN format instead of using a macro.
|
||||
*/
|
||||
#define LSN_FORMAT_ARGS(lsn) (AssertVariableIsOfTypeMacro((lsn), XLogRecPtr), (uint32) ((lsn) >> 32)), ((uint32) (lsn))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user