1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +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

View File

@ -36,124 +36,135 @@ namespace
void usage(const string& pname)
{
cout << "usage: " << pname << " [-vdhx] [-c config_file] section param value" << endl <<
" Updates configuration variable param in section section with value." << endl <<
" -c config_file use config file config_file" << endl <<
" -v display verbose information" << endl <<
" -d don't perform misc checks and don't try to distribute the config file" << endl <<
" after changes are made" << endl <<
" -x delete the param from section (value is still required but ignored)" << endl <<
" -h display this help text" << endl;
cout << "usage: " << pname << " [-vdhx] [-c config_file] section param value" << endl <<
" Updates configuration variable param in section section with value." << endl <<
" -c config_file use config file config_file" << endl <<
" -v display verbose information" << endl <<
" -d don't perform misc checks and don't try to distribute the config file" << endl <<
" after changes are made" << endl <<
" -x delete the param from section (value is still required but ignored)" << endl <<
" -h display this help text" << endl;
}
}
int main(int argc, char** argv)
{
int c;
string pname(argv[0]);
bool vflg = false;
bool dflg = false;
bool xflg = false;
string configFile;
int c;
string pname(argv[0]);
bool vflg = false;
bool dflg = false;
bool xflg = false;
string configFile;
opterr = 0;
opterr = 0;
while ((c = getopt(argc, argv, "c:vdxh")) != EOF)
switch (c)
{
case 'v':
vflg = true;
break;
case 'd':
dflg = true;
break;
case 'c':
configFile = optarg;
break;
case 'x':
xflg = true;
break;
case 'h':
case '?':
default:
usage(pname);
return (c == 'h' ? 0 : 1);
break;
}
while ((c = getopt(argc, argv, "c:vdxh")) != EOF)
switch (c)
{
case 'v':
vflg = true;
break;
if ((argc - optind) < 3)
{
usage(pname);
return 1;
}
case 'd':
dflg = true;
break;
case 'c':
configFile = optarg;
break;
case 'x':
xflg = true;
break;
case 'h':
case '?':
default:
usage(pname);
return (c == 'h' ? 0 : 1);
break;
}
if ((argc - optind) < 3)
{
usage(pname);
return 1;
}
#ifdef COMMUNITY_KEYRANGE
//No OAM in CE...
dflg = true;
//No OAM in CE...
dflg = true;
#endif
Oam oam;
oamModuleInfo_t t;
bool parentOAMModuleFlag = true;
string parentOAMModule = " ";
int serverInstallType = oam::INSTALL_COMBINE_DM_UM_PM;
Oam oam;
oamModuleInfo_t t;
bool parentOAMModuleFlag = true;
string parentOAMModule = " ";
int serverInstallType = oam::INSTALL_COMBINE_DM_UM_PM;
//get local module info; validate running on Active Parent OAM Module
try {
t = oam.getModuleInfo();
parentOAMModuleFlag = boost::get<4>(t);
parentOAMModule = boost::get<3>(t);
serverInstallType = boost::get<5>(t);
}
catch (exception&) {
parentOAMModuleFlag = true;
}
//get local module info; validate running on Active Parent OAM Module
try
{
t = oam.getModuleInfo();
parentOAMModuleFlag = boost::get<4>(t);
parentOAMModule = boost::get<3>(t);
serverInstallType = boost::get<5>(t);
}
catch (exception&)
{
parentOAMModuleFlag = true;
}
if (!dflg && !parentOAMModuleFlag)
{
cerr << "Exiting, setConfig can only be run on the Active "
"OAM Parent Module '" << parentOAMModule << "'" << endl;
return 2;
}
if (!dflg && !parentOAMModuleFlag)
{
cerr << "Exiting, setConfig can only be run on the Active "
"OAM Parent Module '" << parentOAMModule << "'" << endl;
return 2;
}
Config* cf;
if (configFile.length() > 0)
cf = Config::makeConfig(configFile);
else
cf = Config::makeConfig();
Config* cf;
if (vflg)
cout << "Using config file: " << cf->configFile() << endl;
if (configFile.length() > 0)
cf = Config::makeConfig(configFile);
else
cf = Config::makeConfig();
if (xflg)
cf->delConfig(argv[optind + 0], argv[optind + 1]);
else
{
cf->setConfig(argv[optind + 0], argv[optind + 1], argv[optind + 2]);
if (strcmp(argv[optind + 1],"SystemName") == 0)
{
oam.changeMyCnf( "server_audit_syslog_info", argv[optind + 2] );
}
}
cf->write();
if (vflg)
cout << "Using config file: " << cf->configFile() << endl;
if (dflg || serverInstallType == oam::INSTALL_COMBINE_DM_UM_PM)
return 0;
if (xflg)
cf->delConfig(argv[optind + 0], argv[optind + 1]);
else
{
cf->setConfig(argv[optind + 0], argv[optind + 1], argv[optind + 2]);
//get number of pms
string count = cf->getConfig("PrimitiveServers", "Count");
if (strcmp(argv[optind + 1], "SystemName") == 0)
{
oam.changeMyCnf( "server_audit_syslog_info", argv[optind + 2] );
}
}
try {
oam.distributeConfigFile();
//sleep to give time for change to be distributed
sleep(atoi(count.c_str()));
}
catch (...) {
return 1;
}
cf->write();
return 0;
if (dflg || serverInstallType == oam::INSTALL_COMBINE_DM_UM_PM)
return 0;
//get number of pms
string count = cf->getConfig("PrimitiveServers", "Count");
try
{
oam.distributeConfigFile();
//sleep to give time for change to be distributed
sleep(atoi(count.c_str()));
}
catch (...)
{
return 1;
}
return 0;
}
// vim:ts=4 sw=4: