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
@ -5628,6 +5628,7 @@ void Oam::manualMovePmDbroot(std::string residePM, std::string dbrootIDs, std::s
|
||||
|
||||
dbrootList dbroot1;
|
||||
dbroot1.push_back(*pt1);
|
||||
bool returnDbRoot = false;
|
||||
|
||||
//send msg to unmount dbroot if module is not offline
|
||||
int opState;
|
||||
@ -5642,7 +5643,6 @@ void Oam::manualMovePmDbroot(std::string residePM, std::string dbrootIDs, std::s
|
||||
|
||||
if (opState != oam::AUTO_OFFLINE || opState != oam::AUTO_DISABLED)
|
||||
{
|
||||
// bool unmountPass = true;
|
||||
try
|
||||
{
|
||||
mountDBRoot(dbroot1, false);
|
||||
@ -5652,13 +5652,8 @@ void Oam::manualMovePmDbroot(std::string residePM, std::string dbrootIDs, std::s
|
||||
writeLog("ERROR: dbroot failed to unmount", LOG_TYPE_ERROR );
|
||||
cout << endl << "ERROR: umountDBRoot api failure" << endl;
|
||||
exceptionControl("manualMovePmDbroot", API_FAILURE);
|
||||
// unmountPass = false;
|
||||
}
|
||||
|
||||
// if ( !unmountPass) {
|
||||
// dbrootlist.erase(pt1);
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
//check for amazon moving required
|
||||
@ -5676,40 +5671,79 @@ void Oam::manualMovePmDbroot(std::string residePM, std::string dbrootIDs, std::s
|
||||
//if Gluster, do the assign command
|
||||
if ( DataRedundancyConfig == "y")
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
string errmsg;
|
||||
int ret = glusterctl(oam::GLUSTER_ASSIGN, *pt1, toPM, errmsg);
|
||||
|
||||
if ( ret != 0 )
|
||||
if ( ret == 0 )
|
||||
{
|
||||
todbrootConfigList.push_back(*pt2);
|
||||
residedbrootConfigList.erase(pt2);
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "FAILURE: Error assigning gluster dbroot# " + *pt1 + " to pm" + toPMID + ", error: " + errmsg << endl;
|
||||
exceptionControl("manualMovePmDbroot", API_FAILURE);
|
||||
writeLog("FAILURE: Error assigning gluster dbroot# " + *pt1 + " to pm" + toPMID + ", error: " + errmsg, LOG_TYPE_ERROR );
|
||||
returnDbRoot = true;
|
||||
}
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cout << endl << "**** glusterctl API exception: " << e.what() << endl;
|
||||
cerr << "FAILURE: Error assigning gluster dbroot# " + *pt1 + " to pm" + toPMID << endl;
|
||||
exceptionControl("manualMovePmDbroot", API_FAILURE);
|
||||
writeLog("FAILURE: Error assigning gluster dbroot# " + *pt1 + " to pm" + toPMID, LOG_TYPE_ERROR );
|
||||
returnDbRoot = true;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << endl << "**** glusterctl API exception: UNKNOWN" << endl;
|
||||
cerr << "FAILURE: Error assigning gluster dbroot# " + *pt1 + " to pm" + toPMID << endl;
|
||||
exceptionControl("manualMovePmDbroot", API_FAILURE);
|
||||
writeLog("FAILURE: Error assigning gluster dbroot# " + *pt1 + " to pm" + toPMID, LOG_TYPE_ERROR );
|
||||
returnDbRoot = true;
|
||||
}
|
||||
}
|
||||
|
||||
todbrootConfigList.push_back(*pt2);
|
||||
|
||||
residedbrootConfigList.erase(pt2);
|
||||
|
||||
if (returnDbRoot)
|
||||
{
|
||||
// something went wrong return it back to original owner
|
||||
try
|
||||
{
|
||||
string errmsg;
|
||||
writeLog("reassigning gluster dbroot# " + *pt1 + " to pm" + residePMID, LOG_TYPE_ERROR );
|
||||
int ret = glusterctl(oam::GLUSTER_ASSIGN, *pt1, residePM, errmsg);
|
||||
if ( ret != 0 )
|
||||
{
|
||||
cerr << "FAILURE: Error reassigning gluster dbroot# " + *pt1 + " to pm" + residePMID + ", error: " + errmsg << endl;
|
||||
writeLog("FAILURE: Error reassigning gluster dbroot# " + *pt1 + " to pm" + residePMID + ", error: " + errmsg, LOG_TYPE_ERROR );
|
||||
exceptionControl("manualMovePmDbroot", API_INVALID_STATE);
|
||||
}
|
||||
mountDBRoot(dbroot1);
|
||||
//get updated Columnstore.xml distributed
|
||||
distributeConfigFile("system");
|
||||
return;
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cout << endl << "**** glusterctl API exception: " << e.what() << endl;
|
||||
cerr << "FAILURE: Error reassigning gluster dbroot# " + *pt1 + " to pm" + residePMID << endl;
|
||||
writeLog("FAILURE: Error reassigning gluster dbroot# " + *pt1 + " to pm" + residePMID, LOG_TYPE_ERROR );
|
||||
exceptionControl("manualMovePmDbroot", API_INVALID_STATE);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << endl << "**** glusterctl API exception: UNKNOWN" << endl;
|
||||
cerr << "FAILURE: Error reassigning gluster dbroot# " + *pt1 + " to pm" + residePMID << endl;
|
||||
writeLog("FAILURE: Error reassigning gluster dbroot# " + *pt1 + " to pm" + residePMID, LOG_TYPE_ERROR );
|
||||
exceptionControl("manualMovePmDbroot", API_INVALID_STATE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//set the 2 pms dbroot config
|
||||
try
|
||||
{
|
||||
@ -5719,7 +5753,7 @@ void Oam::manualMovePmDbroot(std::string residePM, std::string dbrootIDs, std::s
|
||||
{
|
||||
writeLog("ERROR: setPmDbrootConfig api failure for pm" + residePMID, LOG_TYPE_ERROR );
|
||||
cout << endl << "ERROR: setPmDbrootConfig api failure for pm" + residePMID << endl;
|
||||
exceptionControl("manualMovePmDbroot", API_FAILURE);
|
||||
exceptionControl("manualMovePmDbroot", API_INVALID_STATE);
|
||||
}
|
||||
|
||||
try
|
||||
@ -5730,7 +5764,7 @@ void Oam::manualMovePmDbroot(std::string residePM, std::string dbrootIDs, std::s
|
||||
{
|
||||
writeLog("ERROR: setPmDbrootConfig api failure for pm" + toPMID, LOG_TYPE_ERROR );
|
||||
cout << endl << "ERROR: setPmDbrootConfig api failure for pm" + toPMID << endl;
|
||||
exceptionControl("manualMovePmDbroot", API_FAILURE);
|
||||
exceptionControl("manualMovePmDbroot", API_INVALID_STATE);
|
||||
}
|
||||
|
||||
//send msg to mount dbroot
|
||||
@ -5824,6 +5858,36 @@ bool Oam::autoMovePmDbroot(std::string residePM)
|
||||
exceptionControl("autoMovePmDbroot", API_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
//detach first to make sure DBS can be detach before trying to move to another pm
|
||||
DBRootConfigList::iterator pt3 = residedbrootConfigList.begin();
|
||||
|
||||
for ( ; pt3 != residedbrootConfigList.end() ; pt3++ )
|
||||
{
|
||||
int dbrootID = *pt3;
|
||||
|
||||
try
|
||||
{
|
||||
typedef std::vector<string> dbrootList;
|
||||
dbrootList dbrootlist;
|
||||
dbrootlist.push_back(itoa(dbrootID));
|
||||
|
||||
amazonDetach(dbrootlist);
|
||||
}
|
||||
catch (exception& )
|
||||
{
|
||||
writeLog("ERROR: amazonDetach failure", LOG_TYPE_ERROR );
|
||||
|
||||
//reattach
|
||||
typedef std::vector<string> dbrootList;
|
||||
dbrootList dbrootlist;
|
||||
dbrootlist.push_back(itoa(dbrootID));
|
||||
|
||||
amazonAttach(residePM, dbrootlist);
|
||||
|
||||
exceptionControl("autoMovePmDbroot", API_DETACH_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
//get dbroot id for other PMs
|
||||
systemStorageInfo_t t;
|
||||
DeviceDBRootList moduledbrootlist;
|
||||
@ -6344,16 +6408,16 @@ bool Oam::autoUnMovePmDbroot(std::string toPM)
|
||||
|
||||
if (!found)
|
||||
{
|
||||
writeLog("ERROR: no dbroots found in ../Calpont/local/moveDbrootTransactionLog", LOG_TYPE_ERROR );
|
||||
cout << "ERROR: no dbroots found in " << fileName << endl;
|
||||
exceptionControl("autoUnMovePmDbroot", API_FAILURE);
|
||||
writeLog("No dbroots found in " + InstallDir + "/moveDbrootTransactionLog", LOG_TYPE_DEBUG );
|
||||
|
||||
cout << "No dbroots found in " << fileName << endl;
|
||||
}
|
||||
|
||||
oldFile.close();
|
||||
unlink (fileName.c_str());
|
||||
ofstream newFile (fileName.c_str());
|
||||
|
||||
//create new file
|
||||
//create new file
|
||||
int fd = open(fileName.c_str(), O_RDWR | O_CREAT, 0664);
|
||||
|
||||
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
|
||||
@ -6927,32 +6991,6 @@ void Oam::assignDbroot(std::string toPM, DBRootConfigList& dbrootlist)
|
||||
for ( ; pt3 != dbrootlist.end() ; pt3++)
|
||||
{
|
||||
todbrootConfigList.push_back(*pt3);
|
||||
|
||||
/* if ( DataRedundancyConfig == "y")
|
||||
{
|
||||
try {
|
||||
string errmsg;
|
||||
int ret = glusterctl(oam::GLUSTER_ASSIGN, itoa(*pt3), toPM, errmsg);
|
||||
if ( ret != 0 )
|
||||
{
|
||||
cerr << "FAILURE: Error assigning gluster dbroot# " + itoa(*pt3) + " to pm" + toPMID + ", error: " + errmsg << endl;
|
||||
exceptionControl("assignPmDbrootConfig", API_FAILURE);
|
||||
}
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cout << endl << "**** glusterctl API exception: " << e.what() << endl;
|
||||
cerr << "FAILURE: Error assigning gluster dbroot# " + itoa(*pt3) + " to pm" + toPMID << endl;
|
||||
exceptionControl("assignPmDbrootConfig", API_FAILURE);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << endl << "**** glusterctl API exception: UNKNOWN" << endl;
|
||||
cerr << "FAILURE: Error assigning gluster dbroot# " + itoa(*pt3) + " to pm" + toPMID << endl;
|
||||
exceptionControl("assignPmDbrootConfig", API_FAILURE);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
try
|
||||
@ -7412,12 +7450,14 @@ void Oam::removeDbroot(DBRootConfigList& dbrootlist)
|
||||
{
|
||||
cout << endl << "**** glusterctl API exception: " << e.what() << endl;
|
||||
cerr << "FAILURE: Error assigning gluster dbroot# " + itoa(dbrootID) << endl;
|
||||
writeLog("FAILURE: Error assigning gluster dbroot# " + itoa(dbrootID), LOG_TYPE_ERROR );
|
||||
exceptionControl("removeDbroot", API_FAILURE);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << endl << "**** glusterctl API exception: UNKNOWN" << endl;
|
||||
cerr << "FAILURE: Error assigning gluster dbroot# " + itoa(dbrootID) << endl;
|
||||
writeLog("FAILURE: Error assigning gluster dbroot# " + itoa(dbrootID), LOG_TYPE_ERROR );
|
||||
exceptionControl("removeDbroot", API_FAILURE);
|
||||
}
|
||||
}
|
||||
@ -7753,7 +7793,7 @@ void Oam::actionMysqlCalpont(MYSQLCALPONT_ACTION action)
|
||||
else
|
||||
return;
|
||||
|
||||
// check if mysql-Capont is installed
|
||||
// check if mysql-Columnstore is installed
|
||||
string mysqlscript = InstallDir + "/mysql/mysql-Columnstore";
|
||||
|
||||
if (access(mysqlscript.c_str(), X_OK) != 0)
|
||||
@ -10327,12 +10367,167 @@ void Oam::sendStatusUpdate(ByteStream obs, ByteStream::byte returnRequestType)
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Function: amazonReattach
|
||||
* Function: amazonDetach
|
||||
*
|
||||
* Purpose: Amazon EC2 volume deattach needed
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void Oam::amazonDetach(dbrootList dbrootConfigList)
|
||||
{
|
||||
//if amazon cloud with external volumes, do the detach/attach moves
|
||||
string cloud;
|
||||
string DBRootStorageType;
|
||||
|
||||
try
|
||||
{
|
||||
getSystemConfig("Cloud", cloud);
|
||||
getSystemConfig("DBRootStorageType", DBRootStorageType);
|
||||
}
|
||||
catch (...) {}
|
||||
|
||||
if ( (cloud == "amazon-ec2" || cloud == "amazon-vpc") &&
|
||||
DBRootStorageType == "external" )
|
||||
{
|
||||
writeLog("amazonDetach function started ", LOG_TYPE_DEBUG );
|
||||
|
||||
dbrootList::iterator pt3 = dbrootConfigList.begin();
|
||||
|
||||
for ( ; pt3 != dbrootConfigList.end() ; pt3++)
|
||||
{
|
||||
string dbrootid = *pt3;
|
||||
string volumeNameID = "PMVolumeName" + dbrootid;
|
||||
string volumeName = oam::UnassignedName;
|
||||
string deviceNameID = "PMVolumeDeviceName" + dbrootid;
|
||||
string deviceName = oam::UnassignedName;
|
||||
|
||||
try
|
||||
{
|
||||
getSystemConfig( volumeNameID, volumeName);
|
||||
getSystemConfig( deviceNameID, deviceName);
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
|
||||
if ( volumeName == oam::UnassignedName || deviceName == oam::UnassignedName )
|
||||
{
|
||||
cout << " ERROR: amazonDetach, invalid configure " + volumeName + ":" + deviceName << endl;
|
||||
writeLog("ERROR: amazonDetach, invalid configure " + volumeName + ":" + deviceName, LOG_TYPE_ERROR );
|
||||
exceptionControl("amazonDetach", API_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
//send msg to to-pm to umount volume
|
||||
int returnStatus = sendMsgToProcMgr(UNMOUNT, dbrootid, FORCEFUL, ACK_YES);
|
||||
|
||||
if (returnStatus != API_SUCCESS)
|
||||
{
|
||||
writeLog("ERROR: amazonDetach, umount failed on " + dbrootid, LOG_TYPE_ERROR );
|
||||
}
|
||||
|
||||
if (!detachEC2Volume(volumeName))
|
||||
{
|
||||
cout << " ERROR: amazonDetach, detachEC2Volume failed on " + volumeName << endl;
|
||||
writeLog("ERROR: amazonDetach, detachEC2Volume failed on " + volumeName, LOG_TYPE_ERROR );
|
||||
exceptionControl("amazonDetach", API_FAILURE);
|
||||
}
|
||||
|
||||
writeLog("amazonDetach, detachEC2Volume passed on " + volumeName, LOG_TYPE_DEBUG );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Purpose: Amazon EC2 volume reattach needed
|
||||
* Function: amazonAttach
|
||||
*
|
||||
* Purpose: Amazon EC2 volume Attach needed
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void Oam::amazonAttach(std::string toPM, dbrootList dbrootConfigList)
|
||||
{
|
||||
//if amazon cloud with external volumes, do the detach/attach moves
|
||||
string cloud;
|
||||
string DBRootStorageType;
|
||||
|
||||
try
|
||||
{
|
||||
getSystemConfig("Cloud", cloud);
|
||||
getSystemConfig("DBRootStorageType", DBRootStorageType);
|
||||
}
|
||||
catch (...) {}
|
||||
|
||||
if ( (cloud == "amazon-ec2" || cloud == "amazon-vpc") &&
|
||||
DBRootStorageType == "external" )
|
||||
{
|
||||
writeLog("amazonAttach function started ", LOG_TYPE_DEBUG );
|
||||
|
||||
//get Instance Name for to-pm
|
||||
string toInstanceName = oam::UnassignedName;
|
||||
|
||||
try
|
||||
{
|
||||
ModuleConfig moduleconfig;
|
||||
getSystemConfig(toPM, moduleconfig);
|
||||
HostConfigList::iterator pt1 = moduleconfig.hostConfigList.begin();
|
||||
toInstanceName = (*pt1).HostName;
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
|
||||
if ( toInstanceName == oam::UnassignedName || toInstanceName.empty() )
|
||||
{
|
||||
cout << " ERROR: amazonAttach, invalid Instance Name for " << toPM << endl;
|
||||
writeLog("ERROR: amazonAttach, invalid Instance Name " + toPM, LOG_TYPE_ERROR );
|
||||
exceptionControl("amazonAttach", API_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
dbrootList::iterator pt3 = dbrootConfigList.begin();
|
||||
|
||||
for ( ; pt3 != dbrootConfigList.end() ; pt3++)
|
||||
{
|
||||
string dbrootid = *pt3;
|
||||
string volumeNameID = "PMVolumeName" + dbrootid;
|
||||
string volumeName = oam::UnassignedName;
|
||||
string deviceNameID = "PMVolumeDeviceName" + dbrootid;
|
||||
string deviceName = oam::UnassignedName;
|
||||
|
||||
try
|
||||
{
|
||||
getSystemConfig( volumeNameID, volumeName);
|
||||
getSystemConfig( deviceNameID, deviceName);
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
|
||||
if ( volumeName == oam::UnassignedName || deviceName == oam::UnassignedName )
|
||||
{
|
||||
cout << " ERROR: amazonAttach, invalid configure " + volumeName + ":" + deviceName << endl;
|
||||
writeLog("ERROR: amazonAttach, invalid configure " + volumeName + ":" + deviceName, LOG_TYPE_ERROR );
|
||||
exceptionControl("amazonAttach", API_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
if (!attachEC2Volume(volumeName, deviceName, toInstanceName))
|
||||
{
|
||||
cout << " ERROR: amazonAttach, attachEC2Volume failed on " + volumeName + ":" + deviceName + ":" + toInstanceName << endl;
|
||||
writeLog("ERROR: amazonAttach, attachEC2Volume failed on " + volumeName + ":" + deviceName + ":" + toInstanceName, LOG_TYPE_ERROR );
|
||||
exceptionControl("amazonAttach", API_FAILURE);
|
||||
}
|
||||
|
||||
writeLog("amazonAttach, attachEC2Volume passed on " + volumeName + ":" + toPM, LOG_TYPE_DEBUG );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Function: amazonReattach
|
||||
*
|
||||
* Purpose: Amazon EC2 volume reattach needed
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void Oam::amazonReattach(std::string toPM, dbrootList dbrootConfigList, bool attach)
|
||||
{
|
||||
//if amazon cloud with external volumes, do the detach/attach moves
|
||||
@ -10428,6 +10623,7 @@ void Oam::amazonReattach(std::string toPM, dbrootList dbrootConfigList, bool att
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Function: mountDBRoot
|
||||
|
Reference in New Issue
Block a user