mirror of
https://github.com/postgres/postgres.git
synced 2025-10-19 15:49:24 +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:
@@ -1016,7 +1016,7 @@ apply_handle_commit(StringInfo s)
|
||||
if (commit_data.commit_lsn != remote_final_lsn)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_PROTOCOL_VIOLATION),
|
||||
errmsg_internal("incorrect commit LSN %X/%X in commit message (expected %X/%X)",
|
||||
errmsg_internal("incorrect commit LSN %X/%08X in commit message (expected %X/%08X)",
|
||||
LSN_FORMAT_ARGS(commit_data.commit_lsn),
|
||||
LSN_FORMAT_ARGS(remote_final_lsn))));
|
||||
|
||||
@@ -1108,7 +1108,7 @@ apply_handle_prepare(StringInfo s)
|
||||
if (prepare_data.prepare_lsn != remote_final_lsn)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_PROTOCOL_VIOLATION),
|
||||
errmsg_internal("incorrect prepare LSN %X/%X in prepare message (expected %X/%X)",
|
||||
errmsg_internal("incorrect prepare LSN %X/%08X in prepare message (expected %X/%08X)",
|
||||
LSN_FORMAT_ARGS(prepare_data.prepare_lsn),
|
||||
LSN_FORMAT_ARGS(remote_final_lsn))));
|
||||
|
||||
@@ -3903,7 +3903,7 @@ send_feedback(XLogRecPtr recvpos, bool force, bool requestReply)
|
||||
pq_sendint64(reply_message, now); /* sendTime */
|
||||
pq_sendbyte(reply_message, requestReply); /* replyRequested */
|
||||
|
||||
elog(DEBUG2, "sending feedback (force %d) to recv %X/%X, write %X/%X, flush %X/%X",
|
||||
elog(DEBUG2, "sending feedback (force %d) to recv %X/%08X, write %X/%08X, flush %X/%08X",
|
||||
force,
|
||||
LSN_FORMAT_ARGS(recvpos),
|
||||
LSN_FORMAT_ARGS(writepos),
|
||||
@@ -4909,7 +4909,7 @@ maybe_start_skipping_changes(XLogRecPtr finish_lsn)
|
||||
skip_xact_finish_lsn = finish_lsn;
|
||||
|
||||
ereport(LOG,
|
||||
errmsg("logical replication starts skipping transaction at LSN %X/%X",
|
||||
errmsg("logical replication starts skipping transaction at LSN %X/%08X",
|
||||
LSN_FORMAT_ARGS(skip_xact_finish_lsn)));
|
||||
}
|
||||
|
||||
@@ -4923,8 +4923,8 @@ stop_skipping_changes(void)
|
||||
return;
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("logical replication completed skipping transaction at LSN %X/%X",
|
||||
LSN_FORMAT_ARGS(skip_xact_finish_lsn))));
|
||||
errmsg("logical replication completed skipping transaction at LSN %X/%08X",
|
||||
LSN_FORMAT_ARGS(skip_xact_finish_lsn)));
|
||||
|
||||
/* Stop skipping changes */
|
||||
skip_xact_finish_lsn = InvalidXLogRecPtr;
|
||||
@@ -5012,7 +5012,7 @@ clear_subscription_skip_lsn(XLogRecPtr finish_lsn)
|
||||
if (myskiplsn != finish_lsn)
|
||||
ereport(WARNING,
|
||||
errmsg("skip-LSN of subscription \"%s\" cleared", MySubscription->name),
|
||||
errdetail("Remote transaction's finish WAL location (LSN) %X/%X did not match skip-LSN %X/%X.",
|
||||
errdetail("Remote transaction's finish WAL location (LSN) %X/%08X did not match skip-LSN %X/%08X.",
|
||||
LSN_FORMAT_ARGS(finish_lsn),
|
||||
LSN_FORMAT_ARGS(myskiplsn)));
|
||||
}
|
||||
@@ -5049,7 +5049,7 @@ apply_error_callback(void *arg)
|
||||
logicalrep_message_type(errarg->command),
|
||||
errarg->remote_xid);
|
||||
else
|
||||
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" in transaction %u, finished at %X/%X",
|
||||
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" in transaction %u, finished at %X/%08X",
|
||||
errarg->origin_name,
|
||||
logicalrep_message_type(errarg->command),
|
||||
errarg->remote_xid,
|
||||
@@ -5067,7 +5067,7 @@ apply_error_callback(void *arg)
|
||||
errarg->rel->remoterel.relname,
|
||||
errarg->remote_xid);
|
||||
else
|
||||
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" for replication target relation \"%s.%s\" in transaction %u, finished at %X/%X",
|
||||
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" for replication target relation \"%s.%s\" in transaction %u, finished at %X/%08X",
|
||||
errarg->origin_name,
|
||||
logicalrep_message_type(errarg->command),
|
||||
errarg->rel->remoterel.nspname,
|
||||
@@ -5086,7 +5086,7 @@ apply_error_callback(void *arg)
|
||||
errarg->rel->remoterel.attnames[errarg->remote_attnum],
|
||||
errarg->remote_xid);
|
||||
else
|
||||
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" for replication target relation \"%s.%s\" column \"%s\" in transaction %u, finished at %X/%X",
|
||||
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" for replication target relation \"%s.%s\" column \"%s\" in transaction %u, finished at %X/%08X",
|
||||
errarg->origin_name,
|
||||
logicalrep_message_type(errarg->command),
|
||||
errarg->rel->remoterel.nspname,
|
||||
|
Reference in New Issue
Block a user