mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17: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:
@@ -31,8 +31,7 @@ replorigin_desc(StringInfo buf, XLogReaderState *record)
|
||||
|
||||
appendStringInfo(buf, "set %u; lsn %X/%X; force: %d",
|
||||
xlrec->node_id,
|
||||
(uint32) (xlrec->remote_lsn >> 32),
|
||||
(uint32) xlrec->remote_lsn,
|
||||
LSN_FORMAT_ARGS(xlrec->remote_lsn),
|
||||
xlrec->force);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -306,8 +306,7 @@ xact_desc_commit(StringInfo buf, uint8 info, xl_xact_commit *xlrec, RepOriginId
|
||||
{
|
||||
appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s",
|
||||
origin_id,
|
||||
(uint32) (parsed.origin_lsn >> 32),
|
||||
(uint32) parsed.origin_lsn,
|
||||
LSN_FORMAT_ARGS(parsed.origin_lsn),
|
||||
timestamptz_to_str(parsed.origin_timestamp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
|
||||
"oldest xid %u in DB %u; oldest multi %u in DB %u; "
|
||||
"oldest/newest commit timestamp xid: %u/%u; "
|
||||
"oldest running xid %u; %s",
|
||||
(uint32) (checkpoint->redo >> 32), (uint32) checkpoint->redo,
|
||||
LSN_FORMAT_ARGS(checkpoint->redo),
|
||||
checkpoint->ThisTimeLineID,
|
||||
checkpoint->PrevTimeLineID,
|
||||
checkpoint->fullPageWrites ? "true" : "false",
|
||||
@@ -89,8 +89,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
|
||||
XLogRecPtr startpoint;
|
||||
|
||||
memcpy(&startpoint, rec, sizeof(XLogRecPtr));
|
||||
appendStringInfo(buf, "%X/%X",
|
||||
(uint32) (startpoint >> 32), (uint32) startpoint);
|
||||
appendStringInfo(buf, "%X/%X", LSN_FORMAT_ARGS(startpoint));
|
||||
}
|
||||
else if (info == XLOG_PARAMETER_CHANGE)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user