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

Reformat all code to coding standard

This commit is contained in:
Andrew Hutchings
2017-10-26 17:18:17 +01:00
parent 4985f3456e
commit 01446d1e22
1296 changed files with 403852 additions and 353747 deletions

3672
tools/configMgt/autoConfigure.cpp Executable file → Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@
* List of files being updated by configure:
* Calpont/etc/Columnstore.xml
*
*
*
******************************************************************************************/
/**
* @file
@ -56,122 +56,139 @@ using namespace std;
using namespace oam;
using namespace config;
int main(int argc, char *argv[])
int main(int argc, char* argv[])
{
Oam oam;
string systemUser = "root";
string installParentModuleHostName;
string password;
string debug_flag = "1";
string systemName = "all";
bool VERBOSE = false;
string systemUser = "root";
string installParentModuleHostName;
string password;
string debug_flag = "1";
string systemName = "all";
bool VERBOSE = false;
Config* sysConfig = Config::makeConfig("./systems/CalpontSystems.xml");
Config* sysConfig = Config::makeConfig("./systems/CalpontSystems.xml");
for( int i = 1; i < argc; i++ )
{
if( string("-h") == argv[i] ) {
cout << endl;
cout << "'stackReleaseChecker' retrieves and prints the release installed on a stack." << endl;
cout << endl;
cout << "The list of systems are located in './systems/CalpontSystems.xml" << endl;
cout << endl;
cout << "Usage: stackReleaseChecker [-h][-s system][-v]" << endl;
cout << " -s system-name or leave blank for all systems" << endl;
cout << " -v verbose will give the version numbers" << endl;
exit (0);
}
else if( string("-s") == argv[i] ) {
i++;
if ( argc == i ) {
cout << "ERROR: missing system argument" << endl;
exit(-1);
}
systemName = argv[i];
}
else if( string("-v") == argv[i] )
VERBOSE = true;
}
for ( int i = 1; i < argc; i++ )
{
if ( string("-h") == argv[i] )
{
cout << endl;
cout << "'stackReleaseChecker' retrieves and prints the release installed on a stack." << endl;
cout << endl;
cout << "The list of systems are located in './systems/CalpontSystems.xml" << endl;
cout << endl;
cout << "Usage: stackReleaseChecker [-h][-s system][-v]" << endl;
cout << " -s system-name or leave blank for all systems" << endl;
cout << " -v verbose will give the version numbers" << endl;
exit (0);
}
else if ( string("-s") == argv[i] )
{
i++;
int systemCount;
try {
systemCount = strtol(sysConfig->getConfig("NetworkConfig", "SystemCount").c_str(), 0, 0);
if ( systemCount == 0 ) {
cout << "ERROR: SystemCount in ./systems/CalpontSystems.xml equal to 0" << endl;
exit(-1);
}
}
catch(...)
{
cout << "ERROR: Problem getting SystemCount from ./systems/CalpontSystems.xml" << endl;
exit(-1);
}
if ( argc == i )
{
cout << "ERROR: missing system argument" << endl;
exit(-1);
}
bool FOUND = false;
for ( int i = 1 ; i < systemCount+1 ; i++)
{
string SystemName = "SystemName" + oam.itoa(i);
string oamParentModule = "OAMParentModule" + oam.itoa(i);
string SystemPassword = "SystemPassword" + oam.itoa(i);
string SystemUser = "SystemUser" + oam.itoa(i);
systemName = argv[i];
}
else if ( string("-v") == argv[i] )
VERBOSE = true;
}
string tempSystem;
try {
tempSystem = sysConfig->getConfig("NetworkConfig", SystemName );
}
catch(...)
{
cout << "ERROR: Problem getting SystemName from ./systems/CalpontSystems.xml" << endl;
exit(-1);
}
int systemCount;
if ( tempSystem == systemName || systemName == "all") {
try {
installParentModuleHostName = sysConfig->getConfig("NetworkConfig", oamParentModule );
password = sysConfig->getConfig("NetworkConfig", SystemPassword );
systemUser = sysConfig->getConfig("NetworkConfig", SystemUser );
FOUND = true;
}
catch(...)
{
cout << "ERROR: Problem getting SystemName from ./systems/CalpontSystems.xml" << endl;
exit(-1);
}
try
{
systemCount = strtol(sysConfig->getConfig("NetworkConfig", "SystemCount").c_str(), 0, 0);
if ( tempSystem == "unassigned")
continue;
if ( systemCount == 0 )
{
cout << "ERROR: SystemCount in ./systems/CalpontSystems.xml equal to 0" << endl;
exit(-1);
}
}
catch (...)
{
cout << "ERROR: Problem getting SystemCount from ./systems/CalpontSystems.xml" << endl;
exit(-1);
}
//get if root or no-root user install
string installDir = "/usr/local";
if ( systemUser != "root" )
installDir = "/home/" + systemUser;
bool FOUND = false;
installDir = installDir + "/Calpont";
for ( int i = 1 ; i < systemCount + 1 ; i++)
{
string SystemName = "SystemName" + oam.itoa(i);
string oamParentModule = "OAMParentModule" + oam.itoa(i);
string SystemPassword = "SystemPassword" + oam.itoa(i);
string SystemUser = "SystemUser" + oam.itoa(i);
string cmd;
if (!VERBOSE)
cmd = "./remote_command.sh " + installParentModuleHostName + " " + systemUser + " " + password + " 'cat " + installDir + "/releasenum' 'release=' cat: 10 " + debug_flag;
else
cmd = "./remote_command.sh " + installParentModuleHostName + " " + systemUser + " " + password + " '" + installDir + "/bin/mcsadmin getcalpontsoftware' 'tools' Error 10 " + debug_flag;
string tempSystem;
cout << "***** Calpont InfiniDB Package Release Information for stack '" << tempSystem << "' *****" << endl << endl;
try
{
tempSystem = sysConfig->getConfig("NetworkConfig", SystemName );
}
catch (...)
{
cout << "ERROR: Problem getting SystemName from ./systems/CalpontSystems.xml" << endl;
exit(-1);
}
system(cmd.c_str());
if ( tempSystem == systemName || systemName == "all")
{
try
{
installParentModuleHostName = sysConfig->getConfig("NetworkConfig", oamParentModule );
password = sysConfig->getConfig("NetworkConfig", SystemPassword );
systemUser = sysConfig->getConfig("NetworkConfig", SystemUser );
FOUND = true;
}
catch (...)
{
cout << "ERROR: Problem getting SystemName from ./systems/CalpontSystems.xml" << endl;
exit(-1);
}
cout << endl;
if ( tempSystem == "unassigned")
continue;
cout << "***** Status of stack '" << tempSystem << "' *****" << endl << endl;
//get if root or no-root user install
string installDir = "/usr/local";
cmd = "./remote_command.sh " + installParentModuleHostName + " " + systemUser + " " + password + " '" + installDir + "/bin/mcsadmin getsystems' dummy Error 10 " + debug_flag;
if ( systemUser != "root" )
installDir = "/home/" + systemUser;
system(cmd.c_str());
installDir = installDir + "/Calpont";
cout << endl << endl;
}
}
string cmd;
if ( !FOUND ) {
cout << "ERROR: System Name '" + systemName + "' not in ./systems/CalpontSystems.xml" << endl;
exit(-1);
}
if (!VERBOSE)
cmd = "./remote_command.sh " + installParentModuleHostName + " " + systemUser + " " + password + " 'cat " + installDir + "/releasenum' 'release=' cat: 10 " + debug_flag;
else
cmd = "./remote_command.sh " + installParentModuleHostName + " " + systemUser + " " + password + " '" + installDir + "/bin/mcsadmin getcalpontsoftware' 'tools' Error 10 " + debug_flag;
cout << "***** Calpont InfiniDB Package Release Information for stack '" << tempSystem << "' *****" << endl << endl;
system(cmd.c_str());
cout << endl;
cout << "***** Status of stack '" << tempSystem << "' *****" << endl << endl;
cmd = "./remote_command.sh " + installParentModuleHostName + " " + systemUser + " " + password + " '" + installDir + "/bin/mcsadmin getsystems' dummy Error 10 " + debug_flag;
system(cmd.c_str());
cout << endl << endl;
}
}
if ( !FOUND )
{
cout << "ERROR: System Name '" + systemName + "' not in ./systems/CalpontSystems.xml" << endl;
exit(-1);
}
}

View File

@ -19,7 +19,7 @@
* $Id: svnQuery.cpp 64 2006-10-12 22:21:51Z dhill $
*
*
*
*
******************************************************************************************/
/**
* @file
@ -48,148 +48,167 @@
using namespace std;
using namespace oam;
int main(int argc, char *argv[])
int main(int argc, char* argv[])
{
Oam oam;
vector <string> queryDirectory;
vector <string> queryID;
Oam oam;
vector <string> queryDirectory;
vector <string> queryID;
// get latest set of svn queries
// get latest set of svn queries
// system("rm -rf /root/genii/ > /dev/null 2>&1");
system("updateGenii.pl > /dev/null 2>&1");
system("updateGenii.pl > /dev/null 2>&1");
system("rm -rf /home/qa/bldqry/mysql/* > /dev/null 2>&1");
system("rm -rf /home/qa/bldqry/mysql/* > /dev/null 2>&1");
string cronFile = "/root/calpontBuildTest";
unlink(cronFile.c_str());
string cronFile = "/root/calpontBuildTest";
unlink(cronFile.c_str());
// get query directory list
string topQueryfileName = "/tmp/topQuerydirs";
string secondQueryfileName = "/tmp/secondQuerydirs";
string queryfileName = "/home/qa/bldqry/mysql/querydirs";
// get query directory list
string topQueryfileName = "/tmp/topQuerydirs";
string secondQueryfileName = "/tmp/secondQuerydirs";
string queryfileName = "/home/qa/bldqry/mysql/querydirs";
string cmd = "ls /root/genii/mysql/queries/. > " + topQueryfileName;
system(cmd.c_str());
string cmd = "ls /root/genii/mysql/queries/. > " + topQueryfileName;
system(cmd.c_str());
ifstream file (topQueryfileName.c_str());
if (!file) {
cout << " Error: can't open " + topQueryfileName << endl;
exit (-1);
}
ifstream file (topQueryfileName.c_str());
char line[200];
string topQueryDir;
while (file.getline(line, 200))
{
topQueryDir = line;
if ( topQueryDir.find("queryTester",0) != string::npos || topQueryDir == "Makefile" )
continue;
if (!file)
{
cout << " Error: can't open " + topQueryfileName << endl;
exit (-1);
}
// only do working queries for now
if ( topQueryDir.find("working",0) == string::npos)
continue;
char line[200];
string topQueryDir;
string cmd = "ls /root/genii/mysql/queries/" + topQueryDir + "/. > " + secondQueryfileName;
system(cmd.c_str());
ifstream file (secondQueryfileName.c_str());
if (file) {
char line[200];
string buf;
while (file.getline(line, 200))
{
buf = line;
if ( buf.empty() )
continue;
string tempdir = topQueryDir + "/" + buf;
queryDirectory.push_back(tempdir);
}
}
file.close();
}
while (file.getline(line, 200))
{
topQueryDir = line;
file.close();
if ( topQueryDir.find("queryTester", 0) != string::npos || topQueryDir == "Makefile" )
continue;
if ( queryDirectory.size() == 0 ) {
cout << endl << "Error: no query sub-directories located" << endl;
exit (-1);
}
// only do working queries for now
if ( topQueryDir.find("working", 0) == string::npos)
continue;
// get query list for each query directory
int test = 1;
std::vector<std::string>::iterator pt1 = queryDirectory.begin();
for( ; pt1 != queryDirectory.end() ; pt1++)
{
string directory = *pt1;
string::size_type pos = directory.find("/",0);
if (pos != string::npos)
{
string setName;
setName = directory.substr(0, pos);
setName = setName + "-";
setName = setName + directory.substr(pos+1, 200);
string cmd = "cd /home/qa/bldqry/mysql/;echo " + setName + ".sql > " + oam.itoa(test) + ".txt";
system(cmd.c_str());
queryID.push_back(oam.itoa(test));
test++;
cmd = "rm -f /home/qa/bldqry/mysql/" + setName + ".sql";
system(cmd.c_str());
cmd = "cat /root/genii/mysql/queries/" + directory + "/*.sql >> /home/qa/bldqry/mysql/" + setName + ".sql";
system(cmd.c_str());
}
}
string cmd = "ls /root/genii/mysql/queries/" + topQueryDir + "/. > " + secondQueryfileName;
system(cmd.c_str());
// setup calpontBuildTest cron job with directories
string cronFileTemplate = "/root/calpontBuildTest.template";
ifstream file (secondQueryfileName.c_str());
ifstream cfile (cronFileTemplate.c_str());
if (!cfile) {
cout << endl << "Error: " + cronFileTemplate + " not found" << endl;
exit (-1);
}
if (file)
{
char line[200];
string buf;
vector <string> lines;
string newLine;
string buf;
while (cfile.getline(line, 200))
{
buf = line;
string::size_type pos = buf.find("buildTester",0);
if (pos != string::npos)
{
newLine = buf;
while (file.getline(line, 200))
{
buf = line;
pt1 = queryID.begin();
for( ; pt1 != queryID.end() ; pt1++)
{
newLine.append(" mysql-");
newLine.append(*pt1);
}
if ( buf.empty() )
continue;
newLine.append(" mysql-queryTester");
string tempdir = topQueryDir + "/" + buf;
queryDirectory.push_back(tempdir);
}
}
buf = newLine;
}
//output to temp file
lines.push_back(buf);
}
cfile.close();
file.close();
}
ofstream newFile (cronFile.c_str());
//create new file
int fd = open(cronFile.c_str(), O_RDWR|O_CREAT, 0777);
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
newFile.close();
close(fd);
file.close();
cmd = "chmod 777 " + cronFile;
system(cmd.c_str());
if ( queryDirectory.size() == 0 )
{
cout << endl << "Error: no query sub-directories located" << endl;
exit (-1);
}
// get query list for each query directory
int test = 1;
std::vector<std::string>::iterator pt1 = queryDirectory.begin();
for ( ; pt1 != queryDirectory.end() ; pt1++)
{
string directory = *pt1;
string::size_type pos = directory.find("/", 0);
if (pos != string::npos)
{
string setName;
setName = directory.substr(0, pos);
setName = setName + "-";
setName = setName + directory.substr(pos + 1, 200);
string cmd = "cd /home/qa/bldqry/mysql/;echo " + setName + ".sql > " + oam.itoa(test) + ".txt";
system(cmd.c_str());
queryID.push_back(oam.itoa(test));
test++;
cmd = "rm -f /home/qa/bldqry/mysql/" + setName + ".sql";
system(cmd.c_str());
cmd = "cat /root/genii/mysql/queries/" + directory + "/*.sql >> /home/qa/bldqry/mysql/" + setName + ".sql";
system(cmd.c_str());
}
}
// setup calpontBuildTest cron job with directories
string cronFileTemplate = "/root/calpontBuildTest.template";
ifstream cfile (cronFileTemplate.c_str());
if (!cfile)
{
cout << endl << "Error: " + cronFileTemplate + " not found" << endl;
exit (-1);
}
vector <string> lines;
string newLine;
string buf;
while (cfile.getline(line, 200))
{
buf = line;
string::size_type pos = buf.find("buildTester", 0);
if (pos != string::npos)
{
newLine = buf;
pt1 = queryID.begin();
for ( ; pt1 != queryID.end() ; pt1++)
{
newLine.append(" mysql-");
newLine.append(*pt1);
}
newLine.append(" mysql-queryTester");
buf = newLine;
}
//output to temp file
lines.push_back(buf);
}
cfile.close();
ofstream newFile (cronFile.c_str());
//create new file
int fd = open(cronFile.c_str(), O_RDWR | O_CREAT, 0777);
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
newFile.close();
close(fd);
cmd = "chmod 777 " + cronFile;
system(cmd.c_str());
}