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

Merge pull request #292 from mariadb-corporation/mcol-943-1.0

Mcol 943 1.0
This commit is contained in:
david hill
2017-10-20 17:00:47 -05:00
committed by GitHub
16 changed files with 175 additions and 242 deletions

View File

@@ -1,4 +1,4 @@
COLUMNSTORE_VERSION_MAJOR=1 COLUMNSTORE_VERSION_MAJOR=1
COLUMNSTORE_VERSION_MINOR=0 COLUMNSTORE_VERSION_MINOR=0
COLUMNSTORE_VERSION_PATCH=11 COLUMNSTORE_VERSION_PATCH=12
COLUMNSTORE_VERSION_RELEASE=2 COLUMNSTORE_VERSION_RELEASE=1

View File

@@ -463,7 +463,6 @@
<GlusterStorageType>unassigned</GlusterStorageType> <GlusterStorageType>unassigned</GlusterStorageType>
<CoreFileFlag>n</CoreFileFlag> <CoreFileFlag>n</CoreFileFlag>
<MySQLPort>3306</MySQLPort> <MySQLPort>3306</MySQLPort>
<MySQLPasswordConfig>unassigned</MySQLPasswordConfig>
<AmazonDeviceName>/dev/xvd</AmazonDeviceName> <AmazonDeviceName>/dev/xvd</AmazonDeviceName>
</Installation> </Installation>
<ExtentMap> <ExtentMap>

View File

@@ -458,7 +458,6 @@
<JavaHome>unassigned</JavaHome> <JavaHome>unassigned</JavaHome>
<JavaPath>unassigned</JavaPath> <JavaPath>unassigned</JavaPath>
<MySQLPort>3306</MySQLPort> <MySQLPort>3306</MySQLPort>
<MySQLPasswordConfig>unassigned</MySQLPasswordConfig>
</Installation> </Installation>
<ExtentMap> <ExtentMap>
<!-- <!--

View File

@@ -49,7 +49,7 @@ cat /tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log
$installdir/mysql/bin/mysql \ $installdir/mysql/bin/mysql \
--defaults-file=$installdir/mysql/my.cnf \ --defaults-file=$installdir/mysql/my.cnf \
--user=root $pwprompt \ --user=root $pwprompt \
calpontsys </tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log calpontsys </tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log 2>&1
checkForError checkForError
@@ -65,7 +65,7 @@ cat /tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log
$installdir/mysql/bin/mysql \ $installdir/mysql/bin/mysql \
--defaults-file=$installdir/mysql/my.cnf \ --defaults-file=$installdir/mysql/my.cnf \
--user=root $pwprompt \ --user=root $pwprompt \
calpontsys </tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log calpontsys </tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log 2>&1
checkForError checkForError

View File

@@ -47,7 +47,7 @@ password="Calpont1"
# #
echo "Create Replication User $repUser for node $hostipaddr" >>/tmp/master-rep-status-$hostipaddr.log echo "Create Replication User $repUser for node $hostipaddr" >>/tmp/master-rep-status-$hostipaddr.log
cat >/tmp/idb_master-rep.sql <<EOD cat >/tmp/idb_master-rep.sql <<EOD
CREATE USER '$repUser'@'$hostipaddr' IDENTIFIED BY '$password'; CREATE USER IF NOT EXISTS '$repUser'@'$hostipaddr' IDENTIFIED BY '$password';
GRANT REPLICATION SLAVE ON *.* TO '$repUser'@'$hostipaddr'; GRANT REPLICATION SLAVE ON *.* TO '$repUser'@'$hostipaddr';
EOD EOD
@@ -55,7 +55,7 @@ cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log
$installdir/mysql/bin/mysql \ $installdir/mysql/bin/mysql \
--defaults-file=$installdir/mysql/my.cnf \ --defaults-file=$installdir/mysql/my.cnf \
--user=root $pwprompt \ --user=root $pwprompt \
calpontsys </tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log calpontsys </tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log 2>&1
checkForError checkForError
@@ -73,7 +73,7 @@ cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log
$installdir/mysql/bin/mysql \ $installdir/mysql/bin/mysql \
--defaults-file=$installdir/mysql/my.cnf \ --defaults-file=$installdir/mysql/my.cnf \
--user=root $pwprompt \ --user=root $pwprompt \
calpontsys </tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log calpontsys </tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log 2>&1
checkForError checkForError
@@ -89,7 +89,7 @@ cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log
$installdir/mysql/bin/mysql \ $installdir/mysql/bin/mysql \
--defaults-file=$installdir/mysql/my.cnf \ --defaults-file=$installdir/mysql/my.cnf \
--user=root $pwprompt \ --user=root $pwprompt \
calpontsys </tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log calpontsys </tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log 2>&1
checkForError checkForError
@@ -102,9 +102,11 @@ cat /tmp/idb_master-rep.sql >/tmp/show-master-status.log
$installdir/mysql/bin/mysql \ $installdir/mysql/bin/mysql \
--defaults-file=$installdir/mysql/my.cnf \ --defaults-file=$installdir/mysql/my.cnf \
--user=root $pwprompt \ --user=root $pwprompt \
calpontsys </tmp/idb_master-rep.sql >>/tmp/show-master-status.log calpontsys </tmp/idb_master-rep.sql >>/tmp/show-master-status.log 2>&1
checkForError
#alls good, 'OK' for success #alls good, 'OK' for success
echo "OK" echo "OK"
exit 0 exit 0

