diff --git a/dbcon/execplan/simplecolumn.cpp b/dbcon/execplan/simplecolumn.cpp index 1300e0444..a3a4e0dac 100644 --- a/dbcon/execplan/simplecolumn.cpp +++ b/dbcon/execplan/simplecolumn.cpp @@ -112,7 +112,7 @@ ParseTree* replaceRefCol(ParseTree*& n, CalpontSelectExecutionPlan::ReturnedColu else if (rc) { SimpleColumn* sc = dynamic_cast(rc); - if (sc) + if (sc && (sc->colPosition() > -1)) { ReturnedColumn* tmp = derivedColList[sc->colPosition()]->clone(); delete sc; diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index 0fb1a1326..41873675a 100755 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -38,6 +38,7 @@ #include #include #include +//#define NDEBUG #include #include #include @@ -2289,6 +2290,8 @@ CalpontSystemCatalog::ColType colType_MysqlToIDB (const Item* item) { if (ct.colWidth < 20) ct.colWidth = 20; // for infinidb date length + if (ct.colWidth > 65535) + ct.colWidth = 65535; } // @bug5083. MySQL gives string type for date/datetime column. // need to adjust here. @@ -6491,8 +6494,8 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i if (!isUnion && !gwi.hasWindowFunc && gwi.subSelectType == CalpontSelectExecutionPlan::MAIN_SELECT) { std::ostringstream vtb; - vtb << "infinidb_vtable.$vtable_" << gwi.thd->thread_id; - //vtb << "$vtable_" << gwi.thd->thread_id; + vtb << "infinidb_vtable.$vtable_" << gwi.thd->thread_id; + //vtb << "$vtable_" << gwi.thd->thread_id; // re-construct the select query and redo phase 1 if (redo) { diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index e28e21aa6..c3040e14a 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -2811,8 +2811,6 @@ namespace oam // Get Server Type Install ID serverTypeInstall = atoi(sysConfig->getConfig("Installation", "ServerTypeInstall").c_str()); - - sysConfig; } catch (...) {} diff --git a/oam/oamcpp/liboamcpp.h b/oam/oamcpp/liboamcpp.h index 68c6400c6..8f0dfdb3f 100644 --- a/oam/oamcpp/liboamcpp.h +++ b/oam/oamcpp/liboamcpp.h @@ -1488,7 +1488,7 @@ namespace oam * @param DeviceNetworkConfig the Modules added * @param password Host Root Password */ - EXPORT void addModule(DeviceNetworkList devicenetworklist, const std::string password, const std::string mysqlpw); + EXPORT void addModule(DeviceNetworkList devicenetworklist, const std::string password); /** @brief remove Module * diff --git a/oamapps/mcsadmin/mcsadmin.cpp b/oamapps/mcsadmin/mcsadmin.cpp index 93dd701df..7f3cde2fb 100644 --- a/oamapps/mcsadmin/mcsadmin.cpp +++ b/oamapps/mcsadmin/mcsadmin.cpp @@ -265,7 +265,7 @@ int main(int argc, char *argv[]) } catch(...) {} - //check if root-user + //check if root-user int user; user = getuid(); if (user != 0) diff --git a/procmgr/main.cpp b/procmgr/main.cpp index b6f51a609..01d412610 100644 --- a/procmgr/main.cpp +++ b/procmgr/main.cpp @@ -501,6 +501,8 @@ static void startMgrProcessThread() SystemModuleTypeConfig systemmoduletypeconfig; ModuleTypeConfig PMSmoduletypeconfig; ALARMManager aManager; + + int waitTime = 90; int waitTime = 180; diff --git a/procmon/processmonitor.h b/procmon/processmonitor.h index 5a3145963..e96f65abc 100644 --- a/procmon/processmonitor.h +++ b/procmon/processmonitor.h @@ -500,6 +500,11 @@ public: int changeMyCnf(std::string type); + /** + *@brief run MariaDB Command Line script + */ + int runMariaDBCommandLine(std::string command); + /** *@brief run MariaDB Command Line script */ diff --git a/utils/funcexp/utils_utf8.h b/utils/funcexp/utils_utf8.h index d7a86415d..8055a2580 100644 --- a/utils/funcexp/utils_utf8.h +++ b/utils/funcexp/utils_utf8.h @@ -195,6 +195,29 @@ std::string wstring_to_utf8 (const std::wstring& str) return std::string(outbuf, strmblen); } +inline +uint8_t utf8_truncate_point(const char* input, size_t length) +{ + // Find the beginning of a multibyte char to truncate at and return the + // number of bytes to truncate + if (length < 3) + { + return 0; + } + + const unsigned char *b = (const unsigned char*)(input) + length - 3; + if (b[2] & 0x80) + { + // First byte in a new multi-byte sequence + if (b[2] & 0x40) return 1; + // 3 byte sequence + else if ((b[1] & 0xe0) == 0xe0) return 2; + // 4 byte sequence + else if ((b[0] & 0xf0) == 0xf0) return 3; + } + return 0; +} + } //namespace utf8 } //namespace funcexp diff --git a/writeengine/bulk/we_bulkloadbuffer.cpp b/writeengine/bulk/we_bulkloadbuffer.cpp index 9f75c6873..b1902e98f 100644 --- a/writeengine/bulk/we_bulkloadbuffer.cpp +++ b/writeengine/bulk/we_bulkloadbuffer.cpp @@ -41,6 +41,8 @@ #include "joblisttypes.h" +#include "utils_utf8.h" + using namespace std; using namespace boost; using namespace execplan; @@ -513,7 +515,8 @@ void BulkLoadBuffer::convert(char *field, int fieldLength, // on disk (e.g. 5 for a varchar(5) instead of 8). if (fieldLength > column.definedWidth) { - memcpy( charTmpBuf, field, column.definedWidth ); + uint8_t truncate_point = funcexp::utf8::utf8_truncate_point(field, column.definedWidth); + memcpy( charTmpBuf, field, column.definedWidth - truncate_point ); bufStats.satCount++; } else diff --git a/writeengine/dictionary/we_dctnry.cpp b/writeengine/dictionary/we_dctnry.cpp index 59411b951..e5ed7e606 100644 --- a/writeengine/dictionary/we_dctnry.cpp +++ b/writeengine/dictionary/we_dctnry.cpp @@ -47,6 +47,7 @@ using namespace BRM; #include "IDBPolicy.h" #include "cacheutils.h" using namespace idbdatafile; +#include "utils_utf8.h" namespace { @@ -823,7 +824,8 @@ int Dctnry::insertDctnry(const char* buf, // @Bug 2565: Truncate any strings longer than schema's column width if (curSig.size > m_colWidth) { - curSig.size = m_colWidth; + uint8_t truncate_point = funcexp::utf8::utf8_truncate_point((const char*)curSig.signature, m_colWidth); + curSig.size = m_colWidth - truncate_point; ++truncCount; }