From 1062a1c1f6f6760eea46e726cd4631d7f31c5ddd Mon Sep 17 00:00:00 2001 From: openGaussDev Date: Tue, 8 Mar 2022 12:10:28 +0800 Subject: [PATCH] fix archive slot could not flush lsn Offering: openGaussDev More detail: Modify slot advance part Match-id-3060b2f1218e72eb5ffc28d1742fbc15360ef534 --- src/gausskernel/storage/replication/slot.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gausskernel/storage/replication/slot.cpp b/src/gausskernel/storage/replication/slot.cpp index a9bbd8c3e..e90dcf216 100755 --- a/src/gausskernel/storage/replication/slot.cpp +++ b/src/gausskernel/storage/replication/slot.cpp @@ -2172,18 +2172,22 @@ void AdvanceArchiveSlot(XLogRecPtr restart_pos) ReplicationSlot *slot = &t_thrd.slot_cxt.ReplicationSlotCtl->replication_slots[*slot_idx]; SpinLockAcquire(&slot->mutex); if (slot->in_use == true && slot->archive_config != NULL) { + t_thrd.slot_cxt.MyReplicationSlot = slot; slot->data.restart_lsn = restart_pos; extra_content = slot->extra_content; + SpinLockRelease(&slot->mutex); } else { + SpinLockRelease(&slot->mutex); ereport(WARNING, (errcode_for_file_access(), errmsg("slot idx not valid, obs slot %X/%X not advance ", (uint32)(restart_pos >> 32), (uint32)(restart_pos)))); } - SpinLockRelease(&slot->mutex); + if (extra_content == NULL) { ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("archive thread could not get slot extra content when advance slot."))); } + ReplicationSlotMarkDirty(); log_slot_advance(&slot->data, extra_content); } }