View File

@@ -46,13 +46,36 @@ expect {
-re "passphrase" { send "$PASSWORD\n" } -re "passphrase" { send "$PASSWORD\n" }
-re "failed" { send_user " FAILED: Failure, check tmp log\n" ; exit 1 } -re "failed" { send_user " FAILED: Failure, check tmp log\n" ; exit 1 }
-re "Permission denied" { send_user " FAILED: Invalid password\n" ; exit 1 } -re "Permission denied" { send_user " FAILED: Invalid password\n" ; exit 1 }
-re "total size" { exit 0 } -re "total size" {} abort
} }
expect { expect {
-re "failed" { send_user " FAILED: Failure, check tmp log\n" ; exit 1 } -re "failed" { send_user " FAILED: Failure, check tmp log\n" ; exit 1 }
-re "Permission denied" { send_user " FAILED: Invalid password\n" ; exit 1 } -re "Permission denied" { send_user " FAILED: Invalid password\n" ; exit 1 }
-re "total size" { exit 0 } -re "total size" {} abort
} }
set HOME "$env(HOME)"
set COMMAND "rsync -vopgr -e ssh $HOME/.my.cnf $USERNAME@$SERVER:$HOME/"
#
# run command
#
set timeout 20
send "$COMMAND\n"
expect {
-re "word: " { send "$PASSWORD\n" }
-re "passphrase" { send "$PASSWORD\n" }
-re "total size" {} abort
-re "failed" { exit 0 }
timeout { exit 0 }
}
expect {
-re "total size" {} abort
-re "failed" { exit 0 }
timeout { exit 0 }
}
exit 0 exit 0

View File

@@ -60,7 +60,9 @@ cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log
$installdir/mysql/bin/mysql \ $installdir/mysql/bin/mysql \
--defaults-file=$installdir/mysql/my.cnf \ --defaults-file=$installdir/mysql/my.cnf \
--user=root $pwprompt \ --user=root $pwprompt \
calpontsys </tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log calpontsys </tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log 2>&1
checkForError
# #
# Run Change Master Command # Run Change Master Command
@@ -81,7 +83,9 @@ cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log
$installdir/mysql/bin/mysql \ $installdir/mysql/bin/mysql \
--defaults-file=$installdir/mysql/my.cnf \ --defaults-file=$installdir/mysql/my.cnf \
--user=root $pwprompt \ --user=root $pwprompt \
calpontsys </tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log calpontsys </tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log 2>&1
checkForError
# #
# Run start slave command # Run start slave command
@@ -95,7 +99,9 @@ cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log
$installdir/mysql/bin/mysql \ $installdir/mysql/bin/mysql \
--defaults-file=$installdir/mysql/my.cnf \ --defaults-file=$installdir/mysql/my.cnf \
--user=root $pwprompt \ --user=root $pwprompt \
calpontsys </tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log calpontsys </tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log 2>&1
checkForError
# #
# Run SHOW SLAVE STATUS # Run SHOW SLAVE STATUS
@@ -109,7 +115,7 @@ cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log
$installdir/mysql/bin/mysql \ $installdir/mysql/bin/mysql \
--defaults-file=$installdir/mysql/my.cnf \ --defaults-file=$installdir/mysql/my.cnf \
--user=root $pwprompt \ --user=root $pwprompt \
calpontsys </tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log calpontsys </tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log 2>&1
checkForError checkForError

View File

