1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-09-02 12:41:17 +03:00

Merge pull request #558 from mariadb-corporation/MCOL-1523

Mcol 1523
This commit is contained in:
benthompson15
2018-09-13 11:22:21 -05:00
committed by GitHub
5 changed files with 109 additions and 109 deletions

View File

@@ -10,5 +10,8 @@ alias core='cd /var/log/mariadb/columnstore/corefiles'
alias tmsg='tail -f /var/log/messages' alias tmsg='tail -f /var/log/messages'
alias tdebug='tail -f /var/log/mariadb/columnstore/debug.log' alias tdebug='tail -f /var/log/mariadb/columnstore/debug.log'
alias tinfo='tail -f /var/log/mariadb/columnstore/info.log' alias tinfo='tail -f /var/log/mariadb/columnstore/info.log'
alias terror='tail -f /var/log/mariadb/columnstore/err.log'
alias twarning='tail -f /var/log/mariadb/columnstore/warning.log'
alias tcrit='tail -f /var/log/mariadb/columnstore/crit.log'
alias dbrm='cd /usr/local/mariadb/columnstore/data1/systemFiles/dbrm' alias dbrm='cd /usr/local/mariadb/columnstore/data1/systemFiles/dbrm'
alias module='cat /usr/local/mariadb/columnstore/local/module' alias module='cat /usr/local/mariadb/columnstore/local/module'

View File

