!3619 【资源池化】解决startup线程判断reform失败出现漏判的情况

Merge pull request !3619 from 董宁/bugfix2_up
This commit is contained in:
opengauss_bot
2023-06-26 09:26:02 +00:00
committed by Gitee
4 changed files with 20 additions and 13 deletions

View File

@ -100,11 +100,6 @@ bool SSRecoveryNodes()
{
bool result = false;
while (true) {
if (dms_reform_failed()) {
SSWaitStartupExit();
result = false;
break;
}
/** why use lock:
* time1 startup thread: update IsRecoveryDone, not finish UpdateControlFile
* time2 reform_proc: finish reform, think ControlFile is ok
@ -134,6 +129,12 @@ bool SSRecoveryNodes()
result = true;
break;
}
if (dms_reform_failed()) {
SSWaitStartupExit();
result = false;
break;
}
pg_usleep(REFORM_WAIT_TIME);
}
return result;

View File

@ -486,13 +486,7 @@ void DMSUninit()
int32 DMSWaitReform()
{
uint32 has_offline; /* currently not used in openGauss */
int ret = dms_wait_reform(&has_offline);
if (ret) {
while (g_instance.dms_cxt.SSReformInfo.in_reform) {
pg_usleep(5000L);
}
}
return ret;
return dms_wait_reform(&has_offline);
}
static bool DMSReformCheckStartup()
@ -530,4 +524,15 @@ bool DMSWaitInitStartup()
}
return true;
}
void StartupWaitReform()
{
while (g_instance.dms_cxt.SSReformInfo.in_reform) {
if (dms_reform_failed() || dms_reform_last_failed()) {
ereport(LOG, (errmsg("[SS reform] reform failed, startup no need wait.")));
break;
}
pg_usleep(5000L);
}
}

View File

@ -10563,7 +10563,7 @@ void StartupXLOG(void)
#endif
if (ENABLE_DMS && ENABLE_REFORM && !SS_PRIMARY_DEMOTED && !DORADO_STANDBY_CLUSTER) {
DMSWaitReform();
StartupWaitReform();
}
}

View File

@ -44,5 +44,6 @@ bool DMSWaitInitStartup();
void DMSInitLogger();
void DMSRefreshLogger(char *log_field, unsigned long long *value);
void GetSSLogPath(char *sslog_path);
void StartupWaitReform();
#endif