You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-3606 Make ColumnStore use generic paths
ColumnStore now uses standard bin/lib paths for pretty much everything. Data path is now hard-coded to /var/lib/columnstore. This patch also: * Removes v1 decompression * Removes a bunch of unneeded files * Removes COLUMNSTORE_INSTALL_DIR / $INSTALLDIR * Makes my.cnf.d work for all platforms (MCOL-3558) * Changes configcpp to use recursive mutex (fixes possible config write deadlock) * Fixes MCOL-3599 Fix regr functions, The library was installed in the wrong location * Fixes a bunch of Ubuntu packaging issues * Changes the binary names of several of the executables so as not to clash with potential executables from other packages
This commit is contained in:
@ -83,57 +83,36 @@ Config* Config::makeConfig(const char* cf)
|
||||
{
|
||||
mutex::scoped_lock lk(fInstanceMapMutex);
|
||||
|
||||
static string installDir;
|
||||
static string defaultFilePath;
|
||||
|
||||
if (installDir.empty())
|
||||
installDir = startup::StartUp::installDir();
|
||||
|
||||
if (cf == 0)
|
||||
if (cf == 0 || *cf == 0)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
string cfStr = IDBreadRegistry("ConfigFile");
|
||||
fs::path configFilePath;
|
||||
configFilePath = fs::path(MCSSYSCONFDIR) / fs::path("columnstore") / defaultCalpontConfigFile;
|
||||
defaultFilePath = configFilePath.string();
|
||||
|
||||
if (!cfStr.empty())
|
||||
cf = cfStr.c_str();
|
||||
|
||||
#else
|
||||
cf = getenv("COLUMNSTORE_CONFIG_FILE");
|
||||
#endif
|
||||
|
||||
if (cf == 0 || *cf == 0)
|
||||
if (fInstanceMap.find(defaultFilePath) == fInstanceMap.end())
|
||||
{
|
||||
static string defaultFilePath;
|
||||
|
||||
if (defaultFilePath.empty())
|
||||
{
|
||||
fs::path configFilePath;
|
||||
configFilePath = fs::path(MCSSYSCONFDIR) / fs::path("columnstore") / defaultCalpontConfigFile;
|
||||
defaultFilePath = configFilePath.string();
|
||||
}
|
||||
|
||||
if (fInstanceMap.find(defaultFilePath) == fInstanceMap.end())
|
||||
{
|
||||
Config* instance = new Config(defaultFilePath, installDir);
|
||||
fInstanceMap[defaultFilePath] = instance;
|
||||
}
|
||||
|
||||
return fInstanceMap[defaultFilePath];
|
||||
Config* instance = new Config(defaultFilePath);
|
||||
fInstanceMap[defaultFilePath] = instance;
|
||||
}
|
||||
|
||||
return fInstanceMap[defaultFilePath];
|
||||
}
|
||||
|
||||
string configFile(cf);
|
||||
|
||||
if (fInstanceMap.find(configFile) == fInstanceMap.end())
|
||||
{
|
||||
Config* instance = new Config(configFile, installDir);
|
||||
Config* instance = new Config(configFile);
|
||||
fInstanceMap[configFile] = instance;
|
||||
}
|
||||
|
||||
return fInstanceMap[configFile];
|
||||
}
|
||||
|
||||
Config::Config(const string& configFile, const string& installDir) :
|
||||
fDoc(0), fConfigFile(configFile), fMtime(0), fInstallDir(installDir), fParser(fInstallDir)
|
||||
Config::Config(const string& configFile) :
|
||||
fDoc(0), fConfigFile(configFile), fMtime(0), fParser()
|
||||
{
|
||||
for ( int i = 0 ; i < 20 ; i++ )
|
||||
{
|
||||
@ -239,7 +218,7 @@ void Config::closeConfig(void)
|
||||
|
||||
const string Config::getConfig(const string& section, const string& name)
|
||||
{
|
||||
mutex::scoped_lock lk(fLock);
|
||||
recursive_mutex::scoped_lock lk(fLock);
|
||||
|
||||
if (section.length() == 0 || name.length() == 0)
|
||||
throw invalid_argument("Config::getConfig: both section and name must have a length");
|
||||
@ -266,7 +245,7 @@ const string Config::getConfig(const string& section, const string& name)
|
||||
|
||||
void Config::getConfig(const string& section, const string& name, vector<string>& values)
|
||||
{
|
||||
mutex::scoped_lock lk(fLock);
|
||||
recursive_mutex::scoped_lock lk(fLock);
|
||||
|
||||
if (section.length() == 0)
|
||||
throw invalid_argument("Config::getConfig: section must have a length");
|
||||
@ -291,7 +270,7 @@ void Config::getConfig(const string& section, const string& name, vector<string>
|
||||
|
||||
void Config::setConfig(const string& section, const string& name, const string& value)
|
||||
{
|
||||
mutex::scoped_lock lk(fLock);
|
||||
recursive_mutex::scoped_lock lk(fLock);
|
||||
|
||||
if (section.length() == 0 || name.length() == 0 )
|
||||
throw invalid_argument("Config::setConfig: all of section and name must have a length");
|
||||
@ -321,7 +300,7 @@ void Config::setConfig(const string& section, const string& name, const string&
|
||||
|
||||
void Config::delConfig(const string& section, const string& name)
|
||||
{
|
||||
mutex::scoped_lock lk(fLock);
|
||||
recursive_mutex::scoped_lock lk(fLock);
|
||||
|
||||
if (section.length() == 0 || name.length() == 0)
|
||||
throw invalid_argument("Config::delConfig: both section and name must have a length");
|
||||
@ -349,7 +328,7 @@ void Config::delConfig(const string& section, const string& name)
|
||||
|
||||
void Config::writeConfig(const string& configFile) const
|
||||
{
|
||||
mutex::scoped_lock lk(fLock);
|
||||
recursive_mutex::scoped_lock lk(fLock);
|
||||
FILE* fi;
|
||||
|
||||
if (fDoc == 0)
|
||||
@ -623,7 +602,7 @@ int64_t Config::fromText(const std::string& text)
|
||||
|
||||
time_t Config::getCurrentMTime()
|
||||
{
|
||||
mutex::scoped_lock lk(fLock);
|
||||
recursive_mutex::scoped_lock lk(fLock);
|
||||
|
||||
struct stat statbuf;
|
||||
|
||||
@ -635,7 +614,7 @@ time_t Config::getCurrentMTime()
|
||||
|
||||
const vector<string> Config::enumConfig()
|
||||
{
|
||||
mutex::scoped_lock lk(fLock);
|
||||
recursive_mutex::scoped_lock lk(fLock);
|
||||
|
||||
if (fDoc == 0)
|
||||
{
|
||||
@ -659,7 +638,7 @@ const vector<string> Config::enumConfig()
|
||||
|
||||
const vector<string> Config::enumSection(const string& section)
|
||||
{
|
||||
mutex::scoped_lock lk(fLock);
|
||||
recursive_mutex::scoped_lock lk(fLock);
|
||||
|
||||
if (fDoc == 0)
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ private:
|
||||
|
||||
/** @brief ctor with config file specified
|
||||
*/
|
||||
Config(const std::string& configFile, const std::string& installDir);
|
||||
Config(const std::string& configFile);
|
||||
|
||||
static configMap_t fInstanceMap;
|
||||
static boost::mutex fInstanceMapMutex;
|
||||
@ -230,8 +230,7 @@ private:
|
||||
xmlDocPtr fDoc;
|
||||
const std::string fConfigFile;
|
||||
time_t fMtime;
|
||||
mutable boost::mutex fLock;
|
||||
const std::string fInstallDir;
|
||||
mutable boost::recursive_mutex fLock;
|
||||
XMLParser fParser;
|
||||
|
||||
};
|
||||
|
@ -35,20 +35,20 @@ using namespace messageqcpp;
|
||||
namespace config
|
||||
{
|
||||
|
||||
ConfigStream::ConfigStream(const ByteStream& bs, const string& installDir) :
|
||||
fParser(installDir)
|
||||
ConfigStream::ConfigStream(const ByteStream& bs) :
|
||||
fParser()
|
||||
{
|
||||
init(reinterpret_cast<const xmlChar*>(bs.buf()));
|
||||
}
|
||||
|
||||
ConfigStream::ConfigStream(const string& str, const string& installDir) :
|
||||
fParser(installDir)
|
||||
ConfigStream::ConfigStream(const string& str) :
|
||||
fParser()
|
||||
{
|
||||
init(reinterpret_cast<const xmlChar*>(str.c_str()));
|
||||
}
|
||||
|
||||
ConfigStream::ConfigStream(const char* cptr, const string& installDir) :
|
||||
fParser(installDir)
|
||||
ConfigStream::ConfigStream(const char* cptr) :
|
||||
fParser()
|
||||
{
|
||||
init(reinterpret_cast<const xmlChar*>(cptr));
|
||||
}
|
||||
|
@ -41,9 +41,9 @@ namespace config
|
||||
class ConfigStream
|
||||
{
|
||||
public:
|
||||
ConfigStream(const messageqcpp::ByteStream& bs, const std::string& installDir);
|
||||
ConfigStream(const std::string& str, const std::string& installDir);
|
||||
ConfigStream(const char* cptr, const std::string& installDir);
|
||||
ConfigStream(const messageqcpp::ByteStream& bs);
|
||||
ConfigStream(const std::string& str);
|
||||
ConfigStream(const char* cptr);
|
||||
~ConfigStream();
|
||||
|
||||
const std::string getConfig(const std::string& section, const std::string& name) const
|
||||
|
@ -63,7 +63,7 @@ const string XMLParser::getConfig(const xmlDocPtr doc, const string& section, co
|
||||
if (cur3)
|
||||
res = (const char*)cur3->content;
|
||||
|
||||
return expand(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
cur2 = cur2->next;
|
||||
@ -74,7 +74,7 @@ const string XMLParser::getConfig(const xmlDocPtr doc, const string& section, co
|
||||
}
|
||||
|
||||
// maybe nullstr if not found
|
||||
return expand(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
void XMLParser::getConfig(const xmlDocPtr doc, const string& section, const string& name, vector<string>& values) const
|
||||
@ -108,7 +108,7 @@ void XMLParser::getConfig(const xmlDocPtr doc, const string& section, const stri
|
||||
if (cur3)
|
||||
res = (const char*)cur3->content;
|
||||
|
||||
values.push_back(expand(res));
|
||||
values.push_back(res);
|
||||
}
|
||||
|
||||
cur2 = cur2->next;
|
||||
@ -224,23 +224,6 @@ void XMLParser::delConfig(xmlDocPtr doc, const string& section, const string& na
|
||||
return;
|
||||
}
|
||||
|
||||
const string XMLParser::expand(const std::string& in) const
|
||||
{
|
||||
string out(in);
|
||||
string::size_type pos;
|
||||
const string::size_type len = 11;
|
||||
|
||||
pos = out.find("$INSTALLDIR");
|
||||
|
||||
while (pos != string::npos)
|
||||
{
|
||||
out.replace(pos, len, fInstallDir);
|
||||
pos = out.find("$INSTALLDIR");
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
const vector<string> XMLParser::enumConfig(const xmlDocPtr doc) const
|
||||
{
|
||||
vector<string> resv;
|
||||
@ -289,7 +272,7 @@ const vector<string> XMLParser::enumSection(const xmlDocPtr doc, const string& s
|
||||
res = reinterpret_cast<const char*>(cur2->name);
|
||||
|
||||
if (res != "text" && res != "comment")
|
||||
resv.push_back(expand(res));
|
||||
resv.push_back(res);
|
||||
|
||||
cur2 = cur2->next;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace config
|
||||
class XMLParser
|
||||
{
|
||||
public:
|
||||
XMLParser(const std::string& installDir) : fInstallDir(installDir) { }
|
||||
XMLParser() { }
|
||||
~XMLParser() { }
|
||||
|
||||
const std::string getConfig(const xmlDocPtr doc, const std::string& section, const std::string& name) const;
|
||||
@ -58,11 +58,6 @@ private:
|
||||
//XMLParser(const XMLParser& rhs);
|
||||
//XMLParser& operator=(const XMLParser& rhs);
|
||||
|
||||
/** @brief expand macros in config file to actual values
|
||||
*/
|
||||
const std::string expand(const std::string& in) const;
|
||||
|
||||
const std::string fInstallDir;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user