You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-06-13 16:01:32 +03:00
MCOL-5464: Fixes of bugs from ASAN warnings, part one (#2792)
* Fixes of bugs from ASAN warnings, part one * MQC as static library, with nifty counter for global map and mutex * Switch clang to 16 * link messageqcpp to execplan
This commit is contained in:
@ -69,15 +69,17 @@ const fs::path defaultConfigFilePath(configDefaultFileName);
|
||||
|
||||
namespace config
|
||||
{
|
||||
Config* globConfigInstancePtr = nullptr;
|
||||
Config::configMap_t Config::fInstanceMap;
|
||||
boost::mutex Config::fInstanceMapMutex;
|
||||
Config::configMap_t Config::fInstanceMap;
|
||||
// duplicate to that in the Config class
|
||||
boost::mutex Config::fXmlLock;
|
||||
// duplicate to that in the Config class
|
||||
boost::mutex Config::fWriteXmlLock;
|
||||
std::atomic_bool globHasConfig;
|
||||
|
||||
ConfigUniqPtr globConfigInstancePtr;
|
||||
|
||||
|
||||
void Config::checkAndReloadConfig()
|
||||
{
|
||||
struct stat statbuf;
|
||||
@ -105,20 +107,20 @@ Config* Config::makeConfig(const string& cf)
|
||||
if (globConfigInstancePtr)
|
||||
{
|
||||
globConfigInstancePtr->checkAndReloadConfig();
|
||||
return globConfigInstancePtr;
|
||||
return globConfigInstancePtr.get();
|
||||
}
|
||||
|
||||
// Make this configurable at least at compile-time.
|
||||
std::string configFilePath =
|
||||
std::string(MCSSYSCONFDIR) + std::string("/columnstore/") + configDefaultFileName;
|
||||
globConfigInstancePtr = new Config(configFilePath);
|
||||
globConfigInstancePtr.reset(new Config(configFilePath));
|
||||
globHasConfig.store(true, std::memory_order_relaxed);
|
||||
return globConfigInstancePtr;
|
||||
return globConfigInstancePtr.get();
|
||||
}
|
||||
|
||||
boost::mutex::scoped_lock lk(fInstanceMapMutex);
|
||||
globConfigInstancePtr->checkAndReloadConfig();
|
||||
return globConfigInstancePtr;
|
||||
return globConfigInstancePtr.get();
|
||||
}
|
||||
|
||||
boost::mutex::scoped_lock lk(fInstanceMapMutex);
|
||||
@ -526,21 +528,6 @@ void Config::writeConfigFile(messageqcpp::ByteStream msg) const
|
||||
/* static */
|
||||
void Config::deleteInstanceMap()
|
||||
{
|
||||
boost::mutex::scoped_lock lk(fInstanceMapMutex);
|
||||
|
||||
for (Config::configMap_t::iterator iter = fInstanceMap.begin(); iter != fInstanceMap.end(); ++iter)
|
||||
{
|
||||
Config* instance = iter->second;
|
||||
delete instance;
|
||||
}
|
||||
|
||||
fInstanceMap.clear();
|
||||
|
||||
if (globConfigInstancePtr)
|
||||
{
|
||||
delete globConfigInstancePtr;
|
||||
globConfigInstancePtr = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
@ -643,4 +630,18 @@ std::string Config::getTempFileDir(Config::TempDirPurpose what)
|
||||
return {};
|
||||
}
|
||||
|
||||
void Config::ConfigDeleter::operator()(Config* config)
|
||||
{
|
||||
boost::mutex::scoped_lock lk(fInstanceMapMutex);
|
||||
|
||||
for (Config::configMap_t::iterator iter = fInstanceMap.begin(); iter != fInstanceMap.end(); ++iter)
|
||||
{
|
||||
Config* instance = iter->second;
|
||||
delete instance;
|
||||
}
|
||||
|
||||
fInstanceMap.clear();
|
||||
delete config;
|
||||
}
|
||||
|
||||
} // namespace config
|
||||
|
Reference in New Issue
Block a user