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

MCOL-916: Fix for failovers when dbroots cannot be simply swapped between standby and parent modules. MCOL-913: Prevent distribute config file logging errors. MCOL-915 Improve mcsadmin output for removeModule command when using DataRedundancy. MCOL-928: fix for postConfigure not detecting gluster is installed in Debain9.1.

This commit is contained in:
Ben Thompson 2017-10-13 17:12:52 -05:00
parent cad14d2111
commit 5e367098a9
4 changed files with 483 additions and 437 deletions

View File

@ -5652,6 +5652,46 @@ namespace oam
{
writeLog("FAILURE: Error assigning gluster dbroot# " + itoa(dbrootID), LOG_TYPE_ERROR );
}
// check if a copy is available when residePM returns
string pmList = "";
try {
string errmsg;
int ret = glusterctl(oam::GLUSTER_WHOHAS, itoa(subDBRootID), pmList, errmsg);
if ( ret != 0 )
{
writeLog("ERROR: glusterctl failure getting pm list for dbroot " + itoa(subDBRootID) + " , error: " + errmsg, LOG_TYPE_ERROR );
exceptionControl("autoMovePmDbroot", API_INVALID_PARAMETER);
}
}
catch (exception& )
{
writeLog("ERROR: glusterctl failure getting pm list for dbroot " + itoa(subDBRootID), LOG_TYPE_ERROR );
exceptionControl("autoMovePmDbroot", API_INVALID_PARAMETER);
}
catch (...)
{
writeLog("ERROR: glusterctl failure getting pm list for dbroot " + itoa(subDBRootID), LOG_TYPE_ERROR );
exceptionControl("autoMovePmDbroot", API_INVALID_PARAMETER);
}
bool found = false;
boost::char_separator<char> sep(" ");
boost::tokenizer< boost::char_separator<char> > tokens(pmList, sep);
for ( boost::tokenizer< boost::char_separator<char> >::iterator it = tokens.begin();
it != tokens.end();
++it)
{
if ( atoi((*it).c_str()) == residePMID )
{
// found it and can assign the subDBRoot back to residedPM no switch back is needed
found = true;
}
}
// We will go back to this PM
if (!found)
{
subDBRootID = dbrootID;
}
}
//store in move dbroot transaction file
@ -6632,7 +6672,7 @@ namespace oam
{
getPmDbrootConfig(atoi(residePMID.c_str()), residedbrootConfigList);
cout << "DBRoot IDs assigned to '" + residePM + "' = ";
cout << endl << "DBRoot IDs assigned to '" + residePM + "' = ";
DBRootConfigList::iterator pt = residedbrootConfigList.begin();
for( ; pt != residedbrootConfigList.end() ;)
@ -6650,7 +6690,7 @@ namespace oam
exceptionControl("unassignPmDbrootConfig", API_FAILURE);
}
cout << endl << "Changes being applied" << endl << endl;
cout << "Changes being applied..." << endl;
//remove entered dbroot IDs from reside PM list
DBRootConfigList::iterator pt1 = dbrootlist.begin();
@ -6700,6 +6740,7 @@ namespace oam
detachEC2Volume(volumeName);
residedbrootConfigList.erase(pt2);
cout << "DBRoot IDs unassigned from '" + residePM + "' = " + itoa(*pt1) << endl;
break;
}
@ -6732,7 +6773,7 @@ namespace oam
if (pt != residedbrootConfigList.end())
cout << ", ";
}
cout << endl;
cout << endl << endl;
}
catch (exception& e)
{

View File

@ -2802,7 +2802,8 @@ int main(int argc, char *argv[])
exit(1);
}
if ( install == "y" ) {
if ( install == "y" )
{
SystemSoftware systemsoftware;
try
@ -3167,6 +3168,14 @@ int main(int argc, char *argv[])
cout << " DONE" << endl;
}
}
else
{
if (DataRedundancy && install != "y")
{
cout << endl << "Must choose to install with DataRedundancy configured." << endl;
exit(1);
}
}
}
else
{
@ -3180,34 +3189,12 @@ int main(int argc, char *argv[])
sleep(5);
}
}
}
//configure data redundancy
if (DataRedundancy)
{
cout << endl;
string start = "y";
if ( reuseConfig == "y" )
start = "n";
/*
while(true)
{
pcommand = callReadline("Would you like to configure MariaDB ColumnStore Data Redundancy? [y,n] (" + start + ") > ");
if (pcommand)
{
if (strlen(pcommand) > 0) start = pcommand;
callFree(pcommand);
}
if ( start == "y" || start == "n" )
break;
else
cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl;
start = "y";
if ( noPrompting )
exit(1);
}
*/
if ( start == "y" ) {
if ( reuseConfig != "y" ) {
cout << endl << "===== Configuring MariaDB ColumnStore Data Redundancy Functionality =====" << endl << endl;
if (!glusterSetup(password))
{
@ -3217,6 +3204,8 @@ int main(int argc, char *argv[])
}
}
}
if ( !writeConfig(sysConfig) ) {
cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl;
@ -4442,7 +4431,12 @@ bool storageSetup(bool amazonInstall)
}
//check if gluster is installed
int rtnCode = system("gluster --version > /tmp/gluster.log 2>&1");
int rtnCode = 1;
if (rootUser)
rtnCode = system("gluster --version > /tmp/gluster.log 2>&1");
else
rtnCode = system("sudo gluster --version > /tmp/gluster.log 2>&1");
if (rtnCode == 0)
{
glusterInstalled = "y";
@ -5817,19 +5811,11 @@ bool glusterSetup(string password) {
{
for ( int brick=1; brick<=numberBricksPM; brick++)
{
// create the gluster brick directories now
//if (rootUser)
//{
command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password + " 'mkdir -p " + installDir + "/gluster/brick" + oam.itoa(brick) + "'";
//}
//else
//{
// command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password + " 'sudo mkdir -p " + installDir + "/gluster/brick" + oam.itoa(brick) + "'";
//}
status = system(command.c_str());
if (WEXITSTATUS(status) != 0 )
{
cout << "ERROR: failed to make directory(" << DataRedundancyConfigs[pm].pmIpAddr << "): 'mkdir -p " << installDir << "/gluster/brick" << oam.itoa(brick) << "'" << endl;
cout << "ERROR: failed to make directory(" << DataRedundancyConfigs[pm].pmIpAddr << "): '" << command << "'" << endl;
exit(1);
}
/*

View File

@ -1392,6 +1392,7 @@ void pingDeviceThread()
oam.sendDeviceNotification(config.moduleName(), MODULE_UP);
int status;
DBRootConfigList dbrootConfigList;
// if shared pm, move dbroots back to pm
if ( ( moduleName.find("pm") == 0 && !amazon && ( DBRootStorageType != "internal") ) ||
@ -1414,7 +1415,6 @@ void pingDeviceThread()
//check if any dbroots got assigned back to this module
// they could not be moved if there were busy on other pms
DBRootConfigList dbrootConfigList;
try
{
int moduleID = atoi(moduleName.substr(MAX_MODULE_TYPE_SIZE,MAX_MODULE_ID_SIZE).c_str());
@ -1590,6 +1590,15 @@ void pingDeviceThread()
if ( moduleName.substr(0,MAX_MODULE_TYPE_SIZE) == "pm" )
processManager.setStandbyModule(moduleName);
}
DBRootConfigList::iterator pt = dbrootConfigList.begin();
if (( DBRootStorageType == "DataRedundancy") && (*pt == 1))
{
log.writeLog(__LINE__, "stopModule, " + config.moduleName(), LOG_TYPE_DEBUG);
processManager.stopModule(config.moduleName(), oam::FORCEFUL, false);
processManager.switchParentOAMModule(moduleName);
processManager.stopProcess(config.moduleName(), "ProcessManager", oam::FORCEFUL, true);
break;
}
}
else {
//stop failed, retry

View File

@ -8321,7 +8321,7 @@ int ProcessManager::distributeConfigFile(std::string name, std::string file)
else
{
//log the error event
log.writeLog(__LINE__, (*pt).DeviceName + " distributeConfigFile failed!!", LOG_TYPE_ERROR);
log.writeLog(__LINE__, (*pt).DeviceName + " distributeConfigFile failed!!", LOG_TYPE_DEBUG);
}
}
}
@ -8338,7 +8338,7 @@ int ProcessManager::distributeConfigFile(std::string name, std::string file)
else
{
//log the error event
log.writeLog(__LINE__, name + " distributeConfigFile failed!!", LOG_TYPE_ERROR);
log.writeLog(__LINE__, name + " distributeConfigFile failed!!", LOG_TYPE_DEBUG);
}
}
@ -8653,13 +8653,16 @@ int ProcessManager::switchParentOAMModule(std::string newActiveModuleName)
//move a newparent dbroot to old parent for balancing
DBRootConfigList residedbrootConfigList;
bool doDBRootMove = true;
try
{
oam.getPmDbrootConfig(moduleID, residedbrootConfigList);
if ( residedbrootConfigList.size() > 0 )
{
DBRootConfigList::iterator pt = residedbrootConfigList.begin();
if (*pt != 1)
{
try {
oam.manualMovePmDbroot(newActiveModuleName, oam.itoa(*pt), config.OAMParentName());
}
@ -8670,6 +8673,11 @@ int ProcessManager::switchParentOAMModule(std::string newActiveModuleName)
return API_FAILURE;
}
}
else
{
doDBRootMove = false;
}
}
}
catch (...)
{
@ -8679,6 +8687,8 @@ int ProcessManager::switchParentOAMModule(std::string newActiveModuleName)
}
//move dbroot #1 to new parent
if (doDBRootMove)
{
try {
oam.manualMovePmDbroot(config.OAMParentName(), "1", newActiveModuleName);
}
@ -8688,7 +8698,7 @@ int ProcessManager::switchParentOAMModule(std::string newActiveModuleName)
pthread_mutex_unlock(&THREAD_LOCK);
return API_FAILURE;
}
}
Config* sysConfig4 = Config::makeConfig();
// get new Active address