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

Merge branch 'develop-1.1' into merge-up-dev

This commit is contained in:
Andrew Hutchings
2017-11-24 11:10:09 +02:00
50 changed files with 1070 additions and 1168 deletions

View File

@ -1690,26 +1690,26 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
}
case RUNUPGRADE:
{
log.writeLog(__LINE__, "MSG RECEIVED: Run upgrade script ");
/* case RUNUPGRADE:
{
log.writeLog(__LINE__, "MSG RECEIVED: Run upgrade script ");
string mysqlpw;
msg >> mysqlpw;
string mysqlpw;
msg >> mysqlpw;
// run upgrade script
int ret = runUpgrade(mysqlpw);
// run upgrade script
int ret = runUpgrade(mysqlpw);
ackMsg << (ByteStream::byte) ACK;
ackMsg << (ByteStream::byte) RUNUPGRADE;
ackMsg << (ByteStream::byte) ret;
mq.write(ackMsg);
ackMsg << (ByteStream::byte) ACK;
ackMsg << (ByteStream::byte) RUNUPGRADE;
ackMsg << (ByteStream::byte) ret;
mq.write(ackMsg);
log.writeLog(__LINE__, "RUNUPGRADE: ACK back to ProcMgr return status = " + oam.itoa((int) ret));
break;
}
log.writeLog(__LINE__, "RUNUPGRADE: ACK back to ProcMgr return status = " + oam.itoa((int) ret));
break;
}
*/
case PROCUNMOUNT:
{
string dbrootID;
@ -1921,7 +1921,8 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
string masterLogFile = oam::UnassignedName;
string masterLogPos = oam::UnassignedName;
if ( (PMwithUM == "n") && (config.moduleType() == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
if ( ( (PMwithUM == "n") && (config.moduleType() == "pm") ) &&
( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
{
ackMsg << (ByteStream::byte) ACK;
ackMsg << (ByteStream::byte) MASTERREP;
@ -1993,10 +1994,9 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
msg >> masterLogFile;
string masterLogPos;
msg >> masterLogPos;
string port;
msg >> port;
if ( (PMwithUM == "n") && (config.moduleType() == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
if ( ( (PMwithUM == "n") && (config.moduleType() == "pm") ) &&
( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
{
ackMsg << (ByteStream::byte) ACK;
ackMsg << (ByteStream::byte) SLAVEREP;
@ -2022,7 +2022,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
}
// run Slave Rep script
ret = runSlaveRep(masterLogFile, masterLogPos, port);
ret = runSlaveRep(masterLogFile, masterLogPos);
ackMsg << (ByteStream::byte) ACK;
ackMsg << (ByteStream::byte) SLAVEREP;
@ -2043,7 +2043,8 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
string module;
msg >> module;
if ( (PMwithUM == "n") && (config.moduleType() == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
if ( ( (PMwithUM == "n") && (config.moduleType() == "pm") ) &&
( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
{
ackMsg << (ByteStream::byte) ACK;
ackMsg << (ByteStream::byte) MASTERDIST;
@ -5045,49 +5046,41 @@ void ProcessMonitor::checkProcessFailover( std::string processName)
* purpose: run upgrade script
*
******************************************************************************************/
int ProcessMonitor::runUpgrade(std::string mysqlpw)
/*int ProcessMonitor::runUpgrade(std::string mysqlpw)
{
Oam oam;
Oam oam;
for ( int i = 0 ; i < 10 ; i++ )
{
//run upgrade script
string cmd = startup::StartUp::installDir() + "/bin/upgrade-columnstore.sh doupgrade --password=" +
mysqlpw + " --installdir=" + startup::StartUp::installDir() + " > " + "/tmp/upgrade-columnstore.log 2>&1";
system(cmd.c_str());
for ( int i = 0 ; i < 10 ; i++ )
{
//run upgrade script
string cmd = startup::StartUp::installDir() + "/bin/upgrade-columnstore.sh doupgrade --password=" +
mysqlpw + " --installdir=" + startup::StartUp::installDir() + " > " + "/tmp/upgrade-columnstore.log 2>&1";
system(cmd.c_str());
cmd = "/tmp/upgrade-columnstore.log";
cmd = "/tmp/upgrade-columnstore.log";
if (oam.checkLogStatus(cmd, "OK")) {
log.writeLog(__LINE__, "upgrade-columnstore.sh: Successful return", LOG_TYPE_DEBUG);
return oam::API_SUCCESS;
}
else {
if (oam.checkLogStatus(cmd, "ERROR 1045") ) {
log.writeLog(__LINE__, "upgrade-columnstore.sh: Missing Password error, return success", LOG_TYPE_DEBUG);
return oam::API_SUCCESS;
}
if (oam.checkLogStatus(cmd, "OK"))
{
log.writeLog(__LINE__, "upgrade-columnstore.sh: Successful return", LOG_TYPE_DEBUG);
return oam::API_SUCCESS;
}
else
{
if (oam.checkLogStatus(cmd, "ERROR 1045") )
{
log.writeLog(__LINE__, "upgrade-columnstore.sh: Missing Password error, return success", LOG_TYPE_DEBUG);
return oam::API_SUCCESS;
}
log.writeLog(__LINE__, "upgrade-columnstore.sh: Error return, check log /tmp/upgrade-status.log", LOG_TYPE_ERROR);
//restart mysqld and retry
try
{
oam.actionMysqlCalpont(MYSQL_RESTART);
}
catch (...)
{}
sleep(1);
}
}
return oam::API_FAILURE;
log.writeLog(__LINE__, "upgrade-columnstore.sh: Error return, check log /tmp/upgrade-status.log", LOG_TYPE_ERROR);
//restart mysqld and retry
try {
oam.actionMysqlCalpont(MYSQL_RESTART);
}
catch(...)
{}
sleep(1);
}
}
return oam::API_FAILURE;
}
*/
/******************************************************************************************
* @brief changeMyCnf
@ -5112,51 +5105,8 @@ int ProcessMonitor::changeMyCnf(std::string type)
string dbDir = startup::StartUp::installDir() + "/mysql/db";
/* if ( type == "master" )
{
// set master replication entries
vector <string> lines;
char line[200];
string buf;
while (file.getline(line, 200))
{
buf = line;
string::size_type pos = buf.find("server-id =",0);
if ( pos != string::npos ) {
buf = "server-id = 1";
}
// pos = buf.find("# binlog_format=ROW",0);
// if ( pos != string::npos ) {
// buf = "binlog_format=ROW";
// }
pos = buf.find("infinidb_local_query=1",0);
if ( pos != string::npos && pos == 0) {
buf = "# infinidb_local_query=1";
}
//output to temp file
lines.push_back(buf);
}
file.close();
unlink (mycnfFile.c_str());
ofstream newFile (mycnfFile.c_str());
//create new file
int fd = open(mycnfFile.c_str(), O_RDWR|O_CREAT, 0664);
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
newFile.close();
close(fd);
}
if ( type == "slave" )
{
*/ //get slave id based on ExeMgrx setup
string slaveID = "0";
//get server-id based on ExeMgrx setup
string serverID = "0";
string localModuleName = config.moduleName();
for ( int id = 1 ; ; id++ )
@ -5172,36 +5122,20 @@ int ProcessMonitor::changeMyCnf(std::string type)
if ( moduleName == localModuleName )
{
slaveID = oam.itoa(id);
serverID = oam.itoa(id);
break;
}
}
catch (...) {}
}
if ( slaveID == "0" )
if ( serverID == "0" )
{
log.writeLog(__LINE__, "changeMyCnf: ExeMgr for local module doesn't exist", LOG_TYPE_ERROR);
return oam::API_FAILURE;
}
// get local host name
/* string HOSTNAME = "localhost";
try
{
ModuleConfig moduleconfig;
oam.getSystemConfig(config.moduleName(), moduleconfig);
HostConfigList::iterator pt1 = moduleconfig.hostConfigList.begin();
HOSTNAME = (*pt1).HostName;
}
catch(...)
{}
char* p= getenv("HOSTNAME");
if (p && *p)
HOSTNAME = p;
*/
// set slave replication entries
// set server-id and other options in my.cnf
vector <string> lines;
char line[200];
string buf;
@ -5213,35 +5147,58 @@ int ProcessMonitor::changeMyCnf(std::string type)
if ( pos != string::npos )
{
buf = "server-id = " + slaveID;
buf = "server-id = " + serverID;
string command = "SET GLOBAL server_id=" + serverID + ";";
int ret = runMariaDBCommandLine(command);
if (ret != 0)
{
log.writeLog(__LINE__, "changeMyCnf: runMariaDBCommandLine Error", LOG_TYPE_ERROR);
return oam::API_FAILURE;
}
}
// set local query flag if on pm
if ( (PMwithUM == "y") && config.moduleType() == "pm" )
{
pos = buf.find("# infinidb_local_query=1", 0);
pos = buf.find("infinidb_local_query", 0);
if ( pos != string::npos )
{
buf = "infinidb_local_query=1";
string command = "SET GLOBAL " + buf + ";";
int ret = runMariaDBCommandLine(command);
if (ret != 0)
{
log.writeLog(__LINE__, "changeMyCnf: runMariaDBCommandLine Error", LOG_TYPE_ERROR);
return oam::API_FAILURE;
}
}
}
else
{
// disable, if needed
pos = buf.find("infinidb_local_query=1", 0);
pos = buf.find("infinidb_local_query", 0);
if ( pos != string::npos )
{
buf = "# infinidb_local_query=1";
buf = "infinidb_local_query=0";
string command = "SET GLOBAL " + buf + ";";
int ret = runMariaDBCommandLine(command);
if (ret != 0)
{
log.writeLog(__LINE__, "changeMyCnf: runMariaDBCommandLine Error", LOG_TYPE_ERROR);
return oam::API_FAILURE;
}
}
}
// pos = buf.find("binlog_format=ROW",0);
// if ( pos != string::npos && pos == 0 ) {
// buf = "# binlog_format=ROW";
// }
//output to temp file
lines.push_back(buf);
}
@ -5257,69 +5214,7 @@ int ProcessMonitor::changeMyCnf(std::string type)
newFile.close();
close(fd);
// }
/* if ( type == "disable" )
{
// set master replication entries
vector <string> lines;
char line[200];
string buf;
while (file.getline(line, 200))
{
buf = line;
string::size_type pos = buf.find("server-id",0);
if ( pos != string::npos ) {
string::size_type pos1 = buf.find("1",pos);
if ( pos1 == string::npos ) {
buf = "# server-id = 1";
}
}
pos = buf.find("log-bin=mysql-bin",0);
if ( pos != string::npos ) {
buf = "# log-bin=mysql-bin";
}
pos = buf.find("binlog_format=ROW",0);
if ( pos != string::npos && pos == 0 ) {
buf = "# binlog_format=ROW";
}
pos = buf.find("infinidb_local_query=1",0);
if ( pos != string::npos && pos == 0) {
buf = "# infinidb_local_query=1";
}
pos = buf.find("# relay-log",0);
if ( pos != string::npos ) {
buf = buf;
}
else
{
pos = buf.find("relay-log",0);
if ( pos != string::npos ) {
buf = "# " + buf;
}
}
//output to temp file
lines.push_back(buf);
}
file.close();
unlink (mycnfFile.c_str());
ofstream newFile (mycnfFile.c_str());
//create new file
int fd = open(mycnfFile.c_str(), O_RDWR|O_CREAT, 0664);
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
newFile.close();
close(fd);
}
*/
// set owner and permission
string cmd = "chmod 664 " + mycnfFile + " >/dev/null 2>&1";
@ -5336,19 +5231,76 @@ int ProcessMonitor::changeMyCnf(std::string type)
system(cmd.c_str());
// restart mysql
try
{
oam.actionMysqlCalpont(MYSQL_RESTART);
sleep(5); // give after mysql restart
}
catch (...)
{}
/* try {
oam.actionMysqlCalpont(MYSQL_RESTART);
sleep(5); // give after mysql restart
}
catch(...)
{}
*/
log.writeLog(__LINE__, "changeMyCnf function successfully completed", LOG_TYPE_DEBUG);
return oam::API_SUCCESS;
}
/******************************************************************************************
* @brief runMariaDBCommandLine
*
* purpose: run MariaDB Command Line script
*
******************************************************************************************/
int ProcessMonitor::runMariaDBCommandLine(std::string command)
{
Oam oam;
log.writeLog(__LINE__, "runMariaDBCommandLine function called: cmd = " + command, LOG_TYPE_DEBUG);
// mysql port number
string MySQLPort;
try
{
oam.getSystemConfig("MySQLPort", MySQLPort);
}
catch (...)
{
MySQLPort = "3306";
}
if ( MySQLPort.empty() )
MySQLPort = "3306";
string cmd = startup::StartUp::installDir() + "/bin/mariadb-command-line.sh --installdir=" + startup::StartUp::installDir() + " --command='" + command + "' --port=" + MySQLPort + " > /tmp/mariadb-command-line.sh.log 2>&1";
log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG);
system(cmd.c_str());
string logFile = "/tmp/mariadb-command-line.sh.log";
if (oam.checkLogStatus(logFile, "ERROR 1045") )
{
log.writeLog(__LINE__, "mariadb-command-line.sh: MySQL Password Error, check .my.cnf", LOG_TYPE_ERROR);
return oam::API_FAILURE;
}
else
{
if (oam.checkLogStatus(logFile, "OK"))
{
log.writeLog(__LINE__, "mariadb-command-line.sh: Successful return", LOG_TYPE_DEBUG);
return oam::API_SUCCESS;
}
else
{
log.writeLog(__LINE__, "mariadb-command-line.sh: Error return, check log /tmp/mariadb-command-line.sh.log", LOG_TYPE_ERROR);
return oam::API_FAILURE;
}
}
return oam::API_FAILURE;
}
/******************************************************************************************
* @brief runMasterRep
*
@ -5361,19 +5313,6 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master
log.writeLog(__LINE__, "runMasterRep function called", LOG_TYPE_DEBUG);
//get mysql user password
string mysqlpw = oam::UnassignedName;
try
{
mysqlpw = oam.getMySQLPassword();
}
catch (...)
{}
if ( mysqlpw == oam::UnassignedName )
mysqlpw = "";
SystemModuleTypeConfig systemModuleTypeConfig;
try
@ -5390,6 +5329,21 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master
// log.writeLog(__LINE__, "EXCEPTION ERROR on getSystemConfig: Caught unknown exception!", LOG_TYPE_ERROR);
}
// mysql port number
string MySQLPort;
try
{
oam.getSystemConfig("MySQLPort", MySQLPort);
}
catch (...)
{
MySQLPort = "3306";
}
if ( MySQLPort.empty() )
MySQLPort = "3306";
// create user for each module by ip address
for ( unsigned int i = 0 ; i < systemModuleTypeConfig.moduletypeconfig.size(); i++)
{
@ -5408,66 +5362,44 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master
string moduleType = systemModuleTypeConfig.moduletypeconfig[i].ModuleType;
if ( (PMwithUM == "n") && (moduleType == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
if ( ( (PMwithUM == "n") && (moduleType == "pm") ) &&
( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
continue;
HostConfigList::iterator pt1 = (*pt).hostConfigList.begin();
while (true) // need in case there is a password retry
for ( ; pt1 != (*pt).hostConfigList.end() ; pt1++ )
{
for ( ; pt1 != (*pt).hostConfigList.end() ; pt1++ )
string ipAddr = (*pt1).IPAddr;
string logFile = "/tmp/master-rep-columnstore-" + moduleName + ".log";
string cmd = startup::StartUp::installDir() + "/bin/master-rep-columnstore.sh --installdir=" + startup::StartUp::installDir() + " --hostIP=" + ipAddr + " --port=" + MySQLPort + " > " + logFile + " 2>&1";
log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG);
system(cmd.c_str());
if (oam.checkLogStatus(logFile, "ERROR 1045") )
{
string ipAddr = (*pt1).IPAddr;
string logFile = "/tmp/master-rep-columnstore-" + moduleName + ".log";
string cmd = startup::StartUp::installDir() + "/bin/master-rep-columnstore.sh --password=" +
mysqlpw + " --installdir=" + startup::StartUp::installDir() + " --hostIP=" + ipAddr + " > " + logFile + " 2>&1";
log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG);
system(cmd.c_str());
if (oam.checkLogStatus(logFile, "ERROR 1045") )
{
if ( passwordError )
{
log.writeLog(__LINE__, "master-rep-columnstore.sh: MySQL Password Error", LOG_TYPE_ERROR);
return oam::API_FAILURE;
}
log.writeLog(__LINE__, "master-rep-columnstore.sh: Missing Password error, go check for a password and retry", LOG_TYPE_DEBUG);
passwordError = true;
break;
}
else
{
if (oam.checkLogStatus(logFile, "OK"))
log.writeLog(__LINE__, "master-rep-columnstore.sh: Successful return for node " + moduleName, LOG_TYPE_DEBUG);
else
{
log.writeLog(__LINE__, "master-rep-columnstore.sh: Error return, check log " + logFile, LOG_TYPE_ERROR);
return oam::API_FAILURE;
}
}
}
//got check for password and bypass config check
if ( passwordError )
{
try
{
mysqlpw = oam.getMySQLPassword();
}
catch (...)
{}
if ( mysqlpw == oam::UnassignedName )
if ( passwordError )
{
log.writeLog(__LINE__, "master-rep-columnstore.sh: MySQL Password Error", LOG_TYPE_ERROR);
return oam::API_FAILURE;
}
log.writeLog(__LINE__, "master-rep-columnstore.sh: Missing Password error, go check for a password and retry", LOG_TYPE_DEBUG);
passwordError = true;
break;
}
else
break;
{
if (oam.checkLogStatus(logFile, "OK"))
log.writeLog(__LINE__, "master-rep-columnstore.sh: Successful return for node " + moduleName, LOG_TYPE_DEBUG);
else
{
log.writeLog(__LINE__, "master-rep-columnstore.sh: Error return, check log " + logFile, LOG_TYPE_ERROR);
return oam::API_FAILURE;
}
}
}
}
}
@ -5541,25 +5473,12 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master
* purpose: run Slave Replication script
*
******************************************************************************************/
int ProcessMonitor::runSlaveRep(std::string& masterLogFile, std::string& masterLogPos, std::string& port)
int ProcessMonitor::runSlaveRep(std::string& masterLogFile, std::string& masterLogPos)
{
Oam oam;
log.writeLog(__LINE__, "runSlaveRep function called", LOG_TYPE_DEBUG);
//get mysql user password
string mysqlpw = oam::UnassignedName;
try
{
mysqlpw = oam.getMySQLPassword();
}
catch (...)
{}
if ( mysqlpw == oam::UnassignedName )
mysqlpw = "";
// get master replicaion module IP Address
string PrimaryUMModuleName;
oam.getSystemConfig("PrimaryUMModuleName", PrimaryUMModuleName);
@ -5576,12 +5495,26 @@ int ProcessMonitor::runSlaveRep(std::string& masterLogFile, std::string& masterL
catch (...)
{}
// mysql port number
string MySQLPort;
try
{
oam.getSystemConfig("MySQLPort", MySQLPort);
}
catch (...)
{
MySQLPort = "3306";
}
if ( MySQLPort.empty() )
MySQLPort = "3306";
bool passwordError = false;
while (true)
{
string cmd = startup::StartUp::installDir() + "/bin/slave-rep-columnstore.sh --password=" +
mysqlpw + " --installdir=" + startup::StartUp::installDir() + " --masteripaddr=" + masterIPAddress + " --masterlogfile=" + masterLogFile + " --masterlogpos=" + masterLogPos + + " --port=" + port + " > /tmp/slave-rep-columnstore.log 2>&1";
string cmd = startup::StartUp::installDir() + "/bin/slave-rep-columnstore.sh --installdir=" + startup::StartUp::installDir() + " --masteripaddr=" + masterIPAddress + " --masterlogfile=" + masterLogFile + " --masterlogpos=" + masterLogPos + " --port=" + MySQLPort + " > /tmp/slave-rep-columnstore.log 2>&1";
log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG);
@ -5613,25 +5546,6 @@ int ProcessMonitor::runSlaveRep(std::string& masterLogFile, std::string& masterL
return oam::API_FAILURE;
}
}
//got check for password and bypass config check
if ( passwordError )
{
try
{
mysqlpw = oam.getMySQLPassword();
}
catch (...)
{}
if ( mysqlpw == oam::UnassignedName )
{
log.writeLog(__LINE__, "slave-rep-columnstore.sh: MySQL Password Error", LOG_TYPE_ERROR);
return oam::API_FAILURE;
}
}
else
break;
}
return oam::API_FAILURE;
@ -5649,21 +5563,22 @@ int ProcessMonitor::runDisableRep()
log.writeLog(__LINE__, "runDisableRep function called", LOG_TYPE_DEBUG);
//get mysql user password
string mysqlpw = oam::UnassignedName;
// mysql port number
string MySQLPort;
try
{
mysqlpw = oam.getMySQLPassword();
oam.getSystemConfig("MySQLPort", MySQLPort);
}
catch (...)
{}
{
MySQLPort = "3306";
}
if ( mysqlpw == oam::UnassignedName )
mysqlpw = "";
if ( MySQLPort.empty() )
MySQLPort = "3306";
string cmd = startup::StartUp::installDir() + "/bin/disable-rep-columnstore.sh --password=" +
mysqlpw + " --installdir=" + startup::StartUp::installDir() + " > /tmp/disable-rep-columnstore.log 2>&1";
string cmd = startup::StartUp::installDir() + "/bin/disable-rep-columnstore.sh --installdir=" + startup::StartUp::installDir() + " > /tmp/disable-rep-columnstore.log 2>&1";
log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG);
@ -5719,6 +5634,8 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul
// log.writeLog(__LINE__, "EXCEPTION ERROR on getSystemConfig: Caught unknown exception!", LOG_TYPE_ERROR);
}
int slave = 0;
if ( slaveModule == "all" )
{
// Distrubuted MySQL Front-end DB to Slave Modules
@ -5731,7 +5648,8 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul
string moduleType = systemModuleTypeConfig.moduletypeconfig[i].ModuleType;
if ( (PMwithUM == "n") && (moduleType == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
if ( ( (PMwithUM == "n") && (moduleType == "pm") ) &&
( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
continue;
DeviceNetworkList::iterator pt = systemModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.begin();
@ -5744,6 +5662,8 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul
if ( moduleName == config.moduleName() )
continue;
slave++;
HostConfigList::iterator pt1 = (*pt).hostConfigList.begin();
for ( ; pt1 != (*pt).hostConfigList.end() ; pt1++ )
@ -5758,7 +5678,10 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul
string logFile = "/tmp/master-dist_" + moduleName + ".log";
if (!oam.checkLogStatus(logFile, "FAILED"))
{
log.writeLog(__LINE__, "runMasterDist: Success rsync to module: " + moduleName, LOG_TYPE_DEBUG);
break;
}
else
{
log.writeLog(__LINE__, "runMasterDist: Failure rsync to module: " + moduleName, LOG_TYPE_ERROR);
@ -5770,26 +5693,40 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul
}
else
{
// get slave IP address
ModuleConfig moduleconfig;
oam.getSystemConfig(slaveModule, moduleconfig);
HostConfigList::iterator pt1 = moduleconfig.hostConfigList.begin();
string ipAddr = (*pt1).IPAddr;
// don't do PMs unless PMwithUM flag is set
string cmd = startup::StartUp::installDir() + "/bin/rsync.sh " + ipAddr + " " + password + " " + startup::StartUp::installDir() + " 1 > /tmp/master-dist_" + slaveModule + ".log";
system(cmd.c_str());
string moduleType = slaveModule.substr(0, MAX_MODULE_TYPE_SIZE);
string logFile = "/tmp/master-dist_" + slaveModule + ".log";
if (!oam.checkLogStatus(logFile, "FAILED"))
log.writeLog(__LINE__, "runMasterDist: Success rsync to module: " + slaveModule, LOG_TYPE_DEBUG);
else
if ( (moduleType == "um") ||
( (PMwithUM == "y") && (moduleType == "pm") ) ||
( config.ServerInstallType() == oam::INSTALL_COMBINE_DM_UM_PM) )
{
log.writeLog(__LINE__, "runMasterDist: Failure rsync to module: " + slaveModule, LOG_TYPE_ERROR);
return oam::API_FAILURE;
slave++;
// get slave IP address
ModuleConfig moduleconfig;
oam.getSystemConfig(slaveModule, moduleconfig);
HostConfigList::iterator pt1 = moduleconfig.hostConfigList.begin();
string ipAddr = (*pt1).IPAddr;
string cmd = startup::StartUp::installDir() + "/bin/rsync.sh " + ipAddr + " " + password + " " + startup::StartUp::installDir() + " 1 > /tmp/master-dist_" + slaveModule + ".log";
system(cmd.c_str());
string logFile = "/tmp/master-dist_" + slaveModule + ".log";
if (!oam.checkLogStatus(logFile, "FAILED"))
log.writeLog(__LINE__, "runMasterDist: Success rsync to module: " + slaveModule, LOG_TYPE_DEBUG);
else
{
log.writeLog(__LINE__, "runMasterDist: Failure rsync to module: " + slaveModule, LOG_TYPE_ERROR);
return oam::API_FAILURE;
}
}
}
if (slave == 0 )
log.writeLog(__LINE__, "runMasterDist: No configured slave nodes", LOG_TYPE_DEBUG);
return oam::API_SUCCESS;
}