diff --git a/.gitignore b/.gitignore index 93be85e28..73a91cbd3 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,4 @@ columnstoreversion.h .idea/ .build /.vs +/CMakeSettings.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 42a50a221..be85518bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,17 @@ ENDIF() MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}") +OPTION(USE_CCACHE "reduce compile time with ccache." FALSE) +if(NOT USE_CCACHE) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "") +else() + find_program(CCACHE_FOUND ccache) + if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + endif(CCACHE_FOUND) +endif() # Distinguish between community and non-community builds, with the # default being a community build. This does not impact the feature # set that will be compiled in; it's merely provided as a hint to diff --git a/dbcon/execplan/predicateoperator.h b/dbcon/execplan/predicateoperator.h index 08f0c40cf..66a12ec32 100644 --- a/dbcon/execplan/predicateoperator.h +++ b/dbcon/execplan/predicateoperator.h @@ -295,7 +295,7 @@ inline bool PredicateOperator::getBoolVal(rowgroup::Row& row, bool& isNull, Retu // we won't want to just multiply by scale, as it may move // significant digits out of scope. So we break them apart // and compare each separately - int64_t scale = max(lop->resultType().scale, rop->resultType().scale); + int64_t scale = std::max(lop->resultType().scale, rop->resultType().scale); if (scale) { long double intpart1; diff --git a/dbcon/execplan/treenode.h b/dbcon/execplan/treenode.h index 106b40d37..9fea74984 100644 --- a/dbcon/execplan/treenode.h +++ b/dbcon/execplan/treenode.h @@ -41,9 +41,6 @@ #include "exceptclasses.h" #include "dataconvert.h" -// Workaround for my_global.h #define of isnan(X) causing a std::std namespace -using namespace std; - namespace messageqcpp { class ByteStream; @@ -608,7 +605,7 @@ inline const std::string& TreeNode::getStrVal() int exponent = (int)floor(log10( fabs(fResult.floatVal))); // This will round down the exponent double base = fResult.floatVal * pow(10, -1.0 * exponent); - if (isnan(exponent) || std::isnan(base)) + if (std::isnan(exponent) || std::isnan(base)) { snprintf(tmp, 312, "%f", fResult.floatVal); fResult.strVal = removeTrailing0(tmp, 312); @@ -643,7 +640,7 @@ inline const std::string& TreeNode::getStrVal() int exponent = (int)floor(log10( fabs(fResult.doubleVal))); // This will round down the exponent double base = fResult.doubleVal * pow(10, -1.0 * exponent); - if (isnan(exponent) || std::isnan(base)) + if (std::isnan(exponent) || std::isnan(base)) { snprintf(tmp, 312, "%f", fResult.doubleVal); fResult.strVal = removeTrailing0(tmp, 312); @@ -677,7 +674,7 @@ inline const std::string& TreeNode::getStrVal() int exponent = (int)floorl(log10( fabsl(fResult.longDoubleVal))); // This will round down the exponent long double base = fResult.longDoubleVal * pow(10, -1.0 * exponent); - if (isnan(exponent) || isnan(base)) + if (std::isnan(exponent) || std::isnan(base)) { snprintf(tmp, 312, "%Lf", fResult.longDoubleVal); fResult.strVal = removeTrailing0(tmp, 312); diff --git a/dbcon/execplan/udafcolumn.h b/dbcon/execplan/udafcolumn.h index 4263a9445..3486740ca 100644 --- a/dbcon/execplan/udafcolumn.h +++ b/dbcon/execplan/udafcolumn.h @@ -30,7 +30,6 @@ namespace messageqcpp class ByteStream; } -using namespace mcsv1sdk; /** * Namespace */ @@ -78,7 +77,7 @@ public: /** * Accessors and Mutators */ - mcsv1Context& getContext() + mcsv1sdk::mcsv1Context& getContext() { return context; } @@ -122,7 +121,7 @@ public: virtual bool operator!=(const UDAFColumn& t) const; private: - mcsv1Context context; + mcsv1sdk::mcsv1Context context; }; /** diff --git a/dbcon/joblist/crossenginestep.cpp b/dbcon/joblist/crossenginestep.cpp index d3cef7928..e9b573713 100644 --- a/dbcon/joblist/crossenginestep.cpp +++ b/dbcon/joblist/crossenginestep.cpp @@ -63,9 +63,9 @@ namespace joblist { CrossEngineStep::CrossEngineStep( - const string& schema, - const string& table, - const string& alias, + const std::string& schema, + const std::string& table, + const std::string& alias, const JobInfo& jobInfo) : BatchPrimitive(jobInfo), fRowsRetrieved(0), @@ -113,7 +113,7 @@ bool CrossEngineStep::deliverStringTableRowGroup() const } -void CrossEngineStep::addFcnJoinExp(const vector& fe) +void CrossEngineStep::addFcnJoinExp(const std::vector& fe) { fFeFcnJoin = fe; } @@ -131,7 +131,7 @@ void CrossEngineStep::setFE1Input(const rowgroup::RowGroup& rg) } -void CrossEngineStep::setFcnExpGroup3(const vector& fe) +void CrossEngineStep::setFcnExpGroup3(const std::vector& fe) { fFeSelects = fe; } @@ -336,7 +336,7 @@ int64_t CrossEngineStep::convertValueNum( case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::CLOB: { - string i = boost::any_cast(anyVal); + std::string i = boost::any_cast(anyVal); // bug 1932, pad nulls up to the size of v i.resize(sizeof(rv), 0); rv = *((uint64_t*) i.data()); @@ -435,7 +435,7 @@ void CrossEngineStep::execute() if (ret != 0) mysql->handleMySqlError(mysql->getError().c_str(), ret); - string query(makeQuery()); + std::string query(makeQuery()); fLogger->logMessage(logging::LOG_TYPE_INFO, "QUERY to foreign engine: " + query); if (traceOn()) @@ -651,7 +651,7 @@ void CrossEngineStep::setBPP(JobStep* jobStep) pDictionaryStep* pds = NULL; pDictionaryScan* pdss = NULL; FilterStep* fs = NULL; - string bop = " AND "; + std::string bop = " AND "; if (pcs != 0) { @@ -690,12 +690,12 @@ void CrossEngineStep::setBPP(JobStep* jobStep) } } -void CrossEngineStep::addFilterStr(const vector& f, const string& bop) +void CrossEngineStep::addFilterStr(const std::vector& f, const std::string& bop) { if (f.size() == 0) return; - string filterStr; + std::string filterStr; for (uint64_t i = 0; i < f.size(); i++) { @@ -731,7 +731,7 @@ void CrossEngineStep::setProjectBPP(JobStep* jobStep1, JobStep*) } -string CrossEngineStep::makeQuery() +std::string CrossEngineStep::makeQuery() { ostringstream oss; oss << fSelectClause << " FROM " << fTable; @@ -742,7 +742,7 @@ string CrossEngineStep::makeQuery() if (!fWhereClause.empty()) oss << fWhereClause; - // the string must consist of a single SQL statement without a terminating semicolon ; or \g. + // the std::string must consist of a single SQL statement without a terminating semicolon ; or \g. // oss << ";"; return oss.str(); } @@ -832,7 +832,7 @@ uint32_t CrossEngineStep::nextBand(messageqcpp::ByteStream& bs) } -const string CrossEngineStep::toString() const +const std::string CrossEngineStep::toString() const { ostringstream oss; oss << "CrossEngineStep ses:" << fSessionId << " txn:" << fTxnId << " st:" << fStepId; diff --git a/dbcon/joblist/crossenginestep.h b/dbcon/joblist/crossenginestep.h index 4ebf2ac9d..2e9cc79f0 100644 --- a/dbcon/joblist/crossenginestep.h +++ b/dbcon/joblist/crossenginestep.h @@ -30,8 +30,6 @@ #include "primitivestep.h" #include "threadnaming.h" -using namespace std; - // forward reference namespace utils { @@ -60,9 +58,9 @@ public: /** @brief CrossEngineStep constructor */ CrossEngineStep( - const string& schema, - const string& table, - const string& alias, + const std::string& schema, + const std::string& table, + const std::string& alias, const JobInfo& jobInfo); /** @brief CrossEngineStep destructor @@ -124,15 +122,15 @@ public: { return fRowsReturned; } - const string& schemaName() const + const std::string& schemaName() const { return fSchema; } - const string& tableName() const + const std::string& tableName() const { return fTable; } - const string& tableAlias() const + const std::string& tableAlias() const { return fAlias; } @@ -149,10 +147,10 @@ public: bool deliverStringTableRowGroup() const; uint32_t nextBand(messageqcpp::ByteStream& bs); - void addFcnJoinExp(const vector&); + void addFcnJoinExp(const std::vector&); void addFcnExpGroup1(const boost::shared_ptr&); void setFE1Input(const rowgroup::RowGroup&); - void setFcnExpGroup3(const vector&); + void setFcnExpGroup3(const std::vector&); void setFE23Output(const rowgroup::RowGroup&); void addFilter(JobStep* jobStep); diff --git a/dbcon/joblist/jlf_execplantojoblist.cpp b/dbcon/joblist/jlf_execplantojoblist.cpp index fff1b12fb..7bbb8a136 100644 --- a/dbcon/joblist/jlf_execplantojoblist.cpp +++ b/dbcon/joblist/jlf_execplantojoblist.cpp @@ -3373,7 +3373,7 @@ namespace joblist // conversion performed by the functions in this file. // @bug6131, pre-order traversing /* static */ void -JLF_ExecPlanToJobList::walkTree(ParseTree* n, JobInfo& jobInfo) +JLF_ExecPlanToJobList::walkTree(execplan::ParseTree* n, JobInfo& jobInfo) { TreeNode* tn = n->data(); JobStepVector jsv; diff --git a/dbcon/joblist/jlf_execplantojoblist.h b/dbcon/joblist/jlf_execplantojoblist.h index 0232e87a3..6f9fb5daf 100644 --- a/dbcon/joblist/jlf_execplantojoblist.h +++ b/dbcon/joblist/jlf_execplantojoblist.h @@ -30,7 +30,7 @@ #include "calpontexecutionplan.h" #include "calpontselectexecutionplan.h" #include "calpontsystemcatalog.h" -using namespace execplan; + #include "jlf_common.h" @@ -50,7 +50,7 @@ public: * @param ParseTree (in) is CEP to be translated to a joblist * @param JobInfo& (in/out) is the JobInfo reference that is loaded */ - static void walkTree(ParseTree* n, JobInfo& jobInfo); + static void walkTree(execplan::ParseTree* n, JobInfo& jobInfo); /** @brief This function add new job steps to the job step vector in JobInfo * diff --git a/dbcon/joblist/joblistfactory.cpp b/dbcon/joblist/joblistfactory.cpp index b0c314364..788cf5cc9 100644 --- a/dbcon/joblist/joblistfactory.cpp +++ b/dbcon/joblist/joblistfactory.cpp @@ -88,6 +88,7 @@ using namespace logging; #include "rowgroup.h" using namespace rowgroup; +#include "mcsv1_udaf.h" namespace { @@ -709,7 +710,7 @@ void updateAggregateColType(AggregateColumn* ac, const SRCP& srcp, int op, JobIn if (udafc) { - mcsv1Context& udafContext = udafc->getContext(); + mcsv1sdk::mcsv1Context& udafContext = udafc->getContext(); ct.colDataType = udafContext.getResultType(); ct.colWidth = udafContext.getColWidth(); ct.scale = udafContext.getScale(); diff --git a/dbcon/joblist/jobstep.cpp b/dbcon/joblist/jobstep.cpp index f5419558d..8e90bd2a6 100644 --- a/dbcon/joblist/jobstep.cpp +++ b/dbcon/joblist/jobstep.cpp @@ -57,7 +57,7 @@ namespace joblist { boost::mutex JobStep::fLogMutex; //=PTHREAD_MUTEX_INITIALIZER; -ThreadPool JobStep::jobstepThreadPool(defaultJLThreadPoolSize, 0); +threadpool::ThreadPool JobStep::jobstepThreadPool(defaultJLThreadPoolSize, 0); ostream& operator<<(ostream& os, const JobStep* rhs) { diff --git a/dbcon/joblist/jobstep.h b/dbcon/joblist/jobstep.h index 5e917b2f0..d4f5143f4 100644 --- a/dbcon/joblist/jobstep.h +++ b/dbcon/joblist/jobstep.h @@ -53,8 +53,6 @@ # endif #endif -using namespace threadpool; - namespace joblist { @@ -423,7 +421,7 @@ public: fOnClauseFilter = b; } - static ThreadPool jobstepThreadPool; + static threadpool::ThreadPool jobstepThreadPool; protected: //@bug6088, for telemetry posting diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index e617e5959..e6acfadb9 100644 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -44,6 +44,7 @@ #include #include +#include "mcsv1_udaf.h" using namespace std; @@ -4610,7 +4611,7 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi) if (udafc) { - mcsv1Context& context = udafc->getContext(); + mcsv1sdk::mcsv1Context& context = udafc->getContext(); context.setName(isp->func_name()); // Set up the return type defaults for the call to init() @@ -4620,8 +4621,8 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi) context.setPrecision(udafc->resultType().precision); context.setParamCount(udafc->aggParms().size()); - ColumnDatum colType; - ColumnDatum colTypes[udafc->aggParms().size()]; + mcsv1sdk::ColumnDatum colType; + mcsv1sdk::ColumnDatum colTypes[udafc->aggParms().size()]; // Build the column type vector. // Modified for MCOL-1201 multi-argument aggregate @@ -4649,7 +4650,7 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi) return NULL; } - if (udaf->init(&context, colTypes) == mcsv1_UDAF::ERROR) + if (udaf->init(&context, colTypes) == mcsv1sdk::mcsv1_UDAF::ERROR) { gwi.fatalParseError = true; gwi.parseErrorText = udafc->getContext().getErrorMessage(); @@ -4662,7 +4663,7 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi) // UDAF_OVER_REQUIRED means that this function is for Window // Function only. Reject it here in aggregate land. - if (udafc->getContext().getRunFlag(UDAF_OVER_REQUIRED)) + if (udafc->getContext().getRunFlag(mcsv1sdk::UDAF_OVER_REQUIRED)) { gwi.fatalParseError = true; gwi.parseErrorText = diff --git a/dbcon/mysql/ha_calpont_impl.cpp b/dbcon/mysql/ha_calpont_impl.cpp index 83442b3d3..a2f4cfbe7 100644 --- a/dbcon/mysql/ha_calpont_impl.cpp +++ b/dbcon/mysql/ha_calpont_impl.cpp @@ -3295,7 +3295,7 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table) if (get_local_query(thd)) { - OamCache* oamcache = OamCache::makeOamCache(); + const auto oamcache = oam::OamCache::makeOamCache(); int localModuleId = oamcache->getLocalPMId(); if (localModuleId == 0) diff --git a/dbcon/mysql/ha_mcs_client_udfs.cpp b/dbcon/mysql/ha_mcs_client_udfs.cpp index 1766bdf1c..9113ae51b 100644 --- a/dbcon/mysql/ha_mcs_client_udfs.cpp +++ b/dbcon/mysql/ha_mcs_client_udfs.cpp @@ -58,7 +58,7 @@ extern "C" const char* invalidParmSizeMessage(uint64_t size, size_t& len) { static char str[sizeof(InvalidParmSize) + 12] = {0}; - ostringstream os; + std::ostringstream os; os << InvalidParmSize << size; len = os.str().length(); strcpy(str, os.str().c_str()); @@ -86,13 +86,13 @@ extern "C" uint64_t value = Config::uFromText(valuestr); THD* thd = current_thd; - uint32_t sessionID = CalpontSystemCatalog::idb_tid2sid(thd->thread_id); + uint32_t sessionID = execplan::CalpontSystemCatalog::idb_tid2sid(thd->thread_id); const char* msg = SetParmsError; size_t mlen = Elen; bool includeInput = true; - string pstr(parameter); + std::string pstr(parameter); boost::algorithm::to_lower(pstr); if (get_fe_conn_info_ptr() == NULL) @@ -107,7 +107,7 @@ extern "C" if (rm->getHjTotalUmMaxMemorySmallSide() >= value) { - ci->rmParms.push_back(RMParam(sessionID, execplan::PMSMALLSIDEMEMORY, value)); + ci->rmParms.push_back(execplan::RMParam(sessionID, execplan::PMSMALLSIDEMEMORY, value)); msg = SetParmsPrelude; mlen = Plen; @@ -254,8 +254,8 @@ extern "C" long long oldTrace = ci->traceFlags; ci->traceFlags = (uint32_t)(*((long long*)args->args[0])); // keep the vtablemode bit - ci->traceFlags |= (oldTrace & CalpontSelectExecutionPlan::TRACE_TUPLE_OFF); - ci->traceFlags |= (oldTrace & CalpontSelectExecutionPlan::TRACE_TUPLE_AUTOSWITCH); + ci->traceFlags |= (oldTrace & execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_OFF); + ci->traceFlags |= (oldTrace & execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_AUTOSWITCH); return oldTrace; } @@ -381,8 +381,8 @@ extern "C" { long long rtn = 0; Oam oam; - string PrimaryUMModuleName; - string localModule; + std::string PrimaryUMModuleName; + std::string localModule; oamModuleInfo_t st; try @@ -396,7 +396,7 @@ extern "C" if (PrimaryUMModuleName == "unassigned") rtn = 1; } - catch (runtime_error& e) + catch (std::runtime_error& e) { // It's difficult to return an error message from a numerical UDF //string msg = string("ERROR: Problem getting Primary UM Module Name. ") + e.what(); @@ -469,7 +469,7 @@ extern "C" set_fe_conn_info_ptr((void*)new cal_connection_info()); cal_connection_info* ci = reinterpret_cast(get_fe_conn_info_ptr()); - CalpontSystemCatalog::TableName tableName; + execplan::CalpontSystemCatalog::TableName tableName; if ( args->arg_count == 2 ) { @@ -484,7 +484,7 @@ extern "C" tableName.schema = thd->db.str; else { - string msg("No schema information provided"); + std::string msg("No schema information provided"); memcpy(result, msg.c_str(), msg.length()); *length = msg.length(); return result; @@ -497,7 +497,7 @@ extern "C" //cout << "viewtablelock starts a new client " << ci->dmlProc << " for session " << thd->thread_id << endl; } - string lockinfo = ha_calpont_impl_viewtablelock(*ci, tableName); + std::string lockinfo = ha_calpont_impl_viewtablelock(*ci, tableName); memcpy(result, lockinfo.c_str(), lockinfo.length()); *length = lockinfo.length(); @@ -550,7 +550,7 @@ extern "C" } unsigned long long uLockID = lockID; - string lockinfo = ha_calpont_impl_cleartablelock(*ci, uLockID); + std::string lockinfo = ha_calpont_impl_cleartablelock(*ci, uLockID); memcpy(result, lockinfo.c_str(), lockinfo.length()); *length = lockinfo.length(); @@ -604,7 +604,7 @@ extern "C" { THD* thd = current_thd; - CalpontSystemCatalog::TableName tableName; + execplan::CalpontSystemCatalog::TableName tableName; uint64_t nextVal = 0; if ( args->arg_count == 2 ) @@ -624,9 +624,9 @@ extern "C" } } - boost::shared_ptr csc = - CalpontSystemCatalog::makeCalpontSystemCatalog( - CalpontSystemCatalog::idb_tid2sid(thd->thread_id)); + boost::shared_ptr csc = + execplan::CalpontSystemCatalog::makeCalpontSystemCatalog( + execplan::CalpontSystemCatalog::idb_tid2sid(thd->thread_id)); csc->identity(execplan::CalpontSystemCatalog::FE); try @@ -635,7 +635,7 @@ extern "C" } catch (std::exception&) { - string msg("No such table found during autincrement"); + std::string msg("No such table found during autincrement"); setError(thd, ER_INTERNAL_ERROR, msg); return nextVal; } @@ -649,7 +649,7 @@ extern "C" //@Bug 3559. Return a message for table without autoincrement column. if (nextVal == 0) { - string msg("Autoincrement does not exist for this table."); + std::string msg("Autoincrement does not exist for this table."); setError(thd, ER_INTERNAL_ERROR, msg); return nextVal; } @@ -705,7 +705,7 @@ extern "C" char* result, unsigned long* length, char* is_null, char* error) { - const string* msgp; + const std::string* msgp; int flags = 0; if (args->arg_count > 0) @@ -776,7 +776,7 @@ extern "C" char* result, unsigned long* length, char* is_null, char* error) { - string version(columnstore_version); + std::string version(columnstore_version); *length = version.size(); memcpy(result, version.c_str(), *length); return result; diff --git a/ddlproc/ddlprocessor.cpp b/ddlproc/ddlprocessor.cpp index a10ff31af..fb283f3a7 100644 --- a/ddlproc/ddlprocessor.cpp +++ b/ddlproc/ddlprocessor.cpp @@ -20,7 +20,7 @@ * * ***********************************************************************/ - +#include //cxx11test #include #include using namespace std; diff --git a/dmlproc/dmlproc.cpp b/dmlproc/dmlproc.cpp index deb936422..7b1041b1e 100644 --- a/dmlproc/dmlproc.cpp +++ b/dmlproc/dmlproc.cpp @@ -20,7 +20,7 @@ * * ***********************************************************************/ - +#include //cxx11test #include #include #include @@ -632,7 +632,7 @@ int main(int argc, char* argv[]) if (rm->getDMLJlThreadPoolDebug() == "Y" || rm->getDMLJlThreadPoolDebug() == "y") { JobStep::jobstepThreadPool.setDebug(true); - JobStep::jobstepThreadPool.invoke(ThreadPoolMonitor(&JobStep::jobstepThreadPool)); + JobStep::jobstepThreadPool.invoke(threadpool::ThreadPoolMonitor(&JobStep::jobstepThreadPool)); } //set ACTIVE state diff --git a/exemgr/CMakeLists.txt b/exemgr/CMakeLists.txt index cae1cf3ce..5f77ed886 100644 --- a/exemgr/CMakeLists.txt +++ b/exemgr/CMakeLists.txt @@ -8,7 +8,9 @@ set(ExeMgr_SRCS main.cpp activestatementcounter.cpp femsghandler.cpp ../utils/co add_executable(ExeMgr ${ExeMgr_SRCS}) -target_link_libraries(ExeMgr ${ENGINE_LDFLAGS} ${ENGINE_EXEC_LIBS} ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} cacheutils threadpool) +target_link_libraries(ExeMgr ${ENGINE_LDFLAGS} ${ENGINE_EXEC_LIBS} ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} cacheutils threadpool stdc++fs) + + install(TARGETS ExeMgr DESTINATION ${ENGINE_BINDIR} COMPONENT platform) diff --git a/exemgr/main.cpp b/exemgr/main.cpp index 259d1443e..6790fafbb 100644 --- a/exemgr/main.cpp +++ b/exemgr/main.cpp @@ -39,82 +39,53 @@ * on the Front-End Processor where it is returned to the DBMS * front-end. */ + + + +#include +#include #include -#include -#include -#include + +#include #include -#include -#include -#ifndef _MSC_VER + #include -#else -#include -#include -#endif -//#define NDEBUG -#include -#include -#include -using namespace std; -#include -#include -#include -using namespace boost; - -#include "config.h" -#include "configcpp.h" -using namespace config; -#include "messagequeue.h" -#include "iosocket.h" -#include "bytestream.h" -using namespace messageqcpp; #include "calpontselectexecutionplan.h" -#include "calpontsystemcatalog.h" -#include "simplecolumn.h" -using namespace execplan; -#include "joblist.h" -#include "joblistfactory.h" +#include "activestatementcounter.h" #include "distributedenginecomm.h" #include "resourcemanager.h" -using namespace joblist; -#include "liboamcpp.h" -using namespace oam; -#include "logger.h" -#include "sqllogger.h" -#include "idberrorinfo.h" -using namespace logging; -#include "querystats.h" -using namespace querystats; -#include "MonitorProcMem.h" -#include "querytele.h" -using namespace querytele; +#include "configcpp.h" +#include "queryteleserverparms.h" +#include "iosocket.h" +#include "joblist.h" +#include "joblistfactory.h" #include "oamcache.h" - -#include "activestatementcounter.h" +#include "simplecolumn.h" +#include "bytestream.h" +#include "telestats.h" +#include "messageobj.h" +#include "messagelog.h" +#include "sqllogger.h" #include "femsghandler.h" - -#include "utils_utf8.h" -#include "boost/filesystem.hpp" - -#include "threadpool.h" +#include "idberrorinfo.h" +#include "MonitorProcMem.h" +#include "liboamcpp.h" #include "crashtrace.h" +#include "utils_utf8.h" #if defined(SKIP_OAM_INIT) #include "dbrm.h" #endif -#include "installdir.h" - namespace { //If any flags other than the table mode flags are set, produce output to screeen const uint32_t flagsWantOutput = (0xffffffff & - ~CalpontSelectExecutionPlan::TRACE_TUPLE_AUTOSWITCH & - ~CalpontSelectExecutionPlan::TRACE_TUPLE_OFF); + ~execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_AUTOSWITCH & + ~execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_OFF); int gDebug; @@ -129,46 +100,46 @@ const unsigned logExeMgrExcpt = logging::M0055; logging::Logger msgLog(16); -typedef map SessionMemMap_t; +typedef std::map SessionMemMap_t; SessionMemMap_t sessionMemMap; // track memory% usage during a query -mutex sessionMemMapMutex; +std::mutex sessionMemMapMutex; //...The FrontEnd may establish more than 1 connection (which results in // more than 1 ExeMgr thread) per session. These threads will share // the same CalpontSystemCatalog object for that session. Here, we -// define a map to track how many threads are sharing each session, so +// define a std::map to track how many threads are sharing each session, so // that we know when we can safely delete a CalpontSystemCatalog object // shared by multiple threads per session. -typedef map ThreadCntPerSessionMap_t; +typedef std::map ThreadCntPerSessionMap_t; ThreadCntPerSessionMap_t threadCntPerSessionMap; -mutex threadCntPerSessionMapMutex; +std::mutex threadCntPerSessionMapMutex; //This var is only accessed using thread-safe inc/dec calls ActiveStatementCounter* statementsRunningCount; -DistributedEngineComm* ec; +joblist::DistributedEngineComm* ec; -ResourceManager* rm = ResourceManager::instance(true); +auto rm = joblist::ResourceManager::instance(true); -int toInt(const string& val) +int toInt(const std::string& val) { if (val.length() == 0) return -1; - return static_cast(Config::fromText(val)); + return static_cast(config::Config::fromText(val)); } -const string ExeMgr("ExeMgr1"); +const std::string ExeMgr("ExeMgr1"); -const string prettyPrintMiniInfo(const string& in) +const std::string prettyPrintMiniInfo(const std::string& in) { - //1. take the string and tok it by '\n' + //1. take the std::string and tok it by '\n' //2. for each part in each line calc the longest part //3. padding to each longest value, output a header and the lines typedef boost::tokenizer > my_tokenizer; boost::char_separator sep1("\n"); my_tokenizer tok1(in, sep1); - vector lines; - string header = "Desc Mode Table TableOID ReferencedColumns PIO LIO PBE Elapsed Rows"; + std::vector lines; + std::string header = "Desc Mode Table TableOID ReferencedColumns PIO LIO PBE Elapsed Rows"; const int header_parts = 10; lines.push_back(header); @@ -178,13 +149,13 @@ const string prettyPrintMiniInfo(const string& in) lines.push_back(*iter1); } - vector lens; + std::vector lens; for (int i = 0; i < header_parts; i++) lens.push_back(0); - vector > lineparts; - vector::iterator iter2; + std::vector > lineparts; + std::vector::iterator iter2; int j; for (iter2 = lines.begin(), j = 0; iter2 != lines.end(); ++iter2, j++) @@ -192,14 +163,14 @@ const string prettyPrintMiniInfo(const string& in) boost::char_separator sep2(" "); my_tokenizer tok2(*iter2, sep2); int i; - vector parts; + std::vector parts; my_tokenizer::iterator iter3; for (iter3 = tok2.begin(), i = 0; iter3 != tok2.end(); ++iter3, i++) { if (i >= header_parts) break; - string part(*iter3); + std::string part(*iter3); if (j != 0 && i == 8) part.resize(part.size() - 3); @@ -216,24 +187,24 @@ const string prettyPrintMiniInfo(const string& in) lineparts.push_back(parts); } - ostringstream oss; + std::ostringstream oss; - vector >::iterator iter1 = lineparts.begin(); - vector >::iterator end1 = lineparts.end(); + std::vector >::iterator iter1 = lineparts.begin(); + std::vector >::iterator end1 = lineparts.end(); oss << "\n"; while (iter1 != end1) { - vector::iterator iter2 = iter1->begin(); - vector::iterator end2 = iter1->end(); + std::vector::iterator iter2 = iter1->begin(); + std::vector::iterator end2 = iter1->end(); assert(distance(iter2, end2) == header_parts); int i = 0; while (iter2 != end2) { assert(i < header_parts); - oss << setw(lens[i]) << left << *iter2 << " "; + oss << std::setw(lens[i]) << std::left << *iter2 << " "; ++iter2; i++; } @@ -245,7 +216,7 @@ const string prettyPrintMiniInfo(const string& in) return oss.str(); } -const string timeNow() +const std::string timeNow() { time_t outputTime = time(0); struct tm ltm; @@ -265,13 +236,13 @@ const string timeNow() return buf; } -QueryTeleServerParms gTeleServerParms; +querytele::QueryTeleServerParms gTeleServerParms; class SessionThread { public: - SessionThread(const IOSocket& ios, DistributedEngineComm* ec, ResourceManager* rm) : + SessionThread(const messageqcpp::IOSocket& ios, joblist::DistributedEngineComm* ec, joblist::ResourceManager* rm) : fIos(ios), fEc(ec), fRm(rm), fStatsRetrieved(false), @@ -282,20 +253,20 @@ public: private: - IOSocket fIos; - DistributedEngineComm* fEc; - ResourceManager* fRm; + messageqcpp::IOSocket fIos; + joblist::DistributedEngineComm* fEc; + joblist::ResourceManager* fRm; querystats::QueryStats fStats; // Variables used to store return stats bool fStatsRetrieved; - QueryTeleClient fTeleClient; + querytele::QueryTeleClient fTeleClient; oam::OamCache* fOamCachePtr; //this ptr is copyable... //...Reinitialize stats for start of a new query - void initStats ( uint32_t sessionId, string& sqlText ) + void initStats ( uint32_t sessionId, std::string& sqlText ) { initMaxMemPct ( sessionId ); @@ -314,7 +285,7 @@ private: if ( sessionId < 0x80000000 ) { - mutex::scoped_lock lk(sessionMemMapMutex); + std::lock_guard lk(sessionMemMapMutex); SessionMemMap_t::iterator mapIter = sessionMemMap.find( sessionId ); @@ -333,7 +304,7 @@ private: { if ( sessionId < 0x80000000 ) { - mutex::scoped_lock lk(sessionMemMapMutex); + std::lock_guard lk(sessionMemMapMutex); SessionMemMap_t::iterator mapIter = sessionMemMap.find( sessionId ); @@ -345,15 +316,15 @@ private: } //...Get and log query stats to specified output stream - const string formatQueryStats ( - SJLP& jl, // joblist associated with query - const string& label, // header label to print in front of log output - bool includeNewLine,//include line breaks in query stats string + const std::string formatQueryStats ( + joblist::SJLP& jl, // joblist associated with query + const std::string& label, // header label to print in front of log output + bool includeNewLine,//include line breaks in query stats std::string bool vtableModeOn, bool wantExtendedStats, uint64_t rowsReturned) { - ostringstream os; + std::ostringstream os; // Get stats if not already acquired for current query if ( !fStatsRetrieved ) @@ -377,7 +348,7 @@ private: fStatsRetrieved = true; } - string queryMode; + std::string queryMode; queryMode = (vtableModeOn ? "Distributed" : "Standard"); // Log stats to specified output stream @@ -390,7 +361,7 @@ private: "; BlocksTouched-" << fStats.fMsgRcvCnt; if ( includeNewLine ) - os << endl << " "; // insert line break + os << std::endl << " "; // insert line break else os << "; "; // continue without line break @@ -405,7 +376,7 @@ private: //...Increment the number of threads using the specified sessionId static void incThreadCntPerSession(uint32_t sessionId) { - mutex::scoped_lock lk(threadCntPerSessionMapMutex); + std::lock_guard lk(threadCntPerSessionMapMutex); ThreadCntPerSessionMap_t::iterator mapIter = threadCntPerSessionMap.find(sessionId); @@ -425,7 +396,7 @@ private: //...debugging/stats purpose, such as result graph, etc. static void decThreadCntPerSession(uint32_t sessionId) { - mutex::scoped_lock lk(threadCntPerSessionMapMutex); + std::lock_guard lk(threadCntPerSessionMapMutex); ThreadCntPerSessionMap_t::iterator mapIter = threadCntPerSessionMap.find(sessionId); @@ -434,8 +405,8 @@ private: if (--mapIter->second == 0) { threadCntPerSessionMap.erase(mapIter); - CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId); - CalpontSystemCatalog::removeCalpontSystemCatalog((sessionId ^ 0x80000000)); + execplan::CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId); + execplan::CalpontSystemCatalog::removeCalpontSystemCatalog((sessionId ^ 0x80000000)); } } } @@ -446,8 +417,8 @@ private: { if ( sessionId < 0x80000000 ) { - // cout << "Setting pct to 0 for session " << sessionId << endl; - mutex::scoped_lock lk(sessionMemMapMutex); + // std::cout << "Setting pct to 0 for session " << sessionId << std::endl; + std::lock_guard lk(sessionMemMapMutex); SessionMemMap_t::iterator mapIter = sessionMemMap.find( sessionId ); if ( mapIter == sessionMemMap.end() ) @@ -462,7 +433,7 @@ private: } //... Round off to human readable format (KB, MB, or GB). - const string roundBytes(uint64_t value) const + const std::string roundBytes(uint64_t value) const { const char* units[] = {"B", "KB", "MB", "GB", "TB"}; uint64_t i = 0, up = 0; @@ -478,7 +449,7 @@ private: if (up) roundedValue++; - ostringstream oss; + std::ostringstream oss; oss << roundedValue << units[i]; return oss.str(); } @@ -494,20 +465,20 @@ private: return roundedValue; } - void setRMParms ( const CalpontSelectExecutionPlan::RMParmVec& parms ) + void setRMParms ( const execplan::CalpontSelectExecutionPlan::RMParmVec& parms ) { - for (CalpontSelectExecutionPlan::RMParmVec::const_iterator it = parms.begin(); + for (execplan::CalpontSelectExecutionPlan::RMParmVec::const_iterator it = parms.begin(); it != parms.end(); ++it) { switch (it->id) { - case PMSMALLSIDEMEMORY: + case execplan::PMSMALLSIDEMEMORY: { fRm->addHJPmMaxSmallSideMap(it->sessionId, it->value); break; } - case UMSMALLSIDEMEMORY: + case execplan::UMSMALLSIDEMEMORY: { fRm->addHJUmMaxSmallSideMap(it->sessionId, it->value); break; @@ -519,22 +490,22 @@ private: } } - void buildSysCache(const CalpontSelectExecutionPlan& csep, boost::shared_ptr csc) + void buildSysCache(const execplan::CalpontSelectExecutionPlan& csep, boost::shared_ptr csc) { - const CalpontSelectExecutionPlan::ColumnMap& colMap = csep.columnMap(); - CalpontSelectExecutionPlan::ColumnMap::const_iterator it; - string schemaName; + const execplan::CalpontSelectExecutionPlan::ColumnMap& colMap = csep.columnMap(); + execplan::CalpontSelectExecutionPlan::ColumnMap::const_iterator it; + std::string schemaName; for (it = colMap.begin(); it != colMap.end(); ++it) { - SimpleColumn* sc = dynamic_cast((it->second).get()); + const auto sc = dynamic_cast((it->second).get()); if (sc) { schemaName = sc->schemaName(); // only the first time a schema is got will actually query - // system catalog. System catalog keeps a schema name map. + // system catalog. System catalog keeps a schema name std::map. // if a schema exists, the call getSchemaInfo returns without // doing anything. if (!schemaName.empty()) @@ -542,11 +513,11 @@ private: } } - CalpontSelectExecutionPlan::SelectList::const_iterator subIt; + execplan::CalpontSelectExecutionPlan::SelectList::const_iterator subIt; for (subIt = csep.derivedTableList().begin(); subIt != csep.derivedTableList().end(); ++ subIt) { - buildSysCache(*(dynamic_cast(subIt->get())), csc); + buildSysCache(*(dynamic_cast(subIt->get())), csc); } } @@ -554,10 +525,10 @@ public: void operator()() { - ByteStream bs, inbs; - CalpontSelectExecutionPlan csep; + messageqcpp::ByteStream bs, inbs; + execplan::CalpontSelectExecutionPlan csep; csep.sessionID(0); - SJLP jl; + joblist::SJLP jl; bool incSessionThreadCnt = true; bool selfJoin = false; @@ -579,7 +550,7 @@ public: if (bs.length() == 0) { if (gDebug > 1 || (gDebug && !csep.isInternal())) - cout << "### Got a close(1) for session id " << csep.sessionID() << endl; + std::cout << "### Got a close(1) for session id " << csep.sessionID() << std::endl; // connection closed by client fIos.close(); @@ -588,21 +559,21 @@ public: else if (bs.length() < 4) //Not a CalpontSelectExecutionPlan { if (gDebug) - cout << "### Got a not-a-plan for session id " << csep.sessionID() - << " with length " << bs.length() << endl; + std::cout << "### Got a not-a-plan for session id " << csep.sessionID() + << " with length " << bs.length() << std::endl; fIos.close(); break; } else if (bs.length() == 4) //possible tuple flag { - ByteStream::quadbyte qb; + messageqcpp::ByteStream::quadbyte qb; bs >> qb; if (qb == 4) //UM wants new tuple i/f { if (gDebug) - cout << "### UM wants tuples" << endl; + std::cout << "### UM wants tuples" << std::endl; tryTuples = true; // now wait for the CSEP... @@ -622,7 +593,7 @@ public: else { if (gDebug) - cout << "### Got a not-a-plan value " << qb << endl; + std::cout << "### Got a not-a-plan value " << qb << std::endl; fIos.close(); break; @@ -632,14 +603,14 @@ public: new_plan: csep.unserialize(bs); - QueryTeleStats qts; + querytele::QueryTeleStats qts; if ( !csep.isInternal() && (csep.queryType() == "SELECT" || csep.queryType() == "INSERT_SELECT") ) { qts.query_uuid = csep.uuid(); - qts.msg_type = QueryTeleStats::QT_START; - qts.start_time = QueryTeleClient::timeNowms(); + qts.msg_type = querytele::QueryTeleStats::QT_START; + qts.start_time = querytele::QueryTeleClient::timeNowms(); qts.query = csep.data(); qts.session_id = csep.sessionID(); qts.query_type = csep.queryType(); @@ -651,7 +622,7 @@ new_plan: } if (gDebug > 1 || (gDebug && !csep.isInternal())) - cout << "### For session id " << csep.sessionID() << ", got a CSEP" << endl; + std::cout << "### For session id " << csep.sessionID() << ", got a CSEP" << std::endl; setRMParms(csep.rmParms()); @@ -659,8 +630,8 @@ new_plan: // skip system catalog queries. if (!csep.isInternal()) { - boost::shared_ptr csc = - CalpontSystemCatalog::makeCalpontSystemCatalog(csep.sessionID()); + boost::shared_ptr csc = + execplan::CalpontSystemCatalog::makeCalpontSystemCatalog(csep.sessionID()); buildSysCache(csep, csc); } @@ -674,9 +645,9 @@ new_plan: } bool needDbProfEndStatementMsg = false; - Message::Args args; - string sqlText = csep.data(); - LoggingID li(16, csep.sessionID(), csep.txnID()); + logging::Message::Args args; + std::string sqlText = csep.data(); + logging::LoggingID li(16, csep.sessionID(), csep.txnID()); // Initialize stats for this query, including // init sessionMemMap entry for this session to 0 memory %. @@ -694,7 +665,7 @@ new_plan: args.add((int)csep.statementID()); args.add((int)csep.verID().currentScn); args.add(sqlText); - msgLog.logMessage(LOG_TYPE_DEBUG, + msgLog.logMessage(logging::LOG_TYPE_DEBUG, logDbProfStartStatement, args, li); @@ -705,9 +676,9 @@ new_plan: if (selfJoin) sqlText = ""; - ostringstream oss; + std::ostringstream oss; oss << sqlText << "; |" << csep.schemaName() << "|"; - SQLLogger sqlLog(oss.str(), li); + logging::SQLLogger sqlLog(oss.str(), li); statementsRunningCount->incr(stmtCounted); @@ -715,14 +686,14 @@ new_plan: { try // @bug2244: try/catch around fIos.write() calls responding to makeTupleList { - string emsg("NOERROR"); - ByteStream emsgBs; - ByteStream::quadbyte tflg = 0; - jl = JobListFactory::makeJobList(&csep, fRm, true, true); + std::string emsg("NOERROR"); + messageqcpp::ByteStream emsgBs; + messageqcpp::ByteStream::quadbyte tflg = 0; + jl = joblist::JobListFactory::makeJobList(&csep, fRm, true, true); // assign query stats jl->queryStats(fStats); - ByteStream tbs; + messageqcpp::ByteStream tbs; if ((jl->status()) == 0 && (jl->putEngineComm(fEc) == 0)) { @@ -734,7 +705,7 @@ new_plan: emsgBs.reset(); emsgBs << emsg; fIos.write(emsgBs); - TupleJobList* tjlp = dynamic_cast(jl.get()); + auto tjlp = dynamic_cast(jl.get()); assert(tjlp); tbs.restart(); tbs << tjlp->getOutputRowGroup(); @@ -750,60 +721,60 @@ new_plan: emsgBs.reset(); emsgBs << emsg; fIos.write(emsgBs); - cerr << "ExeMgr: could not build a tuple joblist: " << emsg << endl; + std::cerr << "ExeMgr: could not build a tuple joblist: " << emsg << std::endl; continue; } } catch (std::exception& ex) { - ostringstream errMsg; + std::ostringstream errMsg; errMsg << "ExeMgr: error writing makeJoblist " "response; " << ex.what(); - throw runtime_error( errMsg.str() ); + throw std::runtime_error( errMsg.str() ); } catch (...) { - ostringstream errMsg; + std::ostringstream errMsg; errMsg << "ExeMgr: unknown error writing makeJoblist " "response; "; - throw runtime_error( errMsg.str() ); + throw std::runtime_error( errMsg.str() ); } if (!usingTuples) { if (gDebug) - cout << "### UM wanted tuples but it didn't work out :-(" << endl; + std::cout << "### UM wanted tuples but it didn't work out :-(" << std::endl; } else { if (gDebug) - cout << "### UM wanted tuples and we'll do our best;-)" << endl; + std::cout << "### UM wanted tuples and we'll do our best;-)" << std::endl; } } else { usingTuples = false; - jl = JobListFactory::makeJobList(&csep, fRm, false, true); + jl = joblist::JobListFactory::makeJobList(&csep, fRm, false, true); if (jl->status() == 0) { - string emsg; + std::string emsg; if (jl->putEngineComm(fEc) != 0) - throw runtime_error(jl->errMsg()); + throw std::runtime_error(jl->errMsg()); } else { - throw runtime_error("ExeMgr: could not build a JobList!"); + throw std::runtime_error("ExeMgr: could not build a JobList!"); } } jl->doQuery(); - CalpontSystemCatalog::OID tableOID; + execplan::CalpontSystemCatalog::OID tableOID; bool swallowRows = false; - DeliveredTableMap tm; + joblist::DeliveredTableMap tm; uint64_t totalBytesSent = 0; uint64_t totalRowCount = 0; @@ -815,14 +786,14 @@ new_plan: if (bs.length() == 0) { if (gDebug > 1 || (gDebug && !csep.isInternal())) - cout << "### Got a close(2) for session id " << csep.sessionID() << endl; + std::cout << "### Got a close(2) for session id " << csep.sessionID() << std::endl; break; } if (gDebug && bs.length() > 4) - cout << "### For session id " << csep.sessionID() << ", got too many bytes = " << - bs.length() << endl; + std::cout << "### For session id " << csep.sessionID() << ", got too many bytes = " << + bs.length() << std::endl; //TODO: Holy crud! Can this be right? //@bug 1444 Yes, if there is a self-join @@ -835,14 +806,14 @@ new_plan: assert(bs.length() == 4); - ByteStream::quadbyte qb; + messageqcpp::ByteStream::quadbyte qb; try // @bug2244: try/catch around fIos.write() calls responding to qb command { bs >> qb; if (gDebug > 1 || (gDebug && !csep.isInternal())) - cout << "### For session id " << csep.sessionID() << ", got a command = " << qb << endl; + std::cout << "### For session id " << csep.sessionID() << ", got a command = " << qb << std::endl; if (qb == 0) { @@ -861,46 +832,46 @@ new_plan: { // UM just wants any table assert(swallowRows); - DeliveredTableMap::iterator iter = tm.begin(); + auto iter = tm.begin(); if (iter == tm.end()) { if (gDebug > 1 || (gDebug && !csep.isInternal())) - cout << "### For session id " << csep.sessionID() << ", returning end flag" << endl; + std::cout << "### For session id " << csep.sessionID() << ", returning end flag" << std::endl; bs.restart(); - bs << (ByteStream::byte)1; + bs << (messageqcpp::ByteStream::byte)1; fIos.write(bs); continue; } tableOID = iter->first; } - else if (qb == 3) //special option-UM wants job stats string + else if (qb == 3) //special option-UM wants job stats std::string { - string statsString; + std::string statsString; - //Log stats string to be sent back to front end + //Log stats std::string to be sent back to front end statsString = formatQueryStats( jl, "Query Stats", false, - !(csep.traceFlags() & CalpontSelectExecutionPlan::TRACE_TUPLE_OFF), - (csep.traceFlags() & CalpontSelectExecutionPlan::TRACE_LOG), + !(csep.traceFlags() & execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_OFF), + (csep.traceFlags() & execplan::CalpontSelectExecutionPlan::TRACE_LOG), totalRowCount ); bs.restart(); bs << statsString; - if ((csep.traceFlags() & CalpontSelectExecutionPlan::TRACE_LOG) != 0) + if ((csep.traceFlags() & execplan::CalpontSelectExecutionPlan::TRACE_LOG) != 0) { bs << jl->extendedInfo(); bs << prettyPrintMiniInfo(jl->miniInfo()); } else { - string empty; + std::string empty; bs << empty; bs << empty; } @@ -920,23 +891,23 @@ new_plan: else // (qb > 3) { //Return table bands for the requested tableOID - tableOID = static_cast(qb); + tableOID = static_cast(qb); } } catch (std::exception& ex) { - ostringstream errMsg; + std::ostringstream errMsg; errMsg << "ExeMgr: error writing qb response " "for qb cmd " << qb << "; " << ex.what(); - throw runtime_error( errMsg.str() ); + throw std::runtime_error( errMsg.str() ); } catch (...) { - ostringstream errMsg; + std::ostringstream errMsg; errMsg << "ExeMgr: unknown error writing qb response " "for qb cmd " << qb; - throw runtime_error( errMsg.str() ); + throw std::runtime_error( errMsg.str() ); } if (swallowRows) tm.erase(tableOID); @@ -957,7 +928,7 @@ new_plan: if (jl->status()) { - IDBErrorInfo* errInfo = IDBErrorInfo::instance(); + const auto errInfo = logging::IDBErrorInfo::instance(); if (jl->errMsg().length() != 0) bs << jl->errMsg(); @@ -967,7 +938,7 @@ new_plan: try // @bug2244: try/catch around fIos.write() calls projecting rows { - if (csep.traceFlags() & CalpontSelectExecutionPlan::TRACE_NO_ROWS3) + if (csep.traceFlags() & execplan::CalpontSelectExecutionPlan::TRACE_NO_ROWS3) { // Skip the write to the front end until the last empty band. Used to time queries // through without any front end waiting. @@ -982,7 +953,7 @@ new_plan: catch (std::exception& ex) { msgHandler.stop(); - ostringstream errMsg; + std::ostringstream errMsg; errMsg << "ExeMgr: error projecting rows " "for tableOID: " << tableOID << "; rowCnt: " << rowCount << @@ -1004,12 +975,12 @@ new_plan: return; } - //cout << "connection drop\n"; - throw runtime_error( errMsg.str() ); + //std::cout << "connection drop\n"; + throw std::runtime_error( errMsg.str() ); } catch (...) { - ostringstream errMsg; + std::ostringstream errMsg; msgHandler.stop(); errMsg << "ExeMgr: unknown error projecting rows " "for tableOID: " << @@ -1020,7 +991,7 @@ new_plan: while (rowCount) rowCount = jl->projectTable(tableOID, bs); - throw runtime_error( errMsg.str() ); + throw std::runtime_error( errMsg.str() ); } totalRowCount += rowCount; @@ -1051,20 +1022,20 @@ new_plan: if (needDbProfEndStatementMsg) { - string ss; - ostringstream prefix; + std::string ss; + std::ostringstream prefix; prefix << "ses:" << csep.sessionID() << " Query Totals"; - //Log stats string to standard out + //Log stats std::string to standard out ss = formatQueryStats( jl, prefix.str(), true, - !(csep.traceFlags() & CalpontSelectExecutionPlan::TRACE_TUPLE_OFF), - (csep.traceFlags() & CalpontSelectExecutionPlan::TRACE_LOG), + !(csep.traceFlags() & execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_OFF), + (csep.traceFlags() & execplan::CalpontSelectExecutionPlan::TRACE_LOG), totalRowCount); //@Bug 1306. Added timing info for real time tracking. - cout << ss << " at " << timeNow() << endl; + std::cout << ss << " at " << timeNow() << std::endl; // log query status to debug log file args.reset(); @@ -1078,7 +1049,7 @@ new_plan: args.add(fStats.fMsgBytesIn); args.add(fStats.fMsgBytesOut); args.add(fStats.fCPBlocksSkipped); - msgLog.logMessage(LOG_TYPE_DEBUG, + msgLog.logMessage(logging::LOG_TYPE_DEBUG, logDbProfQueryStats, args, li); @@ -1092,7 +1063,7 @@ new_plan: jl.reset(); args.reset(); args.add((int)csep.statementID()); - msgLog.logMessage(LOG_TYPE_DEBUG, + msgLog.logMessage(logging::LOG_TYPE_DEBUG, logDbProfEndStatement, args, li); @@ -1101,33 +1072,33 @@ new_plan: // delete sessionMemMap entry for this session's memory % use deleteMaxMemPct( csep.sessionID() ); - string endtime(timeNow()); + std::string endtime(timeNow()); if ((csep.traceFlags() & flagsWantOutput) && (csep.sessionID() < 0x80000000)) { - cout << "For session " << csep.sessionID() << ": " << + std::cout << "For session " << csep.sessionID() << ": " << totalBytesSent << - " bytes sent back at " << endtime << endl; + " bytes sent back at " << endtime << std::endl; // @bug 663 - Implemented caltraceon(16) to replace the // $FIFO_SINK compiler definition in pColStep. // This option consumes rows in the project steps. if (csep.traceFlags() & - CalpontSelectExecutionPlan::TRACE_NO_ROWS4) + execplan::CalpontSelectExecutionPlan::TRACE_NO_ROWS4) { - cout << endl; - cout << "**** No data returned to DM. Rows consumed " + std::cout << std::endl; + std::cout << "**** No data returned to DM. Rows consumed " "in ProjectSteps - caltrace(16) is on (FIFO_SINK)." - " ****" << endl; - cout << endl; + " ****" << std::endl; + std::cout << std::endl; } else if (csep.traceFlags() & - CalpontSelectExecutionPlan::TRACE_NO_ROWS3) + execplan::CalpontSelectExecutionPlan::TRACE_NO_ROWS3) { - cout << endl; - cout << "**** No data returned to DM - caltrace(8) is " - "on (SWALLOW_ROWS_EXEMGR). ****" << endl; - cout << endl; + std::cout << std::endl; + std::cout << "**** No data returned to DM - caltrace(8) is " + "on (SWALLOW_ROWS_EXEMGR). ****" << std::endl; + std::cout << std::endl; } } @@ -1136,7 +1107,7 @@ new_plan: if ( !csep.isInternal() && (csep.queryType() == "SELECT" || csep.queryType() == "INSERT_SELECT") ) { - qts.msg_type = QueryTeleStats::QT_SUMMARY; + qts.msg_type = querytele::QueryTeleStats::QT_SUMMARY; qts.max_mem_pct = fStats.fMaxMemPct; qts.num_files = fStats.fNumFiles; qts.phy_io = fStats.fPhyIO; @@ -1146,7 +1117,7 @@ new_plan: qts.msg_bytes_in = fStats.fMsgBytesIn; qts.msg_bytes_out = fStats.fMsgBytesOut; qts.rows = totalRowCount; - qts.end_time = QueryTeleClient::timeNowms(); + qts.end_time = querytele::QueryTeleClient::timeNowms(); qts.session_id = csep.sessionID(); qts.query_type = csep.queryType(); qts.query = csep.data(); @@ -1168,22 +1139,22 @@ new_plan: { decThreadCntPerSession( csep.sessionID() | 0x80000000 ); statementsRunningCount->decr(stmtCounted); - cerr << "### ExeMgr ses:" << csep.sessionID() << " caught: " << ex.what() << endl; - Message::Args args; - LoggingID li(16, csep.sessionID(), csep.txnID()); + std::cerr << "### ExeMgr ses:" << csep.sessionID() << " caught: " << ex.what() << std::endl; + logging::Message::Args args; + logging::LoggingID li(16, csep.sessionID(), csep.txnID()); args.add(ex.what()); - msgLog.logMessage(LOG_TYPE_CRITICAL, logExeMgrExcpt, args, li); + msgLog.logMessage(logging::LOG_TYPE_CRITICAL, logExeMgrExcpt, args, li); fIos.close(); } catch (...) { decThreadCntPerSession( csep.sessionID() | 0x80000000 ); statementsRunningCount->decr(stmtCounted); - cerr << "### Exception caught!" << endl; - Message::Args args; - LoggingID li(16, csep.sessionID(), csep.txnID()); + std::cerr << "### Exception caught!" << std::endl; + logging::Message::Args args; + logging::LoggingID li(16, csep.sessionID(), csep.txnID()); args.add("ExeMgr caught unknown exception"); - msgLog.logMessage(LOG_TYPE_CRITICAL, logExeMgrExcpt, args, li); + msgLog.logMessage(logging::LOG_TYPE_CRITICAL, logExeMgrExcpt, args, li); fIos.close(); } } @@ -1208,41 +1179,42 @@ public: { if (fMaxPct >= 95) { - cerr << "Too much memory allocated!" << endl; - Message::Args args; + std::cerr << "Too much memory allocated!" << std::endl; + logging::Message::Args args; args.add((int)pct); args.add((int)fMaxPct); - msgLog.logMessage(LOG_TYPE_CRITICAL, logRssTooBig, args, LoggingID(16)); + msgLog.logMessage(logging::LOG_TYPE_CRITICAL, logRssTooBig, args, logging::LoggingID(16)); exit(1); } if (statementsRunningCount->cur() == 0) { - cerr << "Too much memory allocated!" << endl; - Message::Args args; + std::cerr << "Too much memory allocated!" << std::endl; + logging::Message::Args args; args.add((int)pct); args.add((int)fMaxPct); - msgLog.logMessage(LOG_TYPE_WARNING, logRssTooBig, args, LoggingID(16)); + msgLog.logMessage(logging::LOG_TYPE_WARNING, logRssTooBig, args, logging::LoggingID(16)); exit(1); } - cerr << "Too much memory allocated, but stmts running" << endl; + std::cerr << "Too much memory allocated, but stmts running" << std::endl; } // Update sessionMemMap entries lower than current mem % use - mutex::scoped_lock lk(sessionMemMapMutex); - - for ( SessionMemMap_t::iterator mapIter = sessionMemMap.begin(); - mapIter != sessionMemMap.end(); - ++mapIter ) { - if ( pct > mapIter->second ) - { - mapIter->second = pct; - } - } + std::lock_guard lk(sessionMemMapMutex); - lk.unlock(); + for (SessionMemMap_t::iterator mapIter = sessionMemMap.begin(); + mapIter != sessionMemMap.end(); + ++mapIter) + { + if (pct > mapIter->second) + { + mapIter->second = pct; + } + } + + } pause_(); } @@ -1263,14 +1235,14 @@ void added_a_pm(int) logging::Message msg(1); args1.add("exeMgr caught SIGHUP. Resetting connections"); msg.format( args1 ); - cout << msg.msg().c_str() << endl; + std::cout << msg.msg().c_str() << std::endl; logging::Logger logger(logid.fSubsysID); logger.logMessage(logging::LOG_TYPE_DEBUG, msg, logid); if (ec) { //set BUSY_INIT state while processing the add pm configuration change - Oam oam; + oam::Oam oam; try { @@ -1296,7 +1268,7 @@ void added_a_pm(int) void printTotalUmMemory(int sig) { int64_t num = rm->availableMemory(); - cout << "Total UM memory available: " << num << endl; + std::cout << "Total UM memory available: " << num << std::endl; } void setupSignalHandlers() @@ -1325,9 +1297,9 @@ void setupSignalHandlers() #endif } -void setupCwd(ResourceManager* rm) +void setupCwd(joblist::ResourceManager* rm) { - string workdir = rm->getScWorkingDir(); + std::string workdir = rm->getScWorkingDir(); (void)chdir(workdir.c_str()); if (access(".", W_OK) != 0) @@ -1376,9 +1348,9 @@ int setupResources() void cleanTempDir() { - config::Config* config = config::Config::makeConfig(); - string allowDJS = config->getConfig("HashJoin", "AllowDiskBasedJoin"); - string tmpPrefix = config->getConfig("HashJoin", "TempFilePath"); + const auto config = config::Config::makeConfig(); + std::string allowDJS = config->getConfig("HashJoin", "AllowDiskBasedJoin"); + std::string tmpPrefix = config->getConfig("HashJoin", "TempFilePath"); if (allowDJS == "N" || allowDJS == "n") return; @@ -1393,31 +1365,31 @@ void cleanTempDir() /* This is quite scary as ExeMgr usually runs as root */ try { - boost::filesystem::remove_all(tmpPrefix); - boost::filesystem::create_directories(tmpPrefix); + std::experimental::filesystem::remove_all(tmpPrefix); + std::experimental::filesystem::create_directories(tmpPrefix); } - catch (std::exception& ex) + catch (const std::exception& ex) { - cerr << ex.what() << endl; - LoggingID logid(16, 0, 0); - Message::Args args; - Message message(8); + std::cerr << ex.what() << std::endl; + logging::LoggingID logid(16, 0, 0); + logging::Message::Args args; + logging::Message message(8); args.add("Execption whilst cleaning tmpdir: "); args.add(ex.what()); message.format( args ); logging::Logger logger(logid.fSubsysID); - logger.logMessage(LOG_TYPE_WARNING, message, logid); + logger.logMessage(logging::LOG_TYPE_WARNING, message, logid); } catch (...) { - cerr << "Caught unknown exception during tmpdir cleanup" << endl; - LoggingID logid(16, 0, 0); - Message::Args args; - Message message(8); + std::cerr << "Caught unknown exception during tmpdir cleanup" << std::endl; + logging::LoggingID logid(16, 0, 0); + logging::Message::Args args; + logging::Message message(8); args.add("Unknown execption whilst cleaning tmpdir"); message.format( args ); logging::Logger logger(logid.fSubsysID); - logger.logMessage(LOG_TYPE_WARNING, message, logid); + logger.logMessage(logging::LOG_TYPE_WARNING, message, logid); } } @@ -1425,7 +1397,7 @@ void cleanTempDir() int main(int argc, char* argv[]) { // get and set locale language - string systemLang = "C"; + std::string systemLang = "C"; systemLang = funcexp::utf8::idb_setlocale(); // This is unset due to the way we start it @@ -1455,7 +1427,7 @@ int main(int argc, char* argv[]) //set BUSY_INIT state { - Oam oam; + oam::Oam oam; try { @@ -1479,7 +1451,7 @@ int main(int argc, char* argv[]) int err = 0; if (!gDebug) err = setupResources(); - string errMsg; + std::string errMsg; switch (err) { @@ -1502,7 +1474,7 @@ int main(int argc, char* argv[]) if (err < 0) { - Oam oam; + oam::Oam oam; logging::Message::Args args; logging::Message message; args.add( errMsg ); @@ -1510,7 +1482,7 @@ int main(int argc, char* argv[]) logging::LoggingID lid(16); logging::MessageLog ml(lid); ml.logCriticalMessage( message ); - cerr << errMsg << endl; + std::cerr << errMsg << std::endl; try { @@ -1528,23 +1500,23 @@ int main(int argc, char* argv[]) cleanTempDir(); - MsgMap msgMap; - msgMap[logDefaultMsg] = Message(logDefaultMsg); - msgMap[logDbProfStartStatement] = Message(logDbProfStartStatement); - msgMap[logDbProfEndStatement] = Message(logDbProfEndStatement); - msgMap[logStartSql] = Message(logStartSql); - msgMap[logEndSql] = Message(logEndSql); - msgMap[logRssTooBig] = Message(logRssTooBig); - msgMap[logDbProfQueryStats] = Message(logDbProfQueryStats); - msgMap[logExeMgrExcpt] = Message(logExeMgrExcpt); + logging::MsgMap msgMap; + msgMap[logDefaultMsg] = logging::Message(logDefaultMsg); + msgMap[logDbProfStartStatement] = logging::Message(logDbProfStartStatement); + msgMap[logDbProfEndStatement] = logging::Message(logDbProfEndStatement); + msgMap[logStartSql] = logging::Message(logStartSql); + msgMap[logEndSql] = logging::Message(logEndSql); + msgMap[logRssTooBig] = logging::Message(logRssTooBig); + msgMap[logDbProfQueryStats] = logging::Message(logDbProfQueryStats); + msgMap[logExeMgrExcpt] = logging::Message(logExeMgrExcpt); msgLog.msgMap(msgMap); - ec = DistributedEngineComm::instance(rm, true); + ec = joblist::DistributedEngineComm::instance(rm, true); ec->Open(); bool tellUser = true; - MessageQueueServer* mqs; + messageqcpp::MessageQueueServer* mqs; statementsRunningCount = new ActiveStatementCounter(rm->getEmExecQueueSize()); @@ -1552,18 +1524,18 @@ int main(int argc, char* argv[]) { try { - mqs = new MessageQueueServer(ExeMgr, rm->getConfig(), ByteStream::BlockSize, 64); + mqs = new messageqcpp::MessageQueueServer(ExeMgr, rm->getConfig(), messageqcpp::ByteStream::BlockSize, 64); break; } - catch (runtime_error& re) + catch (std::runtime_error& re) { - string what = re.what(); + std::string what = re.what(); - if (what.find("Address already in use") != string::npos) + if (what.find("Address already in use") != std::string::npos) { if (tellUser) { - cerr << "Address already in use, retrying..." << endl; + std::cerr << "Address already in use, retrying..." << std::endl; tellUser = false; } @@ -1581,13 +1553,13 @@ int main(int argc, char* argv[]) // because rm has a "isExeMgr" flag that is set upon creation (rm is a singleton). // From the pools perspective, it has no idea if it is ExeMgr doing the // creation, so it has no idea which way to set the flag. So we set the max here. - JobStep::jobstepThreadPool.setMaxThreads(rm->getJLThreadPoolSize()); - JobStep::jobstepThreadPool.setName("ExeMgrJobList"); + joblist::JobStep::jobstepThreadPool.setMaxThreads(rm->getJLThreadPoolSize()); + joblist::JobStep::jobstepThreadPool.setName("ExeMgrJobList"); if (rm->getJlThreadPoolDebug() == "Y" || rm->getJlThreadPoolDebug() == "y") { - JobStep::jobstepThreadPool.setDebug(true); - JobStep::jobstepThreadPool.invoke(ThreadPoolMonitor(&JobStep::jobstepThreadPool)); + joblist::JobStep::jobstepThreadPool.setDebug(true); + joblist::JobStep::jobstepThreadPool.invoke(threadpool::ThreadPoolMonitor(&joblist::JobStep::jobstepThreadPool)); } int serverThreads = rm->getEmServerThreads(); @@ -1605,7 +1577,7 @@ int main(int argc, char* argv[]) setpriority(PRIO_PROCESS, 0, priority); #endif - string teleServerHost(rm->getConfig()->getConfig("QueryTele", "Host")); + std::string teleServerHost(rm->getConfig()->getConfig("QueryTele", "Host")); if (!teleServerHost.empty()) { @@ -1618,13 +1590,13 @@ int main(int argc, char* argv[]) } } - cout << "Starting ExeMgr: st = " << serverThreads << + std::cout << "Starting ExeMgr: st = " << serverThreads << ", qs = " << rm->getEmExecQueueSize() << ", mx = " << maxPct << ", cf = " << - rm->getConfig()->configFile() << endl; + rm->getConfig()->configFile() << std::endl; //set ACTIVE state { - Oam oam; + oam::Oam oam; try { @@ -1646,12 +1618,12 @@ int main(int argc, char* argv[]) if (rm->getExeMgrThreadPoolDebug() == "Y" || rm->getExeMgrThreadPoolDebug() == "y") { exeMgrThreadPool.setDebug(true); - exeMgrThreadPool.invoke(ThreadPoolMonitor(&exeMgrThreadPool)); + exeMgrThreadPool.invoke(threadpool::ThreadPoolMonitor(&exeMgrThreadPool)); } for (;;) { - IOSocket ios; + messageqcpp::IOSocket ios; ios = mqs->accept(); exeMgrThreadPool.invoke(SessionThread(ios, ec, rm)); } diff --git a/oamapps/columnstoreDB/columnstoreDB.cpp b/oamapps/columnstoreDB/columnstoreDB.cpp index 25c06d140..58a7e375f 100644 --- a/oamapps/columnstoreDB/columnstoreDB.cpp +++ b/oamapps/columnstoreDB/columnstoreDB.cpp @@ -23,6 +23,7 @@ /** * @file */ +#include //cxx11test #include #include diff --git a/oamapps/columnstoreSupport/columnstoreSupport.cpp b/oamapps/columnstoreSupport/columnstoreSupport.cpp index ccf7714c4..87adb28f7 100644 --- a/oamapps/columnstoreSupport/columnstoreSupport.cpp +++ b/oamapps/columnstoreSupport/columnstoreSupport.cpp @@ -10,6 +10,7 @@ /** * @file */ +#include //cxx11test #include #include diff --git a/oamapps/mcsadmin/mcsadmin.cpp b/oamapps/mcsadmin/mcsadmin.cpp index d07c67ffb..6b951133b 100644 --- a/oamapps/mcsadmin/mcsadmin.cpp +++ b/oamapps/mcsadmin/mcsadmin.cpp @@ -21,6 +21,7 @@ * $Id: mcsadmin.cpp 3110 2013-06-20 18:09:12Z dhill $ * ******************************************************************************************/ +#include //cxx11test #include #include diff --git a/oamapps/postConfigure/getMySQLpw.cpp b/oamapps/postConfigure/getMySQLpw.cpp index fdc6a6759..0073175bf 100644 --- a/oamapps/postConfigure/getMySQLpw.cpp +++ b/oamapps/postConfigure/getMySQLpw.cpp @@ -24,6 +24,7 @@ /** * @file */ +#include //cxx11test #include #include diff --git a/oamapps/postConfigure/helpers.cpp b/oamapps/postConfigure/helpers.cpp index 3238f9c57..e020ff7bc 100644 --- a/oamapps/postConfigure/helpers.cpp +++ b/oamapps/postConfigure/helpers.cpp @@ -348,8 +348,8 @@ int sendUpgradeRequest(int IserverTypeInstall, bool pmwithum) std::cerr << exc.what() << std::endl; } - ByteStream msg; - ByteStream::byte requestID = RUNUPGRADE; + messageqcpp::ByteStream msg; + messageqcpp::ByteStream::byte requestID = RUNUPGRADE; msg << requestID; @@ -484,8 +484,8 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm if ( (*pt).DeviceName == masterModule ) { // set for Master MySQL DB distrubution to slaves - ByteStream msg1; - ByteStream::byte requestID = oam::MASTERDIST; + messageqcpp::ByteStream msg1; + messageqcpp::ByteStream::byte requestID = oam::MASTERDIST; msg1 << requestID; msg1 << password; msg1 << "all"; // dist to all slave modules @@ -499,7 +499,7 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm } // set for master repl request - ByteStream msg; + messageqcpp::ByteStream msg; requestID = oam::MASTERREP; msg << requestID; @@ -527,8 +527,8 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm continue; } - ByteStream msg; - ByteStream::byte requestID = oam::SLAVEREP; + messageqcpp::ByteStream msg; + messageqcpp::ByteStream::byte requestID = oam::SLAVEREP; msg << requestID; if ( masterLogFile == oam::UnassignedName || @@ -574,7 +574,7 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm * purpose: Sends a Msg to ProcMon * ******************************************************************************************/ -int sendMsgProcMon( std::string module, ByteStream msg, int requestID, int timeout ) +int sendMsgProcMon( std::string module, messageqcpp::ByteStream msg, int requestID, int timeout ) { string msgPort = module + "_ProcessMonitor"; int returnStatus = API_FAILURE; @@ -602,16 +602,16 @@ int sendMsgProcMon( std::string module, ByteStream msg, int requestID, int timeo try { - MessageQueueClient mqRequest(msgPort); + messageqcpp::MessageQueueClient mqRequest(msgPort); mqRequest.write(msg); if ( timeout > 0 ) { // wait for response - ByteStream::byte returnACK; - ByteStream::byte returnRequestID; - ByteStream::byte requestStatus; - ByteStream receivedMSG; + messageqcpp::ByteStream::byte returnACK; + messageqcpp::ByteStream::byte returnRequestID; + messageqcpp::ByteStream::byte requestStatus; + messageqcpp::ByteStream receivedMSG; struct timespec ts = { timeout, 0 }; diff --git a/oamapps/postConfigure/helpers.h b/oamapps/postConfigure/helpers.h index 5f7b1631a..8eb23bce0 100644 --- a/oamapps/postConfigure/helpers.h +++ b/oamapps/postConfigure/helpers.h @@ -21,7 +21,7 @@ #include "liboamcpp.h" -using namespace messageqcpp; + namespace installer { @@ -37,7 +37,7 @@ typedef std::vector ChildModuleList; extern bool waitForActive(); extern void dbrmDirCheck(); extern void mysqlSetup(); -extern int sendMsgProcMon( std::string module, ByteStream msg, int requestID, int timeout ); +extern int sendMsgProcMon( std::string module, messageqcpp::ByteStream msg, int requestID, int timeout ); extern int sendUpgradeRequest(int IserverTypeInstall, bool pmwithum = false); extern int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pmwithum); extern void checkFilesPerPartion(int DBRootCount, Config* sysConfig); diff --git a/oamapps/postConfigure/installer.cpp b/oamapps/postConfigure/installer.cpp index 81b69e548..075870275 100644 --- a/oamapps/postConfigure/installer.cpp +++ b/oamapps/postConfigure/installer.cpp @@ -27,6 +27,7 @@ /** * @file */ +#include //cxx11test #include #include diff --git a/oamapps/postConfigure/mycnfUpgrade.cpp b/oamapps/postConfigure/mycnfUpgrade.cpp index 7f785153e..e42a9b64f 100644 --- a/oamapps/postConfigure/mycnfUpgrade.cpp +++ b/oamapps/postConfigure/mycnfUpgrade.cpp @@ -25,6 +25,7 @@ /** * @file */ +#include //cxx11test #include #include diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index fdfc1482c..a115104e5 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -29,6 +29,7 @@ /** * @file */ +#include //cxx11test #include #include diff --git a/oamapps/serverMonitor/serverMonitor.cpp b/oamapps/serverMonitor/serverMonitor.cpp index 99d0fb04a..f9a468569 100644 --- a/oamapps/serverMonitor/serverMonitor.cpp +++ b/oamapps/serverMonitor/serverMonitor.cpp @@ -21,6 +21,7 @@ * * Author: David Hill ***************************************************************************/ +#include //cxx11test #include "serverMonitor.h" #include "installdir.h" diff --git a/primitives/primproc/dictstep.h b/primitives/primproc/dictstep.h index 1652ec8f3..025658d5b 100644 --- a/primitives/primproc/dictstep.h +++ b/primitives/primproc/dictstep.h @@ -138,7 +138,7 @@ private: int64_t* values; boost::scoped_array* strValues; int compressionType; - ByteStream filterString; + messageqcpp::ByteStream filterString; uint32_t filterCount; uint32_t bufferSize; uint16_t inputRidCount; diff --git a/primitives/primproc/primproc.cpp b/primitives/primproc/primproc.cpp index 2e88493a0..3df972ac1 100644 --- a/primitives/primproc/primproc.cpp +++ b/primitives/primproc/primproc.cpp @@ -21,6 +21,8 @@ * * ***********************************************************************/ +#include //cxx11test + #include #include #include diff --git a/primitives/primproc/umsocketselector.cpp b/primitives/primproc/umsocketselector.cpp index 574e23e56..5fa76f3bc 100644 --- a/primitives/primproc/umsocketselector.cpp +++ b/primitives/primproc/umsocketselector.cpp @@ -243,7 +243,7 @@ UmSocketSelector::addConnection( // ioSock (in) - socket/port connection to be deleted //------------------------------------------------------------------------------ void -UmSocketSelector::delConnection( const IOSocket& ios ) +UmSocketSelector::delConnection( const messageqcpp::IOSocket& ios ) { sockaddr sa = ios.sa(); const sockaddr_in* sinp = reinterpret_cast(&sa); @@ -271,7 +271,7 @@ UmSocketSelector::delConnection( const IOSocket& ios ) //------------------------------------------------------------------------------ bool UmSocketSelector::nextIOSocket( - const IOSocket& ios, + const messageqcpp::IOSocket& ios, SP_UM_IOSOCK& outIos, SP_UM_MUTEX& writeLock ) { @@ -405,7 +405,7 @@ UmModuleIPs::addSocketConn( // ioSock (in) - socket/port connection to be deleted //------------------------------------------------------------------------------ void -UmModuleIPs::delSocketConn( const IOSocket& ioSock ) +UmModuleIPs::delSocketConn( const messageqcpp::IOSocket& ioSock ) { boost::mutex::scoped_lock lock( fUmModuleMutex ); @@ -565,7 +565,7 @@ UmIPSocketConns::addSocketConn( // can benefit from quick random access. //------------------------------------------------------------------------------ void -UmIPSocketConns::delSocketConn( const IOSocket& ioSock ) +UmIPSocketConns::delSocketConn( const messageqcpp::IOSocket& ioSock ) { for (unsigned int i = 0; i < fIOSockets.size(); ++i) { diff --git a/primitives/primproc/umsocketselector.h b/primitives/primproc/umsocketselector.h index 0affabec8..c5be55be8 100644 --- a/primitives/primproc/umsocketselector.h +++ b/primitives/primproc/umsocketselector.h @@ -52,8 +52,6 @@ typedef uint32_t in_addr_t; #include "iosocket.h" -using namespace messageqcpp; - namespace primitiveprocessor { class UmModuleIPs; @@ -61,7 +59,7 @@ class UmIPSocketConns; typedef boost::shared_ptr SP_UM_MODIPS; typedef boost::shared_ptr SP_UM_IPCONNS; -typedef boost::shared_ptr SP_UM_IOSOCK; +typedef boost::shared_ptr SP_UM_IOSOCK; typedef boost::shared_ptr SP_UM_MUTEX; //------------------------------------------------------------------------------ @@ -116,7 +114,7 @@ public: * * @param ios (in) socket/port connection to be removed. */ - void delConnection( const IOSocket& ios ); + void delConnection( const messageqcpp::IOSocket& ios ); /** @brief Get the next output IOSocket to use for the specified ios. * @@ -125,7 +123,7 @@ public: * @param writeLock (out) mutex to use when writing to outIos. * @return boolean indicating if operation was successful. */ - bool nextIOSocket( const IOSocket& ios, SP_UM_IOSOCK& outIos, + bool nextIOSocket( const messageqcpp::IOSocket& ios, SP_UM_IOSOCK& outIos, SP_UM_MUTEX& writeLock ); /** @brief toString method used in logging, debugging, etc. @@ -217,7 +215,7 @@ public: * * @param ioSock (in) socket/port to delete from the connection list. */ - void delSocketConn ( const IOSocket& ioSock ); + void delSocketConn ( const messageqcpp::IOSocket& ioSock ); /** @brief Get the "next" available socket/port for this UM module. * @@ -311,7 +309,7 @@ public: * * @param ioSock (in) socket/port to delete from the connection list. */ - void delSocketConn ( const IOSocket& ioSock ); + void delSocketConn ( const messageqcpp::IOSocket& ioSock ); /** @brief Get the "next" available socket/port for this IP address. * diff --git a/procmgr/main.cpp b/procmgr/main.cpp index c81f5fd69..54529ae0a 100644 --- a/procmgr/main.cpp +++ b/procmgr/main.cpp @@ -21,6 +21,7 @@ * $Id: main.cpp 2203 2013-07-08 16:50:51Z bpaul $ * *****************************************************************************************/ +#include //cxx11test #include diff --git a/procmon/main.cpp b/procmon/main.cpp index 0d2d2ab4a..37afe274c 100644 --- a/procmon/main.cpp +++ b/procmon/main.cpp @@ -15,6 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include //cxx11test #include #include diff --git a/tools/clearShm/main.cpp b/tools/clearShm/main.cpp index e883bc0f6..e80a8c79d 100644 --- a/tools/clearShm/main.cpp +++ b/tools/clearShm/main.cpp @@ -16,6 +16,7 @@ MA 02110-1301, USA. */ // $Id: main.cpp 2101 2013-01-21 14:12:52Z rdempsey $ +#include //cxx11test #include "config.h" @@ -46,7 +47,7 @@ namespace bool vFlg; bool nFlg; -mutex coutMutex; +std::mutex coutMutex; void shmDoit(key_t shm_key, const string& label) { @@ -61,7 +62,7 @@ void shmDoit(key_t shm_key, const string& label) bi::read_only); bi::offset_t memSize = 0; memObj.get_size(memSize); - mutex::scoped_lock lk(coutMutex); + std::lock_guard lk(coutMutex); cout << label << ": shm_key: " << shm_key << "; key_name: " << key_name << "; size: " << memSize << endl; @@ -102,7 +103,7 @@ void semDoit(key_t sem_key, const string& label) bi::read_only); bi::offset_t memSize = 0; memObj.get_size(memSize); - mutex::scoped_lock lk(coutMutex); + std::lock_guard lk(coutMutex); cout << label << ": sem_key: " << sem_key << "; key_name: " << key_name << "; size: " << memSize << endl; diff --git a/tools/cleartablelock/cleartablelock.cpp b/tools/cleartablelock/cleartablelock.cpp index a18148343..cb22cb343 100644 --- a/tools/cleartablelock/cleartablelock.cpp +++ b/tools/cleartablelock/cleartablelock.cpp @@ -18,6 +18,7 @@ /* * $Id: cleartablelock.cpp 2336 2013-06-25 19:11:36Z rdempsey $ */ +#include //cxx11test #include #include diff --git a/tools/configMgt/autoConfigure.cpp b/tools/configMgt/autoConfigure.cpp index 85702952a..fbd5d739a 100644 --- a/tools/configMgt/autoConfigure.cpp +++ b/tools/configMgt/autoConfigure.cpp @@ -28,6 +28,7 @@ /** * @file */ +#include //cxx11test #include #include diff --git a/tools/configMgt/autoInstaller.cpp b/tools/configMgt/autoInstaller.cpp index 15ac98c33..e3699449e 100644 --- a/tools/configMgt/autoInstaller.cpp +++ b/tools/configMgt/autoInstaller.cpp @@ -28,6 +28,7 @@ /** * @file */ +#include //cxx11test #include #include diff --git a/tools/configMgt/svnQuery.cpp b/tools/configMgt/svnQuery.cpp index 1aaee0117..c1de2c065 100644 --- a/tools/configMgt/svnQuery.cpp +++ b/tools/configMgt/svnQuery.cpp @@ -24,6 +24,7 @@ /** * @file */ +#include //cxx11test #include #include diff --git a/tools/cplogger/main.cpp b/tools/cplogger/main.cpp index 0f1b1e32e..4d45cd527 100644 --- a/tools/cplogger/main.cpp +++ b/tools/cplogger/main.cpp @@ -16,6 +16,7 @@ MA 02110-1301, USA. */ // $Id: main.cpp 2336 2013-06-25 19:11:36Z rdempsey $ +#include //cxx11test #include #include #include diff --git a/tools/dbbuilder/dbbuilder.cpp b/tools/dbbuilder/dbbuilder.cpp index aec094b89..6f62eeb0a 100644 --- a/tools/dbbuilder/dbbuilder.cpp +++ b/tools/dbbuilder/dbbuilder.cpp @@ -19,6 +19,7 @@ * $Id: dbbuilder.cpp 2101 2013-01-21 14:12:52Z rdempsey $ * *******************************************************************************/ +#include //cxx11test #include #include #include diff --git a/tools/dbloadxml/colxml.cpp b/tools/dbloadxml/colxml.cpp index 00171ffc0..4e359c599 100644 --- a/tools/dbloadxml/colxml.cpp +++ b/tools/dbloadxml/colxml.cpp @@ -19,6 +19,7 @@ * $Id: colxml.cpp 2237 2013-05-05 23:42:37Z dcathey $ * ******************************************************************************/ +#include //cxx11test #include diff --git a/tools/ddlcleanup/ddlcleanup.cpp b/tools/ddlcleanup/ddlcleanup.cpp index f09e50d7a..9924f91be 100644 --- a/tools/ddlcleanup/ddlcleanup.cpp +++ b/tools/ddlcleanup/ddlcleanup.cpp @@ -18,6 +18,7 @@ /* * $Id: ddlcleanup.cpp 967 2009-10-15 13:57:29Z rdempsey $ */ +#include //cxx11test #include #include diff --git a/tools/editem/editem.cpp b/tools/editem/editem.cpp index 12ff29221..81c34c407 100644 --- a/tools/editem/editem.cpp +++ b/tools/editem/editem.cpp @@ -18,6 +18,7 @@ /* * $Id: editem.cpp 2336 2013-06-25 19:11:36Z rdempsey $ */ +#include //cxx11test #include #include diff --git a/tools/getConfig/main.cpp b/tools/getConfig/main.cpp index 87e5ed724..e895f603b 100644 --- a/tools/getConfig/main.cpp +++ b/tools/getConfig/main.cpp @@ -19,6 +19,7 @@ * $Id: main.cpp 2101 2013-01-21 14:12:52Z rdempsey $ * *****************************************************************************/ +#include //cxx11test #include #include #include diff --git a/tools/idbmeminfo/idbmeminfo.cpp b/tools/idbmeminfo/idbmeminfo.cpp index b0be99d35..4c84403a3 100644 --- a/tools/idbmeminfo/idbmeminfo.cpp +++ b/tools/idbmeminfo/idbmeminfo.cpp @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include //cxx11test #ifdef _MSC_VER #define WIN32_LEAN_AND_MEAN diff --git a/tools/setConfig/main.cpp b/tools/setConfig/main.cpp index d74d51ed9..fb66c9bc7 100644 --- a/tools/setConfig/main.cpp +++ b/tools/setConfig/main.cpp @@ -19,6 +19,7 @@ * $Id: main.cpp 210 2007-06-08 17:08:26Z rdempsey $ * *****************************************************************************/ +#include //cxx11test #include #include #include diff --git a/tools/viewtablelock/viewtablelock.cpp b/tools/viewtablelock/viewtablelock.cpp index cec87cfec..6d163e3e5 100644 --- a/tools/viewtablelock/viewtablelock.cpp +++ b/tools/viewtablelock/viewtablelock.cpp @@ -18,6 +18,7 @@ /* * $Id: viewtablelock.cpp 2101 2013-01-21 14:12:52Z rdempsey $ */ +#include //cxx11test #include #include diff --git a/utils/funcexp/func_date.cpp b/utils/funcexp/func_date.cpp index 7fc990ab6..719b068df 100644 --- a/utils/funcexp/func_date.cpp +++ b/utils/funcexp/func_date.cpp @@ -56,8 +56,8 @@ int64_t Func_date::getIntVal(rowgroup::Row& row, string value = ""; - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; switch (type) { @@ -79,7 +79,7 @@ int64_t Func_date::getIntVal(rowgroup::Row& row, case CalpontSystemCatalog::TIME: { int64_t val; - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aTime.day = 0; aDateTime.hour = 0; diff --git a/utils/funcexp/func_day.cpp b/utils/funcexp/func_day.cpp index 7ff2bab9a..6adfc9c25 100644 --- a/utils/funcexp/func_day.cpp +++ b/utils/funcexp/func_day.cpp @@ -49,8 +49,8 @@ int64_t Func_day::getIntVal(rowgroup::Row& row, { int64_t val = 0; - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; switch (parm[0]->data()->resultType().colDataType) { @@ -64,7 +64,7 @@ int64_t Func_day::getIntVal(rowgroup::Row& row, // Time adds to now() and then gets value case CalpontSystemCatalog::TIME: - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aTime.day = 0; val = addTime(aDateTime, aTime); diff --git a/utils/funcexp/func_dayname.cpp b/utils/funcexp/func_dayname.cpp index 5da6d8943..15933080e 100644 --- a/utils/funcexp/func_dayname.cpp +++ b/utils/funcexp/func_dayname.cpp @@ -54,8 +54,8 @@ int64_t Func_dayname::getIntVal(rowgroup::Row& row, int64_t val = 0; int32_t dayofweek = 0; - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; switch (parm[0]->data()->resultType().colDataType) { @@ -75,7 +75,7 @@ int64_t Func_dayname::getIntVal(rowgroup::Row& row, // Time adds to now() and then gets value case CalpontSystemCatalog::TIME: - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aTime.day = 0; val = addTime(aDateTime, aTime); diff --git a/utils/funcexp/func_dayofweek.cpp b/utils/funcexp/func_dayofweek.cpp index ec84f5738..e9cb9f0e4 100644 --- a/utils/funcexp/func_dayofweek.cpp +++ b/utils/funcexp/func_dayofweek.cpp @@ -52,8 +52,8 @@ int64_t Func_dayofweek::getIntVal(rowgroup::Row& row, uint32_t day = 0; int64_t val = 0; - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; switch (parm[0]->data()->resultType().colDataType) { @@ -73,7 +73,7 @@ int64_t Func_dayofweek::getIntVal(rowgroup::Row& row, // Time adds to now() and then gets value case CalpontSystemCatalog::TIME: - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aTime.day = 0; val = addTime(aDateTime, aTime); diff --git a/utils/funcexp/func_dayofyear.cpp b/utils/funcexp/func_dayofyear.cpp index ee3b9cf30..782e7e1af 100644 --- a/utils/funcexp/func_dayofyear.cpp +++ b/utils/funcexp/func_dayofyear.cpp @@ -52,8 +52,8 @@ int64_t Func_dayofyear::getIntVal(rowgroup::Row& row, uint32_t day = 0; int64_t val = 0; - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; switch (parm[0]->data()->resultType().colDataType) { @@ -73,7 +73,7 @@ int64_t Func_dayofyear::getIntVal(rowgroup::Row& row, // Time adds to now() and then gets value case CalpontSystemCatalog::TIME: - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aTime.day = 0; val = addTime(aDateTime, aTime); diff --git a/utils/funcexp/func_month.cpp b/utils/funcexp/func_month.cpp index 5479270d0..e11cee296 100644 --- a/utils/funcexp/func_month.cpp +++ b/utils/funcexp/func_month.cpp @@ -48,8 +48,8 @@ int64_t Func_month::getIntVal(rowgroup::Row& row, CalpontSystemCatalog::ColType& op_ct) { int64_t val = 0; - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; switch (parm[0]->data()->resultType().colDataType) { @@ -63,7 +63,7 @@ int64_t Func_month::getIntVal(rowgroup::Row& row, // Time adds to now() and then gets value case CalpontSystemCatalog::TIME: - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aTime.day = 0; val = addTime(aDateTime, aTime); diff --git a/utils/funcexp/func_monthname.cpp b/utils/funcexp/func_monthname.cpp index 9657b1ea2..70bba26e0 100644 --- a/utils/funcexp/func_monthname.cpp +++ b/utils/funcexp/func_monthname.cpp @@ -79,8 +79,8 @@ int64_t Func_monthname::getIntVal(rowgroup::Row& row, CalpontSystemCatalog::ColType& op_ct) { int64_t val = 0; - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; switch (parm[0]->data()->resultType().colDataType) { @@ -94,7 +94,7 @@ int64_t Func_monthname::getIntVal(rowgroup::Row& row, // Time adds to now() and then gets value case CalpontSystemCatalog::TIME: - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aTime.day = 0; val = addTime(aDateTime, aTime); diff --git a/utils/funcexp/func_quarter.cpp b/utils/funcexp/func_quarter.cpp index 78559d68d..4f476e2ff 100644 --- a/utils/funcexp/func_quarter.cpp +++ b/utils/funcexp/func_quarter.cpp @@ -50,8 +50,8 @@ int64_t Func_quarter::getIntVal(rowgroup::Row& row, { // try to cast to date/datetime int64_t val = 0, month = 0; - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; switch (parm[0]->data()->resultType().colDataType) { @@ -67,7 +67,7 @@ int64_t Func_quarter::getIntVal(rowgroup::Row& row, // Time adds to now() and then gets value case CalpontSystemCatalog::TIME: - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aTime.day = 0; val = addTime(aDateTime, aTime); diff --git a/utils/funcexp/func_to_days.cpp b/utils/funcexp/func_to_days.cpp index f16642958..33f72b22d 100644 --- a/utils/funcexp/func_to_days.cpp +++ b/utils/funcexp/func_to_days.cpp @@ -59,8 +59,8 @@ int64_t Func_to_days::getIntVal(rowgroup::Row& row, month = 0, day = 0; - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; switch (type) { @@ -89,7 +89,7 @@ int64_t Func_to_days::getIntVal(rowgroup::Row& row, case CalpontSystemCatalog::TIME: { int64_t val; - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aDateTime.hour = 0; aDateTime.minute = 0; diff --git a/utils/funcexp/func_week.cpp b/utils/funcexp/func_week.cpp index a9e47bd4b..ec6131b26 100644 --- a/utils/funcexp/func_week.cpp +++ b/utils/funcexp/func_week.cpp @@ -53,8 +53,8 @@ int64_t Func_week::getIntVal(rowgroup::Row& row, int64_t val = 0; int16_t mode = 0; - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; if (parm.size() > 1) // mode value mode = parm[1]->data()->getIntVal(row, isNull); @@ -77,7 +77,7 @@ int64_t Func_week::getIntVal(rowgroup::Row& row, // Time adds to now() and then gets value case CalpontSystemCatalog::TIME: - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aTime.day = 0; val = addTime(aDateTime, aTime); diff --git a/utils/funcexp/func_weekday.cpp b/utils/funcexp/func_weekday.cpp index 9666710f5..6b5c1f55d 100644 --- a/utils/funcexp/func_weekday.cpp +++ b/utils/funcexp/func_weekday.cpp @@ -52,8 +52,8 @@ int64_t Func_weekday::getIntVal(rowgroup::Row& row, uint32_t month = 0; uint32_t day = 0; int64_t val = 0; - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; switch (parm[0]->data()->resultType().colDataType) { @@ -73,7 +73,7 @@ int64_t Func_weekday::getIntVal(rowgroup::Row& row, // Time adds to now() and then gets value case CalpontSystemCatalog::TIME: - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aTime.day = 0; val = addTime(aDateTime, aTime); diff --git a/utils/funcexp/func_year.cpp b/utils/funcexp/func_year.cpp index 17ff4f2d0..6e71b8a03 100644 --- a/utils/funcexp/func_year.cpp +++ b/utils/funcexp/func_year.cpp @@ -48,8 +48,8 @@ int64_t Func_year::getIntVal(rowgroup::Row& row, CalpontSystemCatalog::ColType& op_ct) { int64_t val = 0; - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; switch (parm[0]->data()->resultType().colDataType) { @@ -63,7 +63,7 @@ int64_t Func_year::getIntVal(rowgroup::Row& row, // Time adds to now() and then gets value case CalpontSystemCatalog::TIME: - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aTime.day = 0; val = addTime(aDateTime, aTime); diff --git a/utils/funcexp/func_yearweek.cpp b/utils/funcexp/func_yearweek.cpp index e567440b4..5568b763c 100644 --- a/utils/funcexp/func_yearweek.cpp +++ b/utils/funcexp/func_yearweek.cpp @@ -54,8 +54,8 @@ int64_t Func_yearweek::getIntVal(rowgroup::Row& row, int64_t val = 0; int16_t mode = 0; // default to 2 - DateTime aDateTime; - Time aTime; + dataconvert::DateTime aDateTime; + dataconvert::Time aTime; if (parm.size() > 1) // mode value mode = parm[1]->data()->getIntVal(row, isNull); @@ -80,7 +80,7 @@ int64_t Func_yearweek::getIntVal(rowgroup::Row& row, // Time adds to now() and then gets value case CalpontSystemCatalog::TIME: - aDateTime = static_cast(nowDatetime()); + aDateTime = static_cast(nowDatetime()); aTime = parm[0]->data()->getTimeIntVal(row, isNull); aTime.day = 0; val = addTime(aDateTime, aTime); diff --git a/utils/funcexp/functor.h b/utils/funcexp/functor.h index 9904c6831..890fddeae 100644 --- a/utils/funcexp/functor.h +++ b/utils/funcexp/functor.h @@ -36,7 +36,6 @@ #include "calpontsystemcatalog.h" #include "dataconvert.h" -using namespace dataconvert; namespace rowgroup { @@ -178,7 +177,7 @@ protected: virtual std::string longDoubleToString(long double); virtual int64_t nowDatetime(); - virtual int64_t addTime(DateTime& dt1, dataconvert::Time& dt2); + virtual int64_t addTime(dataconvert::DateTime& dt1, dataconvert::Time& dt2); virtual int64_t addTime(dataconvert::Time& dt1, dataconvert::Time& dt2); std::string fFuncName; diff --git a/utils/funcexp/functor_str.h b/utils/funcexp/functor_str.h index 5402cc646..fc8de1d9f 100644 --- a/utils/funcexp/functor_str.h +++ b/utils/funcexp/functor_str.h @@ -25,8 +25,6 @@ #include "functor.h" -using namespace std; - namespace funcexp { @@ -141,7 +139,7 @@ protected: exponent = (int)floor(log10( fabsl(floatVal))); base = floatVal * pow(10, -1.0 * exponent); - if (isnan(exponent) || isnan(base)) + if (std::isnan(exponent) || std::isnan(base)) { snprintf(buf, 20, "%Lf", floatVal); fFloatStr = execplan::removeTrailing0(buf, 20); @@ -325,7 +323,7 @@ public: */ class Func_lpad : public Func_Str { - static const string fPad; + static const std::string fPad; public: Func_lpad() : Func_Str("lpad") {} virtual ~Func_lpad() {} @@ -343,7 +341,7 @@ public: */ class Func_rpad : public Func_Str { - static const string fPad; + static const std::string fPad; public: Func_rpad() : Func_Str("rpad") {} virtual ~Func_rpad() {} diff --git a/utils/funcexp/utils_utf8.h b/utils/funcexp/utils_utf8.h index 6f5cb26a8..442ca6297 100644 --- a/utils/funcexp/utils_utf8.h +++ b/utils/funcexp/utils_utf8.h @@ -37,12 +37,9 @@ #include -#include "alarmmanager.h" -using namespace alarmmanager; +#include "ALARMManager.h" #include "liboamcpp.h" -using namespace oam; - /** @file */ @@ -63,7 +60,7 @@ std::string idb_setlocale() { // get and set locale language std::string systemLang("C"); - Oam oam; + oam::Oam oam; try { @@ -81,9 +78,9 @@ std::string idb_setlocale() try { //send alarm - ALARMManager alarmMgr; + alarmmanager::ALARMManager alarmMgr; std::string alarmItem = "system"; - alarmMgr.sendAlarmReport(alarmItem.c_str(), oam::INVALID_LOCALE, SET); + alarmMgr.sendAlarmReport(alarmItem.c_str(), oam::INVALID_LOCALE, alarmmanager::SET); printf("Failed to set locale : %s, Critical alarm generated\n", systemLang.c_str()); } catch (...) @@ -96,9 +93,9 @@ std::string idb_setlocale() try { //send alarm - ALARMManager alarmMgr; + alarmmanager::ALARMManager alarmMgr; std::string alarmItem = "system"; - alarmMgr.sendAlarmReport(alarmItem.c_str(), oam::INVALID_LOCALE, CLEAR); + alarmMgr.sendAlarmReport(alarmItem.c_str(), oam::INVALID_LOCALE, alarmmanager::CLEAR); } catch (...) { diff --git a/utils/regr/corr.cpp b/utils/regr/corr.cpp index c1c388da9..ac69357df 100644 --- a/utils/regr/corr.cpp +++ b/utils/regr/corr.cpp @@ -66,7 +66,7 @@ mcsv1_UDAF::ReturnCode corr::init(mcsv1Context* context, } context->setUserDataSize(sizeof(corr_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(DECIMAL_NOT_SPECIFIED); context->setPrecision(0); diff --git a/utils/regr/corr.h b/utils/regr/corr.h index d1b5f55ac..389b61195 100644 --- a/utils/regr/corr.h +++ b/utils/regr/corr.h @@ -43,7 +43,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/regr/covar_pop.cpp b/utils/regr/covar_pop.cpp index 876be1f30..672da9d75 100644 --- a/utils/regr/covar_pop.cpp +++ b/utils/regr/covar_pop.cpp @@ -64,7 +64,7 @@ mcsv1_UDAF::ReturnCode covar_pop::init(mcsv1Context* context, } context->setUserDataSize(sizeof(covar_pop_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(DECIMAL_NOT_SPECIFIED); context->setPrecision(0); diff --git a/utils/regr/covar_pop.h b/utils/regr/covar_pop.h index dda396fb9..c3f6dde4a 100644 --- a/utils/regr/covar_pop.h +++ b/utils/regr/covar_pop.h @@ -43,7 +43,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/regr/covar_samp.cpp b/utils/regr/covar_samp.cpp index ccc302046..81e9fc212 100644 --- a/utils/regr/covar_samp.cpp +++ b/utils/regr/covar_samp.cpp @@ -64,7 +64,7 @@ mcsv1_UDAF::ReturnCode covar_samp::init(mcsv1Context* context, } context->setUserDataSize(sizeof(covar_samp_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(DECIMAL_NOT_SPECIFIED); context->setPrecision(0); diff --git a/utils/regr/covar_samp.h b/utils/regr/covar_samp.h index a65625520..fe0352fe8 100644 --- a/utils/regr/covar_samp.h +++ b/utils/regr/covar_samp.h @@ -43,7 +43,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/regr/regr_avgx.cpp b/utils/regr/regr_avgx.cpp index 8e4314d01..c27d075ad 100644 --- a/utils/regr/regr_avgx.cpp +++ b/utils/regr/regr_avgx.cpp @@ -65,7 +65,7 @@ mcsv1_UDAF::ReturnCode regr_avgx::init(mcsv1Context* context, } context->setUserDataSize(sizeof(regr_avgx_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(colTypes[1].scale + 4); context->setPrecision(19); diff --git a/utils/regr/regr_avgx.h b/utils/regr/regr_avgx.h index 960a6a892..e76ecf56c 100644 --- a/utils/regr/regr_avgx.h +++ b/utils/regr/regr_avgx.h @@ -43,7 +43,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/regr/regr_avgy.cpp b/utils/regr/regr_avgy.cpp index 3d49e96b4..f22959354 100644 --- a/utils/regr/regr_avgy.cpp +++ b/utils/regr/regr_avgy.cpp @@ -65,7 +65,7 @@ mcsv1_UDAF::ReturnCode regr_avgy::init(mcsv1Context* context, } context->setUserDataSize(sizeof(regr_avgy_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(colTypes[0].scale + 4); context->setPrecision(19); diff --git a/utils/regr/regr_avgy.h b/utils/regr/regr_avgy.h index c2a3020da..9e425a7bd 100644 --- a/utils/regr/regr_avgy.h +++ b/utils/regr/regr_avgy.h @@ -43,7 +43,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/regr/regr_count.cpp b/utils/regr/regr_count.cpp index c65a1f4a6..8b5993d33 100644 --- a/utils/regr/regr_count.cpp +++ b/utils/regr/regr_count.cpp @@ -54,7 +54,7 @@ mcsv1_UDAF::ReturnCode regr_count::init(mcsv1Context* context, } context->setUserDataSize(sizeof(regr_count_data)); - context->setResultType(CalpontSystemCatalog::BIGINT); + context->setResultType(execplan::CalpontSystemCatalog::BIGINT); context->setColWidth(8); context->setRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS); return mcsv1_UDAF::SUCCESS; diff --git a/utils/regr/regr_count.h b/utils/regr/regr_count.h index 25cde7898..0fa140d56 100644 --- a/utils/regr/regr_count.h +++ b/utils/regr/regr_count.h @@ -43,7 +43,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/regr/regr_intercept.cpp b/utils/regr/regr_intercept.cpp index df9310f03..9b457243c 100644 --- a/utils/regr/regr_intercept.cpp +++ b/utils/regr/regr_intercept.cpp @@ -65,7 +65,7 @@ mcsv1_UDAF::ReturnCode regr_intercept::init(mcsv1Context* context, } context->setUserDataSize(sizeof(regr_intercept_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(DECIMAL_NOT_SPECIFIED); context->setPrecision(0); diff --git a/utils/regr/regr_intercept.h b/utils/regr/regr_intercept.h index ef8dc6de5..50c7fbdd9 100644 --- a/utils/regr/regr_intercept.h +++ b/utils/regr/regr_intercept.h @@ -43,7 +43,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/regr/regr_r2.cpp b/utils/regr/regr_r2.cpp index 1abd3ea2e..60bcad65c 100644 --- a/utils/regr/regr_r2.cpp +++ b/utils/regr/regr_r2.cpp @@ -66,7 +66,7 @@ mcsv1_UDAF::ReturnCode regr_r2::init(mcsv1Context* context, } context->setUserDataSize(sizeof(regr_r2_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(DECIMAL_NOT_SPECIFIED); context->setPrecision(0); diff --git a/utils/regr/regr_r2.h b/utils/regr/regr_r2.h index 968814067..fac04eac8 100644 --- a/utils/regr/regr_r2.h +++ b/utils/regr/regr_r2.h @@ -43,7 +43,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/regr/regr_slope.cpp b/utils/regr/regr_slope.cpp index de9eab5c7..17e662f2c 100644 --- a/utils/regr/regr_slope.cpp +++ b/utils/regr/regr_slope.cpp @@ -64,7 +64,7 @@ mcsv1_UDAF::ReturnCode regr_slope::init(mcsv1Context* context, return mcsv1_UDAF::ERROR; } context->setUserDataSize(sizeof(regr_slope_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(DECIMAL_NOT_SPECIFIED); context->setPrecision(0); diff --git a/utils/regr/regr_slope.h b/utils/regr/regr_slope.h index 8a20494c1..d32223ae9 100644 --- a/utils/regr/regr_slope.h +++ b/utils/regr/regr_slope.h @@ -43,7 +43,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/regr/regr_sxx.cpp b/utils/regr/regr_sxx.cpp index 4d5fac370..2338d4436 100644 --- a/utils/regr/regr_sxx.cpp +++ b/utils/regr/regr_sxx.cpp @@ -63,7 +63,7 @@ mcsv1_UDAF::ReturnCode regr_sxx::init(mcsv1Context* context, } context->setUserDataSize(sizeof(regr_sxx_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(DECIMAL_NOT_SPECIFIED); context->setPrecision(0); diff --git a/utils/regr/regr_sxx.h b/utils/regr/regr_sxx.h index 53c771b6f..82ec7e154 100644 --- a/utils/regr/regr_sxx.h +++ b/utils/regr/regr_sxx.h @@ -43,7 +43,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/regr/regr_sxy.cpp b/utils/regr/regr_sxy.cpp index 76e1373c4..daef4333e 100644 --- a/utils/regr/regr_sxy.cpp +++ b/utils/regr/regr_sxy.cpp @@ -64,7 +64,7 @@ mcsv1_UDAF::ReturnCode regr_sxy::init(mcsv1Context* context, } context->setUserDataSize(sizeof(regr_sxy_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(DECIMAL_NOT_SPECIFIED); context->setPrecision(0); diff --git a/utils/regr/regr_sxy.h b/utils/regr/regr_sxy.h index 6371c6fed..47e6c30e6 100644 --- a/utils/regr/regr_sxy.h +++ b/utils/regr/regr_sxy.h @@ -43,7 +43,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/regr/regr_syy.cpp b/utils/regr/regr_syy.cpp index 6febb9579..6d803d992 100644 --- a/utils/regr/regr_syy.cpp +++ b/utils/regr/regr_syy.cpp @@ -63,7 +63,7 @@ mcsv1_UDAF::ReturnCode regr_syy::init(mcsv1Context* context, } context->setUserDataSize(sizeof(regr_syy_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(DECIMAL_NOT_SPECIFIED); context->setPrecision(0); diff --git a/utils/regr/regr_syy.h b/utils/regr/regr_syy.h index d1a582f4d..26c8cc1e7 100644 --- a/utils/regr/regr_syy.h +++ b/utils/regr/regr_syy.h @@ -43,7 +43,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/rowgroup/rowaggregation.cpp b/utils/rowgroup/rowaggregation.cpp index 55be66459..bae0e8e27 100644 --- a/utils/rowgroup/rowaggregation.cpp +++ b/utils/rowgroup/rowaggregation.cpp @@ -1929,7 +1929,7 @@ void RowAggregation::doUDAF(const Row& rowIn, int64_t colIn, int64_t colOut, // The vector of parameters to be sent to the UDAF mcsv1sdk::ColumnDatum valsIn[paramCount]; uint32_t dataFlags[paramCount]; - ConstantColumn* cc; + execplan::ConstantColumn* cc; bool bIsNull = false; execplan::CalpontSystemCatalog::ColDataType colDataType; @@ -1945,10 +1945,10 @@ void RowAggregation::doUDAF(const Row& rowIn, int64_t colIn, int64_t colOut, if (fFunctionCols[funcColsIdx]->fpConstCol) { - cc = dynamic_cast(fFunctionCols[funcColsIdx]->fpConstCol.get()); + cc = dynamic_cast(fFunctionCols[funcColsIdx]->fpConstCol.get()); } - if ((cc && cc->type() == ConstantColumn::NULLDATA) + if ((cc && cc->type() == execplan::ConstantColumn::NULLDATA) || (!cc && isNull(&fRowGroupIn, rowIn, colIn) == true)) { if (fRGContext.getRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS)) @@ -3706,7 +3706,7 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData // Create a datum item for sending to UDAF mcsv1sdk::ColumnDatum& datum = valsIn[0]; - datum.dataType = (CalpontSystemCatalog::ColDataType)colDataType; + datum.dataType = (execplan::CalpontSystemCatalog::ColDataType)colDataType; switch (colDataType) { diff --git a/utils/rowgroup/rowaggregation.h b/utils/rowgroup/rowaggregation.h index c829cdefc..7475a71b7 100644 --- a/utils/rowgroup/rowaggregation.h +++ b/utils/rowgroup/rowaggregation.h @@ -207,7 +207,7 @@ struct RowAggFunctionCol // The first will be a RowUDAFFunctionCol. Subsequent ones will be RowAggFunctionCol // with fAggFunction == ROWAGG_MULTI_PARM. Order is important. // If this parameter is constant, that value is here. - SRCP fpConstCol; + execplan::SRCP fpConstCol; }; @@ -272,7 +272,7 @@ inline void RowAggFunctionCol::deserialize(messageqcpp::ByteStream& bs) if (t) { - fpConstCol.reset(new ConstantColumn); + fpConstCol.reset(new execplan::ConstantColumn); fpConstCol.get()->unserialize(bs); } } diff --git a/utils/rowgroup/rowgroup.h b/utils/rowgroup/rowgroup.h index b91e0f0ef..d496cbcb0 100644 --- a/utils/rowgroup/rowgroup.h +++ b/utils/rowgroup/rowgroup.h @@ -59,7 +59,6 @@ #include "../winport/winport.h" // Workaround for my_global.h #define of isnan(X) causing a std::std namespace -using namespace std; namespace rowgroup { @@ -1028,7 +1027,7 @@ inline void Row::setFloatField(float val, uint32_t colIndex) //N.B. There is a bug in boost::any or in gcc where, if you store a nan, you will get back a nan, // but not necessarily the same bits that you put in. This only seems to be for float (double seems // to work). - if (isnan(val)) + if (std::isnan(val)) setUintField<4>(joblist::FLOATNULL, colIndex); else *((float*) &data[offsets[colIndex]]) = val; diff --git a/utils/threadpool/prioritythreadpool.cpp b/utils/threadpool/prioritythreadpool.cpp index 92fd0ad98..e25cd7af8 100644 --- a/utils/threadpool/prioritythreadpool.cpp +++ b/utils/threadpool/prioritythreadpool.cpp @@ -282,7 +282,7 @@ void PriorityThreadPool::sendErrorMsg(uint32_t id, uint32_t step, primitiveproce ism.Status = logging::primitiveServerErr; ph.UniqueID = id; ph.StepID = step; - ByteStream msg(sizeof(ISMPacketHeader) + sizeof(PrimitiveHeader)); + messageqcpp::ByteStream msg(sizeof(ISMPacketHeader) + sizeof(PrimitiveHeader)); msg.append((uint8_t*) &ism, sizeof(ism)); msg.append((uint8_t*) &ph, sizeof(ph)); diff --git a/utils/udfsdk/allnull.cpp b/utils/udfsdk/allnull.cpp index 247b9e28f..ee6669789 100644 --- a/utils/udfsdk/allnull.cpp +++ b/utils/udfsdk/allnull.cpp @@ -39,7 +39,7 @@ mcsv1_UDAF::ReturnCode allnull::init(mcsv1Context* context, return mcsv1_UDAF::ERROR; } - context->setResultType(CalpontSystemCatalog::TINYINT); + context->setResultType(execplan::CalpontSystemCatalog::TINYINT); return mcsv1_UDAF::SUCCESS; } diff --git a/utils/udfsdk/allnull.h b/utils/udfsdk/allnull.h index 6a727caf6..40e5ce709 100644 --- a/utils/udfsdk/allnull.h +++ b/utils/udfsdk/allnull.h @@ -57,7 +57,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/udfsdk/avg_mode.cpp b/utils/udfsdk/avg_mode.cpp index dba0859fb..317ccce93 100644 --- a/utils/udfsdk/avg_mode.cpp +++ b/utils/udfsdk/avg_mode.cpp @@ -49,7 +49,7 @@ mcsv1_UDAF::ReturnCode avg_mode::init(mcsv1Context* context, return mcsv1_UDAF::ERROR; } - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(context->getScale() * 2); context->setPrecision(19); diff --git a/utils/udfsdk/avg_mode.h b/utils/udfsdk/avg_mode.h index fba1fcdcc..d37c3b83b 100644 --- a/utils/udfsdk/avg_mode.h +++ b/utils/udfsdk/avg_mode.h @@ -65,7 +65,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/udfsdk/avgx.cpp b/utils/udfsdk/avgx.cpp index 15548db36..a7ee4eb75 100644 --- a/utils/udfsdk/avgx.cpp +++ b/utils/udfsdk/avgx.cpp @@ -54,7 +54,7 @@ mcsv1_UDAF::ReturnCode avgx::init(mcsv1Context* context, } context->setUserDataSize(sizeof(avgx_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(colTypes[0].scale + 4); context->setPrecision(19); diff --git a/utils/udfsdk/avgx.h b/utils/udfsdk/avgx.h index a830c6803..0268df021 100644 --- a/utils/udfsdk/avgx.h +++ b/utils/udfsdk/avgx.h @@ -44,7 +44,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/udfsdk/distinct_count.cpp b/utils/udfsdk/distinct_count.cpp index 66dcea18f..11c2ce776 100644 --- a/utils/udfsdk/distinct_count.cpp +++ b/utils/udfsdk/distinct_count.cpp @@ -16,6 +16,7 @@ MA 02110-1301, USA. */ #include "distinct_count.h" +#include "calpontsystemcatalog.h" using namespace mcsv1sdk; @@ -36,7 +37,7 @@ mcsv1_UDAF::ReturnCode distinct_count::init(mcsv1Context* context, context->setErrorMessage("avgx() with other than 1 arguments"); return mcsv1_UDAF::ERROR; } - context->setResultType(CalpontSystemCatalog::BIGINT); + context->setResultType(execplan::CalpontSystemCatalog::BIGINT); context->setColWidth(8); context->setRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS); context->setRunFlag(mcsv1sdk::UDAF_DISTINCT); diff --git a/utils/udfsdk/distinct_count.h b/utils/udfsdk/distinct_count.h index 1d804eaa8..7ad43f952 100644 --- a/utils/udfsdk/distinct_count.h +++ b/utils/udfsdk/distinct_count.h @@ -52,7 +52,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/udfsdk/mcsv1_udaf.cpp b/utils/udfsdk/mcsv1_udaf.cpp index 9d513ced2..4dc30a3ef 100644 --- a/utils/udfsdk/mcsv1_udaf.cpp +++ b/utils/udfsdk/mcsv1_udaf.cpp @@ -75,41 +75,41 @@ int32_t mcsv1Context::getColWidth() // JIT initialization for types that have a defined size. switch (fResultType) { - case CalpontSystemCatalog::BIT: - case CalpontSystemCatalog::TINYINT: - case CalpontSystemCatalog::UTINYINT: - case CalpontSystemCatalog::CHAR: + case execplan::CalpontSystemCatalog::BIT: + case execplan::CalpontSystemCatalog::TINYINT: + case execplan::CalpontSystemCatalog::UTINYINT: + case execplan::CalpontSystemCatalog::CHAR: fColWidth = 1; break; - case CalpontSystemCatalog::SMALLINT: - case CalpontSystemCatalog::USMALLINT: + case execplan::CalpontSystemCatalog::SMALLINT: + case execplan::CalpontSystemCatalog::USMALLINT: fColWidth = 2; break; - case CalpontSystemCatalog::MEDINT: - case CalpontSystemCatalog::INT: - case CalpontSystemCatalog::UMEDINT: - case CalpontSystemCatalog::UINT: - case CalpontSystemCatalog::FLOAT: - case CalpontSystemCatalog::UFLOAT: - case CalpontSystemCatalog::DATE: + case execplan::CalpontSystemCatalog::MEDINT: + case execplan::CalpontSystemCatalog::INT: + case execplan::CalpontSystemCatalog::UMEDINT: + case execplan::CalpontSystemCatalog::UINT: + case execplan::CalpontSystemCatalog::FLOAT: + case execplan::CalpontSystemCatalog::UFLOAT: + case execplan::CalpontSystemCatalog::DATE: fColWidth = 4; break; - case CalpontSystemCatalog::BIGINT: - case CalpontSystemCatalog::UBIGINT: - case CalpontSystemCatalog::DECIMAL: - case CalpontSystemCatalog::UDECIMAL: - case CalpontSystemCatalog::DOUBLE: - case CalpontSystemCatalog::UDOUBLE: - case CalpontSystemCatalog::DATETIME: - case CalpontSystemCatalog::TIME: - case CalpontSystemCatalog::STRINT: + case execplan::CalpontSystemCatalog::BIGINT: + case execplan::CalpontSystemCatalog::UBIGINT: + case execplan::CalpontSystemCatalog::DECIMAL: + case execplan::CalpontSystemCatalog::UDECIMAL: + case execplan::CalpontSystemCatalog::DOUBLE: + case execplan::CalpontSystemCatalog::UDOUBLE: + case execplan::CalpontSystemCatalog::DATETIME: + case execplan::CalpontSystemCatalog::TIME: + case execplan::CalpontSystemCatalog::STRINT: fColWidth = 8; break; - case CalpontSystemCatalog::LONGDOUBLE: + case execplan::CalpontSystemCatalog::LONGDOUBLE: fColWidth = sizeof(long double); break; @@ -212,7 +212,7 @@ void mcsv1Context::createUserData() void mcsv1Context::serialize(messageqcpp::ByteStream& b) const { b.needAtLeast(sizeof(mcsv1Context)); - b << (ObjectReader::id_t) ObjectReader::MCSV1_CONTEXT; + b << (execplan::ObjectReader::id_t) execplan::ObjectReader::MCSV1_CONTEXT; b << functionName; b << fRunFlags; // Dont send context flags, These are set for each call @@ -232,21 +232,21 @@ void mcsv1Context::serialize(messageqcpp::ByteStream& b) const void mcsv1Context::unserialize(messageqcpp::ByteStream& b) { - ObjectReader::checkType(b, ObjectReader::MCSV1_CONTEXT); + execplan::ObjectReader::checkType(b, execplan::ObjectReader::MCSV1_CONTEXT); b >> functionName; b >> fRunFlags; b >> fUserDataSize; uint32_t iResultType; b >> iResultType; - fResultType = (CalpontSystemCatalog::ColDataType)iResultType; + fResultType = (execplan::CalpontSystemCatalog::ColDataType)iResultType; b >> fResultscale; b >> fResultPrecision; b >> errorMsg; uint32_t frame; b >> frame; - fStartFrame = (WF_FRAME)frame; + fStartFrame = (execplan::WF_FRAME)frame; b >> frame; - fEndFrame = (WF_FRAME)frame; + fEndFrame = (execplan::WF_FRAME)frame; b >> fStartConstant; b >> fEndConstant; b >> fParamCount; diff --git a/utils/udfsdk/mcsv1_udaf.h b/utils/udfsdk/mcsv1_udaf.h index d6ba04483..0fcd877c9 100644 --- a/utils/udfsdk/mcsv1_udaf.h +++ b/utils/udfsdk/mcsv1_udaf.h @@ -78,8 +78,6 @@ #include "wf_frame.h" #include "my_decimal_limits.h" -using namespace execplan; - #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) #else @@ -282,7 +280,7 @@ public: EXPORT bool isParamConstant(int paramIdx); // For getting the result type. - EXPORT CalpontSystemCatalog::ColDataType getResultType() const; + EXPORT execplan::CalpontSystemCatalog::ColDataType getResultType() const; // For getting the decimal characteristics for the return type. // These will be set to the default before init(). @@ -291,7 +289,7 @@ public: // If you want to change the result type // valid in init() - EXPORT bool setResultType(CalpontSystemCatalog::ColDataType resultType); + EXPORT bool setResultType(execplan::CalpontSystemCatalog::ColDataType resultType); // For setting the decimal characteristics for the return value. // This only makes sense if the return type is decimal, but should be set @@ -339,14 +337,14 @@ public: // If WF_PRECEEdING and/or WF_FOLLOWING, a start or end constant should // be included to say how many preceeding or following is the default // Set this during init() - EXPORT bool setDefaultWindowFrame(WF_FRAME defaultStartFrame, - WF_FRAME defaultEndFrame, + EXPORT bool setDefaultWindowFrame(execplan::WF_FRAME defaultStartFrame, + execplan::WF_FRAME defaultEndFrame, int32_t startConstant = 0, // For WF_PRECEEDING or WF_FOLLOWING int32_t endConstant = 0); // For WF_PRECEEDING or WF_FOLLOWING // There may be times you want to know the actual frame set by the caller - EXPORT void getStartFrame(WF_FRAME& startFrame, int32_t& startConstant) const; - EXPORT void getEndFrame(WF_FRAME& endFrame, int32_t& endConstant) const; + EXPORT void getStartFrame(execplan::WF_FRAME& startFrame, int32_t& startConstant) const; + EXPORT void getEndFrame(execplan::WF_FRAME& endFrame, int32_t& endConstant) const; // Deep Equivalence bool operator==(const mcsv1Context& c) const; @@ -367,15 +365,15 @@ private: uint64_t fContextFlags; // Set by the framework to define this specific call. int32_t fUserDataSize; boost::shared_ptr fUserData; - CalpontSystemCatalog::ColDataType fResultType; + execplan::CalpontSystemCatalog::ColDataType fResultType; int32_t fColWidth; // The length in bytes of the return type int32_t fResultscale; // For scale, the number of digits to the right of the decimal int32_t fResultPrecision; // The max number of digits allowed in the decimal value std::string errorMsg; uint32_t* dataFlags; // an integer array wirh one entry for each parameter bool* bInterrupted; // Gets set to true by the Framework if something happens - WF_FRAME fStartFrame; // Is set to default to start, then modified by the actual frame in the call - WF_FRAME fEndFrame; // Is set to default to start, then modified by the actual frame in the call + execplan::WF_FRAME fStartFrame; // Is set to default to start, then modified by the actual frame in the call + execplan::WF_FRAME fEndFrame; // Is set to default to start, then modified by the actual frame in the call int32_t fStartConstant; // for start frame WF_PRECEEDIMG or WF_FOLLOWING int32_t fEndConstant; // for end frame WF_PRECEEDIMG or WF_FOLLOWING std::string functionName; @@ -422,12 +420,12 @@ public: // For char, varchar, text, varbinary and blob types, columnData will be std::string. struct ColumnDatum { - CalpontSystemCatalog::ColDataType dataType; // defined in calpontsystemcatalog.h + execplan::CalpontSystemCatalog::ColDataType dataType; // defined in calpontsystemcatalog.h static_any::any columnData; // Not valid in init() uint32_t scale; // If dataType is a DECIMAL type uint32_t precision; // If dataType is a DECIMAL type std::string alias; // Only filled in for init() - ColumnDatum() : dataType(CalpontSystemCatalog::UNDEFINED), scale(0), precision(-1) {}; + ColumnDatum() : dataType(execplan::CalpontSystemCatalog::UNDEFINED), scale(0), precision(-1) {}; }; // Override mcsv1_UDAF to build your User Defined Aggregate (UDAF) and/or @@ -636,14 +634,14 @@ inline mcsv1Context::mcsv1Context() : fRunFlags(UDAF_OVER_ALLOWED | UDAF_ORDER_ALLOWED | UDAF_WINDOWFRAME_ALLOWED), fContextFlags(0), fUserDataSize(0), - fResultType(CalpontSystemCatalog::UNDEFINED), + fResultType(execplan::CalpontSystemCatalog::UNDEFINED), fColWidth(0), fResultscale(0), fResultPrecision(18), dataFlags(NULL), bInterrupted(NULL), - fStartFrame(WF_UNBOUNDED_PRECEDING), - fEndFrame(WF_CURRENT_ROW), + fStartFrame(execplan::WF_UNBOUNDED_PRECEDING), + fEndFrame(execplan::WF_CURRENT_ROW), fStartConstant(0), fEndConstant(0), func(NULL), @@ -774,12 +772,12 @@ inline bool mcsv1Context::isParamConstant(int paramIdx) return false; } -inline CalpontSystemCatalog::ColDataType mcsv1Context::getResultType() const +inline execplan::CalpontSystemCatalog::ColDataType mcsv1Context::getResultType() const { return fResultType; } -inline bool mcsv1Context::setResultType(CalpontSystemCatalog::ColDataType resultType) +inline bool mcsv1Context::setResultType(execplan::CalpontSystemCatalog::ColDataType resultType) { fResultType = resultType; return true; // We may want to sanity check here. @@ -878,8 +876,8 @@ inline void mcsv1Context::setUserData(UserData* userData) } } -inline bool mcsv1Context::setDefaultWindowFrame(WF_FRAME defaultStartFrame, - WF_FRAME defaultEndFrame, +inline bool mcsv1Context::setDefaultWindowFrame(execplan::WF_FRAME defaultStartFrame, + execplan::WF_FRAME defaultEndFrame, int32_t startConstant, int32_t endConstant) { @@ -891,13 +889,13 @@ inline bool mcsv1Context::setDefaultWindowFrame(WF_FRAME defaultStartFrame, return true; } -inline void mcsv1Context::getStartFrame(WF_FRAME& startFrame, int32_t& startConstant) const +inline void mcsv1Context::getStartFrame(execplan::WF_FRAME& startFrame, int32_t& startConstant) const { startFrame = fStartFrame; startConstant = fStartConstant; } -inline void mcsv1Context::getEndFrame(WF_FRAME& endFrame, int32_t& endConstant) const +inline void mcsv1Context::getEndFrame(execplan::WF_FRAME& endFrame, int32_t& endConstant) const { endFrame = fEndFrame; endConstant = fEndConstant; diff --git a/utils/udfsdk/median.h b/utils/udfsdk/median.h index 48bd93c70..ead9eede4 100644 --- a/utils/udfsdk/median.h +++ b/utils/udfsdk/median.h @@ -65,7 +65,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/udfsdk/ssq.cpp b/utils/udfsdk/ssq.cpp index 74b60b5f6..4886acdb1 100644 --- a/utils/udfsdk/ssq.cpp +++ b/utils/udfsdk/ssq.cpp @@ -59,7 +59,7 @@ mcsv1_UDAF::ReturnCode ssq::init(mcsv1Context* context, } context->setUserDataSize(sizeof(ssq_data)); - context->setResultType(CalpontSystemCatalog::DOUBLE); + context->setResultType(execplan::CalpontSystemCatalog::DOUBLE); context->setColWidth(8); context->setScale(context->getScale() * 2); context->setPrecision(19); diff --git a/utils/udfsdk/ssq.h b/utils/udfsdk/ssq.h index e27ecf1fa..58d42084b 100644 --- a/utils/udfsdk/ssq.h +++ b/utils/udfsdk/ssq.h @@ -65,7 +65,6 @@ #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" #include "windowfunctioncolumn.h" -using namespace execplan; #if defined(_MSC_VER) && defined(xxxRGNODE_DLLEXPORT) #define EXPORT __declspec(dllexport) diff --git a/utils/windowfunction/windowfunctiontype.h b/utils/windowfunction/windowfunctiontype.h index e0a1aa832..ecf8f694e 100644 --- a/utils/windowfunction/windowfunctiontype.h +++ b/utils/windowfunction/windowfunctiontype.h @@ -199,9 +199,9 @@ public: fStep = step; } - void constParms(const std::vector& functionParms); + void constParms(const std::vector& functionParms); - static boost::shared_ptr makeWindowFunction(const std::string&, int ct, WindowFunctionColumn* wc); + static boost::shared_ptr makeWindowFunction(const std::string&, int ct, execplan::WindowFunctionColumn* wc); protected: @@ -255,7 +255,7 @@ protected: std::vector fFieldIndex; // constant function parameters -- needed for udaf with constant - std::vector fConstantParms; + std::vector fConstantParms; // row meta data rowgroup::RowGroup fRowGroup; diff --git a/versioning/BRM/dbrmctl.cpp b/versioning/BRM/dbrmctl.cpp index b9bca4d7c..45bf68f36 100644 --- a/versioning/BRM/dbrmctl.cpp +++ b/versioning/BRM/dbrmctl.cpp @@ -19,6 +19,7 @@ * $Id: dbrmctl.cpp 1823 2013-01-21 14:13:09Z rdempsey $ * ****************************************************************************/ +#include //cxx11test #include #include diff --git a/versioning/BRM/load_brm.cpp b/versioning/BRM/load_brm.cpp index 4650fc5ec..871a51122 100644 --- a/versioning/BRM/load_brm.cpp +++ b/versioning/BRM/load_brm.cpp @@ -19,6 +19,7 @@ * $Id: load_brm.cpp 1905 2013-06-14 18:42:28Z rdempsey $ * ****************************************************************************/ +#include //cxx11test #include #include #include diff --git a/versioning/BRM/masternode.cpp b/versioning/BRM/masternode.cpp index cb3eb5024..ea4832dae 100644 --- a/versioning/BRM/masternode.cpp +++ b/versioning/BRM/masternode.cpp @@ -23,6 +23,7 @@ /* * The executable source that runs a Master DBRM Node. */ +#include //cxx11test #include "masterdbrmnode.h" #include "liboamcpp.h" diff --git a/versioning/BRM/reset_locks.cpp b/versioning/BRM/reset_locks.cpp index 895e34600..47237aafa 100644 --- a/versioning/BRM/reset_locks.cpp +++ b/versioning/BRM/reset_locks.cpp @@ -17,6 +17,8 @@ // $Id: reset_locks.cpp 1823 2013-01-21 14:13:09Z rdempsey $ // +#include //cxx11test + #include #include using namespace std; diff --git a/versioning/BRM/rollback.cpp b/versioning/BRM/rollback.cpp index 1944f2938..509635248 100644 --- a/versioning/BRM/rollback.cpp +++ b/versioning/BRM/rollback.cpp @@ -28,6 +28,7 @@ * rollback -p (to get the transaction(s) that need to be rolled back) * rollback -r transID (for each one to roll them back) */ +#include //cxx11test #include "dbrm.h" diff --git a/versioning/BRM/save_brm.cpp b/versioning/BRM/save_brm.cpp index d53507082..6993fd8fb 100644 --- a/versioning/BRM/save_brm.cpp +++ b/versioning/BRM/save_brm.cpp @@ -25,6 +25,7 @@ * * More detailed description */ +#include //cxx11test #include #include diff --git a/versioning/BRM/slavenode.cpp b/versioning/BRM/slavenode.cpp index 1fd89ff7d..26701504a 100644 --- a/versioning/BRM/slavenode.cpp +++ b/versioning/BRM/slavenode.cpp @@ -19,6 +19,7 @@ * $Id: slavenode.cpp 1931 2013-07-08 16:53:02Z bpaul $ * ****************************************************************************/ +#include //cxx11test #include #include diff --git a/writeengine/bulk/we_brmreporter.cpp b/writeengine/bulk/we_brmreporter.cpp index 4c0f1511c..fd9691ef9 100644 --- a/writeengine/bulk/we_brmreporter.cpp +++ b/writeengine/bulk/we_brmreporter.cpp @@ -321,7 +321,7 @@ void BRMReporter::sendCPToFile( ) void BRMReporter::reportTotals( uint64_t totalReadRows, uint64_t totalInsertedRows, - const std::vector >& satCounts) + const std::vector >& satCounts) { if (fRptFile.is_open()) { diff --git a/writeengine/bulk/we_brmreporter.h b/writeengine/bulk/we_brmreporter.h index b5e43f867..e71310ff1 100644 --- a/writeengine/bulk/we_brmreporter.h +++ b/writeengine/bulk/we_brmreporter.h @@ -28,7 +28,6 @@ #include "brmtypes.h" #include "calpontsystemcatalog.h" -using namespace execplan; /** @file * class BRMReporter */ @@ -107,7 +106,7 @@ public: */ void reportTotals(uint64_t totalReadRows, uint64_t totalInsertedRows, - const std::vector >& satCounts); /** @brief Generate report for job that exceeds error limit diff --git a/writeengine/bulk/we_bulkload.cpp b/writeengine/bulk/we_bulkload.cpp index 48cc79f07..134bb07af 100644 --- a/writeengine/bulk/we_bulkload.cpp +++ b/writeengine/bulk/we_bulkload.cpp @@ -473,7 +473,7 @@ int BulkLoad::preProcess( Job& job, int tableNo, int rc = NO_ERROR, minWidth = 9999; // give a big number HWM minHWM = 999999; // rp 9/25/07 Bug 473 ColStruct curColStruct; - CalpontSystemCatalog::ColDataType colDataType; + execplan::CalpontSystemCatalog::ColDataType colDataType; // Initialize portions of TableInfo object tableInfo->setBufferSize(fBufferSize); diff --git a/writeengine/bulk/we_tableinfo.cpp b/writeengine/bulk/we_tableinfo.cpp index 2885d1462..92f8ac19f 100644 --- a/writeengine/bulk/we_tableinfo.cpp +++ b/writeengine/bulk/we_tableinfo.cpp @@ -957,7 +957,7 @@ void TableInfo::reportTotals(double elapsedTime) fLog->logMsg(oss2.str(), MSGLVL_INFO2); // @bug 3504: Loop through columns to print saturation counts - std::vector > satCounts; + std::vector > satCounts; for (unsigned i = 0; i < fColumns.size(); ++i) { @@ -977,30 +977,28 @@ void TableInfo::reportTotals(double elapsedTime) ossSatCnt << "Column " << fTableName << '.' << fColumns[i].column.colName << "; Number of "; - if (fColumns[i].column.dataType == CalpontSystemCatalog::DATE) + if (fColumns[i].column.dataType == execplan::CalpontSystemCatalog::DATE) { ossSatCnt << "invalid dates replaced with zero value : "; } else if (fColumns[i].column.dataType == - CalpontSystemCatalog::DATETIME) + execplan::CalpontSystemCatalog::DATETIME) { //bug5383 ossSatCnt << "invalid date/times replaced with zero value : "; } - else if (fColumns[i].column.dataType == CalpontSystemCatalog::TIME) + else if (fColumns[i].column.dataType == execplan::CalpontSystemCatalog::TIME) { ossSatCnt << "invalid times replaced with zero value : "; } - else if (fColumns[i].column.dataType == CalpontSystemCatalog::CHAR) - ossSatCnt << - "character strings truncated: "; - else if (fColumns[i].column.dataType == - CalpontSystemCatalog::VARCHAR) + else if (fColumns[i].column.dataType == execplan::CalpontSystemCatalog::CHAR) ossSatCnt << "character strings truncated: "; + else if (fColumns[i].column.dataType == execplan::CalpontSystemCatalog::VARCHAR) + ossSatCnt << "character strings truncated: "; else ossSatCnt << "rows inserted with saturated values: "; diff --git a/writeengine/server/we_brmrprtparser.h b/writeengine/server/we_brmrprtparser.h index e9525a744..9b179f070 100644 --- a/writeengine/server/we_brmrprtparser.h +++ b/writeengine/server/we_brmrprtparser.h @@ -31,11 +31,9 @@ #include #include -using namespace std; #include "bytestream.h" #include "messagequeue.h" -using namespace messageqcpp; /* * diff --git a/writeengine/server/we_dataloader.h b/writeengine/server/we_dataloader.h index 4415a3ab4..8750f469b 100644 --- a/writeengine/server/we_dataloader.h +++ b/writeengine/server/we_dataloader.h @@ -67,7 +67,7 @@ public: void str2Argv(std::string CmdLine, std::vector& V); std::string getCalpontHome(); std::string getPrgmPath(std::string& PrgmName); - void updateCmdLineWithPath(string& CmdLine); + void updateCmdLineWithPath(std::string& CmdLine); public: @@ -179,8 +179,8 @@ private: SplitterReadThread& fRef; int fMode; - ofstream fDataDumpFile; - ofstream fJobFile; + std::ofstream fDataDumpFile; + std::ofstream fJobFile; unsigned int fTxBytes; unsigned int fRxBytes; char fPmId; diff --git a/writeengine/server/we_ddlcommon.h b/writeengine/server/we_ddlcommon.h index b1e4e48f1..6af26b143 100644 --- a/writeengine/server/we_ddlcommon.h +++ b/writeengine/server/we_ddlcommon.h @@ -51,11 +51,7 @@ #define EXPORT #endif -using namespace std; -using namespace execplan; - #include -using namespace boost::algorithm; template bool from_string(T& t, @@ -72,7 +68,7 @@ struct DDLColumn { execplan::CalpontSystemCatalog::OID oid; execplan::CalpontSystemCatalog::ColType colType; - execplan:: CalpontSystemCatalog::TableColName tableColName; + execplan::CalpontSystemCatalog::TableColName tableColName; }; typedef std::vector ColumnList; @@ -104,23 +100,23 @@ inline void getColumnsForTable(uint32_t sessionID, std::string schema, std::str ColumnList& colList) { - CalpontSystemCatalog::TableName tableName; + execplan::CalpontSystemCatalog::TableName tableName; tableName.schema = schema; tableName.table = table; std::string err; try { - boost::shared_ptr systemCatalogPtr = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID); - systemCatalogPtr->identity(CalpontSystemCatalog::EC); + boost::shared_ptr systemCatalogPtr = execplan::CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID); + systemCatalogPtr->identity(execplan::CalpontSystemCatalog::EC); - const CalpontSystemCatalog::RIDList ridList = systemCatalogPtr->columnRIDs(tableName); + const execplan::CalpontSystemCatalog::RIDList ridList = systemCatalogPtr->columnRIDs(tableName); - CalpontSystemCatalog::RIDList::const_iterator rid_iterator = ridList.begin(); + execplan::CalpontSystemCatalog::RIDList::const_iterator rid_iterator = ridList.begin(); while (rid_iterator != ridList.end()) { - CalpontSystemCatalog::ROPair roPair = *rid_iterator; + execplan::CalpontSystemCatalog::ROPair roPair = *rid_iterator; DDLColumn column; column.oid = roPair.objnum; @@ -381,112 +377,112 @@ inline int convertDataType(int dataType) switch (dataType) { case ddlpackage::DDL_CHAR: - calpontDataType = CalpontSystemCatalog::CHAR; + calpontDataType = execplan::CalpontSystemCatalog::CHAR; break; case ddlpackage::DDL_VARCHAR: - calpontDataType = CalpontSystemCatalog::VARCHAR; + calpontDataType = execplan::CalpontSystemCatalog::VARCHAR; break; case ddlpackage::DDL_VARBINARY: - calpontDataType = CalpontSystemCatalog::VARBINARY; + calpontDataType = execplan::CalpontSystemCatalog::VARBINARY; break; case ddlpackage::DDL_BIT: - calpontDataType = CalpontSystemCatalog::BIT; + calpontDataType = execplan::CalpontSystemCatalog::BIT; break; case ddlpackage::DDL_REAL: case ddlpackage::DDL_DECIMAL: case ddlpackage::DDL_NUMERIC: case ddlpackage::DDL_NUMBER: - calpontDataType = CalpontSystemCatalog::DECIMAL; + calpontDataType = execplan::CalpontSystemCatalog::DECIMAL; break; case ddlpackage::DDL_FLOAT: - calpontDataType = CalpontSystemCatalog::FLOAT; + calpontDataType = execplan::CalpontSystemCatalog::FLOAT; break; case ddlpackage::DDL_DOUBLE: - calpontDataType = CalpontSystemCatalog::DOUBLE; + calpontDataType = execplan::CalpontSystemCatalog::DOUBLE; break; case ddlpackage::DDL_INT: case ddlpackage::DDL_INTEGER: - calpontDataType = CalpontSystemCatalog::INT; + calpontDataType = execplan::CalpontSystemCatalog::INT; break; case ddlpackage::DDL_BIGINT: - calpontDataType = CalpontSystemCatalog::BIGINT; + calpontDataType = execplan::CalpontSystemCatalog::BIGINT; break; case ddlpackage::DDL_MEDINT: - calpontDataType = CalpontSystemCatalog::MEDINT; + calpontDataType = execplan::CalpontSystemCatalog::MEDINT; break; case ddlpackage::DDL_SMALLINT: - calpontDataType = CalpontSystemCatalog::SMALLINT; + calpontDataType = execplan::CalpontSystemCatalog::SMALLINT; break; case ddlpackage::DDL_TINYINT: - calpontDataType = CalpontSystemCatalog::TINYINT; + calpontDataType = execplan::CalpontSystemCatalog::TINYINT; break; case ddlpackage::DDL_DATE: - calpontDataType = CalpontSystemCatalog::DATE; + calpontDataType = execplan::CalpontSystemCatalog::DATE; break; case ddlpackage::DDL_DATETIME: - calpontDataType = CalpontSystemCatalog::DATETIME; + calpontDataType = execplan::CalpontSystemCatalog::DATETIME; break; case ddlpackage::DDL_TIME: - calpontDataType = CalpontSystemCatalog::TIME; + calpontDataType = execplan::CalpontSystemCatalog::TIME; break; case ddlpackage::DDL_CLOB: - calpontDataType = CalpontSystemCatalog::CLOB; + calpontDataType = execplan::CalpontSystemCatalog::CLOB; break; case ddlpackage::DDL_BLOB: - calpontDataType = CalpontSystemCatalog::BLOB; + calpontDataType = execplan::CalpontSystemCatalog::BLOB; break; case ddlpackage::DDL_TEXT: - calpontDataType = CalpontSystemCatalog::TEXT; + calpontDataType = execplan::CalpontSystemCatalog::TEXT; break; case ddlpackage::DDL_UNSIGNED_TINYINT: - calpontDataType = CalpontSystemCatalog::UTINYINT; + calpontDataType = execplan::CalpontSystemCatalog::UTINYINT; break; case ddlpackage::DDL_UNSIGNED_SMALLINT: - calpontDataType = CalpontSystemCatalog::USMALLINT; + calpontDataType = execplan::CalpontSystemCatalog::USMALLINT; break; case ddlpackage::DDL_UNSIGNED_MEDINT: - calpontDataType = CalpontSystemCatalog::UMEDINT; + calpontDataType = execplan::CalpontSystemCatalog::UMEDINT; break; case ddlpackage::DDL_UNSIGNED_INT: - calpontDataType = CalpontSystemCatalog::UINT; + calpontDataType = execplan::CalpontSystemCatalog::UINT; break; case ddlpackage::DDL_UNSIGNED_BIGINT: - calpontDataType = CalpontSystemCatalog::UBIGINT; + calpontDataType = execplan::CalpontSystemCatalog::UBIGINT; break; case ddlpackage::DDL_UNSIGNED_DECIMAL: case ddlpackage::DDL_UNSIGNED_NUMERIC: - calpontDataType = CalpontSystemCatalog::UDECIMAL; + calpontDataType = execplan::CalpontSystemCatalog::UDECIMAL; break; case ddlpackage::DDL_UNSIGNED_FLOAT: - calpontDataType = CalpontSystemCatalog::UFLOAT; + calpontDataType = execplan::CalpontSystemCatalog::UFLOAT; break; case ddlpackage::DDL_UNSIGNED_DOUBLE: - calpontDataType = CalpontSystemCatalog::UDOUBLE; + calpontDataType = execplan::CalpontSystemCatalog::UDOUBLE; break; default: diff --git a/writeengine/server/we_observer.h b/writeengine/server/we_observer.h index 85401d885..ac3039318 100644 --- a/writeengine/server/we_observer.h +++ b/writeengine/server/we_observer.h @@ -31,7 +31,6 @@ #define OBSERVER_H_ #include -using namespace std; namespace WriteEngine diff --git a/writeengine/server/we_readthread.cpp b/writeengine/server/we_readthread.cpp index 76653ff56..f27ed9795 100644 --- a/writeengine/server/we_readthread.cpp +++ b/writeengine/server/we_readthread.cpp @@ -651,7 +651,7 @@ void SplitterReadThread::operator()() catch (...) { fIbs.restart(); //setting length=0, get out of loop - cout << "Broken Pipe" << endl; + std::cout << "Broken Pipe" << std::endl; logging::LoggingID logid(19, 0, 0); logging::Message::Args args; @@ -889,7 +889,7 @@ void ReadThreadFactory::CreateReadThread(ThreadPool& Tp, IOSocket& Ios, BRM::DBR } catch (std::exception& ex) { - cout << "Handled : " << ex.what() << endl; + std::cout << "Handled : " << ex.what() << std::endl; logging::LoggingID logid(19, 0, 0); logging::Message::Args args; logging::Message msg(1); diff --git a/writeengine/server/we_readthread.h b/writeengine/server/we_readthread.h index 52ce114c9..39f6267dd 100644 --- a/writeengine/server/we_readthread.h +++ b/writeengine/server/we_readthread.h @@ -27,7 +27,6 @@ #include "messagequeue.h" #include "threadpool.h" #include "we_ddlcommandproc.h" -using namespace threadpool; #include "we_ddlcommandproc.h" #include "we_dmlcommandproc.h" @@ -149,7 +148,7 @@ public: virtual ~ReadThreadFactory() {} public: - static void CreateReadThread(ThreadPool& Tp, IOSocket& ios, BRM::DBRM& dbrm); + static void CreateReadThread(threadpool::ThreadPool& Tp, IOSocket& ios, BRM::DBRM& dbrm); }; diff --git a/writeengine/splitter/we_brmupdater.cpp b/writeengine/splitter/we_brmupdater.cpp index 96a3e9d11..ea728fb27 100644 --- a/writeengine/splitter/we_brmupdater.cpp +++ b/writeengine/splitter/we_brmupdater.cpp @@ -512,13 +512,13 @@ bool WEBrmUpdater::prepareRowsInsertedInfo(std::string Entry, bool WEBrmUpdater::prepareColumnOutOfRangeInfo(std::string Entry, int& ColNum, - CalpontSystemCatalog::ColDataType& ColType, + execplan::CalpontSystemCatalog::ColDataType& ColType, std::string& ColName, int& OorValues) { bool aFound = false; - boost::shared_ptr systemCatalogPtr = - CalpontSystemCatalog::makeCalpontSystemCatalog(); + boost::shared_ptr systemCatalogPtr = + execplan::CalpontSystemCatalog::makeCalpontSystemCatalog(); //DATA: 3 1 if ((!Entry.empty()) && (Entry.at(0) == 'D')) @@ -553,7 +553,7 @@ bool WEBrmUpdater::prepareColumnOutOfRangeInfo(std::string Entry, if (pTok) { - ColType = (CalpontSystemCatalog::ColDataType)atoi(pTok); + ColType = (execplan::CalpontSystemCatalog::ColDataType)atoi(pTok); } else { @@ -566,7 +566,7 @@ bool WEBrmUpdater::prepareColumnOutOfRangeInfo(std::string Entry, if (pTok) { uint64_t columnOid = strtol(pTok, NULL, 10); - CalpontSystemCatalog::TableColName colname = systemCatalogPtr->colName(columnOid); + execplan::CalpontSystemCatalog::TableColName colname = systemCatalogPtr->colName(columnOid); ColName = colname.schema + "." + colname.table + "." + colname.column; } else diff --git a/writeengine/splitter/we_brmupdater.h b/writeengine/splitter/we_brmupdater.h index b14cf4430..c575b3bd1 100644 --- a/writeengine/splitter/we_brmupdater.h +++ b/writeengine/splitter/we_brmupdater.h @@ -68,7 +68,7 @@ public: static bool prepareRowsInsertedInfo(std::string Entry, int64_t& TotRows, int64_t& InsRows); static bool prepareColumnOutOfRangeInfo(std::string Entry, int& ColNum, - CalpontSystemCatalog::ColDataType& ColType, + execplan::CalpontSystemCatalog::ColDataType& ColType, std::string& ColName, int& OorValues); static bool prepareErrorFileInfo(std::string Entry, std::string& ErrFileName); static bool prepareBadDataFileInfo(std::string Entry, std::string& BadFileName); diff --git a/writeengine/splitter/we_sdhandler.h b/writeengine/splitter/we_sdhandler.h index f31f40c63..551df4d9f 100644 --- a/writeengine/splitter/we_sdhandler.h +++ b/writeengine/splitter/we_sdhandler.h @@ -233,7 +233,7 @@ public: fWeSplClients[PmId]->setRowsUploadInfo(RowsRead, RowsInserted); } void add2ColOutOfRangeInfo(int PmId, int ColNum, - CalpontSystemCatalog::ColDataType ColType, + execplan::CalpontSystemCatalog::ColDataType ColType, std::string& ColName, int NoOfOors) { fWeSplClients[PmId]->add2ColOutOfRangeInfo(ColNum, ColType, ColName, NoOfOors); @@ -326,7 +326,7 @@ private: { fRowsIns += Rows; } - void updateColOutOfRangeInfo(int aColNum, CalpontSystemCatalog::ColDataType aColType, + void updateColOutOfRangeInfo(int aColNum, execplan::CalpontSystemCatalog::ColDataType aColType, std::string aColName, int aNoOfOors) { WEColOorVec::iterator aIt = fColOorVec.begin(); diff --git a/writeengine/splitter/we_splclient.cpp b/writeengine/splitter/we_splclient.cpp index de84abe8e..59b776888 100644 --- a/writeengine/splitter/we_splclient.cpp +++ b/writeengine/splitter/we_splclient.cpp @@ -453,7 +453,7 @@ void WESplClient::setRowsUploadInfo(int64_t RowsRead, int64_t RowsInserted) //------------------------------------------------------------------------------ void WESplClient::add2ColOutOfRangeInfo(int ColNum, - CalpontSystemCatalog::ColDataType ColType, + execplan::CalpontSystemCatalog::ColDataType ColType, std::string& ColName, int NoOfOors) { WEColOORInfo aColOorInfo; diff --git a/writeengine/splitter/we_splclient.h b/writeengine/splitter/we_splclient.h index 1d86b0610..63c54c337 100644 --- a/writeengine/splitter/we_splclient.h +++ b/writeengine/splitter/we_splclient.h @@ -35,7 +35,6 @@ #include "we_messages.h" #include "calpontsystemcatalog.h" -using namespace execplan; namespace WriteEngine { @@ -47,11 +46,11 @@ class WESplClient; //forward decleration class WEColOORInfo // Column Out-Of-Range Info { public: - WEColOORInfo(): fColNum(0), fColType(CalpontSystemCatalog::INT), fNoOfOORs(0) {} + WEColOORInfo(): fColNum(0), fColType(execplan::CalpontSystemCatalog::INT), fNoOfOORs(0) {} ~WEColOORInfo() {} public: int fColNum; - CalpontSystemCatalog::ColDataType fColType; + execplan::CalpontSystemCatalog::ColDataType fColType; std::string fColName; int fNoOfOORs; }; @@ -390,8 +389,7 @@ private: std::string fErrInfoFile; void setRowsUploadInfo(int64_t RowsRead, int64_t RowsInserted); - void add2ColOutOfRangeInfo(int ColNum, - CalpontSystemCatalog::ColDataType ColType, + void add2ColOutOfRangeInfo(int ColNum, execplan::CalpontSystemCatalog::ColDataType ColType, std::string& ColName, int NoOfOors); void setBadDataFile(const std::string& BadDataFile); void setErrInfoFile(const std::string& ErrInfoFile); diff --git a/writeengine/splitter/we_splitterapp.cpp b/writeengine/splitter/we_splitterapp.cpp index dac0c7387..1b62c6bcd 100644 --- a/writeengine/splitter/we_splitterapp.cpp +++ b/writeengine/splitter/we_splitterapp.cpp @@ -249,8 +249,8 @@ void WESplitterApp::processMessages() { try { - aBs << (ByteStream::byte) WE_CLT_SRV_MODE; - aBs << (ByteStream::quadbyte) fCmdArgs.getMode(); + aBs << (messageqcpp::ByteStream::byte) WE_CLT_SRV_MODE; + aBs << (messageqcpp::ByteStream::quadbyte) fCmdArgs.getMode(); fDh.send2Pm(aBs); std::string aJobId = fCmdArgs.getJobId(); @@ -268,7 +268,7 @@ void WESplitterApp::processMessages() if (fDh.getDebugLvl()) cout << "CPImport cmd line - " << aCpImpCmd << endl; - aBs << (ByteStream::byte) WE_CLT_SRV_CMDLINEARGS; + aBs << (messageqcpp::ByteStream::byte) WE_CLT_SRV_CMDLINEARGS; aBs << aCpImpCmd; fDh.send2Pm(aBs); @@ -278,7 +278,7 @@ void WESplitterApp::processMessages() if (fDh.getDebugLvl()) cout << "BrmReport FileName - " << aBrmRpt << endl; - aBs << (ByteStream::byte) WE_CLT_SRV_BRMRPT; + aBs << (messageqcpp::ByteStream::byte) WE_CLT_SRV_BRMRPT; aBs << aBrmRpt; fDh.send2Pm(aBs); @@ -297,8 +297,8 @@ void WESplitterApp::processMessages() { // In this mode we ignore almost all cmd lines args which // are usually send to cpimport - aBs << (ByteStream::byte) WE_CLT_SRV_MODE; - aBs << (ByteStream::quadbyte) fCmdArgs.getMode(); + aBs << (messageqcpp::ByteStream::byte) WE_CLT_SRV_MODE; + aBs << (messageqcpp::ByteStream::quadbyte) fCmdArgs.getMode(); fDh.send2Pm(aBs); std::string aJobId = fCmdArgs.getJobId(); @@ -323,7 +323,7 @@ void WESplitterApp::processMessages() if (fDh.getDebugLvl()) cout << "CPImport cmd line - " << aCpImpCmd << endl; - aBs << (ByteStream::byte) WE_CLT_SRV_CMDLINEARGS; + aBs << (messageqcpp::ByteStream::byte) WE_CLT_SRV_CMDLINEARGS; aBs << aCpImpCmd; fDh.send2Pm(aBs); @@ -333,7 +333,7 @@ void WESplitterApp::processMessages() if (fDh.getDebugLvl()) cout << "BrmReport FileName - " << aBrmRpt << endl; - aBs << (ByteStream::byte) WE_CLT_SRV_BRMRPT; + aBs << (messageqcpp::ByteStream::byte) WE_CLT_SRV_BRMRPT; aBs << aBrmRpt; fDh.send2Pm(aBs); @@ -352,8 +352,8 @@ void WESplitterApp::processMessages() { // In this mode we ignore almost all cmd lines args which // are usually send to cpimport - aBs << (ByteStream::byte) WE_CLT_SRV_MODE; - aBs << (ByteStream::quadbyte) fCmdArgs.getMode(); + aBs << (messageqcpp::ByteStream::byte) WE_CLT_SRV_MODE; + aBs << (messageqcpp::ByteStream::quadbyte) fCmdArgs.getMode(); fDh.send2Pm(aBs); aBs.restart(); @@ -373,7 +373,7 @@ void WESplitterApp::processMessages() if (fDh.getDebugLvl()) cout << "CPImport FileName - " << aCpImpFileName << endl; - aBs << (ByteStream::byte) WE_CLT_SRV_IMPFILENAME; + aBs << (messageqcpp::ByteStream::byte) WE_CLT_SRV_IMPFILENAME; aBs << aCpImpFileName; fDh.send2Pm(aBs); } @@ -450,8 +450,8 @@ void WESplitterApp::processMessages() if (aNoSec < 10) aNoSec++; //progressively go up to 10Sec interval aBs.restart(); - aBs << (ByteStream::byte) WE_CLT_SRV_KEEPALIVE; - mutex::scoped_lock aLock(fDh.fSendMutex); + aBs << (messageqcpp::ByteStream::byte) WE_CLT_SRV_KEEPALIVE; + boost::mutex::scoped_lock aLock(fDh.fSendMutex); fDh.send2Pm(aBs); aLock.unlock(); //fDh.sendHeartbeats(); @@ -633,7 +633,7 @@ int main(int argc, char** argv) errMsgArgs.add(err); aWESplitterApp.fpSysLog->logMsg(errMsgArgs, logging::LOG_TYPE_ERROR, logging::M0000); SPLTR_EXIT_STATUS = 1; - aWESplitterApp.fDh.fLog.logMsg( err, MSGLVL_ERROR ); + aWESplitterApp.fDh.fLog.logMsg( err, WriteEngine::MSGLVL_ERROR ); aWESplitterApp.fContinue = false; //throw runtime_error(err); BUG 4298 } diff --git a/writeengine/splitter/we_splitterapp.h b/writeengine/splitter/we_splitterapp.h index 5f9436922..5968914ed 100644 --- a/writeengine/splitter/we_splitterapp.h +++ b/writeengine/splitter/we_splitterapp.h @@ -32,15 +32,12 @@ #include #include #include -using namespace boost; #include "bytestream.h" -using namespace messageqcpp; #include "we_cmdargs.h" #include "we_sdhandler.h" #include "we_simplesyslog.h" -using namespace WriteEngine; namespace WriteEngine {