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

Remove global lock from OAMCache

Config now uses a single atomic variable to speed up its operations
Config has a special method to re-read a config file if it changed on disk
This commit is contained in:
Roman Nozdrin
2021-03-19 16:28:51 +00:00
committed by Roman Nozdrin
parent b0da7f4974
commit 2aa5380d51
5 changed files with 125 additions and 110 deletions

View File

@ -365,19 +365,16 @@ void ResourceManager::hbrPredicate() { }
bool ResourceManager::getMysqldInfo(
std::string& h, std::string& u, std::string& w, unsigned int& p) const
{
h = getStringVal("CrossEngineSupport", "Host", "unassigned");
static const std::string hostUserUnassignedValue("unassigned");
// MCS will read username and pass from disk if the config changed.
bool reReadConfig = true;
u = getStringVal("CrossEngineSupport", "User", hostUserUnassignedValue, reReadConfig);
w = getStringVal("CrossEngineSupport", "Password", "", reReadConfig);
// MCS will not read username and pass from disk if the config changed.
h = getStringVal("CrossEngineSupport", "Host", hostUserUnassignedValue);
p = getUintVal("CrossEngineSupport", "Port", 0);
u = getStringVal("CrossEngineSupport", "User", "unassigned");
w = getStringVal("CrossEngineSupport", "Password", "");
bool rc = true;
if ((h.compare("unassigned") == 0) ||
(u.compare("unassigned") == 0) ||
(p == 0))
rc = false;
return rc;
return h != hostUserUnassignedValue && u != hostUserUnassignedValue && p;
}
bool ResourceManager::queryStatsEnabled() const

View File

@ -35,6 +35,7 @@
#include "calpontselectexecutionplan.h"
#include "resourcedistributor.h"
#include "installdir.h"
#include "branchpred.h"
#include "atomicops.h"
@ -547,7 +548,10 @@ private:
* @param name the param name whose value is to be returned
* @param defVal the default value returned if the value is missing
*/
std::string getStringVal(const std::string& section, const std::string& name, const std::string& defVal) const;
std::string getStringVal(const std::string& section,
const std::string& name,
const std::string& defVal,
const bool reReadConfigIfNeeded = false) const;
template<typename IntType>
IntType getUintVal(const std::string& section, const std::string& name, IntType defval) const;
@ -603,13 +607,20 @@ private:
};
inline std::string ResourceManager::getStringVal(const std::string& section, const std::string& name, const std::string& defval) const
inline std::string ResourceManager::getStringVal(const std::string& section,
const std::string& name,
const std::string& defval,
const bool reReadConfigIfNeeded) const
{
std::string val = fConfig->getConfig(section, name);
std::string val = UNLIKELY(reReadConfigIfNeeded)
? fConfig->getFromActualConfig(section, name)
: fConfig->getConfig(section, name);
#ifdef DEBUGRM
std::cout << "RM getStringVal for " << section << " : " << name << " val: " << val << " default: " << defval << std::endl;
#endif
return (0 == val.length() ? defval : val);
if (val.empty())
val = defval;
return val;
}
template<typename IntType>