1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-12 21:01:52 +03:00

Log new catalog xmin candidate in LogicalIncreaseXminForSlot().

Similar to LogicalIncreaseRestartDecodingForSlot() add a debug message to
LogicalIncreaseXminForSlot() reporting a new catalog_xmin candidate.

This just adds additional diagnostic information during logical decoding that
can aid debugging.

Author: Ashutosh Bapat
Reviewed-by: Masahiko Sawada, Amit Kapila
Discussion: https://postgr.es/m/CAExHW5usQWbiUz0hHOCu5twS1O9DvpcPojf6sor=8q--VUuMbA@mail.gmail.com
This commit is contained in:
Amit Kapila
2021-09-07 08:07:11 +05:30
parent bd5846e4a9
commit 4c3478859b

View File

@ -1565,6 +1565,7 @@ LogicalIncreaseXminForSlot(XLogRecPtr current_lsn, TransactionId xmin)
{ {
bool updated_xmin = false; bool updated_xmin = false;
ReplicationSlot *slot; ReplicationSlot *slot;
bool got_new_xmin = false;
slot = MyReplicationSlot; slot = MyReplicationSlot;
@ -1602,9 +1603,19 @@ LogicalIncreaseXminForSlot(XLogRecPtr current_lsn, TransactionId xmin)
{ {
slot->candidate_catalog_xmin = xmin; slot->candidate_catalog_xmin = xmin;
slot->candidate_xmin_lsn = current_lsn; slot->candidate_xmin_lsn = current_lsn;
/*
* Log new xmin at an appropriate log level after releasing the
* spinlock.
*/
got_new_xmin = true;
} }
SpinLockRelease(&slot->mutex); SpinLockRelease(&slot->mutex);
if (got_new_xmin)
elog(DEBUG1, "got new catalog xmin %u at %X/%X", xmin,
LSN_FORMAT_ARGS(current_lsn));
/* candidate already valid with the current flush position, apply */ /* candidate already valid with the current flush position, apply */
if (updated_xmin) if (updated_xmin)
LogicalConfirmReceivedLocation(slot->data.confirmed_flush); LogicalConfirmReceivedLocation(slot->data.confirmed_flush);