@@ -1260,10 +1260,10 @@ namespace oam
* *
********************************************************************/ ********************************************************************/
void Oam::addModule(DeviceNetworkList devicenetworklist, const std::string password, const std::string mysqlpw) void Oam::addModule(DeviceNetworkList devicenetworklist, const std::string password)
{ {
// build and send msg // build and send msg
int returnStatus = sendMsgToProcMgr2(ADDMODULE, devicenetworklist, FORCEFUL, ACK_YES, password, mysqlpw); int returnStatus = sendMsgToProcMgr2(ADDMODULE, devicenetworklist, FORCEFUL, ACK_YES, password);
if (returnStatus != API_SUCCESS) if (returnStatus != API_SUCCESS)
exceptionControl("addModule", returnStatus); exceptionControl("addModule", returnStatus);
@@ -8550,21 +8550,9 @@ namespace oam
* purpose: check and get mysql user password * purpose: check and get mysql user password
* *
******************************************************************************************/ ******************************************************************************************/
std::string Oam::getMySQLPassword(bool bypassConfig) std::string Oam::getMySQLPassword()
{ {
if ( !bypassConfig ) string mysqlUser = "root";
{
string MySQLPasswordConfig;
try {
getSystemConfig("MySQLPasswordConfig", MySQLPasswordConfig);
}
catch(...) {
MySQLPasswordConfig = "n";
}
if ( MySQLPasswordConfig == "n" )
return oam::UnassignedName;
}
string USER = "root"; string USER = "root";
char* p= getenv("USER"); char* p= getenv("USER");
@@ -8578,10 +8566,15 @@ namespace oam
string fileName = HOME + "/.my.cnf"; string fileName = HOME + "/.my.cnf";
writeLog("getMySQLPassword: checking: " + fileName, LOG_TYPE_DEBUG);
ifstream file (fileName.c_str()); ifstream file (fileName.c_str());
if (!file) if (!file)
{
writeLog("getMySQLPassword: doesn't exist: " + fileName, LOG_TYPE_DEBUG);
exceptionControl("getMySQLPassword", API_FILE_OPEN_ERROR); exceptionControl("getMySQLPassword", API_FILE_OPEN_ERROR);
}
char line[400]; char line[400];
string buf; string buf;
@@ -8589,8 +8582,8 @@ namespace oam
while (file.getline(line, 400)) while (file.getline(line, 400))
{ {
buf = line; buf = line;
string::size_type pos = buf.find(mysqlUser,0);
string::size_type pos = buf.find(USER,0);
if (pos != string::npos) if (pos != string::npos)
{ {
file.getline(line, 400); file.getline(line, 400);
@@ -8602,24 +8595,23 @@ namespace oam
string::size_type pos1 = buf.find("=",pos); string::size_type pos1 = buf.find("=",pos);
if (pos1 != string::npos) { if (pos1 != string::npos) {
//password found //password found
if ( bypassConfig )
{
try {
setSystemConfig("MySQLPasswordConfig", "y");
}
catch(...) {}
}
string password = buf.substr(pos1+2, 80); string password = buf.substr(pos1+1, 80);
password.erase(remove_if(password.begin(), password.end(), ::isspace), password.end());
writeLog("getMySQLPassword: password found", LOG_TYPE_DEBUG);
return password; return password;
} }
} }
break;
} }
} }
file.close(); file.close();
writeLog("getMySQLPassword: no password found", LOG_TYPE_DEBUG);
exceptionControl("getMySQLPassword", API_FAILURE); exceptionControl("getMySQLPassword", API_FAILURE);
return oam::UnassignedName; return oam::UnassignedName;
} }

View File

@@ -1468,7 +1468,7 @@ namespace oam
* @param DeviceNetworkConfig the Modules added * @param DeviceNetworkConfig the Modules added
* @param password Host Root Password * @param password Host Root Password
*/ */
EXPORT void addModule(DeviceNetworkList devicenetworklist, const std::string password, const std::string mysqlpw); EXPORT void addModule(DeviceNetworkList devicenetworklist, const std::string password);
/** @brief remove Module /** @brief remove Module
* *
@@ -2449,7 +2449,7 @@ namespace oam
/** @brief check and get mysql user password /** @brief check and get mysql user password
*/ */
EXPORT std::string getMySQLPassword(bool bypassConfig = false); EXPORT std::string getMySQLPassword();
/** @brief update fstab with dbroot mounts /** @brief update fstab with dbroot mounts
*/ */

View File

