!1360 修复逻辑解码bug

Merge pull request !1360 from Cross-罗/my_own_2_0
This commit is contained in:
opengauss-bot 2021-11-16 13:30:17 +00:00 committed by Gitee
commit 61cd9e6bcc
4 changed files with 11 additions and 4 deletions

View File

@ -1157,7 +1157,7 @@ static void initLastTaskLsn()
t_thrd.arch.last_arch_time = TIME_GET_MILLISEC(tv);
volatile ReplicationSlot* obs_archive_slot = getObsReplicationSlot();
if (obs_archive_slot != NULL && !IsServerModeStandby()) {
XLogRecPtr targetLsn = getRestartLsnFromSlot();
targetLsn = getRestartLsnFromSlot();
if (targetLsn != InvalidXLogRecPtr) {
t_thrd.arch.pitr_task_last_lsn = targetLsn;
advanceObsSlot(t_thrd.arch.pitr_task_last_lsn);

View File

@ -260,6 +260,14 @@ void StartupProcessMain(void)
StartupXLOG();
}
/*
* If the archiver is still alive, we need to restart the archiver in startup.
*/
if (g_instance.pid_cxt.PgArchPID != 0 && getObsReplicationSlot() != NULL) {
gs_signal_send(g_instance.pid_cxt.PgArchPID, SIGTERM);
gs_signal_send(g_instance.pid_cxt.PgArchPID, SIGUSR2);
}
/*
* Exit normally. Exit code 0 tells postmaster that we completed recovery
* successfully.

View File

@ -1943,7 +1943,7 @@ void advanceObsSlot(XLogRecPtr restart_pos)
gettimeofday(&tv, NULL);
long current = TIME_GET_MILLISEC(tv);
long diff = current - t_thrd.arch.last_advance_slot_time;
if (diff > t_thrd.arch.advance_slot_wait_interval) {
if (diff > t_thrd.arch.advance_slot_wait_interval && t_thrd.xlog_cxt.server_mode == PRIMARY_MODE) {
flushSlot(current);
}
} else {

View File

@ -856,8 +856,7 @@ void redo_slot_advance(const ReplicationSlotPersistentData *slotInfo)
* for logical replication slot, the Slot->data.database is VALID.
*/
#ifndef ENABLE_MULTIPLE_NODES
if (IsReplicationSlotActive(NameStr(slotInfo->name)) && t_thrd.slot_cxt.MyReplicationSlot != NULL &&
t_thrd.slot_cxt.MyReplicationSlot->data.database != InvalidOid) {
if (IsReplicationSlotActive(NameStr(slotInfo->name)) && slotInfo->database != InvalidOid) {
return;
}
#endif