From 2901293d8b8996b349da4b85daeb1d884e260600 Mon Sep 17 00:00:00 2001 From: maxiang Date: Sat, 29 May 2021 10:12:08 +0800 Subject: [PATCH] update src/gausskernel/storage/replication/logical/logical.cpp. --- src/gausskernel/storage/replication/logical/logical.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gausskernel/storage/replication/logical/logical.cpp b/src/gausskernel/storage/replication/logical/logical.cpp index 127c6e69d..3924db918 100644 --- a/src/gausskernel/storage/replication/logical/logical.cpp +++ b/src/gausskernel/storage/replication/logical/logical.cpp @@ -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. */