1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-02 17:22:27 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-01-21 16:43:49 +00:00
parent 6b6411229f
commit 04752ec546
1376 changed files with 393460 additions and 412662 deletions

View File

@ -20,7 +20,6 @@
*
******************************************************************************/
#include <clocale>
#include <libxml/xmlwriter.h>
@ -43,177 +42,174 @@ using namespace bulkloadxml;
int main(int argc, char** argv)
{
const int DEBUG_LVL_TO_DUMP_SYSCAT_RPT = 4;
// set effective ID to root
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "C");
WriteEngine::Config::initConfigCache(); // load Columnstore.xml config settings
const int DEBUG_LVL_TO_DUMP_SYSCAT_RPT = 4;
// set effective ID to root
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "C");
WriteEngine::Config::initConfigCache(); // load Columnstore.xml config settings
//Bug 6137
std::string aBulkRoot = WriteEngine::Config::getBulkRoot();
// Bug 6137
std::string aBulkRoot = WriteEngine::Config::getBulkRoot();
if (!aBulkRoot.empty())
if (!aBulkRoot.empty())
{
if (!boost::filesystem::exists(aBulkRoot.c_str()))
{
if (!boost::filesystem::exists(aBulkRoot.c_str()))
{
cout << "Creating directory : " << aBulkRoot << endl;
boost::filesystem::create_directories(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(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 (!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;
}
}
}
else
if (!aSuccess)
{
cout << "\nFailed to create bulk directory, check for permissions\n" << endl;
return -1;
cout << "\nFailed to create job directory, please check permissions\n" << endl;
return -1;
}
}
}
else
{
cout << "\nBulkRoot is empty in config file. Failed to create job file.\n\n";
return -1;
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
InputMgr mgr("299"); //@bug 391
if (! mgr.input(argc, argv))
return 1;
if (!mgr.input(argc, argv))
return 1;
int debugLevel = atoi(mgr.getParm(
WriteEngine::XMLGenData::RPT_DEBUG).c_str());
int debugLevel = atoi(mgr.getParm(WriteEngine::XMLGenData::RPT_DEBUG).c_str());
bool bUseLogFile = true;
bool bSysCatRpt = false;
bool bUseLogFile = true;
bool bSysCatRpt = false;
if (debugLevel == DEBUG_LVL_TO_DUMP_SYSCAT_RPT)
{
cout << "\nRunning colxml to dump system catalog report:\n\n";
bUseLogFile = false;
bSysCatRpt = true;
}
else
{
cout << "\nRunning colxml with the following parameters:\n";
}
WriteEngine::XMLGenProc curJob(&mgr, bUseLogFile, bSysCatRpt);
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 ColumnStore 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())
{
string msg =
"Either schema name is invalid or no table "
"is in the schema.";
curJob.logErrorMessage(msg);
}
else
{
curJob.startXMLFile();
for (InputMgr::TableList::const_iterator tbl = tables.begin(); tbl != tables.end(); ++tbl)
{
curJob.makeTableData(*tbl);
rc = curJob.makeColumnData(*tbl);
if (!rc)
cout << "No columns for " << tbl->table << endl;
}
}
}
catch (runtime_error& ex)
{
curJob.logErrorMessage(string("colxml runtime exception: ") + ex.what());
cout << curJob.errorString() << endl;
return 1;
}
catch (exception& ex)
{
curJob.logErrorMessage(string("colxml exception: ") + ex.what());
cout << curJob.errorString() << endl;
return 1;
}
catch (...)
{
curJob.logErrorMessage(string("colxml unknown exception "));
cout << curJob.errorString() << endl;
return 1;
}
if (rc)
{
if (debugLevel == DEBUG_LVL_TO_DUMP_SYSCAT_RPT)
{
cout << "\nRunning colxml to dump system catalog report:\n\n";
bUseLogFile = false;
bSysCatRpt = true;
std::string xmlFileName("-");
curJob.writeXMLFile(xmlFileName);
cout << "\nDump completed for tables:\n\t";
}
else
{
cout << "\nRunning colxml with the following parameters:\n";
std::string xmlFileName = curJob.genJobXMLFileName();
cout << "Creating job description file: " << xmlFileName << endl;
curJob.writeXMLFile(xmlFileName);
cout << "File completed for tables:\n\t";
}
WriteEngine::XMLGenProc curJob(&mgr, bUseLogFile, bSysCatRpt);
copy(tables.begin(), tables.end(),
ostream_iterator<execplan::CalpontSystemCatalog::TableName>(cout, "\n\t"));
cout << "\nNormal exit.\n";
}
else
{
cout << "File not made.\n";
cout << curJob.errorString();
return 1;
}
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 ColumnStore 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())
{
string msg = "Either schema name is invalid or no table "
"is in the schema.";
curJob.logErrorMessage(msg);
}
else
{
curJob.startXMLFile( );
for (InputMgr::TableList::const_iterator tbl = tables.begin();
tbl != tables.end() ; ++tbl)
{
curJob.makeTableData( *tbl );
rc = curJob.makeColumnData(*tbl);
if (!rc)
cout << "No columns for " << tbl->table << endl;
}
}
}
catch (runtime_error& ex)
{
curJob.logErrorMessage(string( "colxml runtime exception: ") +
ex.what() );
cout << curJob.errorString() << endl;
return 1;
}
catch (exception& ex)
{
curJob.logErrorMessage(string( "colxml exception: ") + ex.what() );
cout << curJob.errorString() << endl;
return 1;
}
catch (...)
{
curJob.logErrorMessage(string("colxml unknown exception "));
cout << curJob.errorString() << endl;
return 1;
}
if (rc)
{
if (debugLevel == DEBUG_LVL_TO_DUMP_SYSCAT_RPT)
{
std::string xmlFileName("-");
curJob.writeXMLFile( xmlFileName );
cout << "\nDump completed for tables:\n\t";
}
else
{
std::string xmlFileName = curJob.genJobXMLFileName( );
cout << "Creating job description file: " << xmlFileName << endl;
curJob.writeXMLFile( xmlFileName );
cout << "File completed for tables:\n\t";
}
copy(tables.begin(), tables.end(),
ostream_iterator<execplan::CalpontSystemCatalog::TableName>
(cout, "\n\t"));
cout << "\nNormal exit.\n";
}
else
{
cout << "File not made.\n";
cout << curJob.errorString();
return 1;
}
return 0;
return 0;
}