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

@ -37,7 +37,7 @@
#define MAX_RETRIES 10
BRM::MasterDBRMNode *m;
BRM::MasterDBRMNode* m;
bool die;
using namespace std;
@ -45,33 +45,37 @@ using namespace BRM;
void fail()
{
try {
oam::Oam oam;
try
{
oam::Oam oam;
oam.processInitFailure();
}
catch (exception&) {
cerr << "failed to notify OAM of server failure" << endl;
}
oam.processInitFailure();
}
catch (exception&)
{
cerr << "failed to notify OAM of server failure" << endl;
}
}
void stop(int num)
{
#ifdef BRM_VERBOSE
std::cerr << "stopping..." << std::endl;
std::cerr << "stopping..." << std::endl;
#endif
die = true;
if (m != NULL)
m->stop();
die = true;
if (m != NULL)
m->stop();
}
void restart(int num)
{
#ifdef BRM_VERBOSE
std::cerr << "stopping this instance..." << std::endl;
std::cerr << "stopping this instance..." << std::endl;
#endif
if (m != NULL)
m->stop();
if (m != NULL)
m->stop();
}
/* doesn't quite work yet...
@ -86,90 +90,106 @@ void reload(int num)
}
catch (std::exception &e) {
m->setReadOnly(true);
std::cerr << "Reload failed. Check the config file. Reverting to read-only mode."
std::cerr << "Reload failed. Check the config file. Reverting to read-only mode."
<< std::endl;
}
m->unlock();
}
*/
int main(int argc, char **argv)
int main(int argc, char** argv)
{
// get and set locale language - BUG 5362
string systemLang = "C";
systemLang = funcexp::utf8::idb_setlocale();
string systemLang = "C";
systemLang = funcexp::utf8::idb_setlocale();
BRM::logInit ( BRM::SubSystemLogId_controllerNode );
BRM::logInit ( BRM::SubSystemLogId_controllerNode );
int retries = 0, err;
std::string arg;
int retries = 0, err;
std::string arg;
die = false;
die = false;
if (!(argc >= 2 && (arg = argv[1]) == "fg")) {
if ((err = fork()) < 0){
perror(argv[0]);
log_errno(string(argv[0]));
fail();
exit(1);
}
if (err > 0)
exit(0);
}
if (!(argc >= 2 && (arg = argv[1]) == "fg"))
{
if ((err = fork()) < 0)
{
perror(argv[0]);
log_errno(string(argv[0]));
fail();
exit(1);
}
(void)config::Config::makeConfig();
if (err > 0)
exit(0);
}
/* XXXPAT: we might want to install signal handlers for every signal */
(void)config::Config::makeConfig();
signal(SIGINT, stop);
signal(SIGTERM, stop);
/* XXXPAT: we might want to install signal handlers for every signal */
signal(SIGINT, stop);
signal(SIGTERM, stop);
#ifndef _MSC_VER
signal(SIGHUP, SIG_IGN);
signal(SIGUSR1, restart);
signal(SIGPIPE, SIG_IGN);
signal(SIGHUP, SIG_IGN);
signal(SIGUSR1, restart);
signal(SIGPIPE, SIG_IGN);
#endif
idbdatafile::IDBPolicy::configIDBPolicy();
idbdatafile::IDBPolicy::configIDBPolicy();
m = NULL;
while (retries < MAX_RETRIES && !die) {
try {
if (m != NULL)
delete m;
m = new BRM::MasterDBRMNode();
try {
oam::Oam oam;
m = NULL;
oam.processInitComplete("DBRMControllerNode");
}
catch (exception &e) {
ostringstream os;
while (retries < MAX_RETRIES && !die)
{
try
{
if (m != NULL)
delete m;
os << "failed to notify OAM: " << e.what();
os << " continuing anyway";
cerr << os.str() << endl;
log(os.str(), logging::LOG_TYPE_WARNING);
}
m->run();
retries = 0;
delete m;
m = NULL;
}
catch (std::exception &e) {
ostringstream os;
os << e.what();
os << "... attempt #" << retries+1 << "/" << MAX_RETRIES << " to restart the DBRM controller node";
cerr << os.str() << endl;
log(os.str());
sleep(5);
}
retries++;
}
if (retries == MAX_RETRIES) {
log(string("Exiting after too many errors"));
fail();
}
std::cerr << "Exiting..." << std::endl;
exit(0);
m = new BRM::MasterDBRMNode();
try
{
oam::Oam oam;
oam.processInitComplete("DBRMControllerNode");
}
catch (exception& e)
{
ostringstream os;
os << "failed to notify OAM: " << e.what();
os << " continuing anyway";
cerr << os.str() << endl;
log(os.str(), logging::LOG_TYPE_WARNING);
}
m->run();
retries = 0;
delete m;
m = NULL;
}
catch (std::exception& e)
{
ostringstream os;
os << e.what();
os << "... attempt #" << retries + 1 << "/" << MAX_RETRIES << " to restart the DBRM controller node";
cerr << os.str() << endl;
log(os.str());
sleep(5);
}
retries++;
}
if (retries == MAX_RETRIES)
{
log(string("Exiting after too many errors"));
fail();
}
std::cerr << "Exiting..." << std::endl;
exit(0);
}