summaryrefslogtreecommitdiff
path: root/src/include/access/xlogdefs.h
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2021-02-23 10:14:38 +0100
committerPeter Eisentraut <peter@eisentraut.org>2021-02-23 10:27:02 +0100
commit6f6f284c7ee44264eb3e128e2bf54d9276711d11 (patch)
treec861d32584f751b28a065b98c03e1dd1370daa10 /src/include/access/xlogdefs.h
parentade89ba5f408e6034db7cc8a2c9b7858f5a214c4 (diff)
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
Diffstat (limited to 'src/include/access/xlogdefs.h')
-rw-r--r--src/include/access/xlogdefs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/include/access/xlogdefs.h b/src/include/access/xlogdefs.h
index 65836d5bc65..0940b64ca6b 100644
--- a/src/include/access/xlogdefs.h
+++ b/src/include/access/xlogdefs.h
@@ -36,6 +36,13 @@ typedef uint64 XLogRecPtr;
#define FirstNormalUnloggedLSN ((XLogRecPtr) 1000)
/*
+ * Handy macro for printing XLogRecPtr in conventional format, e.g.,
+ *
+ * printf("%X/%X", LSN_FORMAT_ARGS(lsn));
+ */
+#define LSN_FORMAT_ARGS(lsn) (AssertVariableIsOfTypeMacro((lsn), XLogRecPtr), (uint32) ((lsn) >> 32)), ((uint32) (lsn))
+
+/*
* XLogSegNo - physical log file sequence number.
*/
typedef uint64 XLogSegNo;