You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-01 06:21:41 +03:00
Reformat all code to coding standard
This commit is contained in:
@ -40,7 +40,7 @@
|
||||
using namespace std;
|
||||
using namespace bulkloadxml;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const int DEBUG_LVL_TO_DUMP_SYSCAT_RPT = 4;
|
||||
#ifdef _MSC_VER
|
||||
@ -51,69 +51,76 @@ int main(int argc, char **argv)
|
||||
setlocale(LC_ALL, "");
|
||||
WriteEngine::Config::initConfigCache(); // load Columnstore.xml config settings
|
||||
|
||||
//Bug 6137
|
||||
std::string aBulkRoot = WriteEngine::Config::getBulkRoot();
|
||||
if (!aBulkRoot.empty())
|
||||
{
|
||||
if (!boost::filesystem::exists(aBulkRoot.c_str()))
|
||||
{
|
||||
cout << "Creating directory : " << aBulkRoot <<endl;
|
||||
boost::filesystem::create_directories(aBulkRoot.c_str());
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(aBulkRoot.c_str()))
|
||||
{
|
||||
std::ostringstream aSS;
|
||||
aSS << aBulkRoot;
|
||||
aSS << "/job";
|
||||
std::string jobDir = aSS.str();
|
||||
if (!boost::filesystem::exists(jobDir.c_str()))
|
||||
{
|
||||
cout << "Creating directory : " << jobDir << endl;
|
||||
bool aSuccess = boost::filesystem::create_directories(jobDir.c_str());
|
||||
if (!aSuccess)
|
||||
{
|
||||
cout << "\nFailed to create job directory, please check permissions\n" << endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
//Bug 6137
|
||||
std::string aBulkRoot = WriteEngine::Config::getBulkRoot();
|
||||
|
||||
std::ostringstream aSS2;
|
||||
aSS2 << aBulkRoot;
|
||||
aSS2 << "/log";
|
||||
std::string logDir = aSS2.str();
|
||||
if (!boost::filesystem::exists(logDir.c_str()))
|
||||
{
|
||||
cout << "Creating directory : " << logDir << endl;
|
||||
bool aSuccess = boost::filesystem::create_directories(logDir.c_str());
|
||||
if (!aSuccess)
|
||||
{
|
||||
cout << "\nFailed to create directory, please check permissions\n" << endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "\nFailed to create bulk directory, check for permissions\n" << endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "\nBulkRoot is empty in config file. Failed to create job file.\n\n";
|
||||
return -1;
|
||||
}
|
||||
if (!aBulkRoot.empty())
|
||||
{
|
||||
if (!boost::filesystem::exists(aBulkRoot.c_str()))
|
||||
{
|
||||
cout << "Creating directory : " << aBulkRoot << endl;
|
||||
boost::filesystem::create_directories(aBulkRoot.c_str());
|
||||
}
|
||||
|
||||
if (boost::filesystem::exists(aBulkRoot.c_str()))
|
||||
{
|
||||
std::ostringstream aSS;
|
||||
aSS << aBulkRoot;
|
||||
aSS << "/job";
|
||||
std::string jobDir = aSS.str();
|
||||
|
||||
if (!boost::filesystem::exists(jobDir.c_str()))
|
||||
{
|
||||
cout << "Creating directory : " << jobDir << endl;
|
||||
bool aSuccess = boost::filesystem::create_directories(jobDir.c_str());
|
||||
|
||||
if (!aSuccess)
|
||||
{
|
||||
cout << "\nFailed to create job directory, please check permissions\n" << endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
std::ostringstream aSS2;
|
||||
aSS2 << aBulkRoot;
|
||||
aSS2 << "/log";
|
||||
std::string logDir = aSS2.str();
|
||||
|
||||
if (!boost::filesystem::exists(logDir.c_str()))
|
||||
{
|
||||
cout << "Creating directory : " << logDir << endl;
|
||||
bool aSuccess = boost::filesystem::create_directories(logDir.c_str());
|
||||
|
||||
if (!aSuccess)
|
||||
{
|
||||
cout << "\nFailed to create directory, please check permissions\n" << endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "\nFailed to create bulk directory, check for permissions\n" << endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "\nBulkRoot is empty in config file. Failed to create job file.\n\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
InputMgr mgr("299"); //@bug 391
|
||||
|
||||
if (! mgr.input(argc, argv))
|
||||
return 1;
|
||||
|
||||
int debugLevel = atoi(mgr.getParm(
|
||||
WriteEngine::XMLGenData::RPT_DEBUG).c_str());
|
||||
WriteEngine::XMLGenData::RPT_DEBUG).c_str());
|
||||
|
||||
bool bUseLogFile = true;
|
||||
bool bSysCatRpt = false;
|
||||
|
||||
if (debugLevel == DEBUG_LVL_TO_DUMP_SYSCAT_RPT)
|
||||
{
|
||||
cout << "\nRunning colxml to dump system catalog report:\n\n";
|
||||
@ -126,33 +133,39 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
WriteEngine::XMLGenProc curJob(&mgr, bUseLogFile, bSysCatRpt);
|
||||
if( debugLevel > 0 && debugLevel <= 3 ) {
|
||||
|
||||
if ( debugLevel > 0 && debugLevel <= 3 )
|
||||
{
|
||||
curJob.setDebugLevel( debugLevel );
|
||||
cout << "\nDebug level is set to " << debugLevel << endl;
|
||||
}
|
||||
|
||||
BRM::DBRM dbrm;
|
||||
|
||||
if (dbrm.getSystemReady() < 1)
|
||||
{
|
||||
std::string errMsg(
|
||||
"System is not ready. Verify that InfiniDB is up and ready "
|
||||
"before running colxml.");
|
||||
|
||||
if (bUseLogFile)
|
||||
curJob.logErrorMessage(errMsg);
|
||||
else
|
||||
cout << errMsg << endl;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool rc = false;
|
||||
|
||||
const WriteEngine::XMLGenData::TableList& tables = mgr.getTables();
|
||||
|
||||
try
|
||||
{
|
||||
if (tables.empty())
|
||||
mgr.loadCatalogTables();
|
||||
|
||||
if (tables.empty())
|
||||
if (tables.empty())
|
||||
{
|
||||
string msg = "Either schema name is invalid or no table "
|
||||
"is in the schema.";
|
||||
@ -163,10 +176,11 @@ int main(int argc, char **argv)
|
||||
curJob.startXMLFile( );
|
||||
|
||||
for (InputMgr::TableList::const_iterator tbl = tables.begin();
|
||||
tbl != tables.end() ; ++tbl)
|
||||
tbl != tables.end() ; ++tbl)
|
||||
{
|
||||
curJob.makeTableData( *tbl );
|
||||
rc = curJob.makeColumnData(*tbl);
|
||||
|
||||
if (!rc)
|
||||
cout << "No columns for " << tbl->table << endl;
|
||||
}
|
||||
@ -175,10 +189,10 @@ int main(int argc, char **argv)
|
||||
catch (runtime_error& ex)
|
||||
{
|
||||
curJob.logErrorMessage(string( "colxml runtime exception: ") +
|
||||
ex.what() );
|
||||
ex.what() );
|
||||
cout << curJob.errorString() << endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
catch (exception& ex)
|
||||
{
|
||||
curJob.logErrorMessage(string( "colxml exception: ") + ex.what() );
|
||||
@ -190,9 +204,9 @@ int main(int argc, char **argv)
|
||||
curJob.logErrorMessage(string("colxml unknown exception "));
|
||||
cout << curJob.errorString() << endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc)
|
||||
if (rc)
|
||||
{
|
||||
if (debugLevel == DEBUG_LVL_TO_DUMP_SYSCAT_RPT)
|
||||
{
|
||||
@ -207,9 +221,10 @@ int main(int argc, char **argv)
|
||||
curJob.writeXMLFile( xmlFileName );
|
||||
cout << "File completed for tables:\n\t";
|
||||
}
|
||||
|
||||
copy(tables.begin(), tables.end(),
|
||||
ostream_iterator<execplan::CalpontSystemCatalog::TableName>
|
||||
(cout, "\n\t"));
|
||||
ostream_iterator<execplan::CalpontSystemCatalog::TableName>
|
||||
(cout, "\n\t"));
|
||||
cout << "\nNormal exit.\n";
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user