forked from huawei/openGauss-server
fix archive slot could not flush lsn
Offering: openGaussDev More detail: Modify slot advance part Match-id-3060b2f1218e72eb5ffc28d1742fbc15360ef534
This commit is contained in:
parent
704eed3368
commit
1062a1c1f6
|
|
@ -2172,18 +2172,22 @@ void AdvanceArchiveSlot(XLogRecPtr restart_pos)
|
||||||
ReplicationSlot *slot = &t_thrd.slot_cxt.ReplicationSlotCtl->replication_slots[*slot_idx];
|
ReplicationSlot *slot = &t_thrd.slot_cxt.ReplicationSlotCtl->replication_slots[*slot_idx];
|
||||||
SpinLockAcquire(&slot->mutex);
|
SpinLockAcquire(&slot->mutex);
|
||||||
if (slot->in_use == true && slot->archive_config != NULL) {
|
if (slot->in_use == true && slot->archive_config != NULL) {
|
||||||
|
t_thrd.slot_cxt.MyReplicationSlot = slot;
|
||||||
slot->data.restart_lsn = restart_pos;
|
slot->data.restart_lsn = restart_pos;
|
||||||
extra_content = slot->extra_content;
|
extra_content = slot->extra_content;
|
||||||
|
SpinLockRelease(&slot->mutex);
|
||||||
} else {
|
} else {
|
||||||
|
SpinLockRelease(&slot->mutex);
|
||||||
ereport(WARNING,
|
ereport(WARNING,
|
||||||
(errcode_for_file_access(), errmsg("slot idx not valid, obs slot %X/%X not advance ",
|
(errcode_for_file_access(), errmsg("slot idx not valid, obs slot %X/%X not advance ",
|
||||||
(uint32)(restart_pos >> 32), (uint32)(restart_pos))));
|
(uint32)(restart_pos >> 32), (uint32)(restart_pos))));
|
||||||
}
|
}
|
||||||
SpinLockRelease(&slot->mutex);
|
|
||||||
if (extra_content == NULL) {
|
if (extra_content == NULL) {
|
||||||
ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||||
errmsg("archive thread could not get slot extra content when advance slot.")));
|
errmsg("archive thread could not get slot extra content when advance slot.")));
|
||||||
}
|
}
|
||||||
|
ReplicationSlotMarkDirty();
|
||||||
log_slot_advance(&slot->data, extra_content);
|
log_slot_advance(&slot->data, extra_content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue