1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-05 16:15:50 +03:00

removeModule fixes, check for glusterd in postConfigure, fix glusterUnassign failure logging.

This commit is contained in:
Ben Thompson
2017-09-07 14:59:47 -05:00
parent 90353b9b90
commit dbbfb84ea4
3 changed files with 110 additions and 28 deletions

View File

@@ -4084,6 +4084,18 @@ int processCommand(string* arguments)
case 34: // unassignDbrootPmConfig parameters: dbroot-list reside-pm case 34: // unassignDbrootPmConfig parameters: dbroot-list reside-pm
{ {
string DataRedundancyConfig = "n";
try {
oam.getSystemConfig( "DataRedundancyConfig", DataRedundancyConfig);
}
catch(...)
{}
if (DataRedundancyConfig == "y") {
cout << endl << "**** unassignDbrootPmConfig : command not supported on Data Redundancy configured system. " << endl;
break;
}
if ( localModule != parentOAMModule ) { if ( localModule != parentOAMModule ) {
// exit out since not on active module // exit out since not on active module
cout << endl << "**** unassignDbrootPmConfig Failed : Can only run command on Active OAM Parent Module (" << parentOAMModule << ")." << endl; cout << endl << "**** unassignDbrootPmConfig Failed : Can only run command on Active OAM Parent Module (" << parentOAMModule << ")." << endl;
@@ -4153,6 +4165,18 @@ int processCommand(string* arguments)
case 35: // assignDbrootPmConfig parameters: pm dbroot-list case 35: // assignDbrootPmConfig parameters: pm dbroot-list
{ {
string DataRedundancyConfig = "n";
try {
oam.getSystemConfig( "DataRedundancyConfig", DataRedundancyConfig);
}
catch(...)
{}
if (DataRedundancyConfig == "y") {
cout << endl << "**** assignDbrootPmConfig : command not supported on Data Redundancy configured system. " << endl;
break;
}
if ( localModule != parentOAMModule ) { if ( localModule != parentOAMModule ) {
// exit out since not on active module // exit out since not on active module
cout << endl << "**** assignDbrootPmConfig Failed : Can only run command on Active OAM Parent Module (" << parentOAMModule << ")." << endl; cout << endl << "**** assignDbrootPmConfig Failed : Can only run command on Active OAM Parent Module (" << parentOAMModule << ")." << endl;
@@ -5877,6 +5901,30 @@ int processCommand(string* arguments)
// check for module status and if any dbroots still assigned // check for module status and if any dbroots still assigned
for( ; pt != endpt ; pt++) for( ; pt != endpt ; pt++)
{ {
// check module status
try{
bool degraded;
int opState;
oam.getModuleStatus((*pt).DeviceName, opState, degraded);
if (opState == oam::MAN_OFFLINE ||
opState == oam::MAN_DISABLED ||
opState == oam::FAILED)
{
}
else
{
cout << "**** removeModule Failed : " << (*pt).DeviceName << " is not MAN_OFFLINE, DISABLED, or FAILED state.";
quit = true;
cout << endl;
break;
}
}
catch (exception& ex)
{}
// check dbrootlist should be empty on non data redundancy setups and remove dbroots if dataredundancy removal check passes
if ( moduleType == "pm" ) { if ( moduleType == "pm" ) {
// check for dbroots assigned // check for dbroots assigned
DBRootConfigList dbrootConfigList; DBRootConfigList dbrootConfigList;
@@ -5892,9 +5940,10 @@ int processCommand(string* arguments)
cout << endl; cout << endl;
break; break;
} }
else if (DataRedundancyConfig == "y") else if (DataRedundancyConfig == "y" && !dbrootConfigList.empty())
{ {
bool PMlistError = true; bool PMlistError = true;
cout << "Removing DBRoot(s)" << endl;
DBRootConfigList::iterator dbrootListPt = dbrootConfigList.begin(); DBRootConfigList::iterator dbrootListPt = dbrootConfigList.begin();
for( ; dbrootListPt != dbrootConfigList.end() ; dbrootListPt++) for( ; dbrootListPt != dbrootConfigList.end() ; dbrootListPt++)
{ {
@@ -5944,8 +5993,11 @@ int processCommand(string* arguments)
if (!quit) if (!quit)
{ {
try try
{
if (!dbrootConfigList.empty())
{ {
oam.removeDbroot(dbrootConfigList); oam.removeDbroot(dbrootConfigList);
}
cout << endl << " Successful Removal of DBRoots " << endl << endl; cout << endl << " Successful Removal of DBRoots " << endl << endl;
} }
@@ -5957,27 +6009,6 @@ int processCommand(string* arguments)
} }
} }
} }
// check module status
try{
bool degraded;
int opState;
oam.getModuleStatus((*pt).DeviceName, opState, degraded);
if (opState == oam::MAN_OFFLINE ||
opState == oam::MAN_DISABLED ||
opState == oam::FAILED)
continue;
else
{
cout << "**** removeModule Failed : " << (*pt).DeviceName << " is not MAN_OFFLINE, DISABLED, or FAILED state.";
quit = true;
cout << endl;
break;
}
}
catch (exception& ex)
{}
} }
if (quit) { if (quit) {
@@ -6842,6 +6873,15 @@ int processCommand(string* arguments)
case 65: // alterSystem-disableModule case 65: // alterSystem-disableModule
{ {
string DataRedundancyConfig = "n";
int DataRedundancyCopies;
try {
oam.getSystemConfig( "DataRedundancyConfig", DataRedundancyConfig);
}
catch(...)
{}
if ( SingleServerInstall == "y" ) { if ( SingleServerInstall == "y" ) {
// exit out since not on single-server install // exit out since not on single-server install
cout << endl << "**** alterSystem-disableModule Failed : not support on a Single-Server type installs " << endl; cout << endl << "**** alterSystem-disableModule Failed : not support on a Single-Server type installs " << endl;
@@ -6929,12 +6969,37 @@ int processCommand(string* arguments)
catch(...) catch(...)
{} {}
if ( !dbrootConfigList.empty() ) { if ( !dbrootConfigList.empty() && DataRedundancyConfig == "n") {
cout << endl << "**** alterSystem-disableModule Failed : " << (*pt).DeviceName << " has dbroots still assigned and will not be disabled. Please run movePmDbrootConfig or unassignDbrootPmConfig."; cout << endl << "**** alterSystem-disableModule Failed : " << (*pt).DeviceName << " has dbroots still assigned and will not be disabled. Please run movePmDbrootConfig or unassignDbrootPmConfig.";
quit = true; quit = true;
cout << endl; cout << endl;
break; break;
} }
else if (!dbrootConfigList.empty() && DataRedundancyConfig == "y")
{
//check if dbroot requested to be removed is empty and dboot #1 is requested to be removed
DBRootConfigList::iterator pt = dbrootConfigList.begin();
for( ; pt != dbrootConfigList.end() ; pt++)
{
int dbrootID = *pt;
//check if dbroot is empty
bool isEmpty = false;
string errMsg;
try
{
BRM::DBRM dbrm;
if ( dbrm.isDBRootEmpty(dbrootID, isEmpty, errMsg) != 0)
{
cout << endl << "**** alterSystem-disableModule Failed : Data Redundancy detected DBRoots must be empty to be disabled. Remove data from DBRoot #" << oam.itoa(dbrootID) << " to continue."<< endl;
cout << "ERROR: isDBRootEmpty API error, dbroot #" << oam.itoa(dbrootID) << " :" << errMsg << endl;
quit = true;
}
}
catch (...)
{}
}
}
} }
if (quit) { if (quit) {

View File

@@ -4510,7 +4510,9 @@ bool storageSetup(bool amazonInstall)
{ {
cout << " 'DataRedundancy' - This is specified when gluster is installed and you want" << endl; cout << " 'DataRedundancy' - This is specified when gluster is installed and you want" << endl;
cout << " the DBRoot directories to be controlled by ColumnStore Data Redundancy." << endl; cout << " the DBRoot directories to be controlled by ColumnStore Data Redundancy." << endl;
cout << " High Availability Server Failover is Supported in this mode." << endl << endl; cout << " High Availability Server Failover is Supported in this mode." << endl;
cout << " NOTE: glusterd service must be running and enabled on all PMs." << endl << endl;
} }
if ( hadoopInstalled == "y" ) if ( hadoopInstalled == "y" )
@@ -4797,6 +4799,14 @@ bool storageSetup(bool amazonInstall)
// if gluster // if gluster
if ( storageType == "3" ) if ( storageType == "3" )
{ {
string command = "stat /var/run/glusterd.pid > /dev/null 2>&1";
int status = system(command.c_str());
if (WEXITSTATUS(status) != 0 )
{
cout << "ERROR: No glusterd process detected. " << endl;
cout << " Start and enable glusterd on all PMs and run postConfigure again." << endl;
return false;
}
DataRedundancy = true; DataRedundancy = true;
sysConfig->setConfig(InstallSection, "DataRedundancyConfig", "y"); sysConfig->setConfig(InstallSection, "DataRedundancyConfig", "y");
sysConfig->setConfig("PrimitiveServers", "DirectIO", "n"); sysConfig->setConfig("PrimitiveServers", "DirectIO", "n");
@@ -5891,7 +5901,14 @@ bool glusterSetup(string password) {
} }
} }
sleep(5); sleep(5);
if (rootUser)
{
command = "gluster peer status >> /tmp/glusterCommands.txt 2>&1"; command = "gluster peer status >> /tmp/glusterCommands.txt 2>&1";
}
else
{
command = "sudo gluster peer status >> /tmp/glusterCommands.txt 2>&1";
}
status = system(command.c_str()); status = system(command.c_str());
if (WEXITSTATUS(status) != 0 ) if (WEXITSTATUS(status) != 0 )
{ {

View File

@@ -5871,7 +5871,7 @@ int ProcessMonitor::checkDataMount()
} }
} }
if ( dbrootList.size() == 0 ) { if ( dbrootList.size() == 0 && DataRedundancyConfig != "y") {
log.writeLog(__LINE__, "No dbroots are configured in Columnstore.xml file", LOG_TYPE_WARNING); log.writeLog(__LINE__, "No dbroots are configured in Columnstore.xml file", LOG_TYPE_WARNING);
return API_INVALID_PARAMETER; return API_INVALID_PARAMETER;
} }
@@ -6184,7 +6184,7 @@ int ProcessMonitor::glusterUnassign(std::string dbrootID)
int size = in.tellg(); int size = in.tellg();
if ( size != 0 ) if ( size != 0 )
{ {
if (!oam.checkLogStatus("/tmp/glusterAssign.txt", "not mounted")) { if (!oam.checkLogStatus("/tmp/glusterUnassign.txt", "not mounted")) {
log.writeLog(__LINE__, "glusterUnassign failed.", LOG_TYPE_ERROR); log.writeLog(__LINE__, "glusterUnassign failed.", LOG_TYPE_ERROR);
system("mv -f /tmp/glusterUnassign.txt /tmp/glusterUnassign_failed.txt"); system("mv -f /tmp/glusterUnassign.txt /tmp/glusterUnassign_failed.txt");
return oam::API_FAILURE; return oam::API_FAILURE;