You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-11-24 08:41:09 +03:00
MCOL-1217 - setup msqyl rep on addmodule
This commit is contained in:
@@ -2546,7 +2546,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
|
||||
|
||||
// target = root password
|
||||
oam::DeviceNetworkList devicenetworklist;
|
||||
status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true, target);
|
||||
status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, true, target);
|
||||
|
||||
log.writeLog(__LINE__, "Enable MySQL Replication status: " + oam.itoa(status) );
|
||||
|
||||
@@ -2568,7 +2568,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
|
||||
|
||||
// target = root password
|
||||
oam::DeviceNetworkList devicenetworklist;
|
||||
status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, false, target, false);
|
||||
status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, target, false);
|
||||
|
||||
log.writeLog(__LINE__, "Disable MySQL Replication status: " + oam.itoa(status) );
|
||||
|
||||
@@ -3621,18 +3621,21 @@ int ProcessManager::startProcess(string moduleName, string processName,
|
||||
{
|
||||
Oam oam;
|
||||
|
||||
//skip if module is DISABLED
|
||||
int opState;
|
||||
bool degraded;
|
||||
try{
|
||||
oam.getModuleStatus(moduleName, opState, degraded);
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
if ( actionIndicator != oam::STATUS_UPDATE )
|
||||
{
|
||||
//skip if module is DISABLED
|
||||
int opState;
|
||||
bool degraded;
|
||||
try{
|
||||
oam.getModuleStatus(moduleName, opState, degraded);
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
|
||||
//check if disabled
|
||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||
return API_SUCCESS;
|
||||
//check if disabled
|
||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||
return API_SUCCESS;
|
||||
}
|
||||
|
||||
ByteStream msg;
|
||||
ByteStream::byte requestID = START;
|
||||
@@ -4190,8 +4193,8 @@ int ProcessManager::startProcessType( std::string processName )
|
||||
if ( systemprocessstatus.processstatus[i].ProcessName == processName) {
|
||||
// found one, request restart of it
|
||||
int retStatus = processManager.startProcess(systemprocessstatus.processstatus[i].Module,
|
||||
processName,
|
||||
FORCEFUL);
|
||||
processName,
|
||||
FORCEFUL);
|
||||
log.writeLog(__LINE__, "StartProcessType: Start ACK received from Process-Monitor, return status = " + oam.itoa(retStatus), LOG_TYPE_DEBUG);
|
||||
}
|
||||
}
|
||||
@@ -5426,9 +5429,23 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
|
||||
log.writeLog(__LINE__, "addModule - sleep 60 - give ProcMon time to CONFIGURE and restart", LOG_TYPE_DEBUG);
|
||||
sleep(60);
|
||||
|
||||
//start mysqld on the new modules so mysql replication can be setup
|
||||
listPT = devicenetworklist.begin();
|
||||
for( ; listPT != devicenetworklist.end() ; listPT++)
|
||||
{
|
||||
processManager.startProcess((*listPT).DeviceName, "mysqld", oam::STATUS_UPDATE);
|
||||
}
|
||||
|
||||
log.writeLog(__LINE__, "Setup MySQL Replication for new Modules being Added", LOG_TYPE_DEBUG);
|
||||
processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true, password );
|
||||
processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, true, password, true, true );
|
||||
|
||||
//stop mysqld
|
||||
listPT = devicenetworklist.begin();
|
||||
for( ; listPT != devicenetworklist.end() ; listPT++)
|
||||
{
|
||||
processManager.stopProcess((*listPT).DeviceName, "mysqld", oam::FORCEFUL, true );
|
||||
}
|
||||
|
||||
return API_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -8728,7 +8745,7 @@ int ProcessManager::switchParentOAMModule(std::string newActiveModuleName)
|
||||
//change master MySQL Replication setup
|
||||
log.writeLog(__LINE__, "Setup MySQL Replication for new Parent Module during switch-over", LOG_TYPE_DEBUG);
|
||||
oam::DeviceNetworkList devicenetworklist;
|
||||
processManager.setMySQLReplication(devicenetworklist, newActiveModuleName, false, false, oam::UnassignedName);
|
||||
processManager.setMySQLReplication(devicenetworklist, newActiveModuleName, false, oam::UnassignedName);
|
||||
|
||||
}
|
||||
catch (exception& ex)
|
||||
@@ -9530,7 +9547,7 @@ int ProcessManager::OAMParentModuleChange()
|
||||
//change master MySQL Replication setup
|
||||
log.writeLog(__LINE__, "Setup this node as MySQL Replication Master", LOG_TYPE_DEBUG);
|
||||
oam::DeviceNetworkList devicenetworklist;
|
||||
processManager.setMySQLReplication(devicenetworklist, config.moduleName(), true);
|
||||
processManager.setMySQLReplication(devicenetworklist, config.moduleName());
|
||||
}
|
||||
|
||||
//set query system state not ready
|
||||
@@ -10207,7 +10224,7 @@ void ProcessManager::flushInodeCache()
|
||||
*
|
||||
*
|
||||
******************************************************************************************/
|
||||
int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist, std::string masterModule, bool failover, bool distributeDB, std::string password, bool enable)
|
||||
int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist, std::string masterModule, bool distributeDB, std::string password, bool enable, bool addModule)
|
||||
{
|
||||
Oam oam;
|
||||
|
||||
@@ -10226,57 +10243,6 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
||||
return oam::API_SUCCESS;
|
||||
}
|
||||
|
||||
//also skip if single-server, multi-node seperate with 1 UM, multi-node combo with 1 PM
|
||||
|
||||
/* string SingleServerInstall = "n";
|
||||
try {
|
||||
oam.getSystemConfig("SingleServerInstall", SingleServerInstall);
|
||||
}
|
||||
catch(...) {
|
||||
SingleServerInstall = "n";
|
||||
}
|
||||
|
||||
//single server check
|
||||
if ( SingleServerInstall == "y" )
|
||||
{
|
||||
log.writeLog(__LINE__, "setMySQLReplication: Single-Server, exiting", LOG_TYPE_DEBUG);
|
||||
return oam::API_SUCCESS;
|
||||
}
|
||||
|
||||
//combined system check
|
||||
if ( config.ServerInstallType() == oam::INSTALL_COMBINE_DM_UM_PM && !failover ) {
|
||||
try {
|
||||
Config* sysConfig = Config::makeConfig();
|
||||
if ( sysConfig->getConfig("DBRM_Controller", "NumWorkers") == "1" ) {
|
||||
log.writeLog(__LINE__, "setMySQLReplication: 1 configured module, exiting", LOG_TYPE_DEBUG);
|
||||
return oam::API_SUCCESS;
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
log.writeLog(__LINE__, "setMySQLReplication: makeConfig exception, exiting", LOG_TYPE_DEBUG);
|
||||
return oam::API_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
//seperate system check
|
||||
if ( ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM ) &&
|
||||
(PMwithUM == "n" ) )
|
||||
{
|
||||
ModuleTypeConfig moduletypeconfig;
|
||||
try{
|
||||
oam.getSystemConfig("um", moduletypeconfig);
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
|
||||
if ( moduletypeconfig.ModuleCount < 2 )
|
||||
{
|
||||
log.writeLog(__LINE__, "setMySQLReplication: moduleCount = 1, exiting", LOG_TYPE_DEBUG);
|
||||
return oam::API_SUCCESS;
|
||||
}
|
||||
}
|
||||
*/
|
||||
log.writeLog(__LINE__, "Setup MySQL Replication", LOG_TYPE_DEBUG);
|
||||
|
||||
//get master info
|
||||
@@ -10329,18 +10295,21 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
||||
if ( remoteModuleName == masterModule )
|
||||
continue;
|
||||
|
||||
// skip disabled modules
|
||||
int opState = oam::ACTIVE;
|
||||
bool degraded;
|
||||
try {
|
||||
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
||||
if ( !addModule )
|
||||
{
|
||||
// skip disabled modules
|
||||
int opState = oam::ACTIVE;
|
||||
bool degraded;
|
||||
try {
|
||||
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
|
||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||
continue;
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
|
||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||
continue;
|
||||
|
||||
|
||||
// don't do PMs unless PMwithUM flag is set
|
||||
if ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM ) {
|
||||
string moduleType = remoteModuleName.substr(0,MAX_MODULE_TYPE_SIZE);
|
||||
@@ -10418,18 +10387,21 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
||||
if ( remoteModuleName == masterModule )
|
||||
continue;
|
||||
|
||||
// skip disabled modules
|
||||
int opState = oam::ACTIVE;
|
||||
bool degraded;
|
||||
try {
|
||||
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
||||
if ( !addModule )
|
||||
{
|
||||
// skip disabled modules
|
||||
int opState = oam::ACTIVE;
|
||||
bool degraded;
|
||||
try {
|
||||
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
|
||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||
continue;
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
|
||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||
continue;
|
||||
|
||||
|
||||
// don't do PMs unless PMwithUM flag is set
|
||||
if ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM ) {
|
||||
string moduleType = remoteModuleName.substr(0,MAX_MODULE_TYPE_SIZE);
|
||||
@@ -10477,18 +10449,21 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
||||
if ( remoteModuleName == masterModule )
|
||||
continue;
|
||||
|
||||
// skip disabled modules
|
||||
int opState = oam::ACTIVE;
|
||||
bool degraded;
|
||||
try {
|
||||
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
||||
if ( !addModule )
|
||||
{
|
||||
// skip disabled modules
|
||||
int opState = oam::ACTIVE;
|
||||
bool degraded;
|
||||
try {
|
||||
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
|
||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||
continue;
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
|
||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||
continue;
|
||||
|
||||
|
||||
log.writeLog(__LINE__, "Setup Slave MySQL Replication on " + remoteModuleName, LOG_TYPE_DEBUG);
|
||||
|
||||
ByteStream msg1;
|
||||
|
||||
Reference in New Issue
Block a user