@@ -3402,7 +3402,6 @@ int processCommand(string* arguments)
} }
} }
if (bNeedsConfirm) if (bNeedsConfirm)
{ {
// confirm request // confirm request
@@ -3411,24 +3410,8 @@ int processCommand(string* arguments)
} }
string MySQLRep; string MySQLRep;
string MySQLPasswordConfig;
try { try {
oam.getSystemConfig("MySQLRep", MySQLRep); oam.getSystemConfig("MySQLRep", MySQLRep);
oam.getSystemConfig("MySQLPasswordConfig", MySQLPasswordConfig);
}
catch(...) {}
if ( MySQLRep == "y" && MySQLPasswordConfig == oam::UnassignedName ) {
cout << endl;
string prompt = "MariaDB ColumnStore Replication is enabled, is there a 'MariaDB ColumnStore' Password configured in " + HOME + "/.my.cnf (y,n): ";
MySQLPasswordConfig = dataPrompt(prompt);
}
if ( MySQLPasswordConfig != "y" )
MySQLPasswordConfig = "n";
try {
oam.setSystemConfig("MySQLPasswordConfig", MySQLPasswordConfig);
} }
catch(...) {} catch(...) {}
@@ -4935,6 +4918,12 @@ int processCommand(string* arguments)
case 46: // enableReplication case 46: // enableReplication
{ {
if ( SingleServerInstall == "y" ) {
// exit out since not on single-server install
cout << endl << "**** enableReplication Failed : not supported on a Single-Server type installs " << endl;
break;
}
string MySQLRep; string MySQLRep;
try { try {
oam.getSystemConfig("MySQLRep", MySQLRep); oam.getSystemConfig("MySQLRep", MySQLRep);
@@ -4960,26 +4949,6 @@ int processCommand(string* arguments)
if ( password == "") if ( password == "")
password = oam::UnassignedName; password = oam::UnassignedName;
string MySQLPasswordConfig;
try {
oam.getSystemConfig("MySQLPasswordConfig", MySQLPasswordConfig);
}
catch(...) {}
if ( MySQLPasswordConfig == oam::UnassignedName ) {
cout << endl;
string prompt = "Is there a 'MariaDB ColumnStore' Password configured on the MariaDB ColumnStore Front-end Modules in " + HOME + "/.my.cnf (y,n): ";
MySQLPasswordConfig = dataPrompt(prompt);
}
if ( MySQLPasswordConfig != "y" )
MySQLPasswordConfig = "n";
try {
oam.setSystemConfig("MySQLPasswordConfig", MySQLPasswordConfig);
}
catch(...) {}
//set flag //set flag
try { try {
oam.setSystemConfig("MySQLRep", "y"); oam.setSystemConfig("MySQLRep", "y");
@@ -5451,8 +5420,6 @@ int processCommand(string* arguments)
} }
string mysqlpassword = oam::UnassignedName;
try{ try{
cout << endl << "Adding Modules "; cout << endl << "Adding Modules ";
DeviceNetworkList::iterator pt = devicenetworklist.begin(); DeviceNetworkList::iterator pt = devicenetworklist.begin();
@@ -5464,7 +5431,7 @@ int processCommand(string* arguments)
cout << "please wait..." << endl; cout << "please wait..." << endl;
oam.addModule(devicenetworklist, password, mysqlpassword); oam.addModule(devicenetworklist, password);
cout << "Add Module(s) successfully completed" << endl; cout << "Add Module(s) successfully completed" << endl;
@@ -5927,6 +5894,12 @@ int processCommand(string* arguments)
case 51: // disableReplication case 51: // disableReplication
{ {
if ( SingleServerInstall == "y" ) {
// exit out since not on single-server install
cout << endl << "**** disableReplication Failed : not supported on a Single-Server type installs " << endl;
break;
}
string MySQLRep; string MySQLRep;
try { try {
oam.getSystemConfig("MySQLRep", MySQLRep); oam.getSystemConfig("MySQLRep", MySQLRep);
@@ -5940,26 +5913,6 @@ int processCommand(string* arguments)
break; break;
} }
string MySQLPasswordConfig;
try {
oam.getSystemConfig("MySQLPasswordConfig", MySQLPasswordConfig);
}
catch(...) {}
if ( MySQLPasswordConfig == oam::UnassignedName ) {
cout << endl;
string prompt = "Is there a 'MariaDB ColumnStore' Password configured on the MariaDB ColumnStore Front-end Modules in " + HOME + "/.my.cnf (y,n): ";
MySQLPasswordConfig = dataPrompt(prompt);
}
if ( MySQLPasswordConfig != "y" )
MySQLPasswordConfig = "n";
try {
oam.setSystemConfig("MySQLPasswordConfig", MySQLPasswordConfig);
}
catch(...) {}
//set flag //set flag
try { try {
oam.setSystemConfig("MySQLRep", "n"); oam.setSystemConfig("MySQLRep", "n");

View File

@@ -57,30 +57,59 @@ int main(int argc, char *argv[])
{ {
Oam oam; Oam oam;
//get mysql user password string USER = "root";
string mysqlpw = oam::UnassignedName; char* p= getenv("USER");
try { if (p && *p)
mysqlpw = oam.getMySQLPassword(); USER = p;
}
catch (...) string HOME = "/root";
p= getenv("HOME");
if (p && *p)
HOME = p;
string fileName = HOME + "/.my.cnf";
ifstream file (fileName.c_str());
if (!file)
{ {
cout << oam::UnassignedName << endl; cout << oam::UnassignedName << endl;
exit (1); exit (1);
} }
if ( mysqlpw == oam::UnassignedName ) { char line[400];
cout << oam::UnassignedName << endl; string buf;
exit (1);
while (file.getline(line, 400))
{
buf = line;
string::size_type pos = buf.find("root",0);
if (pos != string::npos)
{
file.getline(line, 400);
buf = line;
pos = buf.find("password",0);
if (pos != string::npos)
{
string::size_type pos1 = buf.find("=",pos);
if (pos1 != string::npos) {
//password found
string password = buf.substr(pos1+2, 80);
cout << password << endl;
exit (0);
}
}
}
} }
file.close();
cout << mysqlpw << endl; cout << oam::UnassignedName << endl;
try { exit (1);
oam.setSystemConfig("MySQLPasswordConfig", "y");
}
catch(...) {}
exit (0);
} }
// vim:ts=4 sw=4: // vim:ts=4 sw=4:

View File

@@ -439,14 +439,6 @@ int main(int argc, char *argv[])
exit(1); exit(1);
} }
//if binary install, then run post-install just in case the user didnt run it
if ( EEPackageType == "binary" )
{
//run post install
cmd = installDir + "/bin/post-install --installdir=" + installDir + " > /dev/null 2>&1";
system(cmd.c_str());
}
//check Config saved files //check Config saved files
if ( !checkSaveConfigFile()) if ( !checkSaveConfigFile())
{ {
@@ -554,11 +546,6 @@ int main(int argc, char *argv[])
{} {}
} }
try {
oam.setSystemConfig("MySQLPasswordConfig", oam::UnassignedName);
}
catch(...) {}
cout << endl; cout << endl;
cout << "===== Setup System Server Type Configuration =====" << endl << endl; cout << "===== Setup System Server Type Configuration =====" << endl << endl;
@@ -3354,22 +3341,7 @@ int main(int argc, char *argv[])
cout << endl << "System Catalog Successfully Created" << endl; cout << endl << "System Catalog Successfully Created" << endl;
else else
{ {
if ( oam.checkLogStatus("/tmp/dbbuilder.log", "System catalog appears to exist") ) { if ( ! oam.checkLogStatus("/tmp/dbbuilder.log", "System catalog appears to exist") )
// cout << endl << "Run MySQL Upgrade.. ";
cout.flush();
//send message to procmon's to run upgrade script
// int status = sendUpgradeRequest(IserverTypeInstall, pmwithum);
// if ( status != 0 ) {
// cout << endl << "MariaDB ColumnStore Install Failed" << endl << endl;
// exit(1);
// }
// else
// cout << " DONE" << endl;
}
else
{ {
cout << endl << "System Catalog Create Failure" << endl; cout << endl << "System Catalog Create Failure" << endl;
cout << "Check latest log file in /tmp/dbbuilder.log.*" << endl; cout << "Check latest log file in /tmp/dbbuilder.log.*" << endl;
@@ -3378,9 +3350,7 @@ int main(int argc, char *argv[])
} }
//set mysql replication, if wasn't setup before on system //set mysql replication, if wasn't setup before on system
if ( ( mysqlRep && pmwithum ) || if ( mysqlRep )
( mysqlRep && (umNumber > 1) ) ||
( mysqlRep && (pmNumber > 1) && (IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM) ) )
{ {
cout << endl << "Run MariaDB ColumnStore Replication Setup.. "; cout << endl << "Run MariaDB ColumnStore Replication Setup.. ";
cout.flush(); cout.flush();

View File

@@ -522,6 +522,8 @@ static void startMgrProcessThread()
ModuleTypeConfig PMSmoduletypeconfig; ModuleTypeConfig PMSmoduletypeconfig;
ALARMManager aManager; ALARMManager aManager;
int waitTime = 90;
log.writeLog(__LINE__, "startMgrProcessThread launched", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "startMgrProcessThread launched", LOG_TYPE_DEBUG);
// processManager.setSystemState(oam::MAN_INIT); // processManager.setSystemState(oam::MAN_INIT);
@@ -576,7 +578,7 @@ static void startMgrProcessThread()
//wait until all modules are up after a system reboot //wait until all modules are up after a system reboot
int i = 0; int i = 0;
for( ; i < 100 ; i++ ) for( ; i < waitTime ; i++ )
{ {
if ( startsystemthreadStop ) { if ( startsystemthreadStop ) {
processManager.setSystemState(oam::MAN_OFFLINE); processManager.setSystemState(oam::MAN_OFFLINE);
@@ -642,7 +644,7 @@ static void startMgrProcessThread()
break; break;
} }
if ( i == 100 ) { if ( i == waitTime ) {
// system didn't successfull restart // system didn't successfull restart
processManager.setSystemState(oam::FAILED); processManager.setSystemState(oam::FAILED);
@@ -661,7 +663,7 @@ static void startMgrProcessThread()
//now wait until all procmons are up and validate rpms on each module //now wait until all procmons are up and validate rpms on each module
int status = API_SUCCESS; int status = API_SUCCESS;
int k = 0; int k = 0;
for( ; k < 1200 ; k++ ) for( ; k < waitTime ; k++ )
{ {
if ( startsystemthreadStop ) { if ( startsystemthreadStop ) {
processManager.setSystemState(oam::MAN_OFFLINE); processManager.setSystemState(oam::MAN_OFFLINE);
@@ -778,7 +780,7 @@ static void startMgrProcessThread()
} }
} }
if ( k == 1200 || status == API_FAILURE) { if ( k == waitTime || status == API_FAILURE) {
// system didn't successfull restart // system didn't successfull restart
processManager.setSystemState(oam::FAILED); processManager.setSystemState(oam::FAILED);
// exit thread // exit thread

View File

@@ -1145,7 +1145,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
//wait until all child modules are offline or A FAILURE HAS OCCURRED //wait until all child modules are offline or A FAILURE HAS OCCURRED
bool failure = false; bool failure = false;
bool stopped = true; bool stopped = true;
for ( int retry = 0 ; retry < 120 ; retry++ ) for ( int retry = 0 ; retry < 30 ; retry++ )
{ {
sleep(1); sleep(1);
stopped = true; stopped = true;
@@ -2569,7 +2569,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, false); status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, false, target, false);
log.writeLog(__LINE__, "Disable MySQL Replication status: " + oam.itoa(status) ); log.writeLog(__LINE__, "Disable MySQL Replication status: " + oam.itoa(status) );
@@ -3856,6 +3856,8 @@ void ProcessManager::setModuleState(string moduleName, uint16_t state)
} }
pthread_mutex_unlock(&STATUS_LOCK); pthread_mutex_unlock(&STATUS_LOCK);
return;
} }
/****************************************************************************************** /******************************************************************************************
@@ -3884,6 +3886,9 @@ void ProcessManager::setExtdeviceState(string extDeviceName, uint16_t state)
// log.writeLog(__LINE__, "EXCEPTION ERROR on setExtDeviceStatus: Caught unknown exception!", LOG_TYPE_ERROR); // log.writeLog(__LINE__, "EXCEPTION ERROR on setExtDeviceStatus: Caught unknown exception!", LOG_TYPE_ERROR);
} }
pthread_mutex_unlock(&STATUS_LOCK); pthread_mutex_unlock(&STATUS_LOCK);
return;
} }
/****************************************************************************************** /******************************************************************************************
@@ -3912,6 +3917,8 @@ void ProcessManager::setNICState(string hostName, uint16_t state)
// log.writeLog(__LINE__, "EXCEPTION ERROR on setNICStatus: Caught unknown exception!", LOG_TYPE_ERROR); // log.writeLog(__LINE__, "EXCEPTION ERROR on setNICStatus: Caught unknown exception!", LOG_TYPE_ERROR);
} }
pthread_mutex_unlock(&STATUS_LOCK); pthread_mutex_unlock(&STATUS_LOCK);
return;
} }
@@ -4045,6 +4052,8 @@ void ProcessManager::setProcessStates(std::string moduleName, uint16_t state, st
} }
} }
} }
return;
} }
/****************************************************************************************** /******************************************************************************************
@@ -6869,10 +6878,6 @@ void startSystemThread(oam::DeviceNetworkList Devicenetworklist)
sleep(2); sleep(2);
} }
log.writeLog(__LINE__, "Setup MySQL Replication for startsystemthread", LOG_TYPE_DEBUG);
oam::DeviceNetworkList devicenetworklistRep;
processManager.setMySQLReplication(devicenetworklistRep);
//set query system state ready //set query system state ready
processManager.setQuerySystemState(true); processManager.setQuerySystemState(true);
@@ -10046,49 +10051,6 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
if ( MySQLRep == "n" && enable ) if ( MySQLRep == "n" && enable )
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" )
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" ) {
return oam::API_SUCCESS;
}
}
catch(...)
{
return oam::API_SUCCESS;
}
}
//seperate system check
if ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM ) {
ModuleTypeConfig moduletypeconfig;
try{
oam.getSystemConfig("um", moduletypeconfig);
}
catch(...)
{}
if ( moduletypeconfig.ModuleCount < 2 )
{
return oam::API_SUCCESS;
}
}
log.writeLog(__LINE__, "Setup MySQL Replication", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "Setup MySQL Replication", LOG_TYPE_DEBUG);
// mysql port number // mysql port number
@@ -10139,7 +10101,6 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
if ( returnStatus != API_SUCCESS) { if ( returnStatus != API_SUCCESS) {
log.writeLog(__LINE__, "setMySQLReplication: ERROR: Error getting MySQL Replication Master Information", LOG_TYPE_ERROR); log.writeLog(__LINE__, "setMySQLReplication: ERROR: Error getting MySQL Replication Master Information", LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
return API_FAILURE; return API_FAILURE;
} }
} }
@@ -10166,7 +10127,6 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
if ( returnStatus != API_SUCCESS) { if ( returnStatus != API_SUCCESS) {
log.writeLog(__LINE__, "setMySQLReplication: ERROR: Error getting MySQL Replication Master Information", LOG_TYPE_ERROR); log.writeLog(__LINE__, "setMySQLReplication: ERROR: Error getting MySQL Replication Master Information", LOG_TYPE_ERROR);
pthread_mutex_unlock(&THREAD_LOCK);
return API_FAILURE; return API_FAILURE;
} }
} }
@@ -10189,6 +10149,7 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
if ( returnStatus != API_SUCCESS) { if ( returnStatus != API_SUCCESS) {
log.writeLog(__LINE__, "setMySQLReplication: ERROR: Error getting MySQL Replication Master Information", LOG_TYPE_ERROR); log.writeLog(__LINE__, "setMySQLReplication: ERROR: Error getting MySQL Replication Master Information", LOG_TYPE_ERROR);
return API_FAILURE;
} }
// //
@@ -10256,6 +10217,7 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
if ( returnStatus != API_SUCCESS) { if ( returnStatus != API_SUCCESS) {
log.writeLog(__LINE__, "setMySQLReplication: ERROR: Error setting MySQL Replication Slave", LOG_TYPE_ERROR); log.writeLog(__LINE__, "setMySQLReplication: ERROR: Error setting MySQL Replication Slave", LOG_TYPE_ERROR);
return API_FAILURE;
} }
} }
} }
@@ -10304,6 +10266,7 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
if ( returnStatus != API_SUCCESS) { if ( returnStatus != API_SUCCESS) {
log.writeLog(__LINE__, "setMySQLReplication: ERROR: Error setting MySQL Replication Slave", LOG_TYPE_ERROR); log.writeLog(__LINE__, "setMySQLReplication: ERROR: Error setting MySQL Replication Slave", LOG_TYPE_ERROR);
return API_FAILURE;
} }
} }
} }

View File

@@ -203,7 +203,12 @@ int main(int argc, char **argv)
pthread_t MessageThread; pthread_t MessageThread;
int ret = pthread_create (&MessageThread, NULL, (void*(*)(void*)) &messageThread, &config); int ret = pthread_create (&MessageThread, NULL, (void*(*)(void*)) &messageThread, &config);
if ( ret != 0 ) if ( ret != 0 )
{
log.writeLog(__LINE__, "pthread_create failed, return code = " + oam.itoa(ret), LOG_TYPE_ERROR); log.writeLog(__LINE__, "pthread_create failed, return code = " + oam.itoa(ret), LOG_TYPE_ERROR);
sleep (1);
string cmd = startup::StartUp::installDir() + "/bin/infinidb stop > /dev/null 2>&1";
system(cmd.c_str());
}
//create and mount data directories //create and mount data directories
aMonitor.createDataDirs(cloud); aMonitor.createDataDirs(cloud);
@@ -2145,7 +2150,7 @@ void processStatusMSG(messageqcpp::IOSocket* cfIos)
catch (exception& ex) catch (exception& ex)
{ {
string error = ex.what(); string error = ex.what();
log.writeLog(__LINE__, "***read error, close create thread: " + error, LOG_TYPE_DEBUG); // log.writeLog(__LINE__, "***read error, close create thread: " + error, LOG_TYPE_DEBUG);
fIos->close(); fIos->close();
delete fIos; delete fIos;
delete msg; delete msg;
@@ -2154,7 +2159,7 @@ void processStatusMSG(messageqcpp::IOSocket* cfIos)
} }
catch(...) catch(...)
{ {
log.writeLog(__LINE__, "***read error, close create thread", LOG_TYPE_DEBUG); // log.writeLog(__LINE__, "***read error, close create thread", LOG_TYPE_DEBUG);
fIos->close(); fIos->close();
delete fIos; delete fIos;
delete msg; delete msg;
@@ -2163,7 +2168,7 @@ void processStatusMSG(messageqcpp::IOSocket* cfIos)
} }
if (msg->length() <= 0) { if (msg->length() <= 0) {
log.writeLog(__LINE__, "***0 bytes, close create thread", LOG_TYPE_DEBUG); // log.writeLog(__LINE__, "***0 bytes, close create thread", LOG_TYPE_DEBUG);
fIos->close(); fIos->close();
delete fIos; delete fIos;
delete msg; delete msg;

View File

@@ -4673,10 +4673,10 @@ int ProcessMonitor::changeMyCnf(std::string type)
buf = "server-id = 1"; buf = "server-id = 1";
} }
pos = buf.find("# binlog_format=ROW",0); // pos = buf.find("# binlog_format=ROW",0);
if ( pos != string::npos ) { // if ( pos != string::npos ) {
buf = "binlog_format=ROW"; // buf = "binlog_format=ROW";
} // }
pos = buf.find("infinidb_local_query=1",0); pos = buf.find("infinidb_local_query=1",0);
if ( pos != string::npos && pos == 0) { if ( pos != string::npos && pos == 0) {
@@ -4755,22 +4755,7 @@ int ProcessMonitor::changeMyCnf(std::string type)
return oam::API_FAILURE; 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 slave replication entries
vector <string> lines; vector <string> lines;
char line[200]; char line[200];
@@ -4799,10 +4784,10 @@ int ProcessMonitor::changeMyCnf(std::string type)
} }
} }
pos = buf.find("binlog_format=ROW",0); // pos = buf.find("binlog_format=ROW",0);
if ( pos != string::npos && pos == 0 ) { // if ( pos != string::npos && pos == 0 ) {
buf = "# binlog_format=ROW"; // buf = "# binlog_format=ROW";
} // }
//output to temp file //output to temp file
lines.push_back(buf); lines.push_back(buf);
@@ -4821,7 +4806,7 @@ int ProcessMonitor::changeMyCnf(std::string type)
close(fd); close(fd);
} }
if ( type == "disable" ) /* if ( type == "disable" )
{ {
// set master replication entries // set master replication entries
vector <string> lines; vector <string> lines;
@@ -4886,7 +4871,7 @@ int ProcessMonitor::changeMyCnf(std::string type)
close(fd); close(fd);
} }
*/
// set owner and permission // set owner and permission
string cmd = "chmod 664 " + mycnfFile + " >/dev/null 2>&1"; string cmd = "chmod 664 " + mycnfFile + " >/dev/null 2>&1";
if ( !rootUser) if ( !rootUser)
@@ -4964,6 +4949,11 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master
bool passwordError = false; bool passwordError = false;
string moduleType = systemModuleTypeConfig.moduletypeconfig[i].ModuleType;
if ( (PMwithUM == "n") && (moduleType == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) )
continue;
HostConfigList::iterator pt1 = (*pt).hostConfigList.begin(); HostConfigList::iterator pt1 = (*pt).hostConfigList.begin();
while(true) // need in case there is a password retry while(true) // need in case there is a password retry
{ {
@@ -5004,7 +4994,7 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master
if ( passwordError ) if ( passwordError )
{ {
try { try {
mysqlpw = oam.getMySQLPassword(true); mysqlpw = oam.getMySQLPassword();
} }
catch (...) catch (...)
{} {}
@@ -5154,7 +5144,7 @@ int ProcessMonitor::runSlaveRep(std::string& masterLogFile, std::string& masterL
if ( passwordError ) if ( passwordError )
{ {
try { try {
mysqlpw = oam.getMySQLPassword(true); mysqlpw = oam.getMySQLPassword();
} }
catch (...) catch (...)
{} {}