1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-24 18:27:02 +03:00

change amazon failover logic, make work like normal system

This commit is contained in:
david hill 2016-03-02 14:27:29 -06:00
parent f38cfc6480
commit 92bf40fcbb
6 changed files with 47 additions and 83 deletions

View File

@ -134,7 +134,7 @@ describeInstanceFile="/tmp/describeInstance.txt"
touch $describeInstanceFile touch $describeInstanceFile
describeInstance() { describeInstance() {
ec2-describe-instances -O $AmazonAccessKey -W $xAmazonSecretKey --region $Region > $describeInstanceFile 2>&1 ec2-describe-instances -O $AmazonAccessKey -W $AmazonSecretKey --region $Region > $describeInstanceFile 2>&1
} }
getInstance() { getInstance() {

View File

@ -110,13 +110,13 @@ AmazonSecretKey=`cat $AmazonSecretKeyFile`
Region=`$prefix/Calpont/bin/getConfig Installation AmazonRegion` Region=`$prefix/Calpont/bin/getConfig Installation AmazonRegion`
if test ! -f $x509Cert ; then if test ! -f $AmazonAccessKeyFile ; then
echo "FAILED: missing x509Cert : $x509Cert" echo "FAILED: missing AmazonAccessKeyFile : $AmazonAccessKeyFile"
exit 1 exit 1
fi fi
if test ! -f $x509PriKey ; then if test ! -f $xAmazonSecretKeyFile ; then
echo "FAILED: missing x509PriKey : $x509PriKey" echo "FAILED: missing AmazonSecretKeyFile : $xAmazonSecretKeyFile"
exit 1 exit 1
fi fi
@ -200,7 +200,7 @@ detachvolume() {
retries=1 retries=1
while [ $retries -ne 60 ]; do while [ $retries -ne 60 ]; do
#retry until it's attached #retry until it's attached
ec2-detach-volume -C $x509Cert -K $x509PriKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 ec2-detach-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1
checkInfostatus checkInfostatus
if [ $STATUS == "available" ]; then if [ $STATUS == "available" ]; then

View File

@ -2132,7 +2132,7 @@ int main(int argc, char *argv[])
catch(...) catch(...)
{} {}
prompt = "Enter Volume Name assigned to module '" + newModuleName + "' (" + volumeName + ") > "; prompt = "Enter Volume ID assigned to module '" + newModuleName + "' (" + volumeName + ") > ";
pcommand = callReadline(prompt.c_str()); pcommand = callReadline(prompt.c_str());
if (pcommand) if (pcommand)
{ {
@ -2140,7 +2140,7 @@ int main(int argc, char *argv[])
callFree(pcommand); callFree(pcommand);
} }
prompt = "Enter Device Name assigned to module '" + newModuleName + "' (" + deviceName + ") > "; prompt = "Enter Device Name (/dev/sdxx) '" + newModuleName + "' (" + deviceName + ") > ";
pcommand = callReadline(prompt.c_str()); pcommand = callReadline(prompt.c_str());
if (pcommand) if (pcommand)
{ {
@ -2409,7 +2409,7 @@ int main(int argc, char *argv[])
catch(...) catch(...)
{} {}
prompt = "Enter Volume Name assigned to '" + DBrootID + "' (" + volumeName + ") > "; prompt = "Enter Volume ID for '" + DBrootID + "' (" + volumeName + ") > ";
pcommand = callReadline(prompt.c_str()); pcommand = callReadline(prompt.c_str());
if (pcommand) if (pcommand)
{ {
@ -2425,7 +2425,7 @@ int main(int argc, char *argv[])
catch(...) catch(...)
{} {}
prompt = "Enter Device Name for volume '" + volumeName + "' (" + deviceName + ") > "; prompt = "Enter Device Name (/dev/sdxx) for volume '" + volumeName + "' (" + deviceName + ") > ";
pcommand = callReadline(prompt.c_str()); pcommand = callReadline(prompt.c_str());
if (pcommand) if (pcommand)
{ {
@ -4582,54 +4582,6 @@ bool storageSetup(string cloud)
} }
} }
if( DBRootStorageType == "external" && cloud == "amazon" )
{ //set AmazonPMFailover
string AmazonPMFailover = "y";
try {
AmazonPMFailover = sysConfig->getConfig(InstallSection, "AmazonPMFailover");
}
catch(...)
{}
cout << endl;
while(true)
{
pcommand = callReadline("Do you want to enable Instance failover support? [y,n] (" + AmazonPMFailover + ") > ");
if (pcommand)
{
if (strlen(pcommand) > 0) AmazonPMFailover = pcommand;
callFree(pcommand);
}
if ( AmazonPMFailover == "y" || AmazonPMFailover == "n" ) {
cout << endl;
break;
}
else
cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl;
if ( noPrompting )
exit(1);
}
try {
sysConfig->setConfig(InstallSection, "AmazonPMFailover", AmazonPMFailover);
}
catch(...)
{}
}
if( DBRootStorageType == "internal" && cloud == "amazon" )
{ //set AmazonPMFailover
try {
sysConfig->setConfig(InstallSection, "AmazonPMFailover", "n");
}
catch(...)
{}
}
if ( !writeConfig(sysConfig) ) { if ( !writeConfig(sysConfig) ) {
cout << "ERROR: Failed trying to update InfiniDB System Configuration file" << endl; cout << "ERROR: Failed trying to update InfiniDB System Configuration file" << endl;
return false; return false;

View File

@ -49,7 +49,6 @@ string cloud;
bool amazon = false; bool amazon = false;
string PMInstanceType; string PMInstanceType;
string UMInstanceType; string UMInstanceType;
string AmazonPMFailover = "y";
string GlusterConfig = "n"; string GlusterConfig = "n";
bool rootUser = true; bool rootUser = true;
string USER = "root"; string USER = "root";
@ -144,7 +143,6 @@ int main(int argc, char **argv)
{ {
oam.getSystemConfig("PMInstanceType", PMInstanceType); oam.getSystemConfig("PMInstanceType", PMInstanceType);
oam.getSystemConfig("UMInstanceType", UMInstanceType); oam.getSystemConfig("UMInstanceType", UMInstanceType);
oam.getSystemConfig("AmazonPMFailover", AmazonPMFailover);
amazon = true; amazon = true;
} }
@ -1281,9 +1279,8 @@ void pingDeviceThread()
int status; int status;
// if pm, move dbroots back to pm // if pm, move dbroots back to pm
if ( ( moduleName.find("pm") == 0 && !amazon ) || if ( ( moduleName.find("pm") == 0 ) ||
( moduleName.find("pm") == 0 && amazon && downActiveOAMModule ) || ( moduleName.find("pm") == 0 && downActiveOAMModule ) ) {
( moduleName.find("pm") == 0 && amazon && AmazonPMFailover == "y") ) {
//restart to get the versionbuffer files closed so it can be unmounted //restart to get the versionbuffer files closed so it can be unmounted
processManager.restartProcessType("WriteEngineServer", moduleName); processManager.restartProcessType("WriteEngineServer", moduleName);
@ -1559,8 +1556,8 @@ void pingDeviceThread()
aManager.sendAlarmReport(moduleName.c_str(), MODULE_DOWN_AUTO, SET); aManager.sendAlarmReport(moduleName.c_str(), MODULE_DOWN_AUTO, SET);
// if pm, move dbroots back to pm // if pm, move dbroots back to pm
if ( ( moduleName.find("pm") == 0 && !amazon ) || if ( ( moduleName.find("pm") == 0 ) ||
( moduleName.find("pm") == 0 && amazon && downActiveOAMModule ) ) { ( moduleName.find("pm") == 0 && downActiveOAMModule ) ) {
//move dbroots to other modules //move dbroots to other modules
try { try {
log.writeLog(__LINE__, "Call autoMovePmDbroot", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "Call autoMovePmDbroot", LOG_TYPE_DEBUG);
@ -1593,9 +1590,9 @@ void pingDeviceThread()
log.writeLog(__LINE__, "Module failed to auto start: " + moduleName, LOG_TYPE_CRITICAL); log.writeLog(__LINE__, "Module failed to auto start: " + moduleName, LOG_TYPE_CRITICAL);
if ( amazon ) // if ( amazon )
processManager.setSystemState(oam::FAILED); // processManager.setSystemState(oam::FAILED);
else // else
processManager.setSystemState(oam::ACTIVE); processManager.setSystemState(oam::ACTIVE);
//set query system state ready //set query system state ready
@ -1663,8 +1660,8 @@ void pingDeviceThread()
log.writeLog(__LINE__, "'dbrmctl reload' done", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "'dbrmctl reload' done", LOG_TYPE_DEBUG);
// if pm, move dbroots to other pms // if pm, move dbroots to other pms
if ( !amazon || // if ( !amazon ||
( amazon && AmazonPMFailover == "y") ) { // ( amazon ) ) {
if( moduleName.find("pm") == 0 ) { if( moduleName.find("pm") == 0 ) {
try { try {
log.writeLog(__LINE__, "Call autoMovePmDbroot", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "Call autoMovePmDbroot", LOG_TYPE_DEBUG);
@ -1683,7 +1680,7 @@ void pingDeviceThread()
log.writeLog(__LINE__, "EXCEPTION ERROR on autoMovePmDbroot: Caught unknown exception!", LOG_TYPE_ERROR); log.writeLog(__LINE__, "EXCEPTION ERROR on autoMovePmDbroot: Caught unknown exception!", LOG_TYPE_ERROR);
} }
} }
} // }
// if Cloud Instance // if Cloud Instance
// state = running, then instance is rebooting, monitor for recovery // state = running, then instance is rebooting, monitor for recovery

View File

@ -53,7 +53,6 @@ extern string USER;
extern bool HDFS; extern bool HDFS;
extern string localHostName; extern string localHostName;
extern string PMwithUM; extern string PMwithUM;
extern string AmazonPMFailover;
typedef map<string, int> moduleList; typedef map<string, int> moduleList;
extern moduleList moduleInfoList; extern moduleList moduleInfoList;
@ -8626,7 +8625,7 @@ int ProcessManager::OAMParentModuleChange()
noAckCount = 0; noAckCount = 0;
//if Amazon Parent PM is restarting, monitor when back active and take needed actions //if Amazon Parent PM is restarting, monitor when back active and take needed actions
if (amazonParentRestart) /* if (amazonParentRestart)
{ {
log.writeLog(__LINE__, "Amazon Parent pinging, waiting until it's active", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "Amazon Parent pinging, waiting until it's active", LOG_TYPE_DEBUG);
sleep(60); sleep(60);
@ -8659,7 +8658,7 @@ int ProcessManager::OAMParentModuleChange()
sleep(5); sleep(5);
} }
} }
*/
sleep(1); sleep(1);
break; break;
} }
@ -8837,7 +8836,7 @@ int ProcessManager::OAMParentModuleChange()
{} {}
//do amazon failover //do amazon failover
if (amazon && AmazonPMFailover == "n") /* if (amazon && AmazonPMFailover == "n")
{ {
log.writeLog(__LINE__, " ", LOG_TYPE_DEBUG); log.writeLog(__LINE__, " ", LOG_TYPE_DEBUG);
log.writeLog(__LINE__, "*** OAMParentModule outage, AmazonPMFailover not set, wating for instance to restart ***", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "*** OAMParentModule outage, AmazonPMFailover not set, wating for instance to restart ***", LOG_TYPE_DEBUG);
@ -8912,7 +8911,7 @@ int ProcessManager::OAMParentModuleChange()
//clear and go monitor again //clear and go monitor again
failover = false; failover = false;
} }*/
} }
} }
@ -9187,9 +9186,7 @@ int ProcessManager::OAMParentModuleChange()
} }
//restart DDLProc/DMLProc to perform any rollbacks, if needed //restart DDLProc/DMLProc to perform any rollbacks, if needed
//dont rollback in amazon, wait until down pm recovers if ( ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM ) ) {
if ( ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM )
&& !amazon ) {
processManager.restartProcessType("DDLProc", config.moduleName()); processManager.restartProcessType("DDLProc", config.moduleName());
sleep(1); sleep(1);
processManager.restartProcessType("DMLProc", config.moduleName()); processManager.restartProcessType("DMLProc", config.moduleName());

View File

@ -1806,16 +1806,34 @@ int main(int argc, char *argv[])
{} {}
try { try {
string AmazonPMFailover = sysConfigOld->getConfig("Installation", "AmazonPMFailover"); string AmazonAccessKey = sysConfigOld->getConfig("Installation", "AmazonAccessKey");
if ( !AmazonPMFailover.empty() ) if ( !AmazonAccessKey.empty() )
{ {
try { try {
sysConfigNew->setConfig("Installation", "AmazonPMFailover", AmazonPMFailover); sysConfigNew->setConfig("Installation", "AmazonAccessKey", AmazonAccessKey);
} }
catch(...) catch(...)
{ {
cout << "ERROR: Problem setting AmazonPMFailover in the Calpont System Configuration file" << endl; cout << "ERROR: Problem setting AmazonAccessKey in the Calpont System Configuration file" << endl;
exit(-1);
}
}
}
catch(...)
{}
try {
string AmazonSecretKey = sysConfigOld->getConfig("Installation", "AmazonSecretKey");
if ( !AmazonAccessKey.empty() )
{
try {
sysConfigNew->setConfig("Installation", "AmazonSecretKey", AmazonSecretKey);
}
catch(...)
{
cout << "ERROR: Problem setting AmazonSecretKey in the Calpont System Configuration file" << endl;
exit(-1); exit(-1);
} }
} }