@@ -7036,15 +7036,24 @@ int processCommand(string* arguments)
if (systemstatus.SystemOpState == oam::ACTIVE ) { if (systemstatus.SystemOpState == oam::ACTIVE ) {
try try
{ {
cout << endl << " Starting Modules" << endl; cout << endl << " Restarting System ";
oam.startModule(devicenetworklist, ackTemp); gracefulTemp = oam::FORCEFUL;
int returnStatus = oam.restartSystem(gracefulTemp, ackTemp);
//reload DBRM with new configuration, needs to be done here after startModule switch (returnStatus)
cmd = startup::StartUp::installDir() + "/bin/dbrmctl reload > /dev/null 2>&1"; {
system(cmd.c_str()); case API_SUCCESS:
sleep(15); if ( waitForActive() )
cout << endl << " Successful restart of System " << endl << endl;
cout << " Successful start of Modules " << endl; else
cout << endl << "**** restartSystem Failed : check log files" << endl;
break;
case API_CANCELLED:
cout << endl << " Restart of System canceled" << endl << endl;
break;
default:
cout << endl << "**** restartSystem Failed : Check system logs" << endl;
break;
}
} }
catch (exception& e) catch (exception& e)
{ {

View File

@@ -1489,7 +1489,7 @@ void pingDeviceThread()
if (moduleInfoList[moduleName] >= ModuleHeartbeatCount || if (moduleInfoList[moduleName] >= ModuleHeartbeatCount ||
opState == oam::DOWN || opState == oam::AUTO_DISABLED) opState == oam::DOWN || opState == oam::AUTO_DISABLED)
{ {
log.writeLog(__LINE__, "Module alive, bring it back online: " + moduleName, LOG_TYPE_DEBUG); log.writeLog(__LINE__, "*** Module alive, bring it back online: " + moduleName, LOG_TYPE_DEBUG);
string PrimaryUMModuleName = config.moduleName(); string PrimaryUMModuleName = config.moduleName();
try { try {
@@ -1917,7 +1917,7 @@ void pingDeviceThread()
{ {
//Log failure, issue alarm, set moduleOpState //Log failure, issue alarm, set moduleOpState
Configuration config; Configuration config;
log.writeLog(__LINE__, "module is down: " + moduleName, LOG_TYPE_CRITICAL); log.writeLog(__LINE__, "*** module is down: " + moduleName, LOG_TYPE_CRITICAL);
//set query system state not ready //set query system state not ready
processManager.setQuerySystemState(false); processManager.setQuerySystemState(false);
@@ -1997,9 +1997,6 @@ void pingDeviceThread()
// resume the dbrm // resume the dbrm
oam.dbrmctl("resume"); oam.dbrmctl("resume");
log.writeLog(__LINE__, "'dbrmctl resume' done", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "'dbrmctl resume' done", LOG_TYPE_DEBUG);
//set recycle process
processManager.recycleProcess(moduleName);
} }
// return values = 'ip address' for running or rebooting, stopped or terminated // return values = 'ip address' for running or rebooting, stopped or terminated

View File

@@ -575,10 +575,12 @@ void processMSG(messageqcpp::IOSocket* cfIos)
if ( count > 0 ) { if ( count > 0 ) {
string module = oam::UnassignedName;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
msg >> value; msg >> value;
devicenetworkconfig.DeviceName = value; devicenetworkconfig.DeviceName = value;
module = value;
msg >> value; msg >> value;
devicenetworkconfig.UserTempDeviceName = value; devicenetworkconfig.UserTempDeviceName = value;
msg >> value; msg >> value;
@@ -606,24 +608,21 @@ void processMSG(messageqcpp::IOSocket* cfIos)
} }
if( status == API_SUCCESS) { if( status == API_SUCCESS) {
processManager.setSystemState(oam::BUSY_INIT);
//set query system state not ready
processManager.setQuerySystemState(false);
//set recycle process
processManager.recycleProcess(target, true);
//distribute config file //distribute config file
processManager.distributeConfigFile("system"); processManager.distributeConfigFile("system");
//call dbrm control //set query system state ready
oam.dbrmctl("halt"); processManager.setQuerySystemState(true);
log.writeLog(__LINE__, "'dbrmctl halt' done", LOG_TYPE_DEBUG);
oam.dbrmctl("reload"); processManager.setSystemState(oam::ACTIVE);
log.writeLog(__LINE__, "'dbrmctl reload' done", LOG_TYPE_DEBUG);
oam.dbrmctl("resume");
log.writeLog(__LINE__, "'dbrmctl resume' done", LOG_TYPE_DEBUG);
// processManager.restartProcessType("ExeMgr");
//setup MySQL Replication for started modules
// log.writeLog(__LINE__, "Setup MySQL Replication for module being started", LOG_TYPE_DEBUG);
// processManager.setMySQLReplication(startdevicenetworklist);
} }
} }
else else
@@ -846,7 +845,6 @@ void processMSG(messageqcpp::IOSocket* cfIos)
//set query system state ready //set query system state ready
processManager.setQuerySystemState(true); processManager.setQuerySystemState(true);
} }
else else
{ {
@@ -1603,6 +1601,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
status = retStatus; status = retStatus;
} }
} }
//now stop local module //now stop local module
processManager.stopModule(config.moduleName(), graceful, manualFlag ); processManager.stopModule(config.moduleName(), graceful, manualFlag );
@@ -1619,7 +1618,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
oam::DeviceNetworkList devicenetworklist; oam::DeviceNetworkList devicenetworklist;
pthread_t startsystemthread; pthread_t startsystemthread;
pthread_create (&startsystemthread, NULL, (void*(*)(void*)) &startSystemThread, &devicenetworklist); status = pthread_create (&startsystemthread, NULL, (void*(*)(void*)) &startSystemThread, &devicenetworklist);
if ( status != 0 ) { if ( status != 0 ) {
log.writeLog(__LINE__, "STARTMODULE: pthread_create failed, return status = " + oam.itoa(status)); log.writeLog(__LINE__, "STARTMODULE: pthread_create failed, return status = " + oam.itoa(status));
@@ -1628,20 +1627,19 @@ void processMSG(messageqcpp::IOSocket* cfIos)
if (status == 0 && ackIndicator) if (status == 0 && ackIndicator)
{ {
// BUG 4554 We don't need the join because calpont console is now looking for "Active" pthread_join(startsystemthread, NULL);
// We need to return the ack right away to let console know we got the message. status = startsystemthreadStatus;
// pthread_join(startsystemthread, NULL);
// status = startsystemthreadStatus;
} }
// setup MySQL Replication after switchover command // setup MySQL Replication after FORCE restart command
/* if (graceful == FORCEFUL) if ( (status == API_SUCCESS) &&
(graceful == oam::FORCEFUL) )
{ {
log.writeLog(__LINE__, "Setup MySQL Replication for restartSystem FORCE, used by switch-parent command", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "Setup MySQL Replication for restartSystem FORCE", LOG_TYPE_DEBUG);
oam::DeviceNetworkList devicenetworklist; oam::DeviceNetworkList devicenetworklist;
processManager.setMySQLReplication(devicenetworklist); processManager.setMySQLReplication(devicenetworklist);
} }
*/
log.writeLog(__LINE__, "RESTARTSYSTEM: Start System Request Completed", LOG_TYPE_INFO); log.writeLog(__LINE__, "RESTARTSYSTEM: Start System Request Completed", LOG_TYPE_INFO);
} }
@@ -2848,10 +2846,13 @@ void processMSG(messageqcpp::IOSocket* cfIos)
} }
// if a DDLProc was restarted, reinit DMLProc // if a DDLProc was restarted, restart DMLProc
if( processName == "DDLProc") { if( processName == "DDLProc") {
processManager.reinitProcessType("DMLProc"); processManager.reinitProcessType("DMLProc");
//set query system states ready
processManager.setQuerySystemState(true); processManager.setQuerySystemState(true);
processManager.setSystemState(oam::ACTIVE);
} }
//only run on auto process restart //only run on auto process restart
@@ -2902,6 +2903,8 @@ void processMSG(messageqcpp::IOSocket* cfIos)
processManager.setQuerySystemState(true); processManager.setQuerySystemState(true);
processManager.setSystemState(oam::ACTIVE); processManager.setSystemState(oam::ACTIVE);
log.writeLog(__LINE__, "MSG RECEIVED: Process Restarted Completed");
} }
break; break;
@@ -3269,6 +3272,7 @@ int ProcessManager::shutdownModule(string target, ByteStream::byte actionIndicat
int ProcessManager::disableModule(string target, bool manualFlag) int ProcessManager::disableModule(string target, bool manualFlag)
{ {
Oam oam; Oam oam;
ProcessManager processManager(config, log);
ModuleConfig moduleconfig; ModuleConfig moduleconfig;
log.writeLog(__LINE__, "disableModule request for " + target, LOG_TYPE_DEBUG); log.writeLog(__LINE__, "disableModule request for " + target, LOG_TYPE_DEBUG);
@@ -3378,6 +3382,11 @@ int ProcessManager::disableModule(string target, bool manualFlag)
if ( updateWorkerNodeconfig() != API_SUCCESS ) if ( updateWorkerNodeconfig() != API_SUCCESS )
return API_FAILURE; return API_FAILURE;
processManager.recycleProcess(target);
//check for SIMPLEX Processes on mate might need to be started
processManager.checkSimplexModule(target);
//distribute config file //distribute config file
distributeConfigFile("system"); distributeConfigFile("system");
@@ -3389,7 +3398,7 @@ int ProcessManager::disableModule(string target, bool manualFlag)
/****************************************************************************************** /******************************************************************************************
* @brief recycleProcess * @brief recycleProcess
* *
* purpose: recyle process, generally after some disable module is run * purpose: recyle process, done after disable/enable module
* *
******************************************************************************************/ ******************************************************************************************/
void ProcessManager::recycleProcess(string module, bool enableModule) void ProcessManager::recycleProcess(string module, bool enableModule)
@@ -3407,54 +3416,40 @@ void ProcessManager::recycleProcess(string module, bool enableModule)
} }
catch(...) {} catch(...) {}
// restart DBRM Process and DMLProc and return if enable module is being done stopProcessType("WriteEngineServer");
if (enableModule)
{
//recycle DBRM processes in all cases
restartProcessType("DBRMControllerNode");
restartProcessType("DBRMWorkerNode");
restartProcessType("DMLProc");
return;
}
//recycle DBRM processes in all cases
restartProcessType("DBRMControllerNode", module);
restartProcessType("DBRMWorkerNode");
// only recycle dmlproc, if down/up module is non-parent UM
if ( ( moduleType == "um" ) &&
( PrimaryUMModuleName != module) )
{
restartProcessType("DMLProc",module);
return;
}
if( PrimaryUMModuleName == module)
{
stopProcessType("DDLProc");
stopProcessType("DMLProc");
}
stopProcessType("ExeMgr"); stopProcessType("ExeMgr");
restartProcessType("PrimProc"); stopProcessType("PrimProc");
sleep(1);
restartProcessType("mysqld"); stopProcessType("DBRMControllerNode");
stopProcessType("DBRMWorkerNode");
restartProcessType("WriteEngineServer"); stopProcessType("DDLProc");
sleep(1); stopProcessType("DMLProc");
stopProcessType("mysqld");
// restartProcessType("mysqld");
startProcessType("DBRMControllerNode");
startProcessType("DBRMWorkerNode");
startProcessType("PrimProc");
sleep(5);
startProcessType("WriteEngineServer");
sleep(3);
startProcessType("ExeMgr"); startProcessType("ExeMgr");
sleep(1);
startProcessType("DDLProc"); startProcessType("DDLProc");
sleep(1); sleep(1);
startProcessType("DMLProc"); startProcessType("DMLProc");
startProcessType("mysqld");
return; return;
} }
@@ -3502,10 +3497,6 @@ int ProcessManager::enableModule(string target, int state, bool failover)
if ( newStandbyModule == target) if ( newStandbyModule == target)
setStandbyModule(newStandbyModule); setStandbyModule(newStandbyModule);
//set recycle process
if (!failover)
recycleProcess(target);
log.writeLog(__LINE__, "enableModule request for " + target + " completed", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "enableModule request for " + target + " completed", LOG_TYPE_DEBUG);
return API_SUCCESS; return API_SUCCESS;
@@ -6493,16 +6484,26 @@ void ProcessManager::setQuerySystemState(bool set)
Oam oam; Oam oam;
BRM::DBRM dbrm; BRM::DBRM dbrm;
log.writeLog(__LINE__, "setQuerySystemState = " + oam.itoa(set), LOG_TYPE_DEBUG); log.writeLog(__LINE__, "setQuerySystemState called = " + oam.itoa(set), LOG_TYPE_DEBUG);
try { try {
dbrm.setSystemQueryReady(set); dbrm.setSystemQueryReady(set);
log.writeLog(__LINE__, "setQuerySystemState successful", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "setSystemQueryReady = " + oam.itoa(set), LOG_TYPE_DEBUG);
try {
dbrm.setSystemReady(set);
log.writeLog(__LINE__, "setSystemReady = " + oam.itoa(set), LOG_TYPE_DEBUG);
}
catch(...)
{
log.writeLog(__LINE__, "setSystemReady failed", LOG_TYPE_DEBUG);
log.writeLog(__LINE__, "setSystemReady failed", LOG_TYPE_ERROR);
}
} }
catch(...) catch(...)
{ {
log.writeLog(__LINE__, "setQuerySystemState failed", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "setSystemQueryReady failed", LOG_TYPE_DEBUG);
log.writeLog(__LINE__, "setQuerySystemState failed", LOG_TYPE_ERROR); log.writeLog(__LINE__, "setSystemQueryReady failed", LOG_TYPE_ERROR);
} }
} }
@@ -7054,23 +7055,29 @@ void startSystemThread(oam::DeviceNetworkList Devicenetworklist)
} }
if (DMLprocessstatus.ProcessOpState == oam::ACTIVE) { if (DMLprocessstatus.ProcessOpState == oam::ACTIVE) {
rtn = oam::ACTIVE; rtn = oam::ACTIVE;
break; break;
} }
if (DMLprocessstatus.ProcessOpState == oam::FAILED) { if (DMLprocessstatus.ProcessOpState == oam::FAILED) {
rtn = oam::FAILED; rtn = oam::FAILED;
status = oam::API_FAILURE;
break; break;
} }
// wait some more // wait some more
sleep(2); sleep(2);
} }
processManager.setSystemState(rtn);
} if ( rtn = oam::ACTIVE )
//set query system state not ready
processManager.setQuerySystemState(true);
processManager.setSystemState(rtn);
}
else
processManager.setSystemState(oam::FAILED);
//set query system state ready
processManager.setQuerySystemState(true);
// exit thread // exit thread
log.writeLog(__LINE__, "startSystemThread Exit", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "startSystemThread Exit", LOG_TYPE_DEBUG);

