!4301 【bugfix】 修复第一轮按需回放失败后,备机failover时备节点core掉的问题

Merge pull request !4301 from 周聪/bugfix_proc_exit_core
This commit is contained in:
opengauss_bot
2023-10-17 06:08:23 +00:00
committed by Gitee

View File

@ -91,6 +91,7 @@
#include "commands/verify.h"
#include "catalog/pg_control.h"
#include "dbmind/hypopg_index.h"
#include "ddes/dms/ss_dms.h"
#include "instruments/instr_unique_sql.h"
#include "instruments/instr_user.h"
#include "instruments/percentile.h"
@ -3981,8 +3982,9 @@ static int ServerLoop(void)
result = BackendStartup(port, isConnectHaPort);
}
if (SS_CLUSTER_ONDEMAND_RECOVERY && SS_IN_REFORM &&
result != STATUS_OK && pmState == PM_WAIT_BACKENDS) {
if (SS_IN_ONDEMAND_RECOVERY && SS_IN_REFORM &&
result != STATUS_OK && pmState == PM_WAIT_BACKENDS &&
(dms_reform_failed() || dms_reform_last_failed())) {
SSOndemandProcExitIfStayWaitBackends();
}
if (result != STATUS_OK) {
@ -15123,10 +15125,10 @@ void SSOndemandProcExitIfStayWaitBackends()
failTimes++;
}
if (pmState == PM_WAIT_BACKENDS) {
ereport(WARNING, (errmsg("Proc exit because pmState stay %s for %d times, "
"when reform failed and in ondemand recovery, "
"to avoid pmState being stuck in PM_WAIT_BACKENDS.",
GetPMState(pmState), WAIT_PMSTATE_UPDATE_TRIES)));
proc_exit(1);
ereport(WARNING, (errmodule(MOD_DMS),
errmsg("[On-demand] Proc exit because pmState stay PM_WAIT_BACKENDS for %d times, "
"when reform failed and in ondemand recovery, to avoid pmState being stuck in PM_WAIT_BACKENDS.",
WAIT_PMSTATE_UPDATE_TRIES)));
_exit(0);
}
}