1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-2068 - added the memory command line parameters to the installer as well to support single type installations

This commit is contained in:
sneJ-
2019-01-16 20:14:56 +01:00
parent fdc9f55840
commit 83f493eef3
2 changed files with 153 additions and 50 deletions

View File

@ -126,10 +126,22 @@ int main(int argc, char* argv[])
mysqlpw = argv[10]; mysqlpw = argv[10];
installer_debug = argv[11]; installer_debug = argv[11];
if (argc >= 13) string totalBlocksPctParam = "";
string totalUmMemoryParam = "";
if (argc >= 13) {
installDir = argv[12]; installDir = argv[12];
else if (argc >= 15) {
if (!string(argv[13]).compare("-")) {
totalBlocksPctParam = argv[13];
}
if (!string(argv[14]).compare("-")) {
totalUmMemoryParam = argv[14];
}
}
}
else {
installDir = "/usr/local/mariadb/columnstore"; installDir = "/usr/local/mariadb/columnstore";
}
ofstream file("/dev/null"); ofstream file("/dev/null");
@ -151,6 +163,12 @@ int main(int argc, char* argv[])
cout << mysqlpw << endl; cout << mysqlpw << endl;
cout << installer_debug << endl; cout << installer_debug << endl;
cout << installDir << endl; cout << installDir << endl;
if (!totalBlocksPctParam.empty()) {
cout << totalBlocksPctParam << endl;
}
if (!totalUmMemoryParam.empty()) {
cout << totalUmMemoryParam << endl;
}
// restore cout stream buffer // restore cout stream buffer
cout.rdbuf (strm_buffer); cout.rdbuf (strm_buffer);
@ -255,16 +273,26 @@ int main(int argc, char* argv[])
return false; return false;
} }
string numBlocksPct = "50"; string numBlocksPct;
if (numBlocksPctParam.empty()) {
if ( DBRootStorageType == "hdfs") numBlocksPct = "50";
numBlocksPct = "25";
if (DBRootStorageType == "hdfs")
numBlocksPct = "25";
}
else {
numBlocksPct = numBlocksPctParam;
}
try try
{ {
sysConfig->setConfig("DBBC", "NumBlocksPct", numBlocksPct); sysConfig->setConfig("DBBC", "NumBlocksPct", numBlocksPct);
cout << endl << "NOTE: Setting 'NumBlocksPct' to " << numBlocksPct << "%" << endl; 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 (...) catch (...)
{ {
@ -282,15 +310,21 @@ int main(int argc, char* argv[])
// long long total = myinfo.totalram / 1024 / 1000; // long long total = myinfo.totalram / 1024 / 1000;
// adjust max memory, 25% of total memory // adjust max memory, 25% of total memory
string percent = "25%"; string percent;
if (totalUmMemoryParam.empty()) {
percent = "25%";
if ( DBRootStorageType == "hdfs") if (DBRootStorageType == "hdfs")
{ {
percent = "12%"; percent = "12%";
}
cout << " Setting 'TotalUmMemory' to " << percent << " of total memory. " << endl;
}
else {
percent = totalUmMemoryParam;
cout << " Setting 'TotalUmMemory' to " << percent << endl;
} }
cout << " Setting 'TotalUmMemory' to " << percent << " of total memory. " << endl;
try try
{ {
sysConfig->setConfig("HashJoin", "TotalUmMemory", percent); sysConfig->setConfig("HashJoin", "TotalUmMemory", percent);
@ -305,29 +339,47 @@ int main(int argc, char* argv[])
{ {
try try
{ {
string numBlocksPct = sysConfig->getConfig("DBBC", "NumBlocksPct"); string numBlocksPct;
string totalUmMemory = sysConfig->getConfig("HashJoin", "TotalUmMemory"); string totalUmMemory;
if (numBlocksPct.empty() || numBlocksPct == "" ) if (!numBlocksPctParam.empty()) {
{ numBlocksPct = numBlocksPctParam;
numBlocksPct = "50"; }
else {
try numBlocksPct = sysConfig->getConfig("DBBC", "NumBlocksPct");
{ }
sysConfig->setConfig("DBBC", "NumBlocksPct", "50"); if (!totalUmMemoryParam.empty()) {
totalUmMemory = totalUmMemoryParam;
cout << endl << "NOTE: Setting 'NumBlocksPct' to 50%" << endl; }
} else {
catch (...) totalUmMemory = sysConfig->getConfig("HashJoin", "TotalUmMemory");
{
cout << "ERROR: Problem setting NumBlocksPct in the MariaDB ColumnStore System Configuration file" << endl;
exit(1);
}
} }
cout << endl << "NOTE: Using previous configuration setting for 'NumBlocksPct' = " << numBlocksPct << "%" << endl; if (numBlocksPct.empty() || numBlocksPct == "")
cout << " Using previous configuration setting for 'TotalUmMemory' = " << totalUmMemory << endl; {
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 (...) catch (...)
{ {
@ -350,7 +402,23 @@ int main(int argc, char* argv[])
// are we using settings from previous config file? // are we using settings from previous config file?
if ( reuseConfig == "n" ) if ( reuseConfig == "n" )
{ {
cout << endl << "NOTE: Using the default setting for 'NumBlocksPct' at 70%" << endl; 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 try
{ {
@ -358,17 +426,14 @@ int main(int argc, char* argv[])
} }
catch (...) {} catch (...) {}
// adjust max memory, 50% of total memory
cout << endl << "Setting 'TotalUmMemory' to 50% of total memory." << endl;
try try
{ {
sysConfig->setConfig("HashJoin", "TotalUmMemory", "50%"); sysConfig->setConfig("DBBC", "NumBlocksPct", numBlocksPct);
sysConfig->setConfig("HashJoin", "TotalUmMemory", totalUmMemory);
} }
catch (...) catch (...)
{ {
cout << "ERROR: Problem setting TotalUmMemory in the MariaDB ColumnStore System Configuration file" << endl; cout << "ERROR: Problem setting TotalUmMemory/NumBlocksPct in the MariaDB ColumnStore System Configuration file" << endl;
exit(1); exit(1);
} }
} }
@ -376,15 +441,47 @@ int main(int argc, char* argv[])
{ {
try try
{ {
string numBlocksPct = sysConfig->getConfig("DBBC", "NumBlocksPct"); string numBlocksPct;
string totalUmMemory = sysConfig->getConfig("HashJoin", "TotalUmMemory"); string totalUmMemory;
if (numBlocksPct.empty() || numBlocksPct == "" ) 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"; numBlocksPct = "70";
}
if (totalUmMemory.empty() || totalUmMemory == "") {
totalUmMemory = "50%";
}
try
{
sysConfig->setConfig("DBBC", "NumBlocksPct", numBlocksPct);
sysConfig->setConfig("HashJoin", "TotalUmMemory", totalUmMemory);
cout << endl << "NOTE: Using previous configuration setting for 'NumBlocksPct' = " << numBlocksPct << "%" << endl; if (*numBlocksPct.rbegin() == 'M' || *numBlocksPct.rbegin() == 'G') {
cout << " Using previous configuration setting for 'TotalUmMemory' = " << totalUmMemory << endl; 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 (...) catch (...)
{ {

View File

@ -333,9 +333,9 @@ int main(int argc, char* argv[])
cout << " -um-ip-addrs User Module IP Addresses xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx" << endl; cout << " -um-ip-addrs User Module IP Addresses xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx" << endl;
cout << " -x Do not resolve IP Addresses from host names" << endl; cout << " -x Do not resolve IP Addresses from host names" << endl;
cout << " -numBlocksPct amount of physical memory to utilize for disk block caching" << endl; cout << " -numBlocksPct amount of physical memory to utilize for disk block caching" << endl;
cout << " (percentages of the total memory need to be stated without suffix, explcit values with suffixes M or G)"; cout << " (percentages of the total memory need to be stated without suffix, explcit values with suffixes M or G)" << endl;
cout << " -totalUmMemory amount of physical memory to utilize for joins, intermediate results and set operations on the UM" << endl; cout << " -totalUmMemory amount of physical memory to utilize for joins, intermediate results and set operations on the UM" << endl;
cout << " (percentages of the total memory need to be stated with suffix %, explcit values with suffixes M or G)"; cout << " (percentages of the total memory need to be stated with suffix %, explcit values with suffixes M or G)" << endl;
exit (0); exit (0);
} }
else if (string("-x") == argv[i]) else if (string("-x") == argv[i])
@ -994,7 +994,6 @@ int main(int argc, char* argv[])
offLineAppCheck(); offLineAppCheck();
checkMysqlPort(mysqlPort, sysConfig); checkMysqlPort(mysqlPort, sysConfig);
if ( !writeConfig(sysConfig) ) if ( !writeConfig(sysConfig) )
{ {
cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl;
@ -1003,7 +1002,14 @@ int main(int argc, char* argv[])
cout << endl << "===== Performing Configuration Setup and MariaDB ColumnStore Startup =====" << endl; cout << endl << "===== Performing Configuration Setup and MariaDB ColumnStore Startup =====" << endl;
cmd = installDir + "/bin/installer dummy.rpm dummy.rpm dummy.rpm dummy.rpm dummy.rpm initial dummy " + reuseConfig + " --nodeps ' ' 1 " + installDir; if (numBlocksPctParam.empty()) {
numBlocksPctParam = "-";
}
if (totalUmMemoryParam.empty()) {
totalUmMemoryParam = "-";
}
cmd = installDir + "/bin/installer dummy.rpm dummy.rpm dummy.rpm dummy.rpm dummy.rpm initial dummy " + reuseConfig + " --nodeps ' ' 1 " + installDir + " " + totalBlocksPctParam + " " + totalUmMemoryParam;
system(cmd.c_str()); system(cmd.c_str());
exit(0); exit(0);
} }