0003-reset-slot-in-acquire.patch
text/x-patch
Filename: 0003-reset-slot-in-acquire.patch
Type: text/x-patch
Part: 2
Patch
Format: format-patch
Series: patch 0003
Subject: reset slot in acquire
| File | + | − |
|---|---|---|
| src/backend/replication/slot.c | 24 | 0 |
From 2437880b414e61cbfd02dca7a5d70ca9853c8a51 Mon Sep 17 00:00:00 2001 From: tomas <tomas> Date: Mon, 11 Nov 2024 20:52:01 +0100 Subject: [PATCH 3/5] reset slot in acquire --- src/backend/replication/slot.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index 01e854b4486..c398b91f40c 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -456,6 +456,30 @@ retry: /* We made this slot active, so it's ours now. */ MyReplicationSlot = s; + + /* + * Reset the time since the slot has become inactive as the slot is active + * now. + */ + SpinLockAcquire(&s->mutex); + + /* + * ReplicationSlotCreate would do this: + * s->effective_xmin = InvalidTransactionId; + * s->effective_catalog_xmin = InvalidTransactionId; + * s->last_saved_confirmed_flush = InvalidXLogRecPtr; + * + * But we do this more like RestoreSlotFromDisk, as if we loaded the + * slot from disk. + */ + s->effective_xmin = s->data.xmin; + s->effective_catalog_xmin = s->data.catalog_xmin; + + s->candidate_catalog_xmin = InvalidTransactionId; + s->candidate_xmin_lsn = InvalidXLogRecPtr; + s->candidate_restart_valid = InvalidXLogRecPtr; + s->candidate_restart_lsn = InvalidXLogRecPtr; + SpinLockRelease(&s->mutex); } /* -- 2.39.5