You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
MCOL-1217 - setup msqyl rep on addmodule
This commit is contained in:
@ -489,7 +489,6 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << endl << "ERROR: Module not Active, replication not done on " << (*pt).DeviceName << endl;
|
||||
pt++;
|
||||
}
|
||||
}
|
||||
|
@ -1803,7 +1803,7 @@ void pingDeviceThread()
|
||||
DeviceNetworkConfig devicenetworkconfig;
|
||||
devicenetworkconfig.DeviceName = moduleName;
|
||||
devicenetworklist.push_back(devicenetworkconfig);
|
||||
processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true);
|
||||
processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,6 +3621,8 @@ int ProcessManager::startProcess(string moduleName, string processName,
|
||||
{
|
||||
Oam oam;
|
||||
|
||||
if ( actionIndicator != oam::STATUS_UPDATE )
|
||||
{
|
||||
//skip if module is DISABLED
|
||||
int opState;
|
||||
bool degraded;
|
||||
@ -3633,6 +3635,7 @@ int ProcessManager::startProcess(string moduleName, string processName,
|
||||
//check if disabled
|
||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||
return API_SUCCESS;
|
||||
}
|
||||
|
||||
ByteStream msg;
|
||||
ByteStream::byte requestID = START;
|
||||
@ -5426,8 +5429,22 @@ 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,6 +10295,8 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
||||
if ( remoteModuleName == masterModule )
|
||||
continue;
|
||||
|
||||
if ( !addModule )
|
||||
{
|
||||
// skip disabled modules
|
||||
int opState = oam::ACTIVE;
|
||||
bool degraded;
|
||||
@ -10340,6 +10308,7 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
||||
|
||||
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 ) {
|
||||
@ -10418,6 +10387,8 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
||||
if ( remoteModuleName == masterModule )
|
||||
continue;
|
||||
|
||||
if ( !addModule )
|
||||
{
|
||||
// skip disabled modules
|
||||
int opState = oam::ACTIVE;
|
||||
bool degraded;
|
||||
@ -10429,6 +10400,7 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
||||
|
||||
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 ) {
|
||||
@ -10477,6 +10449,8 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
||||
if ( remoteModuleName == masterModule )
|
||||
continue;
|
||||
|
||||
if ( !addModule )
|
||||
{
|
||||
// skip disabled modules
|
||||
int opState = oam::ACTIVE;
|
||||
bool degraded;
|
||||
@ -10488,6 +10462,7 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
||||
|
||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||
continue;
|
||||
}
|
||||
|
||||
log.writeLog(__LINE__, "Setup Slave MySQL Replication on " + remoteModuleName, LOG_TYPE_DEBUG);
|
||||
|
||||
|
@ -545,7 +545,7 @@ public:
|
||||
|
||||
/** @brief Set MySQL Replication
|
||||
*/
|
||||
int setMySQLReplication(oam::DeviceNetworkList devicenetworklist, std::string masterModule = oam::UnassignedName, bool failover = false, bool distributeDB = false, std::string password = oam::UnassignedName, bool enable = true);
|
||||
int setMySQLReplication(oam::DeviceNetworkList devicenetworklist, std::string masterModule = oam::UnassignedName, bool distributeDB = false, std::string password = oam::UnassignedName, bool enable = true, bool addModule = false);
|
||||
|
||||
/** @brief Gluster Assign dbroot to a module
|
||||
*/
|
||||
|
@ -457,6 +457,24 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
||||
log.writeLog(__LINE__, "MSG RECEIVED: Stop process request on " + processName);
|
||||
int requestStatus = API_SUCCESS;
|
||||
|
||||
// check for mysql
|
||||
if ( processName == "mysqld" ) {
|
||||
try {
|
||||
oam.actionMysqlCalpont(MYSQL_STOP);
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
|
||||
ackMsg << (ByteStream::byte) ACK;
|
||||
ackMsg << (ByteStream::byte) STOP;
|
||||
ackMsg << (ByteStream::byte) API_SUCCESS;
|
||||
mq.write(ackMsg);
|
||||
|
||||
log.writeLog(__LINE__, "STOP: ACK back to ProcMgr, return status = " + oam.itoa((int) API_SUCCESS));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
processList::iterator listPtr;
|
||||
processList* aPtr = config.monitoredListPtr();
|
||||
listPtr = aPtr->begin();
|
||||
@ -502,6 +520,24 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
||||
msg >> manualFlag;
|
||||
log.writeLog(__LINE__, "MSG RECEIVED: Start process request on: " + processName);
|
||||
|
||||
// check for mysql
|
||||
if ( processName == "mysqld" ) {
|
||||
try {
|
||||
oam.actionMysqlCalpont(MYSQL_START);
|
||||
}
|
||||
catch(...)
|
||||
{}
|
||||
|
||||
ackMsg << (ByteStream::byte) ACK;
|
||||
ackMsg << (ByteStream::byte) START;
|
||||
ackMsg << (ByteStream::byte) API_SUCCESS;
|
||||
mq.write(ackMsg);
|
||||
|
||||
log.writeLog(__LINE__, "START: ACK back to ProcMgr, return status = " + oam.itoa((int) API_SUCCESS));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ProcessConfig processconfig;
|
||||
ProcessStatus processstatus;
|
||||
try {
|
||||
@ -605,7 +641,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
||||
int requestStatus = API_SUCCESS;
|
||||
|
||||
// check for mysql restart
|
||||
if ( processName == "mysql" ) {
|
||||
if ( processName == "mysqld" ) {
|
||||
try {
|
||||
oam.actionMysqlCalpont(MYSQL_RESTART);
|
||||
}
|
||||
@ -4952,11 +4988,11 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master
|
||||
|
||||
//skip if module is not ACTIVE
|
||||
|
||||
int opState = oam::ACTIVE;
|
||||
bool degraded;
|
||||
oam.getModuleStatus(moduleName, opState, degraded);
|
||||
if (opState != oam::ACTIVE)
|
||||
continue;
|
||||
// int opState = oam::ACTIVE;
|
||||
// bool degraded;
|
||||
// oam.getModuleStatus(moduleName, opState, degraded);
|
||||
// if (opState != oam::ACTIVE)
|
||||
// continue;
|
||||
|
||||
bool passwordError = false;
|
||||
|
||||
|
Reference in New Issue
Block a user