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
|
else
|
||||||
{
|
{
|
||||||
cout << endl << "ERROR: Module not Active, replication not done on " << (*pt).DeviceName << endl;
|
|
||||||
pt++;
|
pt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1803,7 +1803,7 @@ void pingDeviceThread()
|
|||||||
DeviceNetworkConfig devicenetworkconfig;
|
DeviceNetworkConfig devicenetworkconfig;
|
||||||
devicenetworkconfig.DeviceName = moduleName;
|
devicenetworkconfig.DeviceName = moduleName;
|
||||||
devicenetworklist.push_back(devicenetworkconfig);
|
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
|
// target = root password
|
||||||
oam::DeviceNetworkList devicenetworklist;
|
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) );
|
log.writeLog(__LINE__, "Enable MySQL Replication status: " + oam.itoa(status) );
|
||||||
|
|
||||||
@ -2568,7 +2568,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
|
|||||||
|
|
||||||
// target = root password
|
// target = root password
|
||||||
oam::DeviceNetworkList devicenetworklist;
|
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) );
|
log.writeLog(__LINE__, "Disable MySQL Replication status: " + oam.itoa(status) );
|
||||||
|
|
||||||
@ -3621,18 +3621,21 @@ int ProcessManager::startProcess(string moduleName, string processName,
|
|||||||
{
|
{
|
||||||
Oam oam;
|
Oam oam;
|
||||||
|
|
||||||
//skip if module is DISABLED
|
if ( actionIndicator != oam::STATUS_UPDATE )
|
||||||
int opState;
|
{
|
||||||
bool degraded;
|
//skip if module is DISABLED
|
||||||
try{
|
int opState;
|
||||||
oam.getModuleStatus(moduleName, opState, degraded);
|
bool degraded;
|
||||||
}
|
try{
|
||||||
catch(...)
|
oam.getModuleStatus(moduleName, opState, degraded);
|
||||||
{}
|
}
|
||||||
|
catch(...)
|
||||||
|
{}
|
||||||
|
|
||||||
//check if disabled
|
//check if disabled
|
||||||
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
if (opState == oam::MAN_DISABLED || opState == oam::AUTO_DISABLED)
|
||||||
return API_SUCCESS;
|
return API_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
ByteStream msg;
|
ByteStream msg;
|
||||||
ByteStream::byte requestID = START;
|
ByteStream::byte requestID = START;
|
||||||
@ -4190,8 +4193,8 @@ int ProcessManager::startProcessType( std::string processName )
|
|||||||
if ( systemprocessstatus.processstatus[i].ProcessName == processName) {
|
if ( systemprocessstatus.processstatus[i].ProcessName == processName) {
|
||||||
// found one, request restart of it
|
// found one, request restart of it
|
||||||
int retStatus = processManager.startProcess(systemprocessstatus.processstatus[i].Module,
|
int retStatus = processManager.startProcess(systemprocessstatus.processstatus[i].Module,
|
||||||
processName,
|
processName,
|
||||||
FORCEFUL);
|
FORCEFUL);
|
||||||
log.writeLog(__LINE__, "StartProcessType: Start ACK received from Process-Monitor, return status = " + oam.itoa(retStatus), LOG_TYPE_DEBUG);
|
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);
|
log.writeLog(__LINE__, "addModule - sleep 60 - give ProcMon time to CONFIGURE and restart", LOG_TYPE_DEBUG);
|
||||||
sleep(60);
|
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);
|
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;
|
return API_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8728,7 +8745,7 @@ int ProcessManager::switchParentOAMModule(std::string newActiveModuleName)
|
|||||||
//change master MySQL Replication setup
|
//change master MySQL Replication setup
|
||||||
log.writeLog(__LINE__, "Setup MySQL Replication for new Parent Module during switch-over", LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "Setup MySQL Replication for new Parent Module during switch-over", LOG_TYPE_DEBUG);
|
||||||
oam::DeviceNetworkList devicenetworklist;
|
oam::DeviceNetworkList devicenetworklist;
|
||||||
processManager.setMySQLReplication(devicenetworklist, newActiveModuleName, false, false, oam::UnassignedName);
|
processManager.setMySQLReplication(devicenetworklist, newActiveModuleName, false, oam::UnassignedName);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (exception& ex)
|
catch (exception& ex)
|
||||||
@ -9530,7 +9547,7 @@ int ProcessManager::OAMParentModuleChange()
|
|||||||
//change master MySQL Replication setup
|
//change master MySQL Replication setup
|
||||||
log.writeLog(__LINE__, "Setup this node as MySQL Replication Master", LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "Setup this node as MySQL Replication Master", LOG_TYPE_DEBUG);
|
||||||
oam::DeviceNetworkList devicenetworklist;
|
oam::DeviceNetworkList devicenetworklist;
|
||||||
processManager.setMySQLReplication(devicenetworklist, config.moduleName(), true);
|
processManager.setMySQLReplication(devicenetworklist, config.moduleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//set query system state not ready
|
//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;
|
Oam oam;
|
||||||
|
|
||||||
@ -10226,57 +10243,6 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
|||||||
return oam::API_SUCCESS;
|
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);
|
log.writeLog(__LINE__, "Setup MySQL Replication", LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
//get master info
|
//get master info
|
||||||
@ -10329,18 +10295,21 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
|||||||
if ( remoteModuleName == masterModule )
|
if ( remoteModuleName == masterModule )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip disabled modules
|
if ( !addModule )
|
||||||
int opState = oam::ACTIVE;
|
{
|
||||||
bool degraded;
|
// skip disabled modules
|
||||||
try {
|
int opState = oam::ACTIVE;
|
||||||
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
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
|
// don't do PMs unless PMwithUM flag is set
|
||||||
if ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM ) {
|
if ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM ) {
|
||||||
string moduleType = remoteModuleName.substr(0,MAX_MODULE_TYPE_SIZE);
|
string moduleType = remoteModuleName.substr(0,MAX_MODULE_TYPE_SIZE);
|
||||||
@ -10418,18 +10387,21 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
|||||||
if ( remoteModuleName == masterModule )
|
if ( remoteModuleName == masterModule )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip disabled modules
|
if ( !addModule )
|
||||||
int opState = oam::ACTIVE;
|
{
|
||||||
bool degraded;
|
// skip disabled modules
|
||||||
try {
|
int opState = oam::ACTIVE;
|
||||||
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
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
|
// don't do PMs unless PMwithUM flag is set
|
||||||
if ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM ) {
|
if ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM ) {
|
||||||
string moduleType = remoteModuleName.substr(0,MAX_MODULE_TYPE_SIZE);
|
string moduleType = remoteModuleName.substr(0,MAX_MODULE_TYPE_SIZE);
|
||||||
@ -10477,18 +10449,21 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
|
|||||||
if ( remoteModuleName == masterModule )
|
if ( remoteModuleName == masterModule )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip disabled modules
|
if ( !addModule )
|
||||||
int opState = oam::ACTIVE;
|
{
|
||||||
bool degraded;
|
// skip disabled modules
|
||||||
try {
|
int opState = oam::ACTIVE;
|
||||||
oam.getModuleStatus(remoteModuleName, opState, degraded);
|
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);
|
log.writeLog(__LINE__, "Setup Slave MySQL Replication on " + remoteModuleName, LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
ByteStream msg1;
|
ByteStream msg1;
|
||||||
|
@ -545,7 +545,7 @@ public:
|
|||||||
|
|
||||||
/** @brief Set MySQL Replication
|
/** @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
|
/** @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);
|
log.writeLog(__LINE__, "MSG RECEIVED: Stop process request on " + processName);
|
||||||
int requestStatus = API_SUCCESS;
|
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::iterator listPtr;
|
||||||
processList* aPtr = config.monitoredListPtr();
|
processList* aPtr = config.monitoredListPtr();
|
||||||
listPtr = aPtr->begin();
|
listPtr = aPtr->begin();
|
||||||
@ -502,6 +520,24 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
|||||||
msg >> manualFlag;
|
msg >> manualFlag;
|
||||||
log.writeLog(__LINE__, "MSG RECEIVED: Start process request on: " + processName);
|
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;
|
ProcessConfig processconfig;
|
||||||
ProcessStatus processstatus;
|
ProcessStatus processstatus;
|
||||||
try {
|
try {
|
||||||
@ -605,7 +641,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
|||||||
int requestStatus = API_SUCCESS;
|
int requestStatus = API_SUCCESS;
|
||||||
|
|
||||||
// check for mysql restart
|
// check for mysql restart
|
||||||
if ( processName == "mysql" ) {
|
if ( processName == "mysqld" ) {
|
||||||
try {
|
try {
|
||||||
oam.actionMysqlCalpont(MYSQL_RESTART);
|
oam.actionMysqlCalpont(MYSQL_RESTART);
|
||||||
}
|
}
|
||||||
@ -4952,11 +4988,11 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master
|
|||||||
|
|
||||||
//skip if module is not ACTIVE
|
//skip if module is not ACTIVE
|
||||||
|
|
||||||
int opState = oam::ACTIVE;
|
// int opState = oam::ACTIVE;
|
||||||
bool degraded;
|
// bool degraded;
|
||||||
oam.getModuleStatus(moduleName, opState, degraded);
|
// oam.getModuleStatus(moduleName, opState, degraded);
|
||||||
if (opState != oam::ACTIVE)
|
// if (opState != oam::ACTIVE)
|
||||||
continue;
|
// continue;
|
||||||
|
|
||||||
bool passwordError = false;
|
bool passwordError = false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user