You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-520 - add in the mariadb upgrade code
This commit is contained in:
@ -98,6 +98,14 @@ if [ $module = "um" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#setup rc.local
|
||||||
|
RCFILE=/etc/rc.d/rc.local
|
||||||
|
|
||||||
|
if [ $user != "root" ]; then
|
||||||
|
echo "uncomment runuser in rc.local, amazon AMI"
|
||||||
|
sudo sed -i -e 's/#runuser/runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#if pm, create dbroot directories
|
#if pm, create dbroot directories
|
||||||
@ -168,19 +176,6 @@ if [ $user == "root" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#setup rc.local
|
|
||||||
if [ -f /etc/rc.d ]; then
|
|
||||||
RCFILE=/etc/rc.d/rc.local
|
|
||||||
else
|
|
||||||
RCFILE=/etc/rc.local
|
|
||||||
fi
|
|
||||||
touch $RCFILE
|
|
||||||
|
|
||||||
if [ $user != "root" ]; then
|
|
||||||
echo "uncomment runuser in rc.local, amazon AMI"
|
|
||||||
sudo sed -i -e 's/#runuser/runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "!!!Module Installation Successfully Completed!!!"
|
echo "!!!Module Installation Successfully Completed!!!"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -4056,7 +4056,18 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
if ( oam.checkLogStatus(dbbuilderLog, "System catalog appears to exist") )
|
if ( oam.checkLogStatus(dbbuilderLog, "System catalog appears to exist") )
|
||||||
{
|
{
|
||||||
cout.flush();
|
cout << endl << "Run MariaDB 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
|
else
|
||||||
{
|
{
|
||||||
|
@ -5107,10 +5107,10 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
|
|||||||
}
|
}
|
||||||
|
|
||||||
//wait until login is success until continuing or fail if can't login
|
//wait until login is success until continuing or fail if can't login
|
||||||
log.writeLog(__LINE__, "addModule - Successfully Launch of new Instance, retry login test: " + moduleName, LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "addModule - Successfully Launch of new Instance, perform login test: " + moduleName, LOG_TYPE_DEBUG);
|
||||||
int retry = 0;
|
int retry = 0;
|
||||||
|
|
||||||
for ( ; retry < 18 ; retry++)
|
for ( ; retry < 30 ; retry++)
|
||||||
{
|
{
|
||||||
IPAddr = oam.getEC2InstanceIpAddress(hostName);
|
IPAddr = oam.getEC2InstanceIpAddress(hostName);
|
||||||
|
|
||||||
@ -5123,7 +5123,7 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
|
|||||||
|
|
||||||
if (IPAddr == "stopped")
|
if (IPAddr == "stopped")
|
||||||
{
|
{
|
||||||
sleep(10);
|
sleep(5);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5131,11 +5131,6 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
|
|||||||
string cmd = installDir + "/bin/remote_command.sh " + IPAddr + " " + password + " 'ls' 1 > " + loginTmp;
|
string cmd = installDir + "/bin/remote_command.sh " + IPAddr + " " + password + " 'ls' 1 > " + loginTmp;
|
||||||
int rtnCode = system(cmd.c_str());
|
int rtnCode = system(cmd.c_str());
|
||||||
|
|
||||||
log.writeLog(__LINE__, "loginTmp " + loginTmp, LOG_TYPE_DEBUG);
|
|
||||||
log.writeLog(__LINE__, "cmd " + cmd, LOG_TYPE_DEBUG);
|
|
||||||
log.writeLog(__LINE__, "rtnCode " + oam.itoa(rtnCode), LOG_TYPE_DEBUG);
|
|
||||||
|
|
||||||
|
|
||||||
if (!oam.checkLogStatus(loginTmp, "README")) {
|
if (!oam.checkLogStatus(loginTmp, "README")) {
|
||||||
//check for RSA KEY ISSUE and fix
|
//check for RSA KEY ISSUE and fix
|
||||||
if (oam.checkLogStatus(loginTmp, "Host key verification failed"))
|
if (oam.checkLogStatus(loginTmp, "Host key verification failed"))
|
||||||
@ -5146,7 +5141,7 @@ log.writeLog(__LINE__, "rtnCode " + oam.itoa(rtnCode), LOG_TYPE_DEBUG);
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.writeLog(__LINE__, "addModule - login failed, retry login test: " + moduleName, LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "addModule - login failed, retry login test: " + moduleName, LOG_TYPE_DEBUG);
|
||||||
sleep(10);
|
sleep(5);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5154,7 +5149,7 @@ log.writeLog(__LINE__, "rtnCode " + oam.itoa(rtnCode), LOG_TYPE_DEBUG);
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( retry >= 18 )
|
if ( retry >= 30 )
|
||||||
{
|
{
|
||||||
log.writeLog(__LINE__, "addModule - Failed to log in to Instance: " + hostName, LOG_TYPE_ERROR);
|
log.writeLog(__LINE__, "addModule - Failed to log in to Instance: " + hostName, LOG_TYPE_ERROR);
|
||||||
pthread_mutex_unlock(&THREAD_LOCK);
|
pthread_mutex_unlock(&THREAD_LOCK);
|
||||||
@ -5546,19 +5541,6 @@ log.writeLog(__LINE__, "rtnCode " + oam.itoa(rtnCode), LOG_TYPE_DEBUG);
|
|||||||
setStandbyModule(remoteModuleName, false);
|
setStandbyModule(remoteModuleName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//set root password
|
|
||||||
if (amazon)
|
|
||||||
{
|
|
||||||
cmd = startup::StartUp::installDir() + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '/root/.scripts/updatePassword.sh " + password + "' > " + tmpLogDir + "/password_change.log";
|
|
||||||
log.writeLog(__LINE__, "addModule - cmd: " + cmd, LOG_TYPE_DEBUG);
|
|
||||||
int rtnCode = system(cmd.c_str());
|
|
||||||
|
|
||||||
if (WEXITSTATUS(rtnCode) == 0)
|
|
||||||
log.writeLog(__LINE__, "addModule - update root password: " + remoteModuleName, LOG_TYPE_DEBUG);
|
|
||||||
else
|
|
||||||
log.writeLog(__LINE__, "addModule - ERROR: update root password: " + remoteModuleName, LOG_TYPE_DEBUG);
|
|
||||||
}
|
|
||||||
|
|
||||||
//default
|
//default
|
||||||
string binaryInstallDir = installDir;
|
string binaryInstallDir = installDir;
|
||||||
|
|
||||||
|
@ -1710,27 +1710,26 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case RUNUPGRADE:
|
||||||
|
{
|
||||||
|
log.writeLog(__LINE__, "MSG RECEIVED: Run upgrade script ");
|
||||||
|
|
||||||
/* case RUNUPGRADE:
|
string mysqlpw;
|
||||||
{
|
msg >> mysqlpw;
|
||||||
log.writeLog(__LINE__, "MSG RECEIVED: Run upgrade script ");
|
|
||||||
|
|
||||||
string mysqlpw;
|
// run upgrade script
|
||||||
msg >> mysqlpw;
|
int ret = runUpgrade(mysqlpw);
|
||||||
|
|
||||||
// run upgrade script
|
ackMsg << (ByteStream::byte) ACK;
|
||||||
int ret = runUpgrade(mysqlpw);
|
ackMsg << (ByteStream::byte) RUNUPGRADE;
|
||||||
|
ackMsg << (ByteStream::byte) ret;
|
||||||
|
mq.write(ackMsg);
|
||||||
|
|
||||||
ackMsg << (ByteStream::byte) ACK;
|
log.writeLog(__LINE__, "RUNUPGRADE: ACK back to ProcMgr return status = " + oam.itoa((int) ret));
|
||||||
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;
|
||||||
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
case PROCUNMOUNT:
|
case PROCUNMOUNT:
|
||||||
{
|
{
|
||||||
string dbrootID;
|
string dbrootID;
|
||||||
@ -6578,6 +6577,47 @@ int ProcessMonitor::glusterUnassign(std::string dbrootID)
|
|||||||
return oam::API_SUCCESS;
|
return oam::API_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************************
|
||||||
|
* @brief runUpgrade
|
||||||
|
*
|
||||||
|
* purpose: run upgrade script
|
||||||
|
*
|
||||||
|
******************************************************************************************/
|
||||||
|
int ProcessMonitor::runUpgrade(std::string mysqlpw)
|
||||||
|
{
|
||||||
|
Oam oam;
|
||||||
|
|
||||||
|
string tmpLog = tmpLogDir + "/mysql_upgrade.log";
|
||||||
|
|
||||||
|
for ( int i = 0 ; i < 10 ; i++ )
|
||||||
|
{
|
||||||
|
//run upgrade script
|
||||||
|
string cmd = startup::StartUp::installDir() + "/mysql/bin/mysql_upgrade --defaults-file=" + startup::StartUp::installDir() + "/mysql/my.cnf --password=" +
|
||||||
|
mysqlpw + " > " + tmpLog + " 2>&1";
|
||||||
|
int retCode = system(cmd.c_str());
|
||||||
|
|
||||||
|
if ( retCode == 0 ) {
|
||||||
|
log.writeLog(__LINE__, "mysql_upgrade.sh: Successful return", LOG_TYPE_DEBUG);
|
||||||
|
return oam::API_SUCCESS;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (oam.checkLogStatus(cmd, "ERROR 1045") ) {
|
||||||
|
log.writeLog(__LINE__, "mysql_upgrade.sh: Missing Password error, return success", LOG_TYPE_DEBUG);
|
||||||
|
return oam::API_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.writeLog(__LINE__, "mysql_upgrade.sh: Error return, check log " + tmpLog, LOG_TYPE_ERROR);
|
||||||
|
//restart mysqld and retry
|
||||||
|
try {
|
||||||
|
oam.actionMysqlCalpont(MYSQL_RESTART);
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{}
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return oam::API_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} //end of namespace
|
} //end of namespace
|
||||||
|
@ -493,7 +493,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
*@brief run upgrade script
|
*@brief run upgrade script
|
||||||
*/
|
*/
|
||||||
// int runUpgrade(std::string mysqlpw);
|
int runUpgrade(std::string mysqlpw);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*@brief change my.cnf
|
*@brief change my.cnf
|
||||||
|
Reference in New Issue
Block a user