Skip to content

Commit 4c34788

Browse files
author
Amit Kapila
committed
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
1 parent bd5846e commit 4c34788

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/backend/replication/logical/logical.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,7 @@ LogicalIncreaseXminForSlot(XLogRecPtr current_lsn, TransactionId xmin)
15651565
{
15661566
bool updated_xmin = false;
15671567
ReplicationSlot *slot;
1568+
bool got_new_xmin = false;
15681569

15691570
slot = MyReplicationSlot;
15701571

@@ -1602,9 +1603,19 @@ LogicalIncreaseXminForSlot(XLogRecPtr current_lsn, TransactionId xmin)
16021603
{
16031604
slot->candidate_catalog_xmin = xmin;
16041605
slot->candidate_xmin_lsn = current_lsn;
1606+
1607+
/*
1608+
* Log new xmin at an appropriate log level after releasing the
1609+
* spinlock.
1610+
*/
1611+
got_new_xmin = true;
16051612
}
16061613
SpinLockRelease(&slot->mutex);
16071614

1615+
if (got_new_xmin)
1616+
elog(DEBUG1, "got new catalog xmin %u at %X/%X", xmin,
1617+
LSN_FORMAT_ARGS(current_lsn));
1618+
16081619
/* candidate already valid with the current flush position, apply */
16091620
if (updated_xmin)
16101621
LogicalConfirmReceivedLocation(slot->data.confirmed_flush);

0 commit comments

Comments
 (0)