You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
Fully resolve potentially ambiguous symbols by removing using namespace statements from headers which have a cascading effect. This causes potential behavior changes when switching to c++11 since symbols can be exported from std and boost while both have been imported into the global namespace.
This commit is contained in:
178
exemgr/main.cpp
178
exemgr/main.cpp
@ -121,25 +121,25 @@ joblist::DistributedEngineComm* ec;
|
|||||||
|
|
||||||
auto rm = joblist::ResourceManager::instance(true);
|
auto rm = joblist::ResourceManager::instance(true);
|
||||||
|
|
||||||
int toInt(const std::string& val)
|
int toInt(const string& val)
|
||||||
{
|
{
|
||||||
if (val.length() == 0) return -1;
|
if (val.length() == 0) return -1;
|
||||||
|
|
||||||
return static_cast<int>(config::Config::fromText(val));
|
return static_cast<int>(config::Config::fromText(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string ExeMgr("ExeMgr1");
|
const string ExeMgr("ExeMgr1");
|
||||||
|
|
||||||
const std::string prettyPrintMiniInfo(const std::string& in)
|
const string prettyPrintMiniInfo(const string& in)
|
||||||
{
|
{
|
||||||
//1. take the std::string and tok it by '\n'
|
//1. take the string and tok it by '\n'
|
||||||
//2. for each part in each line calc the longest part
|
//2. for each part in each line calc the longest part
|
||||||
//3. padding to each longest value, output a header and the lines
|
//3. padding to each longest value, output a header and the lines
|
||||||
typedef boost::tokenizer<boost::char_separator<char> > my_tokenizer;
|
typedef boost::tokenizer<boost::char_separator<char> > my_tokenizer;
|
||||||
boost::char_separator<char> sep1("\n");
|
boost::char_separator<char> sep1("\n");
|
||||||
my_tokenizer tok1(in, sep1);
|
my_tokenizer tok1(in, sep1);
|
||||||
std::vector<std::string> lines;
|
vector<string> lines;
|
||||||
std::string header = "Desc Mode Table TableOID ReferencedColumns PIO LIO PBE Elapsed Rows";
|
string header = "Desc Mode Table TableOID ReferencedColumns PIO LIO PBE Elapsed Rows";
|
||||||
const int header_parts = 10;
|
const int header_parts = 10;
|
||||||
lines.push_back(header);
|
lines.push_back(header);
|
||||||
|
|
||||||
@ -149,13 +149,13 @@ const std::string prettyPrintMiniInfo(const std::string& in)
|
|||||||
lines.push_back(*iter1);
|
lines.push_back(*iter1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<unsigned> lens;
|
vector<unsigned> lens;
|
||||||
|
|
||||||
for (int i = 0; i < header_parts; i++)
|
for (int i = 0; i < header_parts; i++)
|
||||||
lens.push_back(0);
|
lens.push_back(0);
|
||||||
|
|
||||||
std::vector<std::vector<std::string> > lineparts;
|
vector<vector<string> > lineparts;
|
||||||
std::vector<std::string>::iterator iter2;
|
vector<string>::iterator iter2;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (iter2 = lines.begin(), j = 0; iter2 != lines.end(); ++iter2, j++)
|
for (iter2 = lines.begin(), j = 0; iter2 != lines.end(); ++iter2, j++)
|
||||||
@ -163,14 +163,14 @@ const std::string prettyPrintMiniInfo(const std::string& in)
|
|||||||
boost::char_separator<char> sep2(" ");
|
boost::char_separator<char> sep2(" ");
|
||||||
my_tokenizer tok2(*iter2, sep2);
|
my_tokenizer tok2(*iter2, sep2);
|
||||||
int i;
|
int i;
|
||||||
std::vector<std::string> parts;
|
vector<string> parts;
|
||||||
my_tokenizer::iterator iter3;
|
my_tokenizer::iterator iter3;
|
||||||
|
|
||||||
for (iter3 = tok2.begin(), i = 0; iter3 != tok2.end(); ++iter3, i++)
|
for (iter3 = tok2.begin(), i = 0; iter3 != tok2.end(); ++iter3, i++)
|
||||||
{
|
{
|
||||||
if (i >= header_parts) break;
|
if (i >= header_parts) break;
|
||||||
|
|
||||||
std::string part(*iter3);
|
string part(*iter3);
|
||||||
|
|
||||||
if (j != 0 && i == 8)
|
if (j != 0 && i == 8)
|
||||||
part.resize(part.size() - 3);
|
part.resize(part.size() - 3);
|
||||||
@ -189,22 +189,22 @@ const std::string prettyPrintMiniInfo(const std::string& in)
|
|||||||
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
|
|
||||||
std::vector<std::vector<std::string> >::iterator iter1 = lineparts.begin();
|
vector<vector<string> >::iterator iter1 = lineparts.begin();
|
||||||
std::vector<std::vector<std::string> >::iterator end1 = lineparts.end();
|
vector<vector<string> >::iterator end1 = lineparts.end();
|
||||||
|
|
||||||
oss << "\n";
|
oss << "\n";
|
||||||
|
|
||||||
while (iter1 != end1)
|
while (iter1 != end1)
|
||||||
{
|
{
|
||||||
std::vector<std::string>::iterator iter2 = iter1->begin();
|
vector<string>::iterator iter2 = iter1->begin();
|
||||||
std::vector<std::string>::iterator end2 = iter1->end();
|
vector<string>::iterator end2 = iter1->end();
|
||||||
assert(distance(iter2, end2) == header_parts);
|
assert(distance(iter2, end2) == header_parts);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (iter2 != end2)
|
while (iter2 != end2)
|
||||||
{
|
{
|
||||||
assert(i < header_parts);
|
assert(i < header_parts);
|
||||||
oss << std::setw(lens[i]) << std::left << *iter2 << " ";
|
oss << setw(lens[i]) << left << *iter2 << " ";
|
||||||
++iter2;
|
++iter2;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ const std::string prettyPrintMiniInfo(const std::string& in)
|
|||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string timeNow()
|
const string timeNow()
|
||||||
{
|
{
|
||||||
time_t outputTime = time(0);
|
time_t outputTime = time(0);
|
||||||
struct tm ltm;
|
struct tm ltm;
|
||||||
@ -266,7 +266,7 @@ private:
|
|||||||
oam::OamCache* fOamCachePtr; //this ptr is copyable...
|
oam::OamCache* fOamCachePtr; //this ptr is copyable...
|
||||||
|
|
||||||
//...Reinitialize stats for start of a new query
|
//...Reinitialize stats for start of a new query
|
||||||
void initStats ( uint32_t sessionId, std::string& sqlText )
|
void initStats ( uint32_t sessionId, string& sqlText )
|
||||||
{
|
{
|
||||||
initMaxMemPct ( sessionId );
|
initMaxMemPct ( sessionId );
|
||||||
|
|
||||||
@ -316,10 +316,10 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//...Get and log query stats to specified output stream
|
//...Get and log query stats to specified output stream
|
||||||
const std::string formatQueryStats (
|
const string formatQueryStats (
|
||||||
joblist::SJLP& jl, // joblist associated with query
|
joblist::SJLP& jl, // joblist associated with query
|
||||||
const std::string& label, // header label to print in front of log output
|
const string& label, // header label to print in front of log output
|
||||||
bool includeNewLine,//include line breaks in query stats std::string
|
bool includeNewLine,//include line breaks in query stats string
|
||||||
bool vtableModeOn,
|
bool vtableModeOn,
|
||||||
bool wantExtendedStats,
|
bool wantExtendedStats,
|
||||||
uint64_t rowsReturned)
|
uint64_t rowsReturned)
|
||||||
@ -348,7 +348,7 @@ private:
|
|||||||
fStatsRetrieved = true;
|
fStatsRetrieved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string queryMode;
|
string queryMode;
|
||||||
queryMode = (vtableModeOn ? "Distributed" : "Standard");
|
queryMode = (vtableModeOn ? "Distributed" : "Standard");
|
||||||
|
|
||||||
// Log stats to specified output stream
|
// Log stats to specified output stream
|
||||||
@ -361,7 +361,7 @@ private:
|
|||||||
"; BlocksTouched-" << fStats.fMsgRcvCnt;
|
"; BlocksTouched-" << fStats.fMsgRcvCnt;
|
||||||
|
|
||||||
if ( includeNewLine )
|
if ( includeNewLine )
|
||||||
os << std::endl << " "; // insert line break
|
os << endl << " "; // insert line break
|
||||||
else
|
else
|
||||||
os << "; "; // continue without line break
|
os << "; "; // continue without line break
|
||||||
|
|
||||||
@ -417,7 +417,7 @@ private:
|
|||||||
{
|
{
|
||||||
if ( sessionId < 0x80000000 )
|
if ( sessionId < 0x80000000 )
|
||||||
{
|
{
|
||||||
// std::cout << "Setting pct to 0 for session " << sessionId << std::endl;
|
// cout << "Setting pct to 0 for session " << sessionId << endl;
|
||||||
std::lock_guard<std::mutex> lk(sessionMemMapMutex);
|
std::lock_guard<std::mutex> lk(sessionMemMapMutex);
|
||||||
SessionMemMap_t::iterator mapIter = sessionMemMap.find( sessionId );
|
SessionMemMap_t::iterator mapIter = sessionMemMap.find( sessionId );
|
||||||
|
|
||||||
@ -433,7 +433,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//... Round off to human readable format (KB, MB, or GB).
|
//... Round off to human readable format (KB, MB, or GB).
|
||||||
const std::string roundBytes(uint64_t value) const
|
const string roundBytes(uint64_t value) const
|
||||||
{
|
{
|
||||||
const char* units[] = {"B", "KB", "MB", "GB", "TB"};
|
const char* units[] = {"B", "KB", "MB", "GB", "TB"};
|
||||||
uint64_t i = 0, up = 0;
|
uint64_t i = 0, up = 0;
|
||||||
@ -494,7 +494,7 @@ private:
|
|||||||
{
|
{
|
||||||
const execplan::CalpontSelectExecutionPlan::ColumnMap& colMap = csep.columnMap();
|
const execplan::CalpontSelectExecutionPlan::ColumnMap& colMap = csep.columnMap();
|
||||||
execplan::CalpontSelectExecutionPlan::ColumnMap::const_iterator it;
|
execplan::CalpontSelectExecutionPlan::ColumnMap::const_iterator it;
|
||||||
std::string schemaName;
|
string schemaName;
|
||||||
|
|
||||||
for (it = colMap.begin(); it != colMap.end(); ++it)
|
for (it = colMap.begin(); it != colMap.end(); ++it)
|
||||||
{
|
{
|
||||||
@ -550,7 +550,7 @@ public:
|
|||||||
if (bs.length() == 0)
|
if (bs.length() == 0)
|
||||||
{
|
{
|
||||||
if (gDebug > 1 || (gDebug && !csep.isInternal()))
|
if (gDebug > 1 || (gDebug && !csep.isInternal()))
|
||||||
std::cout << "### Got a close(1) for session id " << csep.sessionID() << std::endl;
|
cout << "### Got a close(1) for session id " << csep.sessionID() << endl;
|
||||||
|
|
||||||
// connection closed by client
|
// connection closed by client
|
||||||
fIos.close();
|
fIos.close();
|
||||||
@ -559,8 +559,8 @@ public:
|
|||||||
else if (bs.length() < 4) //Not a CalpontSelectExecutionPlan
|
else if (bs.length() < 4) //Not a CalpontSelectExecutionPlan
|
||||||
{
|
{
|
||||||
if (gDebug)
|
if (gDebug)
|
||||||
std::cout << "### Got a not-a-plan for session id " << csep.sessionID()
|
cout << "### Got a not-a-plan for session id " << csep.sessionID()
|
||||||
<< " with length " << bs.length() << std::endl;
|
<< " with length " << bs.length() << endl;
|
||||||
|
|
||||||
fIos.close();
|
fIos.close();
|
||||||
break;
|
break;
|
||||||
@ -573,7 +573,7 @@ public:
|
|||||||
if (qb == 4) //UM wants new tuple i/f
|
if (qb == 4) //UM wants new tuple i/f
|
||||||
{
|
{
|
||||||
if (gDebug)
|
if (gDebug)
|
||||||
std::cout << "### UM wants tuples" << std::endl;
|
cout << "### UM wants tuples" << endl;
|
||||||
|
|
||||||
tryTuples = true;
|
tryTuples = true;
|
||||||
// now wait for the CSEP...
|
// now wait for the CSEP...
|
||||||
@ -593,7 +593,7 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gDebug)
|
if (gDebug)
|
||||||
std::cout << "### Got a not-a-plan value " << qb << std::endl;
|
cout << "### Got a not-a-plan value " << qb << endl;
|
||||||
|
|
||||||
fIos.close();
|
fIos.close();
|
||||||
break;
|
break;
|
||||||
@ -622,7 +622,7 @@ new_plan:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gDebug > 1 || (gDebug && !csep.isInternal()))
|
if (gDebug > 1 || (gDebug && !csep.isInternal()))
|
||||||
std::cout << "### For session id " << csep.sessionID() << ", got a CSEP" << std::endl;
|
cout << "### For session id " << csep.sessionID() << ", got a CSEP" << endl;
|
||||||
|
|
||||||
setRMParms(csep.rmParms());
|
setRMParms(csep.rmParms());
|
||||||
|
|
||||||
@ -646,7 +646,7 @@ new_plan:
|
|||||||
|
|
||||||
bool needDbProfEndStatementMsg = false;
|
bool needDbProfEndStatementMsg = false;
|
||||||
logging::Message::Args args;
|
logging::Message::Args args;
|
||||||
std::string sqlText = csep.data();
|
string sqlText = csep.data();
|
||||||
logging::LoggingID li(16, csep.sessionID(), csep.txnID());
|
logging::LoggingID li(16, csep.sessionID(), csep.txnID());
|
||||||
|
|
||||||
// Initialize stats for this query, including
|
// Initialize stats for this query, including
|
||||||
@ -686,7 +686,7 @@ new_plan:
|
|||||||
{
|
{
|
||||||
try // @bug2244: try/catch around fIos.write() calls responding to makeTupleList
|
try // @bug2244: try/catch around fIos.write() calls responding to makeTupleList
|
||||||
{
|
{
|
||||||
std::string emsg("NOERROR");
|
string emsg("NOERROR");
|
||||||
messageqcpp::ByteStream emsgBs;
|
messageqcpp::ByteStream emsgBs;
|
||||||
messageqcpp::ByteStream::quadbyte tflg = 0;
|
messageqcpp::ByteStream::quadbyte tflg = 0;
|
||||||
jl = joblist::JobListFactory::makeJobList(&csep, fRm, true, true);
|
jl = joblist::JobListFactory::makeJobList(&csep, fRm, true, true);
|
||||||
@ -721,7 +721,7 @@ new_plan:
|
|||||||
emsgBs.reset();
|
emsgBs.reset();
|
||||||
emsgBs << emsg;
|
emsgBs << emsg;
|
||||||
fIos.write(emsgBs);
|
fIos.write(emsgBs);
|
||||||
std::cerr << "ExeMgr: could not build a tuple joblist: " << emsg << std::endl;
|
cerr << "ExeMgr: could not build a tuple joblist: " << emsg << endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -730,25 +730,25 @@ new_plan:
|
|||||||
std::ostringstream errMsg;
|
std::ostringstream errMsg;
|
||||||
errMsg << "ExeMgr: error writing makeJoblist "
|
errMsg << "ExeMgr: error writing makeJoblist "
|
||||||
"response; " << ex.what();
|
"response; " << ex.what();
|
||||||
throw std::runtime_error( errMsg.str() );
|
throw runtime_error( errMsg.str() );
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
std::ostringstream errMsg;
|
std::ostringstream errMsg;
|
||||||
errMsg << "ExeMgr: unknown error writing makeJoblist "
|
errMsg << "ExeMgr: unknown error writing makeJoblist "
|
||||||
"response; ";
|
"response; ";
|
||||||
throw std::runtime_error( errMsg.str() );
|
throw runtime_error( errMsg.str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!usingTuples)
|
if (!usingTuples)
|
||||||
{
|
{
|
||||||
if (gDebug)
|
if (gDebug)
|
||||||
std::cout << "### UM wanted tuples but it didn't work out :-(" << std::endl;
|
cout << "### UM wanted tuples but it didn't work out :-(" << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gDebug)
|
if (gDebug)
|
||||||
std::cout << "### UM wanted tuples and we'll do our best;-)" << std::endl;
|
cout << "### UM wanted tuples and we'll do our best;-)" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -758,14 +758,14 @@ new_plan:
|
|||||||
|
|
||||||
if (jl->status() == 0)
|
if (jl->status() == 0)
|
||||||
{
|
{
|
||||||
std::string emsg;
|
string emsg;
|
||||||
|
|
||||||
if (jl->putEngineComm(fEc) != 0)
|
if (jl->putEngineComm(fEc) != 0)
|
||||||
throw std::runtime_error(jl->errMsg());
|
throw runtime_error(jl->errMsg());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw std::runtime_error("ExeMgr: could not build a JobList!");
|
throw runtime_error("ExeMgr: could not build a JobList!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -786,14 +786,14 @@ new_plan:
|
|||||||
if (bs.length() == 0)
|
if (bs.length() == 0)
|
||||||
{
|
{
|
||||||
if (gDebug > 1 || (gDebug && !csep.isInternal()))
|
if (gDebug > 1 || (gDebug && !csep.isInternal()))
|
||||||
std::cout << "### Got a close(2) for session id " << csep.sessionID() << std::endl;
|
cout << "### Got a close(2) for session id " << csep.sessionID() << endl;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDebug && bs.length() > 4)
|
if (gDebug && bs.length() > 4)
|
||||||
std::cout << "### For session id " << csep.sessionID() << ", got too many bytes = " <<
|
cout << "### For session id " << csep.sessionID() << ", got too many bytes = " <<
|
||||||
bs.length() << std::endl;
|
bs.length() << endl;
|
||||||
|
|
||||||
//TODO: Holy crud! Can this be right?
|
//TODO: Holy crud! Can this be right?
|
||||||
//@bug 1444 Yes, if there is a self-join
|
//@bug 1444 Yes, if there is a self-join
|
||||||
@ -813,7 +813,7 @@ new_plan:
|
|||||||
bs >> qb;
|
bs >> qb;
|
||||||
|
|
||||||
if (gDebug > 1 || (gDebug && !csep.isInternal()))
|
if (gDebug > 1 || (gDebug && !csep.isInternal()))
|
||||||
std::cout << "### For session id " << csep.sessionID() << ", got a command = " << qb << std::endl;
|
cout << "### For session id " << csep.sessionID() << ", got a command = " << qb << endl;
|
||||||
|
|
||||||
if (qb == 0)
|
if (qb == 0)
|
||||||
{
|
{
|
||||||
@ -837,7 +837,7 @@ new_plan:
|
|||||||
if (iter == tm.end())
|
if (iter == tm.end())
|
||||||
{
|
{
|
||||||
if (gDebug > 1 || (gDebug && !csep.isInternal()))
|
if (gDebug > 1 || (gDebug && !csep.isInternal()))
|
||||||
std::cout << "### For session id " << csep.sessionID() << ", returning end flag" << std::endl;
|
cout << "### For session id " << csep.sessionID() << ", returning end flag" << endl;
|
||||||
|
|
||||||
bs.restart();
|
bs.restart();
|
||||||
bs << (messageqcpp::ByteStream::byte)1;
|
bs << (messageqcpp::ByteStream::byte)1;
|
||||||
@ -847,11 +847,11 @@ new_plan:
|
|||||||
|
|
||||||
tableOID = iter->first;
|
tableOID = iter->first;
|
||||||
}
|
}
|
||||||
else if (qb == 3) //special option-UM wants job stats std::string
|
else if (qb == 3) //special option-UM wants job stats string
|
||||||
{
|
{
|
||||||
std::string statsString;
|
string statsString;
|
||||||
|
|
||||||
//Log stats std::string to be sent back to front end
|
//Log stats string to be sent back to front end
|
||||||
statsString = formatQueryStats(
|
statsString = formatQueryStats(
|
||||||
jl,
|
jl,
|
||||||
"Query Stats",
|
"Query Stats",
|
||||||
@ -871,7 +871,7 @@ new_plan:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string empty;
|
string empty;
|
||||||
bs << empty;
|
bs << empty;
|
||||||
bs << empty;
|
bs << empty;
|
||||||
}
|
}
|
||||||
@ -900,14 +900,14 @@ new_plan:
|
|||||||
errMsg << "ExeMgr: error writing qb response "
|
errMsg << "ExeMgr: error writing qb response "
|
||||||
"for qb cmd " << qb <<
|
"for qb cmd " << qb <<
|
||||||
"; " << ex.what();
|
"; " << ex.what();
|
||||||
throw std::runtime_error( errMsg.str() );
|
throw runtime_error( errMsg.str() );
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
std::ostringstream errMsg;
|
std::ostringstream errMsg;
|
||||||
errMsg << "ExeMgr: unknown error writing qb response "
|
errMsg << "ExeMgr: unknown error writing qb response "
|
||||||
"for qb cmd " << qb;
|
"for qb cmd " << qb;
|
||||||
throw std::runtime_error( errMsg.str() );
|
throw runtime_error( errMsg.str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (swallowRows) tm.erase(tableOID);
|
if (swallowRows) tm.erase(tableOID);
|
||||||
@ -975,8 +975,8 @@ new_plan:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//std::cout << "connection drop\n";
|
//cout << "connection drop\n";
|
||||||
throw std::runtime_error( errMsg.str() );
|
throw runtime_error( errMsg.str() );
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
@ -991,7 +991,7 @@ new_plan:
|
|||||||
while (rowCount)
|
while (rowCount)
|
||||||
rowCount = jl->projectTable(tableOID, bs);
|
rowCount = jl->projectTable(tableOID, bs);
|
||||||
|
|
||||||
throw std::runtime_error( errMsg.str() );
|
throw runtime_error( errMsg.str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
totalRowCount += rowCount;
|
totalRowCount += rowCount;
|
||||||
@ -1022,11 +1022,11 @@ new_plan:
|
|||||||
|
|
||||||
if (needDbProfEndStatementMsg)
|
if (needDbProfEndStatementMsg)
|
||||||
{
|
{
|
||||||
std::string ss;
|
string ss;
|
||||||
std::ostringstream prefix;
|
std::ostringstream prefix;
|
||||||
prefix << "ses:" << csep.sessionID() << " Query Totals";
|
prefix << "ses:" << csep.sessionID() << " Query Totals";
|
||||||
|
|
||||||
//Log stats std::string to standard out
|
//Log stats string to standard out
|
||||||
ss = formatQueryStats(
|
ss = formatQueryStats(
|
||||||
jl,
|
jl,
|
||||||
prefix.str(),
|
prefix.str(),
|
||||||
@ -1035,7 +1035,7 @@ new_plan:
|
|||||||
(csep.traceFlags() & execplan::CalpontSelectExecutionPlan::TRACE_LOG),
|
(csep.traceFlags() & execplan::CalpontSelectExecutionPlan::TRACE_LOG),
|
||||||
totalRowCount);
|
totalRowCount);
|
||||||
//@Bug 1306. Added timing info for real time tracking.
|
//@Bug 1306. Added timing info for real time tracking.
|
||||||
std::cout << ss << " at " << timeNow() << std::endl;
|
cout << ss << " at " << timeNow() << endl;
|
||||||
|
|
||||||
// log query status to debug log file
|
// log query status to debug log file
|
||||||
args.reset();
|
args.reset();
|
||||||
@ -1072,13 +1072,13 @@ new_plan:
|
|||||||
// delete sessionMemMap entry for this session's memory % use
|
// delete sessionMemMap entry for this session's memory % use
|
||||||
deleteMaxMemPct( csep.sessionID() );
|
deleteMaxMemPct( csep.sessionID() );
|
||||||
|
|
||||||
std::string endtime(timeNow());
|
string endtime(timeNow());
|
||||||
|
|
||||||
if ((csep.traceFlags() & flagsWantOutput) && (csep.sessionID() < 0x80000000))
|
if ((csep.traceFlags() & flagsWantOutput) && (csep.sessionID() < 0x80000000))
|
||||||
{
|
{
|
||||||
std::cout << "For session " << csep.sessionID() << ": " <<
|
cout << "For session " << csep.sessionID() << ": " <<
|
||||||
totalBytesSent <<
|
totalBytesSent <<
|
||||||
" bytes sent back at " << endtime << std::endl;
|
" bytes sent back at " << endtime << endl;
|
||||||
|
|
||||||
// @bug 663 - Implemented caltraceon(16) to replace the
|
// @bug 663 - Implemented caltraceon(16) to replace the
|
||||||
// $FIFO_SINK compiler definition in pColStep.
|
// $FIFO_SINK compiler definition in pColStep.
|
||||||
@ -1086,19 +1086,19 @@ new_plan:
|
|||||||
if (csep.traceFlags() &
|
if (csep.traceFlags() &
|
||||||
execplan::CalpontSelectExecutionPlan::TRACE_NO_ROWS4)
|
execplan::CalpontSelectExecutionPlan::TRACE_NO_ROWS4)
|
||||||
{
|
{
|
||||||
std::cout << std::endl;
|
cout << endl;
|
||||||
std::cout << "**** No data returned to DM. Rows consumed "
|
cout << "**** No data returned to DM. Rows consumed "
|
||||||
"in ProjectSteps - caltrace(16) is on (FIFO_SINK)."
|
"in ProjectSteps - caltrace(16) is on (FIFO_SINK)."
|
||||||
" ****" << std::endl;
|
" ****" << endl;
|
||||||
std::cout << std::endl;
|
cout << endl;
|
||||||
}
|
}
|
||||||
else if (csep.traceFlags() &
|
else if (csep.traceFlags() &
|
||||||
execplan::CalpontSelectExecutionPlan::TRACE_NO_ROWS3)
|
execplan::CalpontSelectExecutionPlan::TRACE_NO_ROWS3)
|
||||||
{
|
{
|
||||||
std::cout << std::endl;
|
cout << endl;
|
||||||
std::cout << "**** No data returned to DM - caltrace(8) is "
|
cout << "**** No data returned to DM - caltrace(8) is "
|
||||||
"on (SWALLOW_ROWS_EXEMGR). ****" << std::endl;
|
"on (SWALLOW_ROWS_EXEMGR). ****" << endl;
|
||||||
std::cout << std::endl;
|
cout << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1139,7 +1139,7 @@ new_plan:
|
|||||||
{
|
{
|
||||||
decThreadCntPerSession( csep.sessionID() | 0x80000000 );
|
decThreadCntPerSession( csep.sessionID() | 0x80000000 );
|
||||||
statementsRunningCount->decr(stmtCounted);
|
statementsRunningCount->decr(stmtCounted);
|
||||||
std::cerr << "### ExeMgr ses:" << csep.sessionID() << " caught: " << ex.what() << std::endl;
|
cerr << "### ExeMgr ses:" << csep.sessionID() << " caught: " << ex.what() << endl;
|
||||||
logging::Message::Args args;
|
logging::Message::Args args;
|
||||||
logging::LoggingID li(16, csep.sessionID(), csep.txnID());
|
logging::LoggingID li(16, csep.sessionID(), csep.txnID());
|
||||||
args.add(ex.what());
|
args.add(ex.what());
|
||||||
@ -1150,7 +1150,7 @@ new_plan:
|
|||||||
{
|
{
|
||||||
decThreadCntPerSession( csep.sessionID() | 0x80000000 );
|
decThreadCntPerSession( csep.sessionID() | 0x80000000 );
|
||||||
statementsRunningCount->decr(stmtCounted);
|
statementsRunningCount->decr(stmtCounted);
|
||||||
std::cerr << "### Exception caught!" << std::endl;
|
cerr << "### Exception caught!" << endl;
|
||||||
logging::Message::Args args;
|
logging::Message::Args args;
|
||||||
logging::LoggingID li(16, csep.sessionID(), csep.txnID());
|
logging::LoggingID li(16, csep.sessionID(), csep.txnID());
|
||||||
args.add("ExeMgr caught unknown exception");
|
args.add("ExeMgr caught unknown exception");
|
||||||
@ -1179,7 +1179,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (fMaxPct >= 95)
|
if (fMaxPct >= 95)
|
||||||
{
|
{
|
||||||
std::cerr << "Too much memory allocated!" << std::endl;
|
cerr << "Too much memory allocated!" << endl;
|
||||||
logging::Message::Args args;
|
logging::Message::Args args;
|
||||||
args.add((int)pct);
|
args.add((int)pct);
|
||||||
args.add((int)fMaxPct);
|
args.add((int)fMaxPct);
|
||||||
@ -1189,7 +1189,7 @@ public:
|
|||||||
|
|
||||||
if (statementsRunningCount->cur() == 0)
|
if (statementsRunningCount->cur() == 0)
|
||||||
{
|
{
|
||||||
std::cerr << "Too much memory allocated!" << std::endl;
|
cerr << "Too much memory allocated!" << endl;
|
||||||
logging::Message::Args args;
|
logging::Message::Args args;
|
||||||
args.add((int)pct);
|
args.add((int)pct);
|
||||||
args.add((int)fMaxPct);
|
args.add((int)fMaxPct);
|
||||||
@ -1197,7 +1197,7 @@ public:
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "Too much memory allocated, but stmts running" << std::endl;
|
cerr << "Too much memory allocated, but stmts running" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update sessionMemMap entries lower than current mem % use
|
// Update sessionMemMap entries lower than current mem % use
|
||||||
@ -1235,7 +1235,7 @@ void added_a_pm(int)
|
|||||||
logging::Message msg(1);
|
logging::Message msg(1);
|
||||||
args1.add("exeMgr caught SIGHUP. Resetting connections");
|
args1.add("exeMgr caught SIGHUP. Resetting connections");
|
||||||
msg.format( args1 );
|
msg.format( args1 );
|
||||||
std::cout << msg.msg().c_str() << std::endl;
|
cout << msg.msg().c_str() << endl;
|
||||||
logging::Logger logger(logid.fSubsysID);
|
logging::Logger logger(logid.fSubsysID);
|
||||||
logger.logMessage(logging::LOG_TYPE_DEBUG, msg, logid);
|
logger.logMessage(logging::LOG_TYPE_DEBUG, msg, logid);
|
||||||
|
|
||||||
@ -1299,7 +1299,7 @@ void setupSignalHandlers()
|
|||||||
|
|
||||||
void setupCwd(joblist::ResourceManager* rm)
|
void setupCwd(joblist::ResourceManager* rm)
|
||||||
{
|
{
|
||||||
std::string workdir = rm->getScWorkingDir();
|
string workdir = rm->getScWorkingDir();
|
||||||
(void)chdir(workdir.c_str());
|
(void)chdir(workdir.c_str());
|
||||||
|
|
||||||
if (access(".", W_OK) != 0)
|
if (access(".", W_OK) != 0)
|
||||||
@ -1349,8 +1349,8 @@ int setupResources()
|
|||||||
void cleanTempDir()
|
void cleanTempDir()
|
||||||
{
|
{
|
||||||
const auto config = config::Config::makeConfig();
|
const auto config = config::Config::makeConfig();
|
||||||
std::string allowDJS = config->getConfig("HashJoin", "AllowDiskBasedJoin");
|
string allowDJS = config->getConfig("HashJoin", "AllowDiskBasedJoin");
|
||||||
std::string tmpPrefix = config->getConfig("HashJoin", "TempFilePath");
|
string tmpPrefix = config->getConfig("HashJoin", "TempFilePath");
|
||||||
|
|
||||||
if (allowDJS == "N" || allowDJS == "n")
|
if (allowDJS == "N" || allowDJS == "n")
|
||||||
return;
|
return;
|
||||||
@ -1370,7 +1370,7 @@ void cleanTempDir()
|
|||||||
}
|
}
|
||||||
catch (const std::exception& ex)
|
catch (const std::exception& ex)
|
||||||
{
|
{
|
||||||
std::cerr << ex.what() << std::endl;
|
std::cerr << ex.what() << endl;
|
||||||
logging::LoggingID logid(16, 0, 0);
|
logging::LoggingID logid(16, 0, 0);
|
||||||
logging::Message::Args args;
|
logging::Message::Args args;
|
||||||
logging::Message message(8);
|
logging::Message message(8);
|
||||||
@ -1382,7 +1382,7 @@ void cleanTempDir()
|
|||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
std::cerr << "Caught unknown exception during tmpdir cleanup" << std::endl;
|
cerr << "Caught unknown exception during tmpdir cleanup" << endl;
|
||||||
logging::LoggingID logid(16, 0, 0);
|
logging::LoggingID logid(16, 0, 0);
|
||||||
logging::Message::Args args;
|
logging::Message::Args args;
|
||||||
logging::Message message(8);
|
logging::Message message(8);
|
||||||
@ -1397,7 +1397,7 @@ void cleanTempDir()
|
|||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// get and set locale language
|
// get and set locale language
|
||||||
std::string systemLang = "C";
|
string systemLang = "C";
|
||||||
systemLang = funcexp::utf8::idb_setlocale();
|
systemLang = funcexp::utf8::idb_setlocale();
|
||||||
|
|
||||||
// This is unset due to the way we start it
|
// This is unset due to the way we start it
|
||||||
@ -1451,7 +1451,7 @@ int main(int argc, char* argv[])
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
if (!gDebug)
|
if (!gDebug)
|
||||||
err = setupResources();
|
err = setupResources();
|
||||||
std::string errMsg;
|
string errMsg;
|
||||||
|
|
||||||
switch (err)
|
switch (err)
|
||||||
{
|
{
|
||||||
@ -1482,7 +1482,7 @@ int main(int argc, char* argv[])
|
|||||||
logging::LoggingID lid(16);
|
logging::LoggingID lid(16);
|
||||||
logging::MessageLog ml(lid);
|
logging::MessageLog ml(lid);
|
||||||
ml.logCriticalMessage( message );
|
ml.logCriticalMessage( message );
|
||||||
std::cerr << errMsg << std::endl;
|
cerr << errMsg << endl;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1527,15 +1527,15 @@ int main(int argc, char* argv[])
|
|||||||
mqs = new messageqcpp::MessageQueueServer(ExeMgr, rm->getConfig(), messageqcpp::ByteStream::BlockSize, 64);
|
mqs = new messageqcpp::MessageQueueServer(ExeMgr, rm->getConfig(), messageqcpp::ByteStream::BlockSize, 64);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
catch (std::runtime_error& re)
|
catch (runtime_error& re)
|
||||||
{
|
{
|
||||||
std::string what = re.what();
|
string what = re.what();
|
||||||
|
|
||||||
if (what.find("Address already in use") != std::string::npos)
|
if (what.find("Address already in use") != string::npos)
|
||||||
{
|
{
|
||||||
if (tellUser)
|
if (tellUser)
|
||||||
{
|
{
|
||||||
std::cerr << "Address already in use, retrying..." << std::endl;
|
cerr << "Address already in use, retrying..." << endl;
|
||||||
tellUser = false;
|
tellUser = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1592,7 +1592,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
std::cout << "Starting ExeMgr: st = " << serverThreads <<
|
std::cout << "Starting ExeMgr: st = " << serverThreads <<
|
||||||
", qs = " << rm->getEmExecQueueSize() << ", mx = " << maxPct << ", cf = " <<
|
", qs = " << rm->getEmExecQueueSize() << ", mx = " << maxPct << ", cf = " <<
|
||||||
rm->getConfig()->configFile() << std::endl;
|
rm->getConfig()->configFile() << endl;
|
||||||
|
|
||||||
//set ACTIVE state
|
//set ACTIVE state
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user