You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-27 21:01:50 +03:00
MCOL-3915. Cleanup postConfigure. PostConfigure and Installer no longer editing config file
This commit is contained in:
@ -48,7 +48,7 @@ string prompt;
|
||||
|
||||
const char* pcommand = 0;
|
||||
|
||||
extern bool noPrompting;
|
||||
bool noPrompting = false;
|
||||
|
||||
namespace installer
|
||||
{
|
||||
@ -644,10 +644,8 @@ void checkFilesPerPartion(int DBRootCount, Config* sysConfig)
|
||||
return;
|
||||
}
|
||||
|
||||
void checkMysqlPort( std::string& mysqlPort, Config* sysConfig )
|
||||
void checkMysqlPort(std::string& mysqlPort)
|
||||
{
|
||||
Oam oam;
|
||||
|
||||
string tmpDir = startup::StartUp::tmpDir();
|
||||
|
||||
while (true)
|
||||
@ -663,70 +661,19 @@ void checkMysqlPort( std::string& mysqlPort, Config* sysConfig )
|
||||
oldFile.seekg(0, std::ios::end);
|
||||
int size = oldFile.tellg();
|
||||
|
||||
if ( size != 0 )
|
||||
if (size != 0)
|
||||
{
|
||||
if ( noPrompting )
|
||||
{
|
||||
cout << endl << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use" << endl;
|
||||
cout << "Either use the command line argument of 'port' to enter a different number" << endl;
|
||||
cout << "or stop the process that is using port '" + mysqlPort + "'" << endl;
|
||||
cout << "For No-prompt install, exiting" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cout << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use on local server" << endl;
|
||||
cout << "Either enter a different port to use" << endl;
|
||||
cout << "or stop the process that is using port '" + mysqlPort + "' and enter '" + mysqlPort + "' to continue" << endl;
|
||||
|
||||
while (true)
|
||||
{
|
||||
prompt = "Enter port number > ";
|
||||
pcommand = callReadline(prompt.c_str());
|
||||
|
||||
if (pcommand)
|
||||
{
|
||||
if (strlen(pcommand) > 0) mysqlPort = pcommand;
|
||||
|
||||
callFree(pcommand);
|
||||
pcommand = 0;
|
||||
}
|
||||
|
||||
if ( atoi(mysqlPort.c_str()) < 1000 || atoi(mysqlPort.c_str()) > 9999)
|
||||
{
|
||||
cout << " ERROR: Invalid MariaDB ColumnStore Port ID supplied, must be between 1000-9999" << endl;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
cout << endl << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use" << endl;
|
||||
cout << "Please stop the process that is using port '" + mysqlPort + "'" << endl;
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << endl;
|
||||
|
||||
try
|
||||
{
|
||||
sysConfig->setConfig("Installation", "MySQLPort", mysqlPort);
|
||||
}
|
||||
catch (const std::exception& exc)
|
||||
{
|
||||
std::cerr << exc.what() << std::endl;
|
||||
}
|
||||
|
||||
if ( !writeConfig(sysConfig) )
|
||||
{
|
||||
cout << "ERROR: Failed trying to update MariaDB Columnstore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
// set mysql password
|
||||
oam.changeMyCnf( "port", mysqlPort );
|
||||
}
|
||||
|
||||
void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string USER, std::string password, ChildModuleList childmodulelist, int IserverTypeInstall, bool pmwithum)
|
||||
|
@ -40,7 +40,7 @@ extern void mysqlSetup();
|
||||
extern int sendMsgProcMon( std::string module, messageqcpp::ByteStream msg, int requestID, int timeout );
|
||||
extern int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pmwithum);
|
||||
extern void checkFilesPerPartion(int DBRootCount, Config* sysConfig);
|
||||
extern void checkMysqlPort( string& mysqlPort, Config* sysConfig);
|
||||
extern void checkMysqlPort(string& mysqlPort);
|
||||
extern bool writeConfig(Config* sysConfig);
|
||||
extern void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string USER, std::string password, ChildModuleList childmodulelist, int IserverTypeInstall, bool pmwithum);
|
||||
extern const char* callReadline(string prompt);
|
||||
|
@ -78,7 +78,6 @@ bool uncommentCalpontXml( string entry);
|
||||
|
||||
extern string pwprompt;
|
||||
|
||||
bool noPrompting;
|
||||
string mysqlpw = " ";
|
||||
|
||||
bool rootUser = true;
|
||||
@ -96,8 +95,6 @@ int main(int argc, char* argv[])
|
||||
ModuleList performancemodulelist;
|
||||
Module childmodule;
|
||||
|
||||
struct sysinfo myinfo;
|
||||
|
||||
string prompt;
|
||||
string nodeps = "-h";
|
||||
string installer_debug = "0";
|
||||
@ -216,291 +213,6 @@ int main(int argc, char* argv[])
|
||||
|
||||
IserverTypeInstall = atoi(serverTypeInstall.c_str());
|
||||
|
||||
if ( installType != "uninstall" )
|
||||
{
|
||||
//setup ProcessConfig.xml
|
||||
switch ( IserverTypeInstall )
|
||||
{
|
||||
case (oam::INSTALL_COMBINE_DM_UM_PM): // combined #1 dm/um/pm on a single server
|
||||
case (oam::INSTALL_COMBINE_DM_UM): // combined #2 dm/um on a same server
|
||||
case (oam::INSTALL_COMBINE_PM_UM): // combined #3 um/pm on a same server
|
||||
{
|
||||
//module ProcessConfig.xml to setup all apps on the dm
|
||||
if ( !updateProcessConfig(IserverTypeInstall) )
|
||||
cout << "Update ProcessConfig.xml error" << endl;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//set Resource Settings
|
||||
switch ( IserverTypeInstall )
|
||||
{
|
||||
case (oam::INSTALL_COMBINE_DM_UM_PM): // combined #1 - dm/um/pm on a single server
|
||||
{
|
||||
if ( !writeConfig(sysConfig) )
|
||||
{
|
||||
cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
sysConfig->setConfig("PrimitiveServers", "RotatingDestination", "n");
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem setting RotatingDestination in the MariaDB ColumnStore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// are we using settings from previous config file?
|
||||
if ( reuseConfig == "n" )
|
||||
{
|
||||
try
|
||||
{
|
||||
DBRootStorageType = sysConfig->getConfig(InstallSection, "DBRootStorageType");
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem getting DB Storage Data from the MariaDB ColumnStore System Configuration file" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
string numBlocksPct;
|
||||
if (numBlocksPctParam.empty()) {
|
||||
numBlocksPct = "50";
|
||||
|
||||
if (DBRootStorageType == "hdfs")
|
||||
numBlocksPct = "25";
|
||||
}
|
||||
else {
|
||||
numBlocksPct = numBlocksPctParam;
|
||||
}
|
||||
try
|
||||
{
|
||||
sysConfig->setConfig("DBBC", "NumBlocksPct", numBlocksPct);
|
||||
|
||||
if (*numBlocksPct.rbegin() == 'M' || *numBlocksPct.rbegin() == 'G') {
|
||||
cout << endl << "NOTE: Setting 'NumBlocksPct' to " << numBlocksPct << endl;
|
||||
}
|
||||
else {
|
||||
cout << endl << "NOTE: Setting 'NumBlocksPct' to " << numBlocksPct << "%" << endl;
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem setting NumBlocksPct in the MariaDB ColumnStore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
sysinfo(&myinfo);
|
||||
}
|
||||
catch (...) {}
|
||||
|
||||
//get memory stats
|
||||
// long long total = myinfo.totalram / 1024 / 1000;
|
||||
|
||||
// adjust max memory, 25% of total memory
|
||||
string percent;
|
||||
if (totalUmMemoryParam.empty()) {
|
||||
percent = "25%";
|
||||
|
||||
if (DBRootStorageType == "hdfs")
|
||||
{
|
||||
percent = "12%";
|
||||
}
|
||||
|
||||
cout << " Setting 'TotalUmMemory' to " << percent << " of total memory. " << endl;
|
||||
}
|
||||
else {
|
||||
percent = totalUmMemoryParam;
|
||||
cout << " Setting 'TotalUmMemory' to " << percent << endl;
|
||||
}
|
||||
try
|
||||
{
|
||||
sysConfig->setConfig("HashJoin", "TotalUmMemory", percent);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem setting TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
string numBlocksPct;
|
||||
string totalUmMemory;
|
||||
|
||||
if (!numBlocksPctParam.empty()) {
|
||||
numBlocksPct = numBlocksPctParam;
|
||||
}
|
||||
else {
|
||||
numBlocksPct = sysConfig->getConfig("DBBC", "NumBlocksPct");
|
||||
}
|
||||
if (!totalUmMemoryParam.empty()) {
|
||||
totalUmMemory = totalUmMemoryParam;
|
||||
}
|
||||
else {
|
||||
totalUmMemory = sysConfig->getConfig("HashJoin", "TotalUmMemory");
|
||||
}
|
||||
|
||||
if (numBlocksPct.empty() || numBlocksPct == "")
|
||||
{
|
||||
numBlocksPct = "50";
|
||||
}
|
||||
if (totalUmMemory.empty() || totalUmMemory == "") {
|
||||
totalUmMemory = "25%";
|
||||
}
|
||||
try
|
||||
{
|
||||
sysConfig->setConfig("DBBC", "NumBlocksPct", numBlocksPct);
|
||||
sysConfig->setConfig("HashJoin", "TotalUmMemory", totalUmMemory);
|
||||
|
||||
if (*numBlocksPct.rbegin() == 'M' || *numBlocksPct.rbegin() == 'G') {
|
||||
cout << endl << "NOTE: Setting 'NumBlocksPct' to " << numBlocksPct << endl;
|
||||
}
|
||||
else {
|
||||
cout << endl << "NOTE: Setting 'NumBlocksPct' to " << numBlocksPct << "%" << endl;
|
||||
}
|
||||
cout << " Setting 'TotalUmMemory' to " << totalUmMemory << endl;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem setting NumBlocksPct/TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem reading NumBlocksPct/TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !writeConfig(sysConfig) )
|
||||
{
|
||||
cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: // normal, seperate UM and PM
|
||||
{
|
||||
// are we using settings from previous config file?
|
||||
if ( reuseConfig == "n" )
|
||||
{
|
||||
string numBlocksPct = "70";
|
||||
string totalUmMemory = "50%";
|
||||
|
||||
if (!numBlocksPctParam.empty()) {
|
||||
numBlocksPct = numBlocksPctParam;
|
||||
cout << endl << "NOTE: Setting 'NumBlocksPct' to " << numBlocksPct << endl;
|
||||
}
|
||||
else {
|
||||
cout << endl << "NOTE: Using the default setting for 'NumBlocksPct' at " << numBlocksPct << "%" << endl;
|
||||
}
|
||||
if (!totalUmMemoryParam.empty()) {
|
||||
totalUmMemory = totalUmMemoryParam;
|
||||
cout << endl << "Setting 'TotalUmMemory' to " << totalUmMemory << endl;
|
||||
}
|
||||
else {
|
||||
cout << endl << "Setting 'TotalUmMemory' to " << totalUmMemory << " of total memory." << endl;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
sysinfo(&myinfo);
|
||||
}
|
||||
catch (...) {}
|
||||
|
||||
try
|
||||
{
|
||||
sysConfig->setConfig("DBBC", "NumBlocksPct", numBlocksPct);
|
||||
sysConfig->setConfig("HashJoin", "TotalUmMemory", totalUmMemory);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem setting TotalUmMemory/NumBlocksPct in the MariaDB ColumnStore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
string numBlocksPct;
|
||||
string totalUmMemory;
|
||||
|
||||
if (!numBlocksPctParam.empty()) {
|
||||
numBlocksPct = numBlocksPctParam;
|
||||
}
|
||||
else {
|
||||
numBlocksPct = sysConfig->getConfig("DBBC", "NumBlocksPct");
|
||||
}
|
||||
if (!totalUmMemoryParam.empty()) {
|
||||
totalUmMemory = totalUmMemoryParam;
|
||||
}
|
||||
else {
|
||||
totalUmMemory = sysConfig->getConfig("HashJoin", "TotalUmMemory");
|
||||
}
|
||||
|
||||
if (numBlocksPct.empty() || numBlocksPct == "")
|
||||
{
|
||||
numBlocksPct = "70";
|
||||
}
|
||||
if (totalUmMemory.empty() || totalUmMemory == "") {
|
||||
totalUmMemory = "50%";
|
||||
}
|
||||
try
|
||||
{
|
||||
sysConfig->setConfig("DBBC", "NumBlocksPct", numBlocksPct);
|
||||
sysConfig->setConfig("HashJoin", "TotalUmMemory", totalUmMemory);
|
||||
|
||||
if (*numBlocksPct.rbegin() == 'M' || *numBlocksPct.rbegin() == 'G') {
|
||||
cout << endl << "NOTE: Setting 'NumBlocksPct' to " << numBlocksPct << endl;
|
||||
}
|
||||
else {
|
||||
cout << endl << "NOTE: Setting 'NumBlocksPct' to " << numBlocksPct << "%" << endl;
|
||||
}
|
||||
cout << " Setting 'TotalUmMemory' to " << totalUmMemory << endl;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem setting NumBlocksPct/TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem reading NumBlocksPct/TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !writeConfig(sysConfig) )
|
||||
{
|
||||
cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !writeConfig(sysConfig) )
|
||||
{
|
||||
cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//get PPackage Type
|
||||
try
|
||||
{
|
||||
@ -707,9 +419,6 @@ int main(int argc, char* argv[])
|
||||
// call the mysql setup scripts
|
||||
mysqlSetup();
|
||||
sleep(5);
|
||||
// cout << "(3) SKIP_OAM_INIT is set, so will not start ColumnStore or init the system catalog" << endl;
|
||||
sysConfig->setConfig("Installation", "MySQLRep", "n");
|
||||
sysConfig->write();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user