update src/gausskernel/storage/replication/logical/logical.cpp.

This commit is contained in:
maxiang 2021-05-29 10:18:28 +08:00 committed by Gitee
parent ef48e48294
commit 6f90fd61ef
1 changed files with 8 additions and 0 deletions

View File

@ -825,6 +825,14 @@ void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr re
*/
void LogicalConfirmReceivedLocation(XLogRecPtr lsn)
{
/*
* Check if the slot is not moving backwards. Logical slots have confirmed
* consumption up to confirmed_lsn, meaning that data older than that is
* not available anymore.
*/
if (XLByteLE(lsn, t_thrd.slot_cxt.MyReplicationSlot->data.confirmed_flush))
return;
Assert(!XLByteEQ(lsn, InvalidXLogRecPtr));
(void)LWLockAcquire(LogicalReplicationSlotPersistentDataLock, LW_EXCLUSIVE);
/* Do an unlocked check for candidate_lsn first. */