1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

Fix restart hang

mcsadmin restart will do a status call. Before this would log status
output to a file which would be checked. If that file check failed a PID
check would be made.

We do not log the status to a file any more since it could have multiple
different outputs. The PID check could hit a race condition where it is
being checked before the process is up. This would mean there is no
module state change causing a hang.

This fix does the following:

1. Remove the file status check completely
2. Loop the PID check to give it time to come up
3. If the PID check fails drop to a DEGRADED state

This makes mcsadmin restart work correctly again.
This commit is contained in:
Andrew Hutchings
2020-02-12 09:57:22 +00:00
parent 7df731a3a6
commit f9e5bdbc8d

View File

@@ -7927,11 +7927,11 @@ void Oam::actionMysqlCalpont(MYSQLCALPONT_ACTION action)
getProcessStatus("mysqld", moduleName, procstat); getProcessStatus("mysqld", moduleName, procstat);
int state = procstat.ProcessOpState; int state = procstat.ProcessOpState;
pid_t pidStatus = procstat.ProcessID; pid_t pidStatus = procstat.ProcessID;
pid_t pid = 0;
string mysqlStatus = tmpdir + "/mysql.status"; string mysqlStatus = tmpdir + "/mysql.status";
if (checkLogStatus(mysqlStatus, "MySQL running")) if ( state != ACTIVE )
{ {
if ( state != ACTIVE ) for (int i=0; i < 10; i++)
{ {
//get pid //get pid
char buf[512]; char buf[512];
@@ -7942,17 +7942,26 @@ void Oam::actionMysqlCalpont(MYSQLCALPONT_ACTION action)
pclose( cmd_pipe ); pclose( cmd_pipe );
//set process status if (pid)
try
{ {
setProcessStatus("mysqld", moduleName, ACTIVE, pid); //set process status
try
{
setProcessStatus("mysqld", moduleName, ACTIVE, pid);
}
catch (...)
{}
return;
}
else
{
sleep(2);
} }
catch (...)
{}
return;
} }
else }
else
{
for (int i=0; i < 10; i++)
{ {
//check if pid has changed //check if pid has changed
char buf[512]; char buf[512];
@@ -7963,18 +7972,28 @@ void Oam::actionMysqlCalpont(MYSQLCALPONT_ACTION action)
pclose( cmd_pipe ); pclose( cmd_pipe );
if ( pidStatus != pid ) if (pid)
{ {
//set process status if ( pidStatus != pid )
try
{ {
setProcessStatus("mysqld", moduleName, ACTIVE, pid); //set process status
try
{
setProcessStatus("mysqld", moduleName, ACTIVE, pid);
}
catch (...)
{}
break;
} }
catch (...) }
{} else
{
sleep(2);
} }
} }
}
if (pid)
{
//check module status, if DEGRADED set to ACTIVE //check module status, if DEGRADED set to ACTIVE
int opState; int opState;
bool degraded; bool degraded;