From f3ce8458423329756edbb66b81276e15fdef4d3a Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc Date: Wed, 10 Oct 2018 14:58:50 -0500 Subject: [PATCH] MCOL-520. Fixed several instances where we were using a too-new contructor to ifstream. --- dbcon/mysql/ha_calpont_impl.cpp | 6 +++--- procmgr/processmanager.cpp | 30 +++++++++++++++--------------- procmon/processmonitor.cpp | 24 ++++++++++++------------ 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/dbcon/mysql/ha_calpont_impl.cpp b/dbcon/mysql/ha_calpont_impl.cpp index 42eb9adb7..2b854e3a6 100644 --- a/dbcon/mysql/ha_calpont_impl.cpp +++ b/dbcon/mysql/ha_calpont_impl.cpp @@ -3058,7 +3058,7 @@ int ha_calpont_impl_rnd_init(TABLE* table) // plan serialization string tmpDir = aTmpDir + "/li1-plan.hex"; - ifstream ifs(tmpDir); + ifstream ifs(tmpDir.c_str()); ByteStream bs1; ifs >> bs1; ifs.close(); @@ -5121,7 +5121,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE ci->warningMsg = msg; } - // If the previous query has error and + // If the previous query has error and // this is not a subquery run by the server(MCOL-1601) // re-establish the connection if (ci->queryState != 0) @@ -5221,7 +5221,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE return 0; string query; - // Set the query text only once if the server executes + // Set the query text only once if the server executes // subqueries separately. if(ci->queryState) query.assign(""); diff --git a/procmgr/processmanager.cpp b/procmgr/processmanager.cpp index 45df060fb..424da5605 100644 --- a/procmgr/processmanager.cpp +++ b/procmgr/processmanager.cpp @@ -674,8 +674,8 @@ void processMSG(messageqcpp::IOSocket* cfIos) processManager.recycleProcess(target, true); //distribute config file - processManager.distributeConfigFile("system"); - + processManager.distributeConfigFile("system"); + //set query system state ready processManager.setQuerySystemState(true); @@ -917,7 +917,7 @@ void processMSG(messageqcpp::IOSocket* cfIos) //check for SIMPLEX Processes on mate might need to be started processManager.checkSimplexModule(moduleName); - + processManager.setSystemState(oam::ACTIVE); //set query system state ready @@ -1016,7 +1016,7 @@ void processMSG(messageqcpp::IOSocket* cfIos) { processManager.stopModule(moduleName, graceful, manualFlag); log.writeLog(__LINE__, "stop Module Completed on " + moduleName, LOG_TYPE_INFO); - + status = processManager.enableModule(moduleName, oam::MAN_OFFLINE); log.writeLog(__LINE__, "Enable Module Completed on " + moduleName, LOG_TYPE_INFO); } @@ -1783,7 +1783,7 @@ void processMSG(messageqcpp::IOSocket* cfIos) pthread_join(startsystemthread, NULL); status = startsystemthreadStatus; } - + // setup MySQL Replication after FORCE restart command if ( (status == API_SUCCESS) && (graceful == oam::FORCEFUL) ) @@ -3762,7 +3762,7 @@ void ProcessManager::recycleProcess(string module, bool enableModule) stopProcessType("WriteEngineServer"); stopProcessType("ExeMgr"); - + stopProcessType("PrimProc"); stopProcessType("DBRMControllerNode"); @@ -3774,13 +3774,13 @@ void ProcessManager::recycleProcess(string module, bool enableModule) stopProcessType("mysqld"); // restartProcessType("mysqld"); - + startProcessType("DBRMControllerNode"); startProcessType("DBRMWorkerNode"); startProcessType("PrimProc"); sleep(5); - + startProcessType("WriteEngineServer"); sleep(3); @@ -3840,7 +3840,7 @@ int ProcessManager::enableModule(string target, int state, bool failover) if ( newStandbyModule == target) setStandbyModule(newStandbyModule); - + log.writeLog(__LINE__, "enableModule request for " + target + " completed", LOG_TYPE_DEBUG); return API_SUCCESS; @@ -4152,7 +4152,7 @@ void ProcessManager::setSystemState(uint16_t state) if( state == oam::ACTIVE ) { //set query system states ready processManager.setQuerySystemState(true); - + //clear alarms if set aManager.sendAlarmReport(system.c_str(), SYSTEM_DOWN_AUTO, CLEAR); aManager.sendAlarmReport(system.c_str(), SYSTEM_DOWN_MANUAL, CLEAR); @@ -4694,7 +4694,7 @@ int ProcessManager::restartProcessType( std::string processName, std::string ski if ( systemprocessstatus.processstatus[i].ProcessOpState != oam::ACTIVE ) continue; - + if ( (processName.find("DDLProc") == 0 || processName.find("DMLProc") == 0) ) { string procModuleType = systemprocessstatus.processstatus[i].Module.substr(0, MAX_MODULE_TYPE_SIZE); @@ -7722,7 +7722,7 @@ void startSystemThread(oam::DeviceNetworkList Devicenetworklist) // wait some more sleep(2); } - + if ( rtn = oam::ACTIVE ) //set query system state not ready processManager.setQuerySystemState(true); @@ -8265,7 +8265,7 @@ void ProcessManager::checkSimplexModule(std::string moduleName) if ( systemprocessconfig.processconfig[j].ProcessName == "DDLProc") { setPMProcIPs((*pt).DeviceName); - + log.writeLog(__LINE__, "Set Primary UM Module = " + (*pt).DeviceName, LOG_TYPE_DEBUG); oam.setSystemConfig("PrimaryUMModuleName", (*pt).DeviceName); @@ -8284,7 +8284,7 @@ void ProcessManager::checkSimplexModule(std::string moduleName) log.writeLog(__LINE__, "checkSimplexModule: mate process started: " + (*pt).DeviceName + "/" + systemprocessconfig.processconfig[j].ProcessName, LOG_TYPE_DEBUG); status = processManager.startProcess((*pt).DeviceName, - "DMLProc", + "DMLProc", FORCEFUL); if ( status == API_SUCCESS ) { log.writeLog(__LINE__, "checkSimplexModule: mate process started: " + (*pt).DeviceName + "/DMLProc", LOG_TYPE_DEBUG); @@ -11114,7 +11114,7 @@ int ProcessManager::mountDBRoot(std::string dbrootID) system(cmd.c_str()); } - ifstream in(tmpMount); + ifstream in(tmpMount.c_str()); in.seekg(0, std::ios::end); int size = in.tellg(); diff --git a/procmon/processmonitor.cpp b/procmon/processmonitor.cpp index a406b3f1e..a60c503b5 100644 --- a/procmon/processmonitor.cpp +++ b/procmon/processmonitor.cpp @@ -1057,7 +1057,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO msg >> manualFlag; int requestStatus = oam::API_SUCCESS; log.writeLog(__LINE__, "MSG RECEIVED: Start All process request..."); - + //start the mysqld daemon try @@ -1548,7 +1548,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO system(cmd.c_str()); string tmpFile = tmpLogDir + "/mysqldstart"; - ifstream file (tmpFile); + ifstream file (tmpFile.c_str()); if (!file) { @@ -1829,7 +1829,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO } return_status = API_SUCCESS; - ifstream in(tmpMount); + ifstream in(tmpMount.c_str()); in.seekg(0, std::ios::end); int size = in.tellg(); @@ -4973,7 +4973,7 @@ void ProcessMonitor::checkModuleFailover( std::string processName) oam::DeviceNetworkConfig devicenetworkconfig; oam::DeviceNetworkList devicenetworklist; - + devicenetworkconfig.DeviceName = config.moduleName(); devicenetworklist.push_back(devicenetworkconfig); @@ -5348,7 +5348,7 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master // in log - show-master-status.log string masterLog = tmpLogDir + "/show-master-status.log"; - ifstream file (masterLog); + ifstream file (masterLog.c_str()); if (!file) { @@ -5512,7 +5512,7 @@ int ProcessMonitor::runDisableRep() if ( MySQLPort.empty() ) MySQLPort = "3306"; - + string logFile = tmpLogDir + "/disable-rep-columnstore.log"; string cmd = startup::StartUp::installDir() + "/bin/disable-rep-columnstore.sh --installdir=" + startup::StartUp::installDir() + " --tmpdir=" + tmpLogDir + " > " + logFile + " 2>&1"; @@ -6298,7 +6298,7 @@ int ProcessMonitor::checkDataMount() cmd = "export LC_ALL=C;mount " + dbroot + " > " + mountLog + " 2>&1"; system(cmd.c_str()); - ifstream in(mountLog); + ifstream in(mountLog.c_str()); in.seekg(0, std::ios::end); int size = in.tellg(); @@ -6506,7 +6506,7 @@ int ProcessMonitor::glusterAssign(std::string dbrootID) { log.writeLog(__LINE__, "glusterAssign mount failure: dbroot: " + dbrootID + " error: " + oam.itoa(WEXITSTATUS(ret)), LOG_TYPE_ERROR); - ifstream in(tmpLog); + ifstream in(tmpLog.c_str()); in.seekg(0, std::ios::end); int size = in.tellg(); @@ -6540,9 +6540,9 @@ int ProcessMonitor::glusterUnassign(std::string dbrootID) std::string errmsg = ""; log.writeLog(__LINE__, "glusterUnassign called: " + dbrootID, LOG_TYPE_DEBUG); - + string tmpLog = tmpLogDir + "/glusterUnassign.log"; - + command = "umount -f " + startup::StartUp::installDir() + "/data" + dbrootID + " > " + tmpLog + " 2>&1"; int ret = system(command.c_str()); @@ -6551,7 +6551,7 @@ int ProcessMonitor::glusterUnassign(std::string dbrootID) { log.writeLog(__LINE__, "glusterUnassign mount failure: dbroot: " + dbrootID + " error: " + oam.itoa(WEXITSTATUS(ret)), LOG_TYPE_ERROR); - ifstream in(tmpLog); + ifstream in(tmpLog.c_str()); in.seekg(0, std::ios::end); int size = in.tellg(); @@ -6560,7 +6560,7 @@ int ProcessMonitor::glusterUnassign(std::string dbrootID) if (!oam.checkLogStatus(tmpLog, "not mounted")) { log.writeLog(__LINE__, "glusterUnassign failed.", LOG_TYPE_ERROR); - + string cmd = "mv -f " + tmpLog + " " + tmpLog + "failed"; system(cmd.c_str()); return oam::API_FAILURE;