1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Merge branch 'develop-1.1' into 1.1-merge-up-20180621

This commit is contained in:
Andrew Hutchings
2018-06-22 14:51:20 +01:00
20 changed files with 1065 additions and 443 deletions

View File

@ -5811,6 +5811,35 @@ 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;
@ -6330,10 +6359,8 @@ 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 ../Calpont/local/moveDbrootTransactionLog", LOG_TYPE_DEBUG );
cout << "No dbroots found in " << fileName << endl;
}
oldFile.close();
@ -7746,7 +7773,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)
@ -10344,6 +10371,146 @@ void Oam::sendStatusUpdate(ByteStream obs, ByteStream::byte returnRequestType)
/***************************************************************************
*
* 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 );
}
}
}
/***************************************************************************
*
* 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
@ -10445,6 +10612,7 @@ void Oam::amazonReattach(std::string toPM, dbrootList dbrootConfigList, bool att
}
}
/***************************************************************************
*
* Function: mountDBRoot