View File

@@ -2443,22 +2443,6 @@ void processStatusMSG(messageqcpp::IOSocket* cfIos)
memcpy(fShmSystemStatus[0].StateChangeDate, oam.getCurrentTime().c_str(), DATESIZE); memcpy(fShmSystemStatus[0].StateChangeDate, oam.getCurrentTime().c_str(), DATESIZE);
log.writeLog(__LINE__, "statusControl: REQUEST RECEIVED: Set System State = " + oamState[state], LOG_TYPE_DEBUG); log.writeLog(__LINE__, "statusControl: REQUEST RECEIVED: Set System State = " + oamState[state], LOG_TYPE_DEBUG);
} }
//if DMLProc set to ACTIVE, set system state to ACTIVE if in an INIT state
if ( processName == "DMLProc" && state == oam::ACTIVE )
{
if ( fShmSystemStatus[0].OpState == oam::BUSY_INIT ||
fShmSystemStatus[0].OpState == oam::MAN_INIT ||
fShmSystemStatus[0].OpState == oam::AUTO_INIT )
{
fShmSystemStatus[0].OpState = state;
memcpy(fShmSystemStatus[0].StateChangeDate, oam.getCurrentTime().c_str(), DATESIZE);
log.writeLog(__LINE__, "statusControl: REQUEST RECEIVED: Set System State = " + oamState[state], LOG_TYPE_DEBUG);
}
BRM::DBRM dbrm;
dbrm.setSystemQueryReady(true);
}
} }
break; break;