Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MCOL-1081: Remove repeatitive getConfig() and getDbrootPmConfig() cal…
…ls to improve IS_files performance.
  • Loading branch information
drrtuy committed Mar 13, 2018
1 parent 7df1884 commit d65372f
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 8 deletions.
33 changes: 27 additions & 6 deletions dbcon/mysql/is_columnstore_files.cpp
Expand Up @@ -20,6 +20,8 @@
* MA 02110-1301, USA.
*/

#include "boost/tuple/tuple.hpp"

#include "idb_mysql.h"

#include "dbrm.h"
Expand Down Expand Up @@ -102,6 +104,7 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
messageqcpp::MessageQueueClient* msgQueueClient;
oam::Oam oam_instance;
int pmId = 0;
std::string *DbRootPath;

if (!emp || !emp->isDBRMReady())
{
Expand All @@ -111,6 +114,9 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
execplan::ObjectIDManager oidm;
BRM::OID_t MaxOID = oidm.size();

oam::systemStorageInfo_t storeInfo = oam_instance.getStorageConfig(true);
oam::DeviceDBRootList moduleDBRootList = boost::get<2>(storeInfo);

for (BRM::OID_t oid = 3000; oid <= MaxOID; oid++)
{
emp->getExtents(oid, entries, false, false, true);
Expand All @@ -129,13 +135,29 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
continue;
}

try
pmId = 0;
std::string *DbRootPath = NULL;
std::vector<oam::DeviceDBRootConfig>::iterator DBRootConfIter = moduleDBRootList.begin();

while ( !pmId || DBRootConfIter != moduleDBRootList.end() )
{
oam_instance.getDbrootPmConfig(iter->dbRoot, pmId);
std::vector<uint16_t>::iterator PmDbRootListIter = DBRootConfIter->dbrootConfigList.begin();
std::vector<std::string>::iterator RootPathListIter = DBRootConfIter->dbrootPathList.begin();
while ( !pmId || PmDbRootListIter != DBRootConfIter->dbrootConfigList.end() )
{
if ( *PmDbRootListIter == iter->dbRoot )
{
pmId = DBRootConfIter->DeviceID;
DbRootPath = &(*RootPathListIter);
}
PmDbRootListIter++;
RootPathListIter++;
}
DBRootConfIter++;
}
catch (std::runtime_error)

if ( !pmId || !DbRootPath->size() )
{
// MCOL-1116: If we are here a DBRoot is offline/missing
iter++;
continue;
}
Expand All @@ -147,9 +169,8 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
WriteEngine::Convertor::oid2FileName(oid, oidDirName, dbDir, iter->partitionNum, iter->segmentNum);
std::stringstream DbRootName;
DbRootName << "DBRoot" << iter->dbRoot;
std::string DbRootPath = config->getConfig("SystemConfig", DbRootName.str());
fileSize = compressedFileSize = 0;
snprintf(fullFileName, WriteEngine::FILE_NAME_SIZE, "%s/%s", DbRootPath.c_str(), oidDirName);
snprintf(fullFileName, WriteEngine::FILE_NAME_SIZE, "%s/%s", DbRootPath->c_str(), oidDirName);

std::ostringstream oss;
oss << "pm" << pmId << "_WriteEngineServer";
Expand Down
18 changes: 17 additions & 1 deletion oam/oamcpp/liboamcpp.cpp
Expand Up @@ -5173,7 +5173,7 @@ bool Oam::switchParentOAMModule(std::string moduleName, GRACEFUL_FLAG gracefulfl
* Get Storage Config Data
*
********************************************************************/
systemStorageInfo_t Oam::getStorageConfig()
systemStorageInfo_t Oam::getStorageConfig(bool fillPaths)
{
DeviceDBRootList deviceDBRootList;
std::string storageType = "";
Expand Down Expand Up @@ -5225,6 +5225,22 @@ systemStorageInfo_t Oam::getStorageConfig()
if ( moduleCount > 0 && moduletype == "pm")
{
deviceDBRootList = systemmoduletypeconfig.moduletypeconfig[i].ModuleDBRootList;
if ( fillPaths )
{
std::vector<DeviceDBRootConfig>::iterator deviceDbRootConfIter = deviceDBRootList.begin();
for ( ;deviceDbRootConfIter != deviceDBRootList.end(); deviceDbRootConfIter++ )
{
std::vector<uint16_t>::iterator dBRootConfigListIter = deviceDbRootConfIter->dbrootConfigList.begin();
for ( ;dBRootConfigListIter != deviceDbRootConfIter->dbrootConfigList.end(); dBRootConfigListIter++)
{
std::stringstream DbRootName;
DbRootName << "DBRoot" << *dBRootConfigListIter;
std::string DbRootPath;
getSystemConfig(DbRootName.str(), DbRootPath);
deviceDbRootConfIter->dbrootPathList.push_back(DbRootPath);
}
}
}
return boost::make_tuple(storageType, SystemDBRootCount, deviceDBRootList, UMstorageType);
}
}
Expand Down
9 changes: 8 additions & 1 deletion oam/oamcpp/liboamcpp.h
Expand Up @@ -747,6 +747,12 @@ typedef std::vector<DeviceNetworkConfig> DeviceNetworkList;

typedef std::vector<std::string> DiskMonitorFileSystems;

/** @brief DBRoot Path List
*
*/

typedef std::vector<std::string> DBRootPathList;

/** @brief DBRoot Config List
*
*/
Expand All @@ -761,6 +767,7 @@ struct DeviceDBRootConfig_s
{
uint16_t DeviceID; //!< Device ID
DBRootConfigList dbrootConfigList; //!< DBRoot List
DBRootPathList dbrootPathList; //!< DBRoot paths list, correlates with DBRoot List
};

typedef struct DeviceDBRootConfig_s DeviceDBRootConfig;
Expand Down Expand Up @@ -2242,7 +2249,7 @@ class Oam
/**
*@brief Get Storage Config Data
*/
EXPORT systemStorageInfo_t getStorageConfig();
EXPORT systemStorageInfo_t getStorageConfig(bool fillPaths = false);

/**
*@brief Get PM - DBRoot Config data
Expand Down

0 comments on commit d65372f

Please sign in to comment.