From 8f1136474f68fc818d0077112be658a950bb6f2c Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Sat, 24 Feb 2018 08:04:17 -0500 Subject: [PATCH 01/24] MCOL-1228 Allow alter table for TEXT/BLOB CHANGE COLUMN was blocked for TEXT and BLOB types. This fix applies to things like TINYTEXT as well as the only difference internally is the column width. --- dbcon/ddlpackageproc/altertableprocessor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dbcon/ddlpackageproc/altertableprocessor.cpp b/dbcon/ddlpackageproc/altertableprocessor.cpp index 7c2cdd249..ba8d7ad7b 100644 --- a/dbcon/ddlpackageproc/altertableprocessor.cpp +++ b/dbcon/ddlpackageproc/altertableprocessor.cpp @@ -174,7 +174,10 @@ bool typesAreSame(const CalpontSystemCatalog::ColType& colType, const ColumnType case (CalpontSystemCatalog::CLOB): break; case (CalpontSystemCatalog::BLOB): + if (newType.fType == DDL_BLOB && colType.colWidth == newType.fLength) return true; + break; case (CalpontSystemCatalog::TEXT): + if (newType.fType == DDL_TEXT && colType.colWidth == newType.fLength) return true; break; default: break; From bd71dd1d7a728e9002e52953b43cc1f278ff1e2d Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Sat, 24 Feb 2018 18:34:59 +0000 Subject: [PATCH 02/24] MCOL-1084 Fix TABLE_USAGE() when dict is 0 bytes Dict size of 0 bytes returns NULL which means that the total count is 0. This fix uses COALESCE to stop this happening. --- dbcon/mysql/columnstore_info.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dbcon/mysql/columnstore_info.sql b/dbcon/mysql/columnstore_info.sql index 80b0f12b1..563052a11 100644 --- a/dbcon/mysql/columnstore_info.sql +++ b/dbcon/mysql/columnstore_info.sql @@ -52,21 +52,21 @@ CREATE PROCEDURE table_usage (IN t_schema char(64), IN t_name char(64)) CREATE TABLE columnstore_info.columnstore_files engine=myisam as (select * from information_schema.columnstore_files); ALTER TABLE columnstore_info.columnstore_files ADD INDEX `object_id` (`object_id`); IF t_name IS NOT NULL THEN -SELECT TABLE_SCHEMA, TABLE_NAME, columnstore_info.format_filesize(data) as DATA_DISK_USAGE, columnstore_info.format_filesize(dict) as DICT_DISK_USAGE, columnstore_info.format_filesize(data + dict) as TOTAL_USAGE FROM ( +SELECT TABLE_SCHEMA, TABLE_NAME, columnstore_info.format_filesize(data) as DATA_DISK_USAGE, columnstore_info.format_filesize(dict) as DICT_DISK_USAGE, columnstore_info.format_filesize(data + COALESCE(dict, 0)) as TOTAL_USAGE FROM ( SELECT TABLE_SCHEMA, TABLE_NAME, (SELECT sum(cf.file_size) as data FROM columnstore_info.columnstore_columns cc JOIN columnstore_info.columnstore_files cf ON cc.object_id = cf.object_id WHERE table_name = ics.table_name and table_schema = ics.table_schema) as data, (SELECT sum(cf.file_size) as dict FROM columnstore_info.columnstore_columns cc JOIN columnstore_info.columnstore_files cf ON cc.dictionary_object_id = cf.object_id WHERE table_name = ics.table_name and table_schema = ics.table_schema GROUP BY table_schema, table_name) as dict FROM columnstore_info.columnstore_columns ics where table_name = t_name and (table_schema = t_schema or t_schema IS NULL) group by table_schema, table_name ) q; ELSEIF t_schema IS NOT NULL THEN -SELECT TABLE_SCHEMA, TABLE_NAME, columnstore_info.format_filesize(data) as DATA_DISK_USAGE, columnstore_info.format_filesize(dict) as DICT_DISK_USAGE, columnstore_info.format_filesize(data + dict) as TOTAL_USAGE FROM ( +SELECT TABLE_SCHEMA, TABLE_NAME, columnstore_info.format_filesize(data) as DATA_DISK_USAGE, columnstore_info.format_filesize(dict) as DICT_DISK_USAGE, columnstore_info.format_filesize(data + COALESCE(dict, 0)) as TOTAL_USAGE FROM ( SELECT TABLE_SCHEMA, TABLE_NAME, (SELECT sum(cf.file_size) as data FROM columnstore_info.columnstore_columns cc JOIN columnstore_info.columnstore_files cf ON cc.object_id = cf.object_id WHERE table_name = ics.table_name and table_schema = ics.table_schema) as data, (SELECT sum(cf.file_size) as dict FROM columnstore_info.columnstore_columns cc JOIN columnstore_info.columnstore_files cf ON cc.dictionary_object_id = cf.object_id WHERE table_name = ics.table_name and table_schema = ics.table_schema GROUP BY table_schema, table_name) as dict FROM columnstore_info.columnstore_columns ics where table_schema = t_schema group by table_schema, table_name ) q; ELSE -SELECT TABLE_SCHEMA, TABLE_NAME, columnstore_info.format_filesize(data) as DATA_DISK_USAGE, columnstore_info.format_filesize(dict) as DICT_DISK_USAGE, columnstore_info.format_filesize(data + dict) as TOTAL_USAGE FROM ( +SELECT TABLE_SCHEMA, TABLE_NAME, columnstore_info.format_filesize(data) as DATA_DISK_USAGE, columnstore_info.format_filesize(dict) as DICT_DISK_USAGE, columnstore_info.format_filesize(data + COALESCE(dict, 0)) as TOTAL_USAGE FROM ( SELECT TABLE_SCHEMA, TABLE_NAME, (SELECT sum(cf.file_size) as data FROM columnstore_info.columnstore_columns cc JOIN columnstore_info.columnstore_files cf ON cc.object_id = cf.object_id WHERE table_name = ics.table_name and table_schema = ics.table_schema) as data, (SELECT sum(cf.file_size) as dict FROM columnstore_info.columnstore_columns cc JOIN columnstore_info.columnstore_files cf ON cc.dictionary_object_id = cf.object_id WHERE table_name = ics.table_name and table_schema = ics.table_schema GROUP BY table_schema, table_name) as dict FROM columnstore_info.columnstore_columns ics From 9e2d8b8e71c2b626b39a145fe82c915a7b11b4f2 Mon Sep 17 00:00:00 2001 From: david hill Date: Wed, 28 Feb 2018 11:12:02 -0500 Subject: [PATCH 03/24] mcol-1235 - fix issue with too many files open --- procmgr/main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/procmgr/main.cpp b/procmgr/main.cpp index 9fed1540f..3dd9766e0 100644 --- a/procmgr/main.cpp +++ b/procmgr/main.cpp @@ -553,8 +553,11 @@ static void alarmMessageThread(Configuration config) msg = fIos.read(); if (msg.length() <= 0) - continue; - + { + fIos.close(); + continue; + } + //log.writeLog(__LINE__, "MSG RECEIVED: Process Alarm Message"); ByteStream::byte alarmID; @@ -585,6 +588,8 @@ static void alarmMessageThread(Configuration config) ALARMManager aManager; aManager.processAlarmReport(calAlarm); + + fIos.close(); } catch (exception& ex) { From 1ad112a44d3d7770d102a6596b59532c4ac107cc Mon Sep 17 00:00:00 2001 From: david hill Date: Mon, 5 Mar 2018 10:48:46 -0600 Subject: [PATCH 04/24] mcol-1235 - add close in exceptions --- procmgr/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/procmgr/main.cpp b/procmgr/main.cpp index 3dd9766e0..434902138 100644 --- a/procmgr/main.cpp +++ b/procmgr/main.cpp @@ -595,11 +595,13 @@ static void alarmMessageThread(Configuration config) { string error = ex.what(); log.writeLog(__LINE__, "EXCEPTION ERROR on read for ProcMgr_Alarm:" + error, LOG_TYPE_ERROR); + fIos.close(); continue; } catch(...) { log.writeLog(__LINE__, "EXCEPTION ERROR on read for ProcMgr_Alarm: Caught unknown exception!", LOG_TYPE_ERROR); + fIos.close(); continue; } } From 8d0312950bfb57a46947e3e6cbe7f83855c830de Mon Sep 17 00:00:00 2001 From: david hill Date: Mon, 5 Mar 2018 11:36:10 -0600 Subject: [PATCH 05/24] update version 1.1.3-2 --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 445a70a7a..21aec268d 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ COLUMNSTORE_VERSION_MAJOR=1 COLUMNSTORE_VERSION_MINOR=1 -COLUMNSTORE_VERSION_PATCH=4 -COLUMNSTORE_VERSION_RELEASE=1 +COLUMNSTORE_VERSION_PATCH=3 +COLUMNSTORE_VERSION_RELEASE=2 From f96410a3dbf4589c76e98dd4e2879471a53664d8 Mon Sep 17 00:00:00 2001 From: Ben Thompson Date: Mon, 5 Mar 2018 15:27:17 -0600 Subject: [PATCH 06/24] Update ubuntu package dependencies to require libsnappy1v5 and not snappy the media player --- cpackEngineDEB.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpackEngineDEB.cmake b/cpackEngineDEB.cmake index 42c1f6974..5f8a83c42 100644 --- a/cpackEngineDEB.cmake +++ b/cpackEngineDEB.cmake @@ -69,7 +69,7 @@ if ("${DEBIAN_VERSION_NUMBER}" EQUAL "8") elseif ("${DEBIAN_VERSION_NUMBER}" EQUAL "9") SET(CPACK_DEBIAN_PLATFORM_PACKAGE_DEPENDS "expect, perl, openssl, file, sudo, libdbi-perl, libreadline-dev, rsync, net-tools, libboost-all-dev, mariadb-columnstore-libs, mariadb-columnstore-server, libsnappy1v5, libreadline5") else() - SET(CPACK_DEBIAN_PLATFORM_PACKAGE_DEPENDS "expect, perl, openssl, file, sudo, libdbi-perl, libboost-all-dev, libreadline-dev, rsync, snappy, net-tools") + SET(CPACK_DEBIAN_PLATFORM_PACKAGE_DEPENDS "expect, perl, openssl, file, sudo, libdbi-perl, libboost-all-dev, libreadline-dev, rsync, libsnappy1v5, net-tools") endif () SET(CPACK_DEBIAN_STORAGE-ENGINE_PACKAGE_DEPENDS "mariadb-columnstore-libs") From 208bb8b6b93ebc7efc8e691cb61228e0744be53e Mon Sep 17 00:00:00 2001 From: david hill Date: Mon, 5 Mar 2018 16:12:25 -0600 Subject: [PATCH 07/24] MCOL-1224 move touch inside of root check and added SUDO for non-root --- oam/install_scripts/post-install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index a295a088f..2c11ff12c 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -183,11 +183,11 @@ else RCFILE=/etc/rc.local fi -touch $RCFILE - if [ $user = "root" ]; then + touch $RCFILE chmod +x $RCFILE else + $SUDO touch $RCFILE $SUDO chmod 777 $RCFILE printf '%s\n' '#!/bin/bash' "#" | $SUDO tee -a $RCFILEl > /dev/null 2>&1 From 278b1f33640e4f23b53c35e8dbe11d75bbc57f2c Mon Sep 17 00:00:00 2001 From: david hill Date: Mon, 5 Mar 2018 16:15:57 -0600 Subject: [PATCH 08/24] Update post-install --- oam/install_scripts/post-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index 2c11ff12c..fba043cef 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -189,7 +189,7 @@ if [ $user = "root" ]; then else $SUDO touch $RCFILE $SUDO chmod 777 $RCFILE - printf '%s\n' '#!/bin/bash' "#" | $SUDO tee -a $RCFILEl > /dev/null 2>&1 + $SUDO printf '%s\n' '#!/bin/bash' "#" | $SUDO tee -a $RCFILEl > /dev/null 2>&1 if [ -n "$systemctl" ]; then $SUDO systemctl start rc-local >/dev/null 2>&1 From ad67f17c546dbe19788f43919d3de66d96650b7c Mon Sep 17 00:00:00 2001 From: david hill Date: Mon, 5 Mar 2018 16:19:25 -0600 Subject: [PATCH 09/24] Update post-install --- oam/install_scripts/post-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index fba043cef..5f0feee8f 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -189,7 +189,7 @@ if [ $user = "root" ]; then else $SUDO touch $RCFILE $SUDO chmod 777 $RCFILE - $SUDO printf '%s\n' '#!/bin/bash' "#" | $SUDO tee -a $RCFILEl > /dev/null 2>&1 + $SUDO printf '%s\n' '#!/bin/bash' "#" | $SUDO tee -a $RCFILE > /dev/null 2>&1 if [ -n "$systemctl" ]; then $SUDO systemctl start rc-local >/dev/null 2>&1 From 75ebfc91425ee248bead67e2788c0785378561d9 Mon Sep 17 00:00:00 2001 From: david hill Date: Wed, 7 Mar 2018 10:02:08 -0600 Subject: [PATCH 10/24] update version bump to 1.1.4 --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 21aec268d..445a70a7a 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ COLUMNSTORE_VERSION_MAJOR=1 COLUMNSTORE_VERSION_MINOR=1 -COLUMNSTORE_VERSION_PATCH=3 -COLUMNSTORE_VERSION_RELEASE=2 +COLUMNSTORE_VERSION_PATCH=4 +COLUMNSTORE_VERSION_RELEASE=1 From 77a9e49f1028676bf139bf7b6ffc92fcab98a405 Mon Sep 17 00:00:00 2001 From: david hill Date: Wed, 7 Mar 2018 10:48:16 -0600 Subject: [PATCH 11/24] MCOL-1225 - change mysql lib path --- oam/install_scripts/columnstore | 2 +- oam/install_scripts/module_installer.sh | 2 +- oam/install_scripts/post-install | 2 +- oam/install_scripts/post-mysql-install | 2 +- oamapps/calpontSupport/findStranded.sh | 2 +- oamapps/calpontSupport/sqlLogs.sh | 2 +- oamapps/columnstoreSupport/findStranded.sh | 2 +- oamapps/columnstoreSupport/sqlLogs.sh | 2 +- tools/setConfig/configxml.sh | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/oam/install_scripts/columnstore b/oam/install_scripts/columnstore index f4fc48157..038ad0c43 100644 --- a/oam/install_scripts/columnstore +++ b/oam/install_scripts/columnstore @@ -36,7 +36,7 @@ InstallDir=$COLUMNSTORE_INSTALL_DIR if [ $InstallDir != "/usr/local/mariadb/columnstore" ]; then export PATH=$InstallDir/bin:$InstallDir/mysql/bin:/bin:/usr/bin - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$InstallDir/lib:$InstallDir/mysql/lib/mysql + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$InstallDir/lib:$InstallDir/mysql/lib fi #hadoop diff --git a/oam/install_scripts/module_installer.sh b/oam/install_scripts/module_installer.sh index 10cefaf5f..6ca39b70f 100755 --- a/oam/install_scripts/module_installer.sh +++ b/oam/install_scripts/module_installer.sh @@ -47,7 +47,7 @@ shift $shiftcnt if [ $installdir != "/usr/local/mariadb/columnstore" ]; then export COLUMNSTORE_INSTALL_DIR=$installdir export PATH=$COLUMNSTORE_INSTALL_DIR/bin:$COLUMNSTORE_INSTALL_DIR/mysql/bin:/bin:/usr/bin - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib/mysql + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib else export COLUMNSTORE_INSTALL_DIR=$installdir fi diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index 5f0feee8f..781f3a5ee 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -112,7 +112,7 @@ if [ $user != "root" ]; then sudo echo " " >> ${profileFileEnv} sudo echo "# MariaDB Columnstore Non-Root Environment Variables" >> ${profileFileEnv} sudo echo "export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR" >> ${profileFileEnv} - sudo echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib/mysql" >> ${profileFileEnv} + sudo echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib" >> ${profileFileEnv} . ${profileFileEnv} fi diff --git a/oam/install_scripts/post-mysql-install b/oam/install_scripts/post-mysql-install index 08c38b84e..24711b048 100755 --- a/oam/install_scripts/post-mysql-install +++ b/oam/install_scripts/post-mysql-install @@ -64,7 +64,7 @@ USER=`whoami 2>/dev/null` if [ $USER != "root" ]; then sudo ldconfig >/dev/null 2>&1 export COLUMNSTORE_INSTALL_DIR=$installdir - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib/mysql + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib else ldconfig fi diff --git a/oamapps/calpontSupport/findStranded.sh b/oamapps/calpontSupport/findStranded.sh index 6d6ca28a3..1263aace9 100755 --- a/oamapps/calpontSupport/findStranded.sh +++ b/oamapps/calpontSupport/findStranded.sh @@ -18,7 +18,7 @@ export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR if [ $COLUMNSTORE_INSTALL_DIR != "/usr/local/mariadb/columnstore" ]; then export PATH=$COLUMNSTORE_INSTALL_DIR/bin:$COLUMNSTORE_INSTALL_DIR/mysql/bin:/bin:/usr/bin - export LD_LIBRARY_PATH=$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib/mysql + export LD_LIBRARY_PATH=$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib fi cd $COLUMNSTORE_INSTALL_DIR diff --git a/oamapps/calpontSupport/sqlLogs.sh b/oamapps/calpontSupport/sqlLogs.sh index a1a9a403c..818ab546c 100755 --- a/oamapps/calpontSupport/sqlLogs.sh +++ b/oamapps/calpontSupport/sqlLogs.sh @@ -14,7 +14,7 @@ export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR if [ $COLUMNSTORE_INSTALL_DIR != "/usr/local/mariadb/columnstore" ]; then export PATH=$COLUMNSTORE_INSTALL_DIR/bin:$COLUMNSTORE_INSTALL_DIR/mysql/bin:/bin:/usr/bin - export LD_LIBRARY_PATH=$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib/mysql + export LD_LIBRARY_PATH=$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib fi diff --git a/oamapps/columnstoreSupport/findStranded.sh b/oamapps/columnstoreSupport/findStranded.sh index 8577e06e3..12e160172 100755 --- a/oamapps/columnstoreSupport/findStranded.sh +++ b/oamapps/columnstoreSupport/findStranded.sh @@ -18,7 +18,7 @@ export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR if [ $COLUMNSTORE_INSTALL_DIR != "/usr/local/mariadb/columnstore" ]; then export PATH=$COLUMNSTORE_INSTALL_DIR/bin:$COLUMNSTORE_INSTALL_DIR/mysql/bin:/bin:/usr/bin - export LD_LIBRARY_PATH=$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib/mysql + export LD_LIBRARY_PATH=$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib fi cd $COLUMNSTORE_INSTALL_DIR diff --git a/oamapps/columnstoreSupport/sqlLogs.sh b/oamapps/columnstoreSupport/sqlLogs.sh index 385b2d912..564973e7e 100755 --- a/oamapps/columnstoreSupport/sqlLogs.sh +++ b/oamapps/columnstoreSupport/sqlLogs.sh @@ -14,7 +14,7 @@ export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR if [ $COLUMNSTORE_INSTALL_DIR != "/usr/local/mariadb/columnstore" ]; then export PATH=$COLUMNSTORE_INSTALL_DIR/bin:$COLUMNSTORE_INSTALL_DIR/mysql/bin:/bin:/usr/bin - export LD_LIBRARY_PATH=$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib/mysql + export LD_LIBRARY_PATH=$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib fi diff --git a/tools/setConfig/configxml.sh b/tools/setConfig/configxml.sh index 2c3568f00..d78953660 100755 --- a/tools/setConfig/configxml.sh +++ b/tools/setConfig/configxml.sh @@ -18,7 +18,7 @@ InstallDir=$COLUMNSTORE_INSTALL_DIR if [ $InstallDir != "/usr/local/mariadb/columnstore" ]; then export PATH=$InstallDir/bin:$InstallDir/mysql/bin:/bin:/usr/bin - export LD_LIBRARY_PATH=$InstallDir/lib:$InstallDir/mysql/lib/mysql + export LD_LIBRARY_PATH=$InstallDir/lib:$InstallDir/mysql/lib fi case "$1" in From 17e954db7de3a8cc2c68241a2a653af48ca9e516 Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Wed, 7 Mar 2018 16:56:42 +0000 Subject: [PATCH 12/24] MCOL-1246 Fix string matching for whitespace For equality string matches other engines ignore trailing whitespace (this does not apply to LIKE matches). So we should do the same. This patch trims whitespace for MIN/MAX extent elimination checks, fixed width columns and dictionary columns during equality matches against constants (SELECT * FROM t1 WHERE b = 'ABC'). --- dbcon/joblist/lbidlist.cpp | 10 +++++++++- primitives/linux-port/column.cpp | 7 +++++++ primitives/linux-port/dictionary.cpp | 6 +++++- utils/dataconvert/dataconvert.h | 13 +++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/dbcon/joblist/lbidlist.cpp b/dbcon/joblist/lbidlist.cpp index 69fbbb7c2..b7cbe9e57 100644 --- a/dbcon/joblist/lbidlist.cpp +++ b/dbcon/joblist/lbidlist.cpp @@ -27,6 +27,7 @@ #include "calpontsystemcatalog.h" #include "brm.h" #include "brmtypes.h" +#include "dataconvert.h" #define IS_VERBOSE (fDebug >= 4) #define IS_DETAIL (fDebug >= 3) @@ -653,7 +654,14 @@ bool LBIDList::CasualPartitionPredicate(const int64_t Min, if (bIsChar && 1 < ct.colWidth) { - scan = compareVal(order_swap(Min), order_swap(Max), order_swap(value), + // MCOL-1246 Trim trailing whitespace for matching so that we have + // the same as InnoDB behaviour + int64_t tMin = Min; + int64_t tMax = Max; + dataconvert::DataConvert::trimWhitespace(tMin); + dataconvert::DataConvert::trimWhitespace(tMax); + + scan = compareVal(order_swap(tMin), order_swap(tMax), order_swap(value), op, lcf); // cout << "scan=" << (uint32_t) scan << endl; } diff --git a/primitives/linux-port/column.cpp b/primitives/linux-port/column.cpp index 6804c8b21..cdb70ef67 100644 --- a/primitives/linux-port/column.cpp +++ b/primitives/linux-port/column.cpp @@ -39,6 +39,7 @@ using namespace boost; #include "we_type.h" #include "stats.h" #include "primproc.h" +#include "dataconvert.h" using namespace logging; using namespace dbbc; using namespace primitives; @@ -527,7 +528,13 @@ inline bool colCompare(int64_t val1, int64_t val2, uint8_t COP, uint8_t rf, int type == CalpontSystemCatalog::TEXT) && !isNull ) { if (!regex.used && !rf) + { + // MCOL-1246 Trim trailing whitespace for matching, but not for + // regex + dataconvert::DataConvert::trimWhitespace(val1); + dataconvert::DataConvert::trimWhitespace(val2); return colCompare_(order_swap(val1), order_swap(val2), COP); + } else return colStrCompare_(order_swap(val1), order_swap(val2), COP, rf, ®ex); } diff --git a/primitives/linux-port/dictionary.cpp b/primitives/linux-port/dictionary.cpp index 0cc56df34..88d71dc3d 100644 --- a/primitives/linux-port/dictionary.cpp +++ b/primitives/linux-port/dictionary.cpp @@ -21,6 +21,7 @@ #include #include +#include #include using namespace std; @@ -164,7 +165,10 @@ void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader *h, string arg_utf8; if (eqFilter) { - bool gotIt = eqFilter->find(string(sig, siglen)) != eqFilter->end(); + // MCOL-1246 Trim whitespace before match + string strData(sig, siglen); + boost::trim_right(strData); + bool gotIt = eqFilter->find(strData) != eqFilter->end(); if ((h->COP1 == COMPARE_EQ && gotIt) || (h->COP1 == COMPARE_NE && !gotIt)) goto store; diff --git a/utils/dataconvert/dataconvert.h b/utils/dataconvert/dataconvert.h index 019ebcd77..aba5a8bd8 100644 --- a/utils/dataconvert/dataconvert.h +++ b/utils/dataconvert/dataconvert.h @@ -408,6 +408,7 @@ public: static inline std::string decimalToString(int64_t value, uint8_t scale, execplan::CalpontSystemCatalog::ColDataType colDataType); static inline void decimalToString(int64_t value, uint8_t scale, char* buf, unsigned int buflen, execplan::CalpontSystemCatalog::ColDataType colDataType); static inline std::string constructRegexp(const std::string& str); + static inline void trimWhitespace(int64_t &charData); static inline bool isEscapedChar(char c) { return ('%' == c || '_' == c); } // convert string to date @@ -552,6 +553,18 @@ inline void DataConvert::decimalToString(int64_t int_val, uint8_t scale, char* b *(ptr + l1) = '.'; } +inline void DataConvert::trimWhitespace(int64_t &charData) +{ + // Trims whitespace characters off non-dict character data + char *ch_data = (char*) &charData; + for (int8_t i = 7; i > 0; i--) + { + if (isspace(ch_data[i]) || ch_data[i] == '\0') + ch_data[i] = '\0'; + else + break; + } +} //FIXME: copy/pasted from dictionary.cpp: refactor inline std::string DataConvert::constructRegexp(const std::string& str) From b800fc7a2d1702dc2f2c4732803cd81738288a64 Mon Sep 17 00:00:00 2001 From: david hill Date: Wed, 7 Mar 2018 14:30:57 -0600 Subject: [PATCH 13/24] MCOL-1225 - add to post-install to remove older profile files --- oam/install_scripts/post-install | 3 +++ 1 file changed, 3 insertions(+) diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index 781f3a5ee..f7aeeb2ca 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -104,6 +104,9 @@ if [ $installdir != "/usr/local/mariadb/columnstore" ]; then fi if [ $user != "root" ]; then + sudo rm -f $profileFileEnv + sudo rm -f $profileFileAlias + sudo touch $profileFileEnv sudo chmod 666 $profileFileEnv egrep -qs 'MariaDB Columnstore Non-Root' ${profileFileEnv} From 905ce2ce8b6d6a41fa129bb0dc8e6c94e9021515 Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Fri, 9 Mar 2018 11:14:33 +0000 Subject: [PATCH 14/24] MCOL-1246 Fix for non-DSS step For TEXT columns (and some other scenarios) we don't do a DSS step to scan dictionaries and do it directly in the BPS step instead. This patch applies the previous fix to this case too. --- primitives/linux-port/dictionary.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/primitives/linux-port/dictionary.cpp b/primitives/linux-port/dictionary.cpp index 88d71dc3d..0e6083505 100644 --- a/primitives/linux-port/dictionary.cpp +++ b/primitives/linux-port/dictionary.cpp @@ -773,8 +773,10 @@ void PrimitiveProcessor::p_Dictionary(const DictInput *in, vector *out, filterOffset = sizeof(DictInput) + (in->NVALS * sizeof(PrimToken)); if (eqFilter) { - bool gotIt = (eqFilter->find(string((char *) sigptr.data, sigptr.len)) - != eqFilter->end()); + // MCOL-1246 Trim whitespace before match + string strData((char*)sigptr.data, sigptr.len); + boost::trim_right(strData); + bool gotIt = eqFilter->find(strData) != eqFilter->end(); if ((gotIt && eqOp == COMPARE_EQ) || (!gotIt && eqOp == COMPARE_NE)) goto store; goto no_store; From fa3574b6b1ef5ab753484c1858075b204e622554 Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Fri, 9 Mar 2018 13:08:09 +0000 Subject: [PATCH 15/24] MCOL-1246 Make matching SQL-92 compliant(ish) SQL-92 basically specifies for a NOPAD collation that only space should be ignored for matches. Tabs and other whitespace are handled differently. We don't fully support collations yet so we assume the defaults. --- primitives/linux-port/dictionary.cpp | 4 ++-- utils/dataconvert/dataconvert.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/primitives/linux-port/dictionary.cpp b/primitives/linux-port/dictionary.cpp index 0e6083505..8aba1bf8a 100644 --- a/primitives/linux-port/dictionary.cpp +++ b/primitives/linux-port/dictionary.cpp @@ -167,7 +167,7 @@ void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader *h, if (eqFilter) { // MCOL-1246 Trim whitespace before match string strData(sig, siglen); - boost::trim_right(strData); + boost::trim_right_if(strData, boost::is_any_if(" ")); bool gotIt = eqFilter->find(strData) != eqFilter->end(); if ((h->COP1 == COMPARE_EQ && gotIt) || (h->COP1 == COMPARE_NE && !gotIt)) @@ -775,7 +775,7 @@ void PrimitiveProcessor::p_Dictionary(const DictInput *in, vector *out, if (eqFilter) { // MCOL-1246 Trim whitespace before match string strData((char*)sigptr.data, sigptr.len); - boost::trim_right(strData); + boost::trim_right_if(strData, boost::is_any_of(" ")); bool gotIt = eqFilter->find(strData) != eqFilter->end(); if ((gotIt && eqOp == COMPARE_EQ) || (!gotIt && eqOp == COMPARE_NE)) goto store; diff --git a/utils/dataconvert/dataconvert.h b/utils/dataconvert/dataconvert.h index aba5a8bd8..d424a52f7 100644 --- a/utils/dataconvert/dataconvert.h +++ b/utils/dataconvert/dataconvert.h @@ -559,7 +559,7 @@ inline void DataConvert::trimWhitespace(int64_t &charData) char *ch_data = (char*) &charData; for (int8_t i = 7; i > 0; i--) { - if (isspace(ch_data[i]) || ch_data[i] == '\0') + if (ch_data[i] == ' ' || ch_data[i] == '\0') ch_data[i] = '\0'; else break; From 44c7693d484e4dd87458dfa6d270f2911c0ed93d Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Fri, 9 Mar 2018 15:21:53 +0000 Subject: [PATCH 16/24] MCOL-1246 Fix typo in boost call --- primitives/linux-port/dictionary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/primitives/linux-port/dictionary.cpp b/primitives/linux-port/dictionary.cpp index 8aba1bf8a..81a46e103 100644 --- a/primitives/linux-port/dictionary.cpp +++ b/primitives/linux-port/dictionary.cpp @@ -167,7 +167,7 @@ void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader *h, if (eqFilter) { // MCOL-1246 Trim whitespace before match string strData(sig, siglen); - boost::trim_right_if(strData, boost::is_any_if(" ")); + boost::trim_right_if(strData, boost::is_any_of(" ")); bool gotIt = eqFilter->find(strData) != eqFilter->end(); if ((h->COP1 == COMPARE_EQ && gotIt) || (h->COP1 == COMPARE_NE && !gotIt)) From 5b694773432745e7116d37c22b013988b0df6138 Mon Sep 17 00:00:00 2001 From: david hill Date: Thu, 15 Mar 2018 09:41:44 -0500 Subject: [PATCH 17/24] MCOL-1222 - improved the waitforsystemactive function --- oam/oamcpp/liboamcpp.cpp | 86 +++++++++++++++++++++++++++++++ oam/oamcpp/liboamcpp.h | 4 ++ oamapps/mcsadmin/mcsadmin.cpp | 59 ++------------------- oamapps/postConfigure/helpers.cpp | 27 ++++------ 4 files changed, 105 insertions(+), 71 deletions(-) diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index dfaa71609..aab98c5b8 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -8832,6 +8832,92 @@ namespace oam return entry; } + + /****************************************************************************************** + * @brief waitForActive + * + * purpose: wait for system to be active + * + ******************************************************************************************/ + void Oam::waitForActive() + { + SystemStatus systemstatus; + SystemProcessStatus systemprocessstatus; + bool bfirst = true; + + for (int i = 0 ; i < 18 ; i ++) + { + sleep (10); + try + { + getSystemStatus(systemstatus); + if (systemstatus.SystemOpState == ACTIVE) + { + BRM::DBRM dbrm; + try { + int rc = dbrm.getSystemQueryReady(); + if (rc == -1 ) { + writeLog("waitForActive: getSystemQueryReady error return: startSystem failed", LOG_TYPE_ERROR); + exceptionControl("waitForActive", API_FAILURE); + } + + if ( rc != 0 ) + return; + + writeLog("waitForActive: getSystemQueryReady not ready", LOG_TYPE_DEBUG); + } + catch(...) + {} + } + + if (systemstatus.SystemOpState == FAILED) + { + exceptionControl("waitForActive", API_FAILURE); + } + + if (systemstatus.SystemOpState == MAN_OFFLINE) + { + exceptionControl("waitForActive", API_FAILURE); + } + + cout << "." << flush; + + // Check DMLProc for a switch to BUSY_INIT. + // In such a case, we need to print a message that rollbacks + // are occurring and will take some time. + if (bfirst) // Once we've printed our message, no need to waste cpu looking + { + getProcessStatus(systemprocessstatus); + for (unsigned int i = 0 ; i < systemprocessstatus.processstatus.size(); i++) + { + if (systemprocessstatus.processstatus[i].ProcessName == "DMLProc") + { + if (systemprocessstatus.processstatus[i].ProcessOpState == oam::ROLLBACK_INIT) + { + cout << endl << endl <<" System Not Ready, DMLProc is checking/processing rollback of abandoned transactions. Processing could take some time, please wait..." << flush; + bfirst = false; + } + // At this point, we've found our DMLProc, so there's no need to spin the for loop + // any further. + break; + } + } + } + } + catch (...) + { + // At some point, we need to give up, ProcMon just isn't going to respond. + if (i > 18) // 3 minutes + { + cout << endl << endl << "TIMEOUT: ProcMon not responding to getSystemStatus"; + break; + } + } + } + + exceptionControl("waitForActive", API_FAILURE); + } + /*************************************************************************** * PRIVATE FUNCTIONS diff --git a/oam/oamcpp/liboamcpp.h b/oam/oamcpp/liboamcpp.h index f23f73dbd..51c1f773c 100644 --- a/oam/oamcpp/liboamcpp.h +++ b/oam/oamcpp/liboamcpp.h @@ -2481,6 +2481,10 @@ namespace oam bool checkSystemRunning(); + /** @brief wait for system to be active + */ + EXPORT void waitForActive(); + private: int sendMsgToProcMgr3(messageqcpp::ByteStream::byte requestType, alarmmanager::AlarmList& alarmlist, const std::string date); diff --git a/oamapps/mcsadmin/mcsadmin.cpp b/oamapps/mcsadmin/mcsadmin.cpp index f7a6e2a38..935d081cc 100644 --- a/oamapps/mcsadmin/mcsadmin.cpp +++ b/oamapps/mcsadmin/mcsadmin.cpp @@ -77,62 +77,13 @@ bool SendToWES(Oam& oam, ByteStream bs); bool waitForActive() { Oam oam; - SystemStatus systemstatus; - SystemProcessStatus systemprocessstatus; - bool bfirst = true; - - for (int i = 0 ; i < 1200 ; i ++) + try { - sleep (3); - try - { - oam.getSystemStatus(systemstatus); - if (systemstatus.SystemOpState == ACTIVE) - { - return true; - } - if (systemstatus.SystemOpState == FAILED) - { - return false; - } - if (systemstatus.SystemOpState == MAN_OFFLINE) - { - return false; - } - cout << "." << flush; - - // Check DMLProc for a switch to BUSY_INIT. - // In such a case, we need to print a message that rollbacks - // are occurring and will take some time. - if (bfirst) // Once we've printed our message, no need to waste cpu looking - { - oam.getProcessStatus(systemprocessstatus); - for (unsigned int i = 0 ; i < systemprocessstatus.processstatus.size(); i++) - { - if (systemprocessstatus.processstatus[i].ProcessName == "DMLProc") - { - if (systemprocessstatus.processstatus[i].ProcessOpState == oam::ROLLBACK_INIT) - { - cout << endl << endl <<" System Not Ready, DMLProc is checking/processing rollback of abandoned transactions. Processing could take some time, please wait..." << flush; - bfirst = false; - } - // At this point, we've found our DMLProc, so there's no need to spin the for loop - // any further. - break; - } - } - } - } - catch (...) - { - // At some point, we need to give up, ProcMgr just isn't going to respond. - if (i > 60) // 3 minutes - { - cout << "ProcMgr not responding while waiting for system to start"; - break; - } - } + oam.waitForActive(); + return true; } + catch (...) + {} return false; } diff --git a/oamapps/postConfigure/helpers.cpp b/oamapps/postConfigure/helpers.cpp index b53a17302..f8cc46990 100644 --- a/oamapps/postConfigure/helpers.cpp +++ b/oamapps/postConfigure/helpers.cpp @@ -74,28 +74,21 @@ void callFree(const char* ) } - bool waitForActive() { - Oam oam; + Oam oam; + try + { + oam.waitForActive(); + return true; + } + catch (...) + {} - const string cmd = installDir + "/bin/mcsadmin getsystemstatus > /tmp/wait.log"; - system(cmd.c_str()); - - for ( int i = 0 ; i < 120 ; i ++ ) - { - if (oam.checkLogStatus("/tmp/wait.log", "System ACTIVE") ) - return true; - if ( oam.checkLogStatus("/tmp/wait.log", "System FAILED") ) - return false; - cout << "."; - cout.flush(); - sleep (10); - system(cmd.c_str()); - } - return false; + return false; } + void dbrmDirCheck() { From 38684501c912458a008a1365a39b095a3b2327af Mon Sep 17 00:00:00 2001 From: david hill Date: Thu, 22 Mar 2018 13:46:40 -0500 Subject: [PATCH 18/24] MCOL-1222 - changed the delay from 10 to 3 seconds --- oam/oamcpp/liboamcpp.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index aab98c5b8..649d86f13 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -8844,10 +8844,11 @@ namespace oam SystemStatus systemstatus; SystemProcessStatus systemprocessstatus; bool bfirst = true; - - for (int i = 0 ; i < 18 ; i ++) + int dot = 0; + + for (int i = 0 ; i < 120 ; i ++, dot ++) { - sleep (10); + sleep (3); try { getSystemStatus(systemstatus); @@ -8880,7 +8881,11 @@ namespace oam exceptionControl("waitForActive", API_FAILURE); } - cout << "." << flush; + if (dot >= 3 ) + { + cout << "." << flush; + dot=0; + } // Check DMLProc for a switch to BUSY_INIT. // In such a case, we need to print a message that rollbacks @@ -8907,7 +8912,7 @@ namespace oam catch (...) { // At some point, we need to give up, ProcMon just isn't going to respond. - if (i > 18) // 3 minutes + if (i > 60) // 3 minutes { cout << endl << endl << "TIMEOUT: ProcMon not responding to getSystemStatus"; break; From 73b1ac68faa9cbf05a6ca312a35df61c6e4f60a0 Mon Sep 17 00:00:00 2001 From: David Hall Date: Tue, 27 Mar 2018 12:43:43 -0500 Subject: [PATCH 19/24] MCOL-1196 Error when using OR in case THEN portion In ha_calpont_execplan, Allow OR to be parsed; in searched_case parsing, reverse the order of processing arguments so that ptWorkStack.pop() is executed in the same order as the arguments being processed. In func_case, modify to pass left and right to getBoolVal, if they exist. --- dbcon/mysql/ha_calpont_execplan.cpp | 12 ++++++++---- utils/funcexp/func_case.cpp | 7 +++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index 6cb25c269..690c8b3b5 100755 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -2553,6 +2553,10 @@ ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupp break; } + case Item::COND_ITEM: + { + break; + } default: { gwi.fatalParseError = true; @@ -3183,6 +3187,7 @@ FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonS if (((Item_func_case*)item)->get_first_expr_num() == -1) funcName = "case_searched"; + funcParms.reserve(item->argument_count()); if (gwi.clauseType == SELECT || gwi.clauseType == HAVING || gwi.clauseType == GROUP_BY) // select clause { // the first argument @@ -3233,13 +3238,12 @@ FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonS gwi.clauseType = SELECT; if (funcName == "case_searched") { - for (uint32_t i = 0; i < item->argument_count(); i++) + for (int32_t i = item->argument_count()-1; i >=0; i--) { - if (i % 2 == 0 && i != item->argument_count()-1) + if (i % 2 == 0 && uint(i) != item->argument_count()-1) { // build item from arguments to avoid parm sequence complexity sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport)); - funcParms.push_back(sptp); if (!gwi.ptWorkStack.empty()) gwi.ptWorkStack.pop(); } @@ -3258,8 +3262,8 @@ FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonS if (!gwi.ptWorkStack.empty()) gwi.ptWorkStack.pop(); } - funcParms.push_back(sptp); } + funcParms.insert(funcParms.begin(), sptp); } } else // simple_case diff --git a/utils/funcexp/func_case.cpp b/utils/funcexp/func_case.cpp index 7cc033f85..3787947ab 100644 --- a/utils/funcexp/func_case.cpp +++ b/utils/funcexp/func_case.cpp @@ -470,6 +470,13 @@ bool Func_searched_case::getBoolVal(Row& row, if (isNull) return joblist::BIGINTNULL; + ParseTree* lop = parm[i+1]->left(); + ParseTree* rop = parm[i+1]->right(); + if (lop && rop) + { + return (reinterpret_cast(parm[i+1]->data()))->getBoolVal(row, isNull, lop, rop); + } + return parm[i+1]->data()->getBoolVal(row, isNull); } From c83896609dd76ba5476b3cc1b0edda08ae185288 Mon Sep 17 00:00:00 2001 From: David Hall Date: Tue, 27 Mar 2018 15:23:47 -0500 Subject: [PATCH 20/24] MCOL-1196 add a comment --- dbcon/mysql/ha_calpont_execplan.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index 690c8b3b5..7e138792b 100755 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -2555,6 +2555,8 @@ ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupp case Item::COND_ITEM: { + // MCOL-1196: Allow COND_ITEM thru. They will be picked up + // by further logic. It may become desirable to add code here. break; } default: From aa581b5dc3d88b4d0d07a224de4da5c96cf23aa3 Mon Sep 17 00:00:00 2001 From: David Hall Date: Mon, 2 Apr 2018 17:02:54 -0500 Subject: [PATCH 21/24] MCOL-1234 Nested CASE filters not processed Change the way buildCaseFunction() handles the ptWorkStack and the rcWorkStack. --- dbcon/execplan/arithmeticoperator.cpp | 2 +- dbcon/execplan/filter.cpp | 2 +- dbcon/execplan/logicoperator.cpp | 2 +- dbcon/execplan/predicateoperator.cpp | 2 +- dbcon/execplan/simplecolumn.cpp | 10 +- dbcon/execplan/treenodeimpl.cpp | 2 +- dbcon/mysql/ha_calpont_execplan.cpp | 146 +++++++++++--------------- 7 files changed, 73 insertions(+), 93 deletions(-) diff --git a/dbcon/execplan/arithmeticoperator.cpp b/dbcon/execplan/arithmeticoperator.cpp index b16b0dbeb..122f481ae 100644 --- a/dbcon/execplan/arithmeticoperator.cpp +++ b/dbcon/execplan/arithmeticoperator.cpp @@ -102,7 +102,7 @@ void ArithmeticOperator::unserialize(messageqcpp::ByteStream& b) bool ArithmeticOperator::operator==(const ArithmeticOperator& t) const { - if (fData == t.fData) + if (data() == t.data()) return true; return false; } diff --git a/dbcon/execplan/filter.cpp b/dbcon/execplan/filter.cpp index 386acd256..7368d4379 100644 --- a/dbcon/execplan/filter.cpp +++ b/dbcon/execplan/filter.cpp @@ -72,7 +72,7 @@ const string Filter::toString() const bool Filter::operator==(const Filter& t) const { - if (fData == t.fData) + if (data() == t.data()) return true; return false; } diff --git a/dbcon/execplan/logicoperator.cpp b/dbcon/execplan/logicoperator.cpp index 9c12d27ae..99a7d0656 100644 --- a/dbcon/execplan/logicoperator.cpp +++ b/dbcon/execplan/logicoperator.cpp @@ -106,7 +106,7 @@ void LogicOperator::unserialize(messageqcpp::ByteStream& b) bool LogicOperator::operator==(const LogicOperator& t) const { - if (fData == t.fData) + if (data() == t.data()) return true; return false; } diff --git a/dbcon/execplan/predicateoperator.cpp b/dbcon/execplan/predicateoperator.cpp index 38e7a2f54..2b47ec058 100644 --- a/dbcon/execplan/predicateoperator.cpp +++ b/dbcon/execplan/predicateoperator.cpp @@ -152,7 +152,7 @@ void PredicateOperator::unserialize(messageqcpp::ByteStream& b) bool PredicateOperator::operator==(const PredicateOperator& t) const { - if (fData == t.fData) + if (data() == t.data()) return true; return false; } diff --git a/dbcon/execplan/simplecolumn.cpp b/dbcon/execplan/simplecolumn.cpp index a3a4e0dac..895334fc9 100644 --- a/dbcon/execplan/simplecolumn.cpp +++ b/dbcon/execplan/simplecolumn.cpp @@ -370,16 +370,16 @@ bool SimpleColumn::operator==(const SimpleColumn& t) const return false; if (fColumnName != t.fColumnName) return false; - if (fIndexName != t.fIndexName) - return false; +// if (fIndexName != t.fIndexName) +// return false; if (fViewName != t.fViewName) return false; if (fOid != t.fOid) return false; - if (fData != t.fData) - return false; - if (fAlias != t.fAlias) + if (data() != t.data()) return false; +// if (fAlias != t.fAlias) +// return false; if (fTableAlias != t.fTableAlias) return false; if (fAsc != t.fAsc) diff --git a/dbcon/execplan/treenodeimpl.cpp b/dbcon/execplan/treenodeimpl.cpp index 6ffe2787a..50fa7d209 100644 --- a/dbcon/execplan/treenodeimpl.cpp +++ b/dbcon/execplan/treenodeimpl.cpp @@ -63,7 +63,7 @@ const string TreeNodeImpl::toString() const bool TreeNodeImpl::operator==(const TreeNodeImpl& t) const { - if (fData == t.fData) + if (data() == t.data()) return true; return false; } diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index 7e138792b..da80366b8 100755 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -3190,107 +3190,85 @@ FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonS funcName = "case_searched"; funcParms.reserve(item->argument_count()); - if (gwi.clauseType == SELECT || gwi.clauseType == HAVING || gwi.clauseType == GROUP_BY) // select clause + // so buildXXXcolumn function will not pop stack. + ClauseType realClauseType = gwi.clauseType; + gwi.clauseType = SELECT; + + // We ought to be able to just build from the stack, and would + // be able to if there were any way to know which stack had the + // next case item. Unfortunately, parameters may have been pushed + // onto the ptWorkStack or rcWorkStack or neither, depending on type + // and position. We can't tell which at this point, so we + // rebuild the item from the arguments directly and then try to + // figure what to pop, if anything, in order to sync the stacks. + for (int32_t i = item->argument_count()-1; i >=0; i--) { - // the first argument - if (funcName == "case_searched") + // For case_searched, we know the items for the WHEN clause will + // not be ReturnedColumns. We do this separately just to save + // some cpu cycles trying to build a ReturnedColumn as below. + // Every even numbered arg is a WHEN. In between are the THEN. + // An odd number of args indicates an ELSE residing in the last spot. + if (funcName == "case_searched" && + i % 2 == 0 && uint(i) != item->argument_count()-1) { - for (uint32_t i = 0; i < item->argument_count(); i++) + sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport)); + if (!gwi.ptWorkStack.empty() && *gwi.ptWorkStack.top()->data() == sptp->data()) { - if (i % 2 == 0 && i != 1 && i != item->argument_count()-1) - { - sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport)); - funcParms.push_back(sptp); - } - else - { - ReturnedColumn* parm = buildReturnedColumn(item->arguments()[i], gwi, nonSupport); - if (parm) - { - sptp.reset(new ParseTree(parm)); - } - else - { - sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport)); - } - funcParms.push_back(sptp); - } + gwi.ptWorkStack.pop(); } } else { - for (uint32_t i = 0; i < item->argument_count(); i++) + // First try building a ReturnedColumn. It may or may not succeed + // depending on the types involved. There's also little correlation + // between buildReturnedColumn and the existance of the item on + // rwWorkStack or ptWorkStack. + // For example, simple predicates, such as 1=1 or 1=0, land in the + // ptWorkStack but other stuff might land in the rwWorkStack + ReturnedColumn* parm = buildReturnedColumn(item->arguments()[i], gwi, nonSupport); + if (parm) { - ReturnedColumn* parm = buildReturnedColumn(item->arguments()[i], gwi, nonSupport); - if (parm) + sptp.reset(new ParseTree(parm)); + // We need to pop whichever stack is holding it, if any. + if ((!gwi.rcWorkStack.empty()) && + *gwi.rcWorkStack.top() == parm) { - sptp.reset(new ParseTree(parm)); + gwi.rcWorkStack.pop(); } else + if (!gwi.ptWorkStack.empty()) { - sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport)); - } - funcParms.push_back(sptp); - } - } - } - else // where clause - { - // so buildXXXcolumn function will not pop stack. - gwi.clauseType = SELECT; - if (funcName == "case_searched") - { - for (int32_t i = item->argument_count()-1; i >=0; i--) - { - if (i % 2 == 0 && uint(i) != item->argument_count()-1) - { - // build item from arguments to avoid parm sequence complexity - sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport)); - if (!gwi.ptWorkStack.empty()) + ReturnedColumn* ptrc = dynamic_cast(gwi.ptWorkStack.top()->data()); + if (ptrc && *ptrc == *parm) gwi.ptWorkStack.pop(); } - else - { - ReturnedColumn* parm = buildReturnedColumn(item->arguments()[i], gwi, nonSupport); - if (parm) - { - sptp.reset(new ParseTree(parm)); - if (!gwi.rcWorkStack.empty()) - gwi.rcWorkStack.pop(); - } - else - { - sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport)); - if (!gwi.ptWorkStack.empty()) - gwi.ptWorkStack.pop(); - } - } - funcParms.insert(funcParms.begin(), sptp); } - } - else // simple_case - { - for (uint32_t i = 0; i < item->argument_count(); i++) + else { - ReturnedColumn* parm = buildReturnedColumn(item->arguments()[i], gwi, nonSupport); - if (parm) + sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport)); + // We need to pop whichever stack is holding it, if any. + if ((!gwi.ptWorkStack.empty()) && + *gwi.ptWorkStack.top()->data() == sptp->data()) { - sptp.reset(new ParseTree(parm)); - if (!gwi.rcWorkStack.empty()) + gwi.ptWorkStack.pop(); + } + else + if (!gwi.rcWorkStack.empty()) + { + // Probably won't happen, but it might have been on the + // rcWorkStack all along. + ReturnedColumn* ptrc = dynamic_cast(sptp->data()); + if (ptrc && *ptrc == *gwi.rcWorkStack.top()) + { gwi.rcWorkStack.pop(); + } } - else - { - sptp.reset(buildParseTree((Item_func*)(item->arguments()[i]), gwi, nonSupport)); - if (!gwi.ptWorkStack.empty()) - gwi.ptWorkStack.pop(); - } - funcParms.push_back(sptp); } } - // recover clause type - gwi.clauseType = WHERE; + funcParms.insert(funcParms.begin(), sptp); } + // recover clause type + gwi.clauseType = realClauseType; if (gwi.fatalParseError) { @@ -4259,9 +4237,9 @@ void gp_walk(const Item *item, void *arg) } // bug 3137. If filter constant like 1=0, put it to ptWorkStack // MariaDB bug 750. Breaks if compare is an argument to a function. - if ((int32_t)gwip->rcWorkStack.size() <= (gwip->rcBookMarkStack.empty() ? 0 : gwip->rcBookMarkStack.top()) - && isPredicateFunction(ifp, gwip)) -// if (isPredicateFunction(ifp, gwip)) +// if ((int32_t)gwip->rcWorkStack.size() <= (gwip->rcBookMarkStack.empty() ? 0 : gwip->rcBookMarkStack.top()) +// && isPredicateFunction(ifp, gwip)) + if (isPredicateFunction(ifp, gwip)) gwip->ptWorkStack.push(new ParseTree(cc)); else gwip->rcWorkStack.push(cc); @@ -5505,7 +5483,9 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i // @bug 1706 String funcStr; ifp->print(&funcStr, QT_INFINIDB); - gwi.selectCols.push_back(string(funcStr.c_ptr()) + " `" + escapeBackTick(ifp->name) + "`"); + string valStr; + valStr.assign(funcStr.ptr(), funcStr.length()); + gwi.selectCols.push_back(valStr + " `" + escapeBackTick(ifp->name) + "`"); // clear the error set by buildFunctionColumn gwi.fatalParseError = false; gwi.parseErrorText = ""; From fa43a962a8b19b4bd851055c6793663b705dec2a Mon Sep 17 00:00:00 2001 From: David Hall Date: Wed, 4 Apr 2018 15:56:53 -0500 Subject: [PATCH 22/24] MCOL-1325 rename table fails when database different than current database --- dbcon/mysql/ha_calpont_ddl.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dbcon/mysql/ha_calpont_ddl.cpp b/dbcon/mysql/ha_calpont_ddl.cpp index 68f963825..611f1da3b 100755 --- a/dbcon/mysql/ha_calpont_ddl.cpp +++ b/dbcon/mysql/ha_calpont_ddl.cpp @@ -2074,16 +2074,14 @@ int ha_calpont_impl_rename_table_(const char* from, const char* to, cal_connecti stmt = stmt1.str(); string db; - if ( thd->db ) - db = thd->db; - else if ( fromPair.first.length() !=0 ) + if ( fromPair.first.length() !=0 ) db = fromPair.first; - else - db = toPair.first; + else if ( thd->db ) + db = thd->db; int rc = ProcessDDLStatement(stmt, db, "", tid2sid(thd->thread_id), emsg); if (rc != 0) - push_warning(thd, Sql_condition::WARN_LEVEL_ERROR, 9999, emsg.c_str()); + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 9999, emsg.c_str()); return rc; } From 4067d6927803f5317cbee9812054de8824913c56 Mon Sep 17 00:00:00 2001 From: david hill Date: Thu, 5 Apr 2018 13:23:06 -0500 Subject: [PATCH 23/24] MCOL-1317 Mcol-1318 --- .../clusterTester/columnstoreClusterTester.sh | 68 ++++++------------- 1 file changed, 20 insertions(+), 48 deletions(-) diff --git a/utils/clusterTester/columnstoreClusterTester.sh b/utils/clusterTester/columnstoreClusterTester.sh index b512eeb20..56d78c49f 100755 --- a/utils/clusterTester/columnstoreClusterTester.sh +++ b/utils/clusterTester/columnstoreClusterTester.sh @@ -494,7 +494,7 @@ checkSELINUX() # SELINUX check # echo "" - echo "** Run SELINUX check - Setting should to be disabled on all nodes" + echo "** Run SELINUX check" echo "" pass=true @@ -502,9 +502,8 @@ checkSELINUX() if [ -f /etc/selinux/config ]; then `cat /etc/selinux/config | grep SELINUX | grep enforcing > /tmp/selinux_check 2>&1` if [ "$?" -eq 0 ]; then - echo "${bold}Failed${normal}, Local Node SELINUX setting is Enabled, please disable" + echo "${bold}Warning${normal}, Local Node SELINUX setting is Enabled, check port test results" pass=false - REPORTPASS=false else echo "Local Node SELINUX setting is Not Enabled" fi @@ -519,19 +518,14 @@ checkSELINUX() else `cat config | grep SELINUX | grep enforcing > /tmp/selinux_check 2>&1` if [ "$?" -eq 0 ]; then - echo "${bold}Failed${normal}, $ipadd SELINUX setting is Enabled, please disable" + echo "${bold}Warning${normal}, $ipadd SELINUX setting is Enabled, check port test results" pass=false - REPORTPASS=false else echo "$ipadd Node SELINUX setting is Not Enabled" fi `rm -f config` fi done - - if ! $pass; then - checkContinue - fi } checkFirewalls() @@ -539,28 +533,23 @@ checkFirewalls() # FIREWALL checks # echo "" - echo "** Run Firewall Services check - Firewall Services should to be Inactive on all nodes" + echo "** Run Firewall Services check" echo "" declare -a FIREWALL_LIST=("iptables" "ufw" "firewalld" "firewall") - fpass=true #check local FIREWALLS for firewall in "${FIREWALL_LIST[@]}"; do pass=true `service $firewall status > /tmp/firewall1_check 2>&1` if [ "$?" -eq 0 ]; then - echo "${bold}Failed${normal}, Local Node $firewall service is Active, please disable" + echo "${bold}Warning${normal}, Local Node $firewall service is Active, check port test results" pass=false - fpass=false - REPORTPASS=false else `systemctl status $firewall > /tmp/firewall1_check 2>&1` if [ "$?" -eq 0 ]; then - echo "${bold}Failed${normal}, Local Node $firewall service is Active, please disable" + echo "${bold}Warning${normal}, Local Node $firewall service is Active, check port test results" pass=false - fpass=false - REPORTPASS=false fi fi @@ -569,10 +558,6 @@ checkFirewalls() fi done - if ! $fpass; then - checkContinue - fi - echo "" fpass=true for ipadd in "${NODE_IPADDRESS[@]}"; do @@ -581,17 +566,13 @@ checkFirewalls() pass=true `$COLUMNSTORE_INSTALL_DIR/bin/remote_command.sh $ipadd $PASSWORD "service '$firewall' status > /tmp/firewall_check 2>&1" 1 > /tmp/remote_command_check` if [ "$?" -eq 0 ]; then - echo "${bold}Failed${normal}, $ipadd Node $firewall service is Active, please disable" + echo "${bold}Warning${normal}, $ipadd Node $firewall service is Active, check port test results" pass=false - fpass=false - REPORTPASS=false else `$COLUMNSTORE_INSTALL_DIR/bin/remote_command.sh $ipadd $PASSWORD "systemctl status '$firewall' > /tmp/firewall_check 2>&1" 1 > /tmp/remote_command_check` if [ "$?" -eq 0 ]; then - echo "${bold}Failed${normal}, $ipadd Node $firewall service is Active, please disable" + echo "${bold}Warning${normal}, $ipadd Node $firewall service is Active, check port test results" pass=false - fpass=false - REPORTPASS=false fi fi @@ -602,25 +583,20 @@ checkFirewalls() echo "" done - - if ! $fpass; then - checkContinue - fi if [ $OS == "suse12" ]; then # rcSuSEfirewall2 check # echo "" - echo "** Run rcSuSEfirewall2 check - Service should to be disabled on all nodes" + echo "** Run rcSuSEfirewall2 check" echo "" pass=true #check local IPTABLES `/sbin/rcSuSEfirewall2 status > /tmp/rcSuSEfirewall2_check 2>&1` if [ "$?" -eq 0 ]; then - echo "${bold}Failed${normal}, Local Node rcSuSEfirewall2 service is Enabled, please disable" + echo "${bold}Failed${normal}, Local Node rcSuSEfirewall2 service is Enabled, check port test results" pass=false - REPORTPASS=false else echo "Local Node rcSuSEfirewall2 service is Not Enabled" fi @@ -629,17 +605,12 @@ checkFirewalls() `$COLUMNSTORE_INSTALL_DIR/bin/remote_command.sh $ipadd $PASSWORD '/sbin/rcSuSEfirewall2 status > /tmp/rcSuSEfirewall2_check 2>&1' 1 > /tmp/remote_command_check` rc="$?" if [ $rc -eq 0 ] ; then - echo "${bold}Failed${normal}, $ipadd Node rcSuSEfirewall2 service is Enabled, please disable" + echo "${bold}Failed${normal}, $ipadd Node rcSuSEfirewall2 service is Enabled, check port test results" pass=false - REPORTPASS=false else echo "$ipadd Node rcSuSEfirewall2 service is Not Enabled" fi done - - if ! $pass; then - checkContinue - fi fi } @@ -648,17 +619,18 @@ checkPorts() # port test # echo "" - echo "** Run MariaDB ColumnStore Port (8600-8620) availibility test" + echo "** Run MariaDB ColumnStore Port (8600-8630,8700,8800,3306) availibility test" echo "" pass=true for ipadd in "${NODE_IPADDRESS[@]}"; do - `nmap $ipadd -p 8600-8620 | grep 'closed unknown' > /dev/null` - if [ "$?" -eq 0 ]; then + `sudo nmap $ipadd -p 8600-8630,8700,8800,3306 | grep 'filtered' > /tmp/port_test` + if [ "$?" -ne 0 ]; then echo $ipadd " Node Passed port test" else - echo $ipadd " Node ${bold}Failed${normal} port test, check and disable any firwalls that were reported enabled" + echo $ipadd " Node ${bold}Failed${normal} port test, check and disable any firewalls or open ports in firewall" + cat /tmp/port_test pass=false REPORTPASS=false fi @@ -764,7 +736,7 @@ checkPackages() echo "** Run MariaDB ColumnStore Dependent Package Check" echo "" - declare -a CENTOS_PKG=("expect" "perl" "perl-DBI" "openssl" "zlib" "file" "sudo" "libaio" "rsync" "snappy" "net-tools" "perl-DBD-MySQL") + declare -a CENTOS_PKG=("expect" "perl" "perl-DBI" "openssl" "zlib" "file" "sudo" "libaio" "rsync" "snappy" "net-tools") declare -a CENTOS_PKG_NOT=("mariadb-libs") if [ "$OS" == "centos6" ] || [ "$OS" == "centos7" ]; then @@ -883,7 +855,7 @@ checkPackages() fi fi - declare -a SUSE_PKG=("boost-devel" "expect" "perl" "perl-DBI" "openssl" "file" "sudo" "libaio1" "rsync" "libsnappy1" "net-tools" "perl-DBD-mysql") + declare -a SUSE_PKG=("boost-devel" "expect" "perl" "perl-DBI" "openssl" "file" "sudo" "libaio1" "rsync" "libsnappy1" "net-tools") declare -a SUSE_PKG_NOT=("mariadb" , "libmariadb18") if [ "$OS" == "suse12" ]; then @@ -974,7 +946,7 @@ checkPackages() fi fi - declare -a UBUNTU_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline-dev" "rsync" "libsnappy1V5" "net-tools" "libdbd-mysql-perl") + declare -a UBUNTU_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline-dev" "rsync" "libsnappy1V5" "net-tools") declare -a UBUNTU_PKG_NOT=("mariadb-server" "libmariadb18") if [ "$OS" == "ubuntu16" ] ; then @@ -1091,7 +1063,7 @@ checkPackages() fi fi - declare -a DEBIAN_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline-dev" "rsync" "libsnappy1" "net-tools" "libdbd-mysql-perl") + declare -a DEBIAN_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline-dev" "rsync" "libsnappy1" "net-tools") declare -a DEBIAN_PKG_NOT=("libmariadb18" "mariadb-server") if [ "$OS" == "debian8" ]; then From 333f848a2fb82d9bc1b0af4ad3ab71d8b022afa8 Mon Sep 17 00:00:00 2001 From: david hill Date: Thu, 5 Apr 2018 13:24:55 -0500 Subject: [PATCH 24/24] MCOL-1317 Mcol-1318 --- utils/clusterTester/columnstoreClusterTester.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/clusterTester/columnstoreClusterTester.sh b/utils/clusterTester/columnstoreClusterTester.sh index 56d78c49f..341e37748 100755 --- a/utils/clusterTester/columnstoreClusterTester.sh +++ b/utils/clusterTester/columnstoreClusterTester.sh @@ -619,7 +619,7 @@ checkPorts() # port test # echo "" - echo "** Run MariaDB ColumnStore Port (8600-8630,8700,8800,3306) availibility test" + echo "** Run MariaDB ColumnStore Port (8600-8630,8700,8800,3306) availability test" echo "" pass=true