1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

Merge pull request #428 from mariadb-corporation/MCOL-1222

MCOL-1222 - improved the waitforsystemactive function
This commit is contained in:
David.Hall
2018-03-22 17:16:31 -05:00
committed by GitHub
4 changed files with 110 additions and 71 deletions

View File

@ -77,62 +77,13 @@ bool SendToWES(Oam& oam, ByteStream bs);
bool waitForActive()
{
Oam oam;
SystemStatus systemstatus;
SystemProcessStatus systemprocessstatus;
bool bfirst = true;
for (int i = 0 ; i < 1200 ; i ++)
try
{
sleep (3);
try
{
oam.getSystemStatus(systemstatus);
if (systemstatus.SystemOpState == ACTIVE)
{
return true;
}
if (systemstatus.SystemOpState == FAILED)
{
return false;
}
if (systemstatus.SystemOpState == MAN_OFFLINE)
{
return false;
}
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
{
oam.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, ProcMgr just isn't going to respond.
if (i > 60) // 3 minutes
{
cout << "ProcMgr not responding while waiting for system to start";
break;
}
}
oam.waitForActive();
return true;
}
catch (...)
{}
return false;
}

View File

@ -74,28 +74,21 @@ void callFree(const char* )
}
bool waitForActive()
{
Oam oam;
Oam oam;
try
{
oam.waitForActive();
return true;
}
catch (...)
{}
const string cmd = installDir + "/bin/mcsadmin getsystemstatus > /tmp/wait.log";
system(cmd.c_str());
for ( int i = 0 ; i < 120 ; i ++ )
{
if (oam.checkLogStatus("/tmp/wait.log", "System ACTIVE") )
return true;
if ( oam.checkLogStatus("/tmp/wait.log", "System FAILED") )
return false;
cout << ".";
cout.flush();
sleep (10);
system(cmd.c_str());
}
return false;
return false;
}
void dbrmDirCheck()
{