You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-1222 - improved the waitforsystemactive function
This commit is contained in:
@ -8832,6 +8832,92 @@ namespace oam
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
/******************************************************************************************
|
||||
* @brief waitForActive
|
||||
*
|
||||
* purpose: wait for system to be active
|
||||
*
|
||||
******************************************************************************************/
|
||||
void Oam::waitForActive()
|
||||
{
|
||||
SystemStatus systemstatus;
|
||||
SystemProcessStatus systemprocessstatus;
|
||||
bool bfirst = true;
|
||||
|
||||
for (int i = 0 ; i < 18 ; i ++)
|
||||
{
|
||||
sleep (10);
|
||||
try
|
||||
{
|
||||
getSystemStatus(systemstatus);
|
||||
if (systemstatus.SystemOpState == ACTIVE)
|
||||
{
|
||||
BRM::DBRM dbrm;
|
||||
try {
|
||||
int rc = dbrm.getSystemQueryReady();
|
||||
if (rc == -1 ) {
|
||||
writeLog("waitForActive: getSystemQueryReady error return: startSystem failed", LOG_TYPE_ERROR);
|
||||
exceptionControl("waitForActive", API_FAILURE);
|
||||
}
|
||||
|
||||
if ( rc != 0 )
|
||||
return;
|
||||
|
||||
writeLog("waitForActive: getSystemQueryReady not ready", LOG_TYPE_DEBUG);
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
}
|
||||
|
||||
if (systemstatus.SystemOpState == FAILED)
|
||||
{
|
||||
exceptionControl("waitForActive", API_FAILURE);
|
||||
}
|
||||
|
||||
if (systemstatus.SystemOpState == MAN_OFFLINE)
|
||||
{
|
||||
exceptionControl("waitForActive", API_FAILURE);
|
||||
}
|
||||
|
||||
cout << "." << flush;
|
||||
|
||||
// Check DMLProc for a switch to BUSY_INIT.
|
||||
// In such a case, we need to print a message that rollbacks
|
||||
// are occurring and will take some time.
|
||||
if (bfirst) // Once we've printed our message, no need to waste cpu looking
|
||||
{
|
||||
getProcessStatus(systemprocessstatus);
|
||||
for (unsigned int i = 0 ; i < systemprocessstatus.processstatus.size(); i++)
|
||||
{
|
||||
if (systemprocessstatus.processstatus[i].ProcessName == "DMLProc")
|
||||
{
|
||||
if (systemprocessstatus.processstatus[i].ProcessOpState == oam::ROLLBACK_INIT)
|
||||
{
|
||||
cout << endl << endl <<" System Not Ready, DMLProc is checking/processing rollback of abandoned transactions. Processing could take some time, please wait..." << flush;
|
||||
bfirst = false;
|
||||
}
|
||||
// At this point, we've found our DMLProc, so there's no need to spin the for loop
|
||||
// any further.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// At some point, we need to give up, ProcMon just isn't going to respond.
|
||||
if (i > 18) // 3 minutes
|
||||
{
|
||||
cout << endl << endl << "TIMEOUT: ProcMon not responding to getSystemStatus";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exceptionControl("waitForActive", API_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* PRIVATE FUNCTIONS
|
||||
|
Reference in New Issue
Block a user