diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c index 3fe1774a1e9..e941bb491d8 100644 --- a/src/backend/replication/logical/logical.c +++ b/src/backend/replication/logical/logical.c @@ -1774,6 +1774,7 @@ LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart /* don't overwrite if have a newer restart lsn */ if (restart_lsn <= slot->data.restart_lsn) { + SpinLockRelease(&slot->mutex); } /* @@ -1784,6 +1785,7 @@ LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart { slot->candidate_restart_valid = current_lsn; slot->candidate_restart_lsn = restart_lsn; + SpinLockRelease(&slot->mutex); /* our candidate can directly be used */ updated_lsn = true; @@ -1794,7 +1796,7 @@ LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart * might never end up updating if the receiver acks too slowly. A missed * value here will just cause some extra effort after reconnecting. */ - if (slot->candidate_restart_valid == InvalidXLogRecPtr) + else if (slot->candidate_restart_valid == InvalidXLogRecPtr) { slot->candidate_restart_valid = current_lsn; slot->candidate_restart_lsn = restart_lsn;