From be7e778ee1df0b4ffec54ae22e2703ec1313f34d Mon Sep 17 00:00:00 2001 From: dongning12 Date: Sun, 25 Jun 2023 10:57:50 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=B5=84=E6=BA=90=E6=B1=A0=E5=8C=96]=E8=A7=A3?= =?UTF-8?q?=E5=86=B3startup=E5=85=B3=E4=BA=8Ereform=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=87=BA=E7=8E=B0=E6=BC=8F=E5=88=A4=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ddes/adapter/ss_dms_recovery.cpp | 11 ++++++----- src/gausskernel/ddes/adapter/ss_init.cpp | 19 ++++++++++++------- .../storage/access/transam/xlog.cpp | 2 +- src/include/ddes/dms/ss_init.h | 1 + 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/gausskernel/ddes/adapter/ss_dms_recovery.cpp b/src/gausskernel/ddes/adapter/ss_dms_recovery.cpp index 540e4a4ee..de58c272b 100644 --- a/src/gausskernel/ddes/adapter/ss_dms_recovery.cpp +++ b/src/gausskernel/ddes/adapter/ss_dms_recovery.cpp @@ -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; diff --git a/src/gausskernel/ddes/adapter/ss_init.cpp b/src/gausskernel/ddes/adapter/ss_init.cpp index 666bdf950..b9ec4ada7 100644 --- a/src/gausskernel/ddes/adapter/ss_init.cpp +++ b/src/gausskernel/ddes/adapter/ss_init.cpp @@ -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); + } } \ No newline at end of file diff --git a/src/gausskernel/storage/access/transam/xlog.cpp b/src/gausskernel/storage/access/transam/xlog.cpp index f830e6eec..bcded19fa 100755 --- a/src/gausskernel/storage/access/transam/xlog.cpp +++ b/src/gausskernel/storage/access/transam/xlog.cpp @@ -10563,7 +10563,7 @@ void StartupXLOG(void) #endif if (ENABLE_DMS && ENABLE_REFORM && !SS_PRIMARY_DEMOTED && !DORADO_STANDBY_CLUSTER) { - DMSWaitReform(); + StartupWaitReform(); } } diff --git a/src/include/ddes/dms/ss_init.h b/src/include/ddes/dms/ss_init.h index 28451a991..6bc61a5c0 100644 --- a/src/include/ddes/dms/ss_init.h +++ b/src/include/ddes/dms/ss_init.h @@ -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