diff --git a/cpackEngineRPM.cmake b/cpackEngineRPM.cmake index 260a2a2a1..a6013b280 100644 --- a/cpackEngineRPM.cmake +++ b/cpackEngineRPM.cmake @@ -217,6 +217,7 @@ SET(CPACK_RPM_platform_USER_FILELIST "/usr/local/mariadb/columnstore/post/test-004.sh" "/usr/local/mariadb/columnstore/bin/os_detect.sh" "/usr/local/mariadb/columnstore/bin/columnstoreClusterTester.sh" +"/usr/local/mariadb/columnstore/bin/mariadb-command-line.sh" ${ignored}) SET(CPACK_RPM_libs_USER_FILELIST diff --git a/dbcon/mysql/columnstore_info.sql b/dbcon/mysql/columnstore_info.sql index 60dab7eac..23a6a0ed6 100644 --- a/dbcon/mysql/columnstore_info.sql +++ b/dbcon/mysql/columnstore_info.sql @@ -82,9 +82,7 @@ DROP PROCEDURE IF EXISTS `compression_ratio` // CREATE PROCEDURE compression_ratio() BEGIN -SELECT CONCAT(((sum(compressed_data_size) / sum(data_size)) * 100), '%') COMPRESSION_RATIO FROM INFORMATION_SCHEMA.COLUMNSTORE_EXTENTS ce -JOIN INFORMATION_SCHEMA.COLUMNSTORE_FILES cf ON ce.object_id = cf.object_id -WHERE compressed_data_size IS NOT NULL; +SELECT CONCAT((SELECT SUM(file_size) FROM information_schema.columnstore_files WHERE compressed_data_size IS NOT NULL) / (SELECT SUM(data_size) FROM information_schema.columnstore_extents) * 100, '%') COMPRESSION_RATIO; END // DELIMITER ; diff --git a/dbcon/mysql/ha_calpont_dml.cpp b/dbcon/mysql/ha_calpont_dml.cpp index d9934a7f9..1cef4d4da 100644 --- a/dbcon/mysql/ha_calpont_dml.cpp +++ b/dbcon/mysql/ha_calpont_dml.cpp @@ -942,12 +942,12 @@ int ha_calpont_impl_write_batch_row_(uchar* buf, TABLE* table, cal_impl_if::cal_ { if (ci.columnTypes[colpos].colWidth < 256) { - dataLength = *(int8_t*) buf; + dataLength = *(uint8_t*) buf; buf++; } else { - dataLength = *(int16_t*) buf; + dataLength = *(uint16_t*) buf; buf = buf + 2 ; } @@ -959,7 +959,7 @@ int ha_calpont_impl_write_batch_row_(uchar* buf, TABLE* table, cal_impl_if::cal_ { if (ci.columnTypes[colpos].colWidth < 86) { - dataLength = *(int8_t*) buf; + dataLength = *(uint8_t*) buf; buf++; } else diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index a80678222..c4a37a77d 100644 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -2335,7 +2335,7 @@ void setError(THD* thd, uint32_t errcode, string errmsg) } thd->raise_error_printf(errcode, errmsg.c_str()); - thd->infinidb_vtable.mysql_optimizer_off = false; + thd->infinidb_vtable.isNewQuery = true; thd->infinidb_vtable.override_largeside_estimate = false; // reset expressionID @@ -4891,6 +4891,14 @@ void gp_walk(const Item* item, void* arg) bool isOr = (ftype == Item_func::COND_OR_FUNC); bool isXor = (ftype == Item_func::XOR_FUNC); + // MCOL-1029 A cached COND_ITEM is something like: + // AND (TRUE OR FALSE) + // We can skip it + if (isCached) + { + break; + } + List* argumentList; List xorArgumentList; @@ -7209,9 +7217,9 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i } } - // populate string to be added to the select list for order by redo = (redo || fieldVec.size() != 0); + // populate string to be added to the select list for order by for (uint32_t i = 0; i < fieldVec.size(); i++) { SimpleColumn* sc = buildSimpleColumn(fieldVec[i], gwi); diff --git a/dbcon/mysql/ha_calpont_impl.cpp b/dbcon/mysql/ha_calpont_impl.cpp index d16d25186..29a1b7188 100644 --- a/dbcon/mysql/ha_calpont_impl.cpp +++ b/dbcon/mysql/ha_calpont_impl.cpp @@ -3345,8 +3345,8 @@ int ha_calpont_impl_rnd_end(TABLE* table) return rc; } - if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_REDO_PHASE1 && thd->infinidb_vtable.mysql_optimizer_off) - return rc; +// if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_REDO_PHASE1) +// return rc; if ( (thd->lex)->sql_command == SQLCOM_ALTER_TABLE ) return rc; @@ -3363,7 +3363,7 @@ int ha_calpont_impl_rnd_end(TABLE* table) // @bug 4022. error handling for select part of dml if (ci->cal_conn_hndl && ci->rc) { - // send ExeMgr a signal before cloing the connection + // send ExeMgr a signal before closing the connection ByteStream msg; ByteStream::quadbyte qb = 0; msg << qb; diff --git a/dbcon/mysql/install_calpont_mysql.sh b/dbcon/mysql/install_calpont_mysql.sh index 611b50ef3..aaa17473a 100755 --- a/dbcon/mysql/install_calpont_mysql.sh +++ b/dbcon/mysql/install_calpont_mysql.sh @@ -14,9 +14,6 @@ for arg in "$@"; do installdir=$prefix/mariadb/columnstore elif [ `expr -- "$arg" : '--rpmmode='` -eq 10 ]; then rpmmode="`echo $arg | awk -F= '{print $2}'`" - elif [ `expr -- "$arg" : '--password='` -eq 11 ]; then - password="`echo $arg | awk -F= '{print $2}'`" - pwprompt="--password=$password" elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then installdir="`echo $arg | awk -F= '{print $2}'`" prefix=`dirname $installdir` @@ -27,7 +24,7 @@ done df=$installdir/mysql/my.cnf -$installdir/mysql/bin/mysql --defaults-file=$df --force --user=root $pwprompt mysql 2>/tmp/mysql_install.log </tmp/mysql_install.log </dev/null <$installdir/mysql/syscatalog_mysql.sql -$installdir/mysql/bin/mysql --defaults-file=$df --user=root $pwprompt mysql 2>/dev/null <$installdir/mysql/calsetuserpriority.sql -$installdir/mysql/bin/mysql --defaults-file=$df --user=root $pwprompt mysql 2>/dev/null <$installdir/mysql/calremoveuserpriority.sql -$installdir/mysql/bin/mysql --defaults-file=$df --user=root $pwprompt mysql 2>/dev/null <$installdir/mysql/calshowprocesslist.sql -$installdir/mysql/bin/mysql --defaults-file=$df --user=root $pwprompt mysql 2>/dev/null <$installdir/mysql/columnstore_info.sql +$installdir/mysql/bin/mysql --defaults-extra-file=$df --user=root mysql 2>/dev/null <$installdir/mysql/syscatalog_mysql.sql +$installdir/mysql/bin/mysql --defaults-extra-file=$df --user=root mysql 2>/dev/null <$installdir/mysql/calsetuserpriority.sql +$installdir/mysql/bin/mysql --defaults-extra-file=$df --user=root mysql 2>/dev/null <$installdir/mysql/calremoveuserpriority.sql +$installdir/mysql/bin/mysql --defaults-extra-file=$df --user=root mysql 2>/dev/null <$installdir/mysql/calshowprocesslist.sql +$installdir/mysql/bin/mysql --defaults-extra-file=$df --user=root mysql 2>/dev/null <$installdir/mysql/columnstore_info.sql sed -i 's/infinidb_compression_type=1/infinidb_compression_type=2/' $installdir/mysql/my.cnf >/dev/null 2>&1 diff --git a/dbcon/mysql/is_columnstore_extents.cpp b/dbcon/mysql/is_columnstore_extents.cpp index e9d4eafdf..8eb8e15e3 100644 --- a/dbcon/mysql/is_columnstore_extents.cpp +++ b/dbcon/mysql/is_columnstore_extents.cpp @@ -168,14 +168,18 @@ static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond) table->field[14]->store("Unknown", strlen("Unknown"), cs); } - // MCOL-454: special case, sometimes blockOffset can be > 0 and HWM can be 0 + // MCOL-1016: on multiple segments HWM is set to 0 on the lower + // segments, we don't want these to show as 8KB. The down side is + // if the column has less than 1 block it will show as 0 bytes. + // We have no lookahead without it getting messy so this is the + // best compromise. if (iter->HWM == 0) { - table->field[15]->store(8192); + table->field[15]->store(0); } else { - table->field[15]->store((iter->HWM - iter->blockOffset + 1) * 8192); + table->field[15]->store((iter->HWM + 1) * 8192); } if (schema_table_store_record(thd, table)) diff --git a/dbcon/mysql/my.cnf b/dbcon/mysql/my.cnf index d4f595062..fb20fd8c9 100644 --- a/dbcon/mysql/my.cnf +++ b/dbcon/mysql/my.cnf @@ -53,7 +53,7 @@ infinidb_compression_type=2 infinidb_stringtable_threshold=20 # infinidb local query flag -# infinidb_local_query=1 +infinidb_local_query=0 infinidb_diskjoin_smallsidelimit=0 infinidb_diskjoin_largesidelimit=0 @@ -79,7 +79,7 @@ plugin_dir = /usr/local/mariadb/columnstore/mysql/lib/plugi # Replication Master Server (default) # binary logging is required for replication # log-bin=mysql-bin -# binlog_format=ROW +binlog_format=ROW # required unique id between 1 and 2^32 - 1 # defaults to 1 if master-host diff --git a/dbcon/mysql/mysql-Columnstore b/dbcon/mysql/mysql-Columnstore index a0c8bca23..b49c646e2 100755 --- a/dbcon/mysql/mysql-Columnstore +++ b/dbcon/mysql/mysql-Columnstore @@ -61,7 +61,7 @@ datadir=$basedir/db # Value here is overriden by value in my.cnf. # 0 means don't wait at all # Negative numbers mean to wait indefinitely -service_startup_timeout=30 +service_startup_timeout=60 # Lock directory for RedHat / SuSE. lockdir='/var/lock/subsys' @@ -262,6 +262,8 @@ wait_for_gone () { done log_failure_msg + kill_by_pid + return 1 } @@ -310,7 +312,7 @@ fi kill_by_pid() { # let's see if we can kill the 2 mysql procs by hand # get the our mysql from ps - eval $(ps -ef | grep "$COLUMNSTORE_INSTALL_DIR/mysql//bin/mysqld" | grep -v grep | head -1 | awk '{printf "pid=%d\n", $2}') + eval $(ps -ef | grep "$COLUMNSTORE_INSTALL_DIR/mysql/bin/mysqld" | grep -v grep | head -1 | awk '{printf "pid=%d\n", $2}') if [ -n "$pid" ]; then ppid=$(ps -o ppid= -p $pid) @@ -369,6 +371,7 @@ case "$mode" in wait_for_gone $mysqld_pid "$mysqld_pid_file_path"; return_value=$? else log_failure_msg "MySQL server process #$mysqld_pid is not running!" + kill_by_pid rm "$mysqld_pid_file_path" fi diff --git a/oam/etc/Columnstore.xml b/oam/etc/Columnstore.xml index 6efa3f8aa..c3aa79c42 100644 --- a/oam/etc/Columnstore.xml +++ b/oam/etc/Columnstore.xml @@ -226,12 +226,12 @@ C columnstore-1 - unassigned + pm1 unassigned unassigned 1 3 - 6 // 2.5 minutes + 12 // 2.5 minutes diff --git a/oam/install_scripts/CMakeLists.txt b/oam/install_scripts/CMakeLists.txt index 6b7296c54..d450d7f27 100644 --- a/oam/install_scripts/CMakeLists.txt +++ b/oam/install_scripts/CMakeLists.txt @@ -33,6 +33,7 @@ install(PROGRAMS post-install myCnf-include-args.text myCnf-exclude-args.text columnstore.service + mariadb-command-line.sh DESTINATION ${ENGINE_BINDIR} COMPONENT platform) install(FILES module DESTINATION ${ENGINE_LOCALDIR} COMPONENT platform) diff --git a/oam/install_scripts/binary_installer.sh b/oam/install_scripts/binary_installer.sh index 2437af2b8..9baa26e4a 100644 --- a/oam/install_scripts/binary_installer.sh +++ b/oam/install_scripts/binary_installer.sh @@ -54,14 +54,14 @@ expect { exp_continue } "Exit status 0" { send_user "DONE"} - "Exit status 1" { send_user "FAILED: Login Failure\n" ; exit 1 } + "Exit status 1" { send_user "FAILED: Login Failure\n" ; exit 1 } "Host key verification failed" { send_user "FAILED: Host key verification failed\n" ; exit 1 } "service not known" { send_user "FAILED: Invalid Host\n" ; exit 1 } "Permission denied, please try again" { send_user "ERROR: Invalid password\n" ; exit 1 } "Connection refused" { send_user "ERROR: Connection refused\n" ; exit 1 } "Connection closed" { send_user "ERROR: Connection closed\n" ; exit 1 } "No route to host" { send_user "ERROR: No route to host\n" ; exit 1 } - timeout { send_user "ERROR: Timeout to host\n" ; exit 1 } + timeout { send_user "ERROR: Timeout to host\n" ; exit 2 } } send_user "\n" @@ -125,7 +125,7 @@ expect { send_user "\n*** Installation ERROR\n" ; exit 1 } "Read-only file system" { send_user "ERROR: local disk - Read-only file system\n" ; exit 1} - timeout { send_user "ERROR: Timeout\n" ; exit 1 } + timeout { send_user "ERROR: Timeout\n" ; exit 2 } } send_user "\n" # @@ -144,7 +144,7 @@ expect { } "Exit status 0" { send_user "DONE" } "Read-only file system" { send_user "ERROR: local disk - Read-only file system\n" ; exit 1} - timeout { send_user "ERROR: Timeout\n" ; exit 1 } + timeout { send_user "ERROR: Timeout\n" ; exit 2 } } send_user "\n" @@ -167,7 +167,7 @@ expect { send_user "\n*** Installation ERROR\n" ; exit 1 } "Read-only file system" { send_user "ERROR: local disk - Read-only file system\n" ; exit 1} - timeout { send_user "ERROR: Timeout\n" ; exit 1 } + timeout { send_user "ERROR: Timeout\n" ; exit 2 } } send_user "\n" @@ -189,7 +189,7 @@ expect { send_user "\n*** Installation ERROR\n" ; exit 1 } "Exit status 0" { send_user "DONE" } "Exit status 1" { send_user "ERROR: scp failed" ; exit 1 } - timeout { send_user "ERROR: Timeout to host\n" ; exit 1 } + timeout { send_user "ERROR: Timeout to host\n" ; exit 2 } } send_user "\n" @@ -208,7 +208,7 @@ expect { "Exit status 127" { send_user "ERROR: $INSTALLDIR/bin/post-install Not Found\n" ; exit 1 } "MariaDB Columnstore syslog logging not working" { send_user "WARNING: MariaDB Columnstore System logging not setup\n"; exp_continue } "Exit status 0" { send_user "DONE" } - timeout { send_user "ERROR: Timeout to host\n" ; exit 1 } + timeout { send_user "ERROR: Timeout to host\n" ; exit 2 } } send_user "\n" @@ -226,7 +226,7 @@ expect { } "Exit status 127" { send_user "ERROR: $INSTALLDIR/bin/post-install Not Found\n" ; exit 1 } "Exit status 0" { send_user "DONE" } - timeout { send_user "ERROR: Timeout to host\n" ; exit 1 } + timeout { send_user "ERROR: Timeout to host\n" ; exit 2 } } send_user "\n" diff --git a/oam/install_scripts/disable-rep-columnstore.sh b/oam/install_scripts/disable-rep-columnstore.sh index 7824304ad..0a8c9b17f 100644 --- a/oam/install_scripts/disable-rep-columnstore.sh +++ b/oam/install_scripts/disable-rep-columnstore.sh @@ -47,7 +47,7 @@ EOD cat /tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ calpontsys >/tmp/disable-rep-status.log 2>&1 @@ -63,7 +63,7 @@ EOD cat /tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ calpontsys >/tmp/disable-rep-status.log 2>&1 diff --git a/oam/install_scripts/disable-rep-infinidb.sh b/oam/install_scripts/disable-rep-infinidb.sh index 7da2c202e..5aacc82a2 100644 --- a/oam/install_scripts/disable-rep-infinidb.sh +++ b/oam/install_scripts/disable-rep-infinidb.sh @@ -47,7 +47,7 @@ EOD cat /tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ calpontsys >/tmp/disable-rep-status.log @@ -63,7 +63,7 @@ EOD cat /tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ calpontsys >/tmp/disable-rep-status.log diff --git a/oam/install_scripts/mariadb-command-line.sh b/oam/install_scripts/mariadb-command-line.sh new file mode 100644 index 000000000..bb2750581 --- /dev/null +++ b/oam/install_scripts/mariadb-command-line.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# $Id$ +# +# generic MariaDB Columnstore Command Line script. +# +# Notes: This script gets run by ProcMon during installs and upgrades: + +# check log for error +checkForError() { + grep ERROR /tmp/mariadb-command-line.log > /tmp/error.check + if [ `cat /tmp/error.check | wc -c` -ne 0 ]; then + echo "ERROR: check log file: /tmp/mariadb-command-line.log" + rm -f /tmp/error.check + exit 1 + fi + rm -f /tmp/error.check +} + +prefix=/usr/local +installdir=$prefix/mariadb/columnstore +pwprompt= +for arg in "$@"; do + if [ `expr -- "$arg" : '--command='` -eq 10 ]; then + command1="`echo $arg | awk -F= '{print $2}'`" + command2="`echo $arg | awk -F= '{print $3}'`" + command=$command1"="$command2 + elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then + installdir="`echo $arg | awk -F= '{print $2}'`" + prefix=`dirname $installdir` + elif [ `expr -- "$arg" : '--port='` -eq 7 ]; then + port="`echo $arg | awk -F= '{print $2}'`" + fi +done + +test -f $installdir/post/functions && . $installdir/post/functions + + +>/tmp/mariadb-command-line.log + +# +# Run command +# +echo "Run command" >>/tmp/mariadb-command-line.log +cat >/tmp/mariadb-command-line.sql <> /tmp/mariadb-command-line.log +$installdir/mysql/bin/mysql \ + --defaults-extra-file=$installdir/mysql/my.cnf \ + --user=root \ + calpontsys < /tmp/mariadb-command-line.sql >> /tmp/mariadb-command-line.log 2>&1 + +checkForError + +#alls good, 'OK' for success +echo "OK" +exit 0 diff --git a/oam/install_scripts/master-rep-columnstore.sh b/oam/install_scripts/master-rep-columnstore.sh index e8ccc4f4d..5d27ee278 100644 --- a/oam/install_scripts/master-rep-columnstore.sh +++ b/oam/install_scripts/master-rep-columnstore.sh @@ -24,9 +24,6 @@ for arg in "$@"; do if [ `expr -- "$arg" : '--prefix='` -eq 9 ]; then prefix="`echo $arg | awk -F= '{print $2}'`" installdir=$prefix/mariadb/columnstore - elif [ `expr -- "$arg" : '--password='` -eq 11 ]; then - password="`echo $arg | awk -F= '{print $2}'`" - pwprompt="--password=$password" elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then installdir="`echo $arg | awk -F= '{print $2}'`" prefix=`dirname $installdir` @@ -53,8 +50,8 @@ EOD cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ - --user=root $pwprompt \ + --defaults-extra-file=$installdir/mysql/my.cnf \ + --user=root \ calpontsys >/tmp/master-rep-status-$hostipaddr.log 2>&1 checkForError @@ -71,8 +68,8 @@ EOD cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ - --user=root $pwprompt \ + --defaults-extra-file=$installdir/mysql/my.cnf \ + --user=root \ calpontsys >/tmp/master-rep-status-$hostipaddr.log 2>&1 checkForError @@ -87,8 +84,8 @@ EOD cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ - --user=root $pwprompt \ + --defaults-extra-file=$installdir/mysql/my.cnf \ + --user=root \ calpontsys >/tmp/master-rep-status-$hostipaddr.log 2>&1 checkForError @@ -100,8 +97,8 @@ EOD cat /tmp/idb_master-rep.sql >/tmp/show-master-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ - --user=root $pwprompt \ + --defaults-extra-file=$installdir/mysql/my.cnf \ + --user=root \ calpontsys >/tmp/show-master-status.log diff --git a/oam/install_scripts/master-rep-infinidb.sh b/oam/install_scripts/master-rep-infinidb.sh index 3420ac39e..cd4054773 100644 --- a/oam/install_scripts/master-rep-infinidb.sh +++ b/oam/install_scripts/master-rep-infinidb.sh @@ -53,7 +53,7 @@ EOD cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ calpontsys >/tmp/master-rep-status-$hostipaddr.log @@ -71,7 +71,7 @@ EOD cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ calpontsys >/tmp/master-rep-status-$hostipaddr.log @@ -87,7 +87,7 @@ EOD cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ calpontsys >/tmp/master-rep-status-$hostipaddr.log @@ -100,7 +100,7 @@ EOD cat /tmp/idb_master-rep.sql >/tmp/show-master-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ calpontsys >/tmp/show-master-status.log diff --git a/oam/install_scripts/module_installer.sh b/oam/install_scripts/module_installer.sh index 514943989..10cefaf5f 100755 --- a/oam/install_scripts/module_installer.sh +++ b/oam/install_scripts/module_installer.sh @@ -59,8 +59,6 @@ cloud=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation Cloud` if [ $cloud = "amazon-ec2" ] || [ $cloud = "amazon-vpc" ]; then echo "Amazon setup on Module" cp $COLUMNSTORE_INSTALL_DIR/local/etc/credentials $HOME/.aws/. > /dev/null 2>&1 - sudo sed -i -e 's/#sudo runuser/sudo runuser/g' /etc/rc.d/rc.local - sudo chmod 777 /etc/rc.d/rc.local if [ $module = "pm" ]; then if test -f $COLUMNSTORE_INSTALL_DIR/local/etc/pm1/fstab ; then @@ -156,12 +154,7 @@ if [ $module = "um" ] || ( [ $module = "pm" ] && [ $PMwithUM = "y" ] ) || [ $Ser fi echo "Run post-mysql-install" - password=`$COLUMNSTORE_INSTALL_DIR/bin/getMySQLpw` - if [ $password = "unassigned" ]; then - password="" - fi - - $COLUMNSTORE_INSTALL_DIR/bin/post-mysql-install --installdir=$COLUMNSTORE_INSTALL_DIR --password=$password > /tmp/post-mysql-install.log 2>&1 + $COLUMNSTORE_INSTALL_DIR/bin/post-mysql-install --installdir=$COLUMNSTORE_INSTALL_DIR > /tmp/post-mysql-install.log 2>&1 if [ $? -ne 0 ]; then echo "ERROR: post-mysql-install failed: check /tmp/post-mysql-install.log" exit 1 @@ -179,38 +172,51 @@ if [ $? -ne 0 ]; then fi #setup rc.local +if [ -f /etc/rc.d ]; then + RCFILE=/etc/rc.d/rc.local +else + RCFILE=/etc/rc.local +fi +touch $RCFILE + +echo "add deadline to rc.local" if [ $module = "um" ]; then if [ $user = "root" ]; then - echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> /etc/rc.local - echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> /etc/rc.local - echo "done" >> /etc/rc.local + echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE + echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE + echo "done" >> $RCFILE else - sudo chmod 666 /etc/rc.local - sudo echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> /etc/rc.local - sudo echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> /etc/rc.local - sudo echo "done" >> /etc/rc.local + sudo chmod 666 $RCFILE + sudo echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE + sudo echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE + sudo echo "done" >> $RCFILE fi else if [ $user = "root" ]; then - echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> /etc/rc.local - echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> /etc/rc.local - echo "done" >> /etc/rc.local + echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE + echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE + echo "done" >> $RCFILE - echo "for scsi_dev in \`mount | awk '/columnstore\\/data/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> /etc/rc.local - echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> /etc/rc.local - echo "done" >> /etc/rc.local + echo "for scsi_dev in \`mount | awk '/columnstore\\/data/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE + echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE + echo "done" >> $RCFILE else - sudo chmod 666 /etc/rc.local - sudo echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> /etc/rc.local - sudo echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> /etc/rc.local - sudo echo "done" >> /etc/rc.local + sudo chmod 666 $RCFILE + sudo echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE + sudo echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE + sudo echo "done" >> $RCFILE - sudo echo "for scsi_dev in \`mount | awk '/columnstore\\/data/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> /etc/rc.local - sudo echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> /etc/rc.local - sudo echo "done" >> /etc/rc.local + sudo echo "for scsi_dev in \`mount | awk '/columnstore\\/data/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE + sudo echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE + sudo echo "done" >> $RCFILE fi fi +if [ $user != "root" ]; then + echo "uncomment runuser in rc.local" + sudo sed -i -e 's/#sudo runuser/sudo runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1 +fi + echo "!!!Module Installation Successfully Completed!!!" exit 0 diff --git a/oam/install_scripts/package_installer.sh b/oam/install_scripts/package_installer.sh index 32b05e0a4..02486cb96 100644 --- a/oam/install_scripts/package_installer.sh +++ b/oam/install_scripts/package_installer.sh @@ -79,7 +79,7 @@ expect { "Connection refused" { send_user "ERROR: Connection refused\n" ; exit 1 } "Connection closed" { send_user "ERROR: Connection closed\n" ; exit 1 } "No route to host" { send_user "ERROR: No route to host\n" ; exit 1 } - timeout { send_user "ERROR: Timeout to host\n" ; exit 1 } + timeout { send_user "ERROR: Timeout to host\n" ; exit 2 } } send_user "\n" @@ -138,7 +138,7 @@ expect { exp_continue } "Exit status 0" { send_user "DONE" } - timeout { send_user "ERROR: Timeout to host\n" ; exit 1 } + timeout { send_user "ERROR: Timeout to host\n" ; exit 2 } } set timeout 180 send "scp -v $HOME/mariadb-columnstore*$VERSION*$PKGTYPE $USERNAME@$SERVER:.\n" @@ -154,7 +154,7 @@ expect { exit 1 } "Exit status 0" { send_user "DONE" } "Exit status 1" { send_user "ERROR: scp failed" ; exit 1 } - timeout { send_user "ERROR: Timeout to host\n" ; exit 1 } + timeout { send_user "ERROR: Timeout to host\n" ; exit 2 } } send_user "\n" @@ -179,7 +179,7 @@ expect { "conflicts" { send_user "ERROR: File Conflict issue\n" ; exit 1 } "MariaDB Columnstore syslog logging not working" { send_user "WARNING: MariaDB Columnstore System logging not setup\n"; exp_continue } "Exit status 0" { send_user "DONE" } - timeout { send_user "ERROR: Timeout to host\n" ; exit 1 } + timeout { send_user "ERROR: Timeout to host\n" ; exit 2 } } send_user "\n" @@ -202,7 +202,7 @@ expect { send_user "\n*** Installation ERROR\n" ; exit 1 } "Read-only file system" { send_user "ERROR: local disk - Read-only file system\n" ; exit 1} - timeout { send_user "ERROR: Timeout\n" ; exit 1 } + timeout { send_user "ERROR: Timeout\n" ; exit 2 } } send_user "\n" @@ -224,7 +224,7 @@ expect { exit 1 } "Exit status 0" { send_user "DONE" } "Exit status 1" { send_user "ERROR: scp failed" ; exit 1 } - timeout { send_user "ERROR: Timeout to host\n" ; exit 1 } + timeout { send_user "ERROR: Timeout to host\n" ; exit 2 } } send_user "\n" @@ -242,7 +242,7 @@ expect { } "Exit status 0" { send_user "DONE" } "Exit status 127" { send_user "ERROR: $INSTALLDIR/bin/columnstore Not Found\n" ; exit 1 } - timeout { send_user "ERROR: Timeout to host\n" ; exit 1 } + timeout { send_user "ERROR: Timeout to host\n" ; exit 2 } } send_user "\n" diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index 9bf703751..bd3d3fb55 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -177,14 +177,24 @@ $installdir/bin/clearShm > /dev/null 2>&1 systemctl=`which systemctl 2>/dev/null` #check and create rc.local file if missing -if [ ! -f /etc/rc.d/rc.local ]; then - printf '%s\n' '#!/bin/bash' "#" | $SUDO tee -a /etc/rc.local > /dev/null 2>&1 - $SUDO chmod +x /etc/rc.d/rc.local - - if [ -n "$systemctl" ]; then - systemctl restart rc-local >/dev/null 2>&1 - systemctl enable rc-local >/dev/null 2>&1 - fi +if [ -f /etc/rc.d ]; then + RCFILE=/etc/rc.d/rc.local +else + RCFILE=/etc/rc.local +fi + +touch $RCFILE + +if [ $user = "root" ]; then + chmod +x $RCFILE +else + $SUDO chmod 777 $RCFILE + printf '%s\n' '#!/bin/bash' "#" | $SUDO tee -a $RCFILEl > /dev/null 2>&1 +fi + +if [ -n "$systemctl" ]; then + $SUDO systemctl restart rc-local >/dev/null 2>&1 + $SUDO systemctl enable rc-local >/dev/null 2>&1 fi #setup the columnstore service script @@ -218,6 +228,7 @@ if [ $user = "root" ]; then fi fi fi + #setup MariaDB Columnstore system logging sed -i -e s/groupname/$user/g $installdir/bin/columnstoreSyslog7 sed -i -e s/username/$user/g $installdir/bin/columnstoreSyslog7 @@ -241,7 +252,6 @@ else $SUDO chmod 777 /var/lock/subsys > /dev/null 2>&1 $SUDO rm -f /var/lock/subsys/mysql-Columnstore $SUDO chmod 666 /etc/fstab - $SUDO chmod 777 /etc/rc.d/rc.local fi # install Columnstore Log Rotate File diff --git a/oam/install_scripts/post-mysql-install b/oam/install_scripts/post-mysql-install index f46f78bf5..08c38b84e 100755 --- a/oam/install_scripts/post-mysql-install +++ b/oam/install_scripts/post-mysql-install @@ -9,25 +9,11 @@ checkForError() { # check for password error grep "ERROR 1045" /tmp/mysql_install.log > /tmp/error.check if [ `cat /tmp/error.check | wc -c` -ne 0 ]; then - if test -f $HOME/.my.cnf ; then - password=`cat $HOME/.my.cnf | grep password | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'` - if [ ! -z $password ]; then - pwprompt="-p$password" - return 1; - else - echo "MySQL Password file missing or incorrect, check .my.cnf file" - rm -f /tmp/error.check - $installdir/mysql/mysql-Columnstore stop - sleep 2 - exit 2; - fi - else - echo "MySQL Password file missing or incorrect, check .my.cnf file" - rm -f /tmp/error.check - $installdir/mysql/mysql-Columnstore stop - sleep 2 - exit 2; - fi + echo "MySQL Password file missing or incorrect, check .my.cnf file" + rm -f /tmp/error.check + $installdir/mysql/mysql-Columnstore stop + sleep 2 + exit 2; fi rm -f /tmp/error.check @@ -37,7 +23,7 @@ checkForError() { #--------------------------------------------------------------------------- echo "checking for engine columnstore..." $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ --execute='show engines;' \ calpontsys | grep -i columnstore @@ -66,11 +52,6 @@ for arg in "$@"; do installdir=$prefix/mariadb/columnstore elif [ $(expr -- "$arg" : '--rpmmode=') -eq 10 ]; then rpmmode="$(echo $arg | awk -F= '{print $2}')" - elif [ $(expr -- "$arg" : '--password=') -eq 11 ]; then - password="$(echo $arg | awk -F= '{print $2}')" - if [ ! -z $password ]; then - pwprompt="-p$password" - fi elif [ $(expr -- "$arg" : '--installdir=') -eq 13 ]; then installdir="$(echo $arg | awk -F= '{print $2}')" prefix=$(dirname $installdir) @@ -119,11 +100,11 @@ if [ -x $installdir/mysql/mysql-Columnstore ]; then sleep 5 # Install various Calpont stuff... - $installdir/mysql/install_calpont_mysql.sh --password=$password --installdir=$installdir + $installdir/mysql/install_calpont_mysql.sh --installdir=$installdir checkForError if [ $? -ne 0 ]; then # retry - $installdir/mysql/install_calpont_mysql.sh --password=$password --installdir=$installdir + $installdir/mysql/install_calpont_mysql.sh --installdir=$installdir checkForError if [ $? -ne 0 ]; then echo "ERROR: Invalid password in .my.cnf, or Columnstore plugin install missing" diff --git a/oam/install_scripts/post-mysqld-install b/oam/install_scripts/post-mysqld-install index 2624b3322..58f2b3d65 100755 --- a/oam/install_scripts/post-mysqld-install +++ b/oam/install_scripts/post-mysqld-install @@ -69,7 +69,7 @@ fi test -x /usr/local/bin/idb-testing-mysql-pre-start && /usr/local/bin/idb-testing-mysql-pre-start $installdir/mysql ### Don't give the user the notes, we'll fix them ourselves... -$installdir/mysql/scripts/mysql_install_db --rpm --user=$user --defaults-file=$installdir/mysql/my.cnf --basedir=$installdir/mysql >/dev/null +$installdir/mysql/scripts/mysql_install_db --rpm --user=$user --defaults-extra-file=$installdir/mysql/my.cnf --basedir=$installdir/mysql >/dev/null # Change permissions again to fix any new files. chown -R $user:$user $mysql_datadir diff --git a/oam/install_scripts/pre-uninstall b/oam/install_scripts/pre-uninstall index 73efa387f..2f58b5421 100755 --- a/oam/install_scripts/pre-uninstall +++ b/oam/install_scripts/pre-uninstall @@ -72,7 +72,7 @@ $installdir/bin/clearShm > /dev/null 2>&1 $SUDO rm -f /etc/cron.d/ps > /dev/null 2>&1 $SUDO rm -f /etc/pscollect > /dev/null 2>&1 $SUDO /etc/init.d/crond reload > /dev/null 2>&1 -$SUDO $SUDO systemctl reload crond.service > /dev/null 2>&1 +$SUDO systemctl reload crond.service > /dev/null 2>&1 # delete tmp files rm -f $installdir/local/*.columnstore diff --git a/oam/install_scripts/rsync.sh b/oam/install_scripts/rsync.sh index 7bbe29641..660057582 100755 --- a/oam/install_scripts/rsync.sh +++ b/oam/install_scripts/rsync.sh @@ -30,7 +30,7 @@ set COMMAND "rsync -vopgr -e ssh --exclude=mysql/ --exclude=test/ --exclude=infi # # run command # -set timeout 60 +set timeout 20 send "$COMMAND\n" expect { -re "Host key verification failed" { send_user "FAILED: Host key verification failed\n" ; exit -1} @@ -57,25 +57,27 @@ expect { set HOME "$env(HOME)" -set COMMAND "rsync -vopgr -e ssh $HOME/.my.cnf $USERNAME@$SERVER:$HOME/" +if {[file exist $HOME/.my.cnf]} { -# -# run command -# -set timeout 20 -send "$COMMAND\n" -expect { - -re "word: " { send "$PASSWORD\n" } - -re "passphrase" { send "$PASSWORD\n" } - -re "total size" {} abort - -re "failed" { exit 0 } - timeout { exit 0 } -} -expect { - -re "total size" {} abort - -re "failed" { exit 0 } - timeout { exit 0 } -} + set COMMAND "rsync -vopgr -e ssh $HOME/.my.cnf $USERNAME@$SERVER:$HOME/" + # + # run command + # + set timeout 10 + send "$COMMAND\n" + expect { + -re "word: " { send "$PASSWORD\n" } + -re "passphrase" { send "$PASSWORD\n" } + -re "total size" {} abort + -re "failed" { exit 0 } + timeout { exit 0 } + } + expect { + -re "total size" {} abort + -re "failed" { exit 0 } + timeout { exit 0 } + } +} exit 0 diff --git a/oam/install_scripts/slave-rep-columnstore.sh b/oam/install_scripts/slave-rep-columnstore.sh index e3318f8a2..ae8914237 100644 --- a/oam/install_scripts/slave-rep-columnstore.sh +++ b/oam/install_scripts/slave-rep-columnstore.sh @@ -24,9 +24,6 @@ for arg in "$@"; do if [ `expr -- "$arg" : '--prefix='` -eq 9 ]; then prefix="`echo $arg | awk -F= '{print $2}'`" installdir=$prefix/mariadb/columnstore - elif [ `expr -- "$arg" : '--password='` -eq 11 ]; then - password="`echo $arg | awk -F= '{print $2}'`" - pwprompt="--password=$password" elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then installdir="`echo $arg | awk -F= '{print $2}'`" prefix=`dirname $installdir` @@ -58,8 +55,8 @@ EOD cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ - --user=root $pwprompt \ + --defaults-extra-file=$installdir/mysql/my.cnf \ + --user=root \ calpontsys >/tmp/slave-rep-status.log 2>&1 checkForError @@ -81,8 +78,8 @@ EOD cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ - --user=root $pwprompt \ + --defaults-extra-file=$installdir/mysql/my.cnf \ + --user=root \ calpontsys >/tmp/slave-rep-status.log 2>&1 checkForError @@ -97,8 +94,8 @@ EOD cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ - --user=root $pwprompt \ + --defaults-extra-file=$installdir/mysql/my.cnf \ + --user=root \ calpontsys >/tmp/slave-rep-status.log 2>&1 checkForError @@ -113,8 +110,8 @@ EOD cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ - --user=root $pwprompt \ + --defaults-extra-file=$installdir/mysql/my.cnf \ + --user=root \ calpontsys >/tmp/slave-rep-status.log 2>&1 checkForError diff --git a/oam/install_scripts/slave-rep-infinidb.sh b/oam/install_scripts/slave-rep-infinidb.sh index f48f84527..d9d41def6 100644 --- a/oam/install_scripts/slave-rep-infinidb.sh +++ b/oam/install_scripts/slave-rep-infinidb.sh @@ -58,7 +58,7 @@ EOD cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ calpontsys >/tmp/slave-rep-status.log @@ -80,7 +80,7 @@ EOD cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ calpontsys >/tmp/slave-rep-status.log @@ -94,7 +94,7 @@ EOD cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ calpontsys >/tmp/slave-rep-status.log @@ -108,7 +108,7 @@ EOD cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log $installdir/mysql/bin/mysql \ - --defaults-file=$installdir/mysql/my.cnf \ + --defaults-extra-file=$installdir/mysql/my.cnf \ --user=root $pwprompt \ calpontsys >/tmp/slave-rep-status.log diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index aa0196a05..49077402d 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -9033,13 +9033,13 @@ int Oam::glusterctl(GLUSTER_COMMANDS command, std::string argument1, std::string if (WEXITSTATUS(status) != 0 ) { cout << "ERROR: peer probe command failed." << endl; - command = InstallDir + "/bin/remote_command.sh " + DataRedundancyConfigs[pm].pmIpAddr + " " + password + "'stat /var/run/glusterd.pid > /dev/null 2>&1'"; + command = InstallDir + "/bin/remote_command.sh " + DataRedundancyConfigs[pm].pmIpAddr + " " + password + " 'stat /var/run/glusterd.pid > /dev/null 2>&1'"; status = system(command.c_str()); if (WEXITSTATUS(status) != 0 ) { cout << "ERROR: No glusterd process detected at " << DataRedundancyConfigs[pm].pmIpAddr << "." << endl; - cout << " Start and enable glusterd and run postConfigure again." << endl; + cout << " Start and enable glusterd at " << DataRedundancyConfigs[pm].pmIpAddr << "." << endl; } exceptionControl("GLUSTER_ADD", API_FAILURE); @@ -9199,13 +9199,13 @@ int Oam::glusterctl(GLUSTER_COMMANDS command, std::string argument1, std::string if (WEXITSTATUS(status) != 0 ) { cout << "ERROR: peer probe command failed." << endl; - command = InstallDir + "/bin/remote_command.sh " + ipAddress + " " + password + "'stat /var/run/glusterd.pid > /dev/null 2>&1'"; + command = InstallDir + "/bin/remote_command.sh " + ipAddress + " " + password + " 'stat /var/run/glusterd.pid > /dev/null 2>&1'"; status = system(command.c_str()); if (WEXITSTATUS(status) != 0 ) { cout << "ERROR: No glusterd process detected at " << ipAddress << "." << endl; - cout << " Start and enable glusterd and run postConfigure again." << endl; + cout << " Start and enable glusterd at " << ipAddress << "." << endl; } return 1; @@ -9423,6 +9423,9 @@ int Oam::checkGlusterLog(std::string logFile, std::string& msg) ******************************************************************************************/ std::string Oam::getMySQLPassword() { + + return oam::UnassignedName; + string mysqlUser = "root"; string USER = "root"; diff --git a/oamapps/calpontSupport/approximateRowCount.sh b/oamapps/calpontSupport/approximateRowCount.sh index a1a2bfc62..13cea4582 100755 --- a/oamapps/calpontSupport/approximateRowCount.sh +++ b/oamapps/calpontSupport/approximateRowCount.sh @@ -11,7 +11,7 @@ if [ -z "$MYSQLCMD" ]; then INSTALLDIR="/usr/local/mariadb/columnstore" MYSQLCNF=$INSTALLDIR/mysql/my.cnf - MYSQLCMD="$INSTALLDIR/mysql/bin/mysql --defaults-file=$MYSQLCNF -u root" + MYSQLCMD="$INSTALLDIR/mysql/bin/mysql --defaults-extra-file=$MYSQLCNF -u root" fi # diff --git a/oamapps/calpontSupport/getMinMax.sh b/oamapps/calpontSupport/getMinMax.sh index aab502da1..9a95e518d 100755 --- a/oamapps/calpontSupport/getMinMax.sh +++ b/oamapps/calpontSupport/getMinMax.sh @@ -11,7 +11,7 @@ if [ -z "$MYSQLCMD" ]; then INSTALLDIR="/usr/local/mariadb/columnstore" MYSQLCNF=$INSTALLDIR/mysql/my.cnf - MYSQLCMD="$INSTALLDIR/mysql/bin/mysql --defaults-file=$MYSQLCNF -u root" + MYSQLCMD="$INSTALLDIR/mysql/bin/mysql --defaults-extra-file=$MYSQLCNF -u root" fi # diff --git a/oamapps/calpontSupport/minMaxCheck.sh b/oamapps/calpontSupport/minMaxCheck.sh index 4aab0f31e..4e36db272 100755 --- a/oamapps/calpontSupport/minMaxCheck.sh +++ b/oamapps/calpontSupport/minMaxCheck.sh @@ -45,7 +45,7 @@ # if [ -z "$MYSQLCMD" ]; then - MYSQLCMD="/usr/local/mariadb/columnstore/mysql/bin/mysql --defaults-file=/usr/local/mariadb/columnstore/mysql/my.cnf -u root" + MYSQLCMD="/usr/local/mariadb/columnstore/mysql/bin/mysql --defaults-extra-file=/usr/local/mariadb/columnstore/mysql/my.cnf -u root" fi if [ -z "$INSTALLDIR" ]; then diff --git a/oamapps/calpontSupport/sqlLogs.sh b/oamapps/calpontSupport/sqlLogs.sh index bc8b5b1c4..a1a9a403c 100755 --- a/oamapps/calpontSupport/sqlLogs.sh +++ b/oamapps/calpontSupport/sqlLogs.sh @@ -19,7 +19,7 @@ fi if [ -z "$MYSQLCMD" ]; then - MYSQLCMD="$COLUMNSTORE_INSTALL_DIR/mysql/bin/mysql --defaults-file=$COLUMNSTORE_INSTALL_DIR/mysql/my.cnf -u root" + MYSQLCMD="$COLUMNSTORE_INSTALL_DIR/mysql/bin/mysql --defaults-extra-file=$COLUMNSTORE_INSTALL_DIR/mysql/my.cnf -u root" export MYSQLCMD fi diff --git a/oamapps/columnstoreSupport/approximateRowCount.sh b/oamapps/columnstoreSupport/approximateRowCount.sh index 9b5a356be..db1deb425 100755 --- a/oamapps/columnstoreSupport/approximateRowCount.sh +++ b/oamapps/columnstoreSupport/approximateRowCount.sh @@ -11,7 +11,7 @@ if [ -z "$MYSQLCMD" ]; then INSTALLDIR="/usr/local/mariadb/columnstore" MYSQLCNF=$INSTALLDIR/mysql/my.cnf - MYSQLCMD="$INSTALLDIR/mysql/bin/mysql --defaults-file=$MYSQLCNF -u root" + MYSQLCMD="$INSTALLDIR/mysql/bin/mysql --defaults-extra-file=$MYSQLCNF -u root" fi # diff --git a/oamapps/columnstoreSupport/columnstoreSupport.cpp b/oamapps/columnstoreSupport/columnstoreSupport.cpp index 6543d9686..742f81e97 100644 --- a/oamapps/columnstoreSupport/columnstoreSupport.cpp +++ b/oamapps/columnstoreSupport/columnstoreSupport.cpp @@ -442,7 +442,7 @@ int main(int argc, char* argv[]) cout << "It should be run on the server with the DBRM front-end." << endl; cout << "Check the Admin Guide for additional information." << endl; cout << endl; - cout << "Usage: columnstoreSupport [-h][-a][-hw][-s][-c][-db][-r][-l][-bl][-lc][-p 'root-password'][-mp 'mariadb-columnstore-root-password'][-de]"; + cout << "Usage: columnstoreSupport [-h][-a][-hw][-s][-c][-db][-r][-l][-bl][-lc][-p 'root-password'][-de]"; // if hdfs set up print the hadoop option if (!DataFilePlugin.empty()) @@ -460,7 +460,6 @@ int main(int argc, char* argv[]) cout << " -bl Output Columnstore Bulk Log Reports only" << endl; cout << " -lc Output Reports for Local Server only" << endl; cout << " -p password (multi-server systems), root-password or 'ssh' to use 'ssh keys'" << endl; - cout << " -mp MariaDB Columnstore root user password" << endl; cout << " -de Debug Flag" << endl; // if hdfs set up print the hadoop option @@ -843,7 +842,7 @@ int main(int argc, char* argv[]) else { // check if mysql is supported and get info - string columnstoreMysql = installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root "; + string columnstoreMysql = installDir + "/mysql/bin/mysql --defaults-extra-file=" + installDir + "/mysql/my.cnf -u root "; string cmd = columnstoreMysql + " -e 'status' > /tmp/idbmysql.log 2>&1"; system(cmd.c_str()); @@ -917,7 +916,7 @@ int main(int argc, char* argv[]) if (!FAILED) { // check if mysql is supported and get info - string columnstoreMysql = installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root " + pwprompt; + string columnstoreMysql = installDir + "/mysql/bin/mysql --defaults-extra-file=" + installDir + "/mysql/my.cnf -u root " + pwprompt; string cmd = columnstoreMysql + " -V > /dev/null 2>&1"; int ret = system(cmd.c_str()); diff --git a/oamapps/columnstoreSupport/getMinMax.sh b/oamapps/columnstoreSupport/getMinMax.sh index 58faeeb3c..90434680d 100755 --- a/oamapps/columnstoreSupport/getMinMax.sh +++ b/oamapps/columnstoreSupport/getMinMax.sh @@ -11,7 +11,7 @@ if [ -z "$MYSQLCMD" ]; then INSTALLDIR="/usr/local/mariadb/columnstore" MYSQLCNF=$INSTALLDIR/mysql/my.cnf - MYSQLCMD="$INSTALLDIR/mysql/bin/mysql --defaults-file=$MYSQLCNF -u root" + MYSQLCMD="$INSTALLDIR/mysql/bin/mysql --defaults-extra-file=$MYSQLCNF -u root" fi # diff --git a/oamapps/columnstoreSupport/minMaxCheck.sh b/oamapps/columnstoreSupport/minMaxCheck.sh index 4aab0f31e..4e36db272 100755 --- a/oamapps/columnstoreSupport/minMaxCheck.sh +++ b/oamapps/columnstoreSupport/minMaxCheck.sh @@ -45,7 +45,7 @@ # if [ -z "$MYSQLCMD" ]; then - MYSQLCMD="/usr/local/mariadb/columnstore/mysql/bin/mysql --defaults-file=/usr/local/mariadb/columnstore/mysql/my.cnf -u root" + MYSQLCMD="/usr/local/mariadb/columnstore/mysql/bin/mysql --defaults-extra-file=/usr/local/mariadb/columnstore/mysql/my.cnf -u root" fi if [ -z "$INSTALLDIR" ]; then diff --git a/oamapps/columnstoreSupport/sqlLogs.sh b/oamapps/columnstoreSupport/sqlLogs.sh index 5a06a76ea..385b2d912 100755 --- a/oamapps/columnstoreSupport/sqlLogs.sh +++ b/oamapps/columnstoreSupport/sqlLogs.sh @@ -19,7 +19,7 @@ fi if [ -z "$MYSQLCMD" ]; then - MYSQLCMD="$COLUMNSTORE_INSTALL_DIR/mysql/bin/mysql --defaults-file=$COLUMNSTORE_INSTALL_DIR/mysql/my.cnf -u root" + MYSQLCMD="$COLUMNSTORE_INSTALL_DIR/mysql/bin/mysql --defaults-extra-file=$COLUMNSTORE_INSTALL_DIR/mysql/my.cnf -u root" export MYSQLCMD fi diff --git a/oamapps/mcsadmin/mcsadmin.cpp b/oamapps/mcsadmin/mcsadmin.cpp index a5ff6f8fe..ddcafed30 100644 --- a/oamapps/mcsadmin/mcsadmin.cpp +++ b/oamapps/mcsadmin/mcsadmin.cpp @@ -7196,6 +7196,8 @@ int processCommand(string* arguments) printModuleMemory(systemmemory.modulememory[i]); } + cout << endl; + } catch (exception& e) { diff --git a/oamapps/postConfigure/getMySQLpw.cpp b/oamapps/postConfigure/getMySQLpw.cpp index 0edfcc879..fdc6a6759 100644 --- a/oamapps/postConfigure/getMySQLpw.cpp +++ b/oamapps/postConfigure/getMySQLpw.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2014 InfiniDB, Inc. - + Copyright (C) 2017 MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of @@ -57,6 +57,10 @@ int main(int argc, char* argv[]) { Oam oam; + cout << oam::UnassignedName << endl; + + exit (0); + string USER = "root"; char* p = getenv("USER"); diff --git a/oamapps/postConfigure/helpers.cpp b/oamapps/postConfigure/helpers.cpp index d3e44d0db..aa586afc2 100644 --- a/oamapps/postConfigure/helpers.cpp +++ b/oamapps/postConfigure/helpers.cpp @@ -285,7 +285,7 @@ void mysqlSetup() HOME = p; } - cmd = installDir + "/bin/post-mysql-install " + pwprompt + " --installdir=" + installDir + " > /tmp/post-mysql-install.log";; + cmd = installDir + "/bin/post-mysql-install --installdir=" + installDir + " > /tmp/post-mysql-install.log";; rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) == 2) @@ -407,7 +407,7 @@ int sendUpgradeRequest(int IserverTypeInstall, bool pmwithum) * * ******************************************************************************************/ -int sendReplicationRequest(int IserverTypeInstall, std::string password, std::string port, bool pmwithum) +int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pmwithum) { Oam oam; @@ -513,7 +513,8 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, std::st // don't do PMs unless PMwithUM flag is set string moduleType = (*pt).DeviceName.substr(0, MAX_MODULE_TYPE_SIZE); - if ( moduleType == "pm" && !pmwithum ) + if ( ( moduleType == "pm" && !pmwithum ) && + ( IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM ) ) { pt++; continue; @@ -529,7 +530,6 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, std::st msg << masterLogFile; msg << masterLogPos; - msg << port; returnStatus = sendMsgProcMon( (*pt).DeviceName, msg, requestID, 30 ); @@ -756,15 +756,19 @@ void checkMysqlPort( std::string& mysqlPort, Config* sysConfig ) if ( noPrompting ) { cout << endl << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use" << endl; - cout << "For No-prompt install, use the command line argument of 'port' to enter a different number" << endl; + cout << "Either use the command line argument of 'port' to enter a different number" << endl; + cout << "or stop the process that is using port '" + mysqlPort + "'" << endl; + cout << "For No-prompt install, exiting" << endl; exit(1); } cout << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use on local server" << endl; + cout << "Either enter a different port to use" << endl; + cout << "or stop the process that is using port '" + mysqlPort + "' and enter '" + mysqlPort + "' to continue" << endl; while (true) { - prompt = "Enter a different port number > "; + prompt = "Enter port number > "; pcommand = callReadline(prompt.c_str()); if (pcommand) @@ -842,7 +846,9 @@ void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string if ( noPrompting ) { cout << endl << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use" << endl; - cout << "For No-prompt install, use the command line argument of 'port' to enter a different number" << endl; + cout << "Either use the command line argument of 'port' to enter a different number" << endl; + cout << "or stop the process that is using port '" + mysqlPort + "'" << endl; + cout << "For No-prompt install, exiting" << endl; exit(1); } else @@ -878,7 +884,9 @@ void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string if ( noPrompting ) { cout << endl << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use on " << remoteModuleName << endl; - cout << "For No-prompt install, use the command line argument of 'port' to enter a different number" << endl; + cout << "Either use the command line argument of 'port' to enter a different number" << endl; + cout << "or stop the process that is using port '" + mysqlPort + "'" << endl; + cout << "For No-prompt install, exiting" << endl; cout << "exiting..." << endl; exit(1); } @@ -896,10 +904,12 @@ void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string if ( inUse ) { cout << endl << "The MariaDB ColumnStore port of '" + mysqlPort + "' is already in-use on " << inUseServer << endl; + cout << "Either enter a different port to use" << endl; + cout << "or stop the process that is using port '" + mysqlPort + "' and enter '" + mysqlPort + "' to continue" << endl; while (true) { - prompt = "Enter a different port number > "; + prompt = "Enter a port number > "; pcommand = callReadline(prompt.c_str()); if (pcommand) diff --git a/oamapps/postConfigure/helpers.h b/oamapps/postConfigure/helpers.h index 524096330..8d79beb64 100644 --- a/oamapps/postConfigure/helpers.h +++ b/oamapps/postConfigure/helpers.h @@ -39,7 +39,7 @@ extern void dbrmDirCheck(); extern void mysqlSetup(); extern int sendMsgProcMon( std::string module, ByteStream msg, int requestID, int timeout ); extern int sendUpgradeRequest(int IserverTypeInstall, bool pmwithum); -extern int sendReplicationRequest(int IserverTypeInstall, std::string password, std::string mysqlPort, bool pmwithum); +extern int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pmwithum); extern void checkFilesPerPartion(int DBRootCount, Config* sysConfig); extern void checkMysqlPort( string& mysqlPort, Config* sysConfig); extern bool writeConfig(Config* sysConfig); diff --git a/oamapps/postConfigure/installer.cpp b/oamapps/postConfigure/installer.cpp index 90c6478ff..32716b2f0 100644 --- a/oamapps/postConfigure/installer.cpp +++ b/oamapps/postConfigure/installer.cpp @@ -683,6 +683,7 @@ int main(int argc, char* argv[]) if ( !setOSFiles(parentOAMModuleName, IserverTypeInstall) ) { cout << "ERROR: setOSFiles error" << endl; + cout << " IMPORTANT: Once issue has been resolved, rerun postConfigure" << endl << endl; exit(1); } @@ -886,6 +887,7 @@ int main(int argc, char* argv[]) { cout << endl << "System Catalog Create Failure" << endl; cout << "Check latest log file in /tmp/dbbuilder.log.*" << endl; + cout << " IMPORTANT: Once issue has been resolved, rerun postConfigure" << endl << endl; exit (1); } } @@ -904,6 +906,9 @@ int main(int argc, char* argv[]) else { cout << " FAILED" << endl; + + cout << " IMPORTANT: There was a system startup failed, once issue has been resolved, rerun postConfigure" << endl << endl; + cout << endl << "ERROR: MariaDB ColumnStore Process failed to start, check log files in /var/log/mariadb/columnstore" << endl; cout << "Enter the following command to define MariaDB ColumnStore Alias Commands" << endl << endl; @@ -1119,8 +1124,6 @@ bool updateProcessConfig(int serverTypeInstall) */ bool makeRClocal(string moduleName, int IserverTypeInstall) { - string cmd; - string moduleType = moduleName.substr(0, MAX_MODULE_TYPE_SIZE); vector lines; @@ -1209,17 +1212,26 @@ bool makeRClocal(string moduleName, int IserverTypeInstall) if ( lines.begin() == lines.end()) return true; - string fileName = "etc/rc.local"; + string RCfileName = "/etc/rc.d/rc.local"; + std::ofstream file; - ofstream newFile (fileName.c_str()); + file.open(RCfileName.c_str(), std::ios::out | std::ios::app); - //create new file - int fd = open(fileName.c_str(), O_RDWR | O_CREAT, 0666); + if (file.fail()) + { + RCfileName = "/etc/rc.local"; - copy(lines.begin(), lines.end(), ostream_iterator(newFile, "\n")); - newFile.close(); + file.open(RCfileName.c_str(), std::ios::out | std::ios::app); - close(fd); + if (file.fail()) + return true; + } + + file.exceptions(file.exceptions() | std::ios::failbit | std::ifstream::badbit); + + copy(lines.begin(), lines.end(), ostream_iterator(file, "\n")); + + file.close(); return true; } diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index bd372f11a..f8139ccd4 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -517,69 +517,76 @@ int main(int argc, char* argv[]) char* addr; bool found = false; - getifaddrs (&ifap); - - for (ifa = ifap; ifa; ifa = ifa->ifa_next) + if (getifaddrs (&ifap) == 0 ) { - if (ifa->ifa_addr->sa_family == AF_INET) + for (ifa = ifap; ifa; ifa = ifa->ifa_next) { - sa = (struct sockaddr_in*) ifa->ifa_addr; - addr = inet_ntoa(sa->sin_addr); - //printf("Interface: %s\tAddress: %s\n", ifa->ifa_name, addr); - - if ( PM1ipAdd == addr ) + if (ifa->ifa_addr == NULL ) { - //match found = true; - } - } - - if (found) - break; - } - - freeifaddrs(ifap); - - if (!found) - { - - string answer = "y"; - - while (true) - { - cout << endl << "The Configured PM1 IP Address of " << PM1ipAdd << " does not match any of the" << endl; - cout << "Server Ethernet IP addresses there were detected, do you want to continue?" << endl; - cout << "This is to make sure that you arent running postConfigure from a non-PM1 node." << endl; - prompt = "Enter 'y' to continue using Configured IP address [y,n] (y) > "; - - pcommand = callReadline(prompt.c_str()); - - if (pcommand) - { - if (strlen(pcommand) > 0) answer = pcommand; - - callFree(pcommand); - } - - if ( answer == "y" || answer == "n" ) - { - cout << endl; break; } - else - cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; - if ( noPrompting ) - exit(1); + if (ifa->ifa_addr->sa_family == AF_INET) + { + sa = (struct sockaddr_in*) ifa->ifa_addr; + addr = inet_ntoa(sa->sin_addr); + //printf("Interface: %s\tAddress: %s\n", ifa->ifa_name, addr); + + if ( PM1ipAdd == addr ) + { + //match + found = true; + } + } + + if (found) + break; } - if ( answer == "n" ) + freeifaddrs(ifap); + + if (!found) { - cout << endl; - cout << "ERROR: postConfigure install can only be done on the PM1" << endl; - cout << "designated node. The configured PM1 IP address doesn't match the local" << endl; - cout << "IP Address. exiting..." << endl; - exit(1); + + string answer = "y"; + + while (true) + { + cout << endl << "The Configured PM1 IP Address of " << PM1ipAdd << " does not match any of the" << endl; + cout << "Server Ethernet IP addresses there were detected, do you want to continue?" << endl; + cout << "This is to make sure that you arent running postConfigure from a non-PM1 node." << endl; + prompt = "Enter 'y' to continue using Configured IP address [y,n] (y) > "; + + pcommand = callReadline(prompt.c_str()); + + if (pcommand) + { + if (strlen(pcommand) > 0) answer = pcommand; + + callFree(pcommand); + } + + if ( answer == "y" || answer == "n" ) + { + cout << endl; + break; + } + else + cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; + + if ( noPrompting ) + exit(1); + } + + if ( answer == "n" ) + { + cout << endl; + cout << "ERROR: postConfigure install can only be done on the PM1" << endl; + cout << "designated node. The configured PM1 IP address doesn't match the local" << endl; + cout << "IP Address. exiting..." << endl; + exit(1); + } } } } @@ -666,7 +673,7 @@ int main(int argc, char* argv[]) if ( !rootUser ) { system("sudo sed -i -e 's/#sudo runuser/sudo runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1"); - system("sudo chmod 777 /etc/rc.d/rc.local >/dev/null 2>&1"); + system("sudo chmod 666 /etc/fstab >/dev/null 2>&1"); } cout << endl; @@ -984,6 +991,12 @@ int main(int argc, char* argv[]) catch (...) {} + if ( !writeConfig(sysConfig) ) + { + cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; + exit(1); + } + break; } } @@ -1113,7 +1126,8 @@ int main(int argc, char* argv[]) { if ( cloud == oam::UnassignedName ) { - cout << "NOTE: Amazon AWS CLI Tools are installed and allow MariaDB ColumnStore to create Instances and ABS Volumes" << endl << endl; + cout << "NOTE: Amazon AWS CLI Tools are installed and allow MariaDB ColumnStore" << endl; + cout << " to create Instances and EBS Volumes" << endl << endl; while (true) { @@ -3167,175 +3181,235 @@ int main(int argc, char* argv[]) // cout << endl << "===== System Installation =====" << endl << endl; - cout << "System Configuration is complete, System Installation is the next step." << endl; + cout << "System Configuration is complete." << endl; + cout << "Performing System Installation." << endl; - while (true) + SystemSoftware systemsoftware; + + try { - pcommand = callReadline("Would you like to continue with the System Installation? [y,n] (y) > "); - - if (pcommand) - { - if (strlen(pcommand) > 0) install = pcommand; - - callFree(pcommand); - } - - if ( install == "y" || install == "n" ) - break; - else - cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; - - install = "y"; - - if ( noPrompting ) - exit(1); + oam.getSystemSoftware(systemsoftware); + } + catch (exception& e) + { + cout << " ERROR: reading getSystemSoftware API" << endl; + exit (1); } - if ( install == "y" ) + cout << endl; + + string version = systemsoftware.Version + "-" + systemsoftware.Release; + + string installType = "initial"; + + if ( EEPackageType == "rpm" ) { - SystemSoftware systemsoftware; - - try + cout << "Performing a MariaDB ColumnStore System install using RPM packages" << endl; + cout << "located in the " + HOME + " directory." << endl << endl; + } + else + { + if ( EEPackageType == "binary" ) { - oam.getSystemSoftware(systemsoftware); - } - catch (exception& e) - { - cout << " ERROR: reading getSystemSoftware API" << endl; - exit (1); - } - - cout << endl; - - string version = systemsoftware.Version + "-" + systemsoftware.Release; - - string installType = "initial"; - - if ( EEPackageType == "rpm" ) - { - cout << "Performing a MariaDB ColumnStore System install using RPM packages" << endl; + cout << "Performing a MariaDB ColumnStore System install using a Binary package" << endl; cout << "located in the " + HOME + " directory." << endl << endl; } else { - if ( EEPackageType == "binary" ) - { - cout << "Performing a MariaDB ColumnStore System install using a Binary package" << endl; - cout << "located in the " + HOME + " directory." << endl << endl; - } - else - { - cout << "Performing a MariaDB ColumnStore System install using using DEB packages" << endl; - cout << "located in the " + HOME + " directory." << endl; - } + cout << "Performing a MariaDB ColumnStore System install using using DEB packages" << endl; + cout << "located in the " + HOME + " directory." << endl; } + } - //check if pkgs are located in $HOME directory - if ( EEPackageType == "rpm") - columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.rpm"; - else if ( EEPackageType == "deb") - columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.deb"; - else - columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.bin.tar.gz"; + //check if pkgs are located in $HOME directory + if ( EEPackageType == "rpm") + columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.rpm"; + else if ( EEPackageType == "deb") + columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.deb"; + else + columnstorePackage = HOME + "/" + "mariadb-columnstore-" + version + "*.bin.tar.gz"; - if ( !pkgCheck(columnstorePackage) ) - exit(1); + if ( !pkgCheck(columnstorePackage) ) + exit(1); - if ( password.empty() ) + if ( password.empty() ) + { + cout << endl; + cout << "Next step is to enter the password to access the other Servers." << endl; + cout << "This is either your password or you can default to using a ssh key" << endl; + cout << "If using a password, the password needs to be the same on all Servers." << endl << endl; + } + + while (true) + { + char* pass1, *pass2; + + if ( noPrompting ) { - cout << endl; - cout << "Next step is to enter the password to access the other Servers." << endl; - cout << "This is either your password or you can default to using a ssh key" << endl; - cout << "If using a password, the password needs to be the same on all Servers." << endl << endl; - } + cout << "Enter password, hit 'enter' to default to using a ssh key, or 'exit' > " << endl; - while (true) - { - char* pass1, *pass2; - - if ( noPrompting ) - { - cout << "Enter password, hit 'enter' to default to using a ssh key, or 'exit' > " << endl; - - if ( password.empty() ) - password = "ssh"; - - break; - } - - //check for command line option password - if ( !password.empty() ) - break; - - pass1 = getpass("Enter password, hit 'enter' to default to using a ssh key, or 'exit' > "); - - if ( strcmp(pass1, "") == 0 ) - { + if ( password.empty() ) password = "ssh"; - break; - } - if ( pass1 == "exit") - exit(0); - - string p1 = pass1; - pass2 = getpass("Confirm password > "); - string p2 = pass2; - - if ( p1 == p2 ) - { - password = p2; - break; - } - else - cout << "Password mismatch, please re-enter" << endl; + break; } - //add single quote for special characters - if ( password != "ssh" ) + //check for command line option password + if ( !password.empty() ) + break; + + pass1 = getpass("Enter password, hit 'enter' to default to using a ssh key, or 'exit' > "); + + if ( strcmp(pass1, "") == 0 ) { - password = "'" + password + "'"; + password = "ssh"; + break; } - checkSystemMySQLPort(mysqlPort, sysConfig, USER, password, childmodulelist, IserverTypeInstall, pmwithum); + if ( pass1 == "exit") + exit(0); - if ( ( IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM ) || - ( (IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) && pmwithum ) ) + string p1 = pass1; + pass2 = getpass("Confirm password > "); + string p2 = pass2; + + if ( p1 == p2 ) { - cout << endl << "===== Running the MariaDB ColumnStore MariaDB ColumnStore setup scripts =====" << endl << endl; + password = p2; + break; + } + else + cout << "Password mismatch, please re-enter" << endl; + } - // call the mysql setup scripts - mysqlSetup(); - sleep(5); + //add single quote for special characters + if ( password != "ssh" ) + { + password = "'" + password + "'"; + } + + checkSystemMySQLPort(mysqlPort, sysConfig, USER, password, childmodulelist, IserverTypeInstall, pmwithum); + + if ( ( IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM ) || + ( (IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) && pmwithum ) ) + { + cout << endl << "===== Running the MariaDB ColumnStore MariaDB ColumnStore setup scripts =====" << endl << endl; + + // call the mysql setup scripts + mysqlSetup(); + sleep(5); + } + + string AmazonInstall = "0"; + + if ( amazonInstall ) + AmazonInstall = "1"; + + ChildModuleList::iterator list1 = childmodulelist.begin(); + + for (; list1 != childmodulelist.end() ; list1++) + { + string remoteModuleName = (*list1).moduleName; + string remoteModuleIP = (*list1).moduleIP; + string remoteHostName = (*list1).hostName; + string remoteModuleType = remoteModuleName.substr(0, MAX_MODULE_TYPE_SIZE); + + string debug_logfile; + string logfile; + + if ( remote_installer_debug == "1" ) + { + logfile = "/tmp/"; + logfile += remoteModuleName + "_" + EEPackageType + "_install.log"; + debug_logfile = " > " + logfile; } - string AmazonInstall = "0"; - - if ( amazonInstall ) - AmazonInstall = "1"; - - ChildModuleList::iterator list1 = childmodulelist.begin(); - - for (; list1 != childmodulelist.end() ; list1++) + if ( remoteModuleType == "um" || + (remoteModuleType == "pm" && IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM) || + (remoteModuleType == "pm" && pmwithum) ) { - string remoteModuleName = (*list1).moduleName; - string remoteModuleIP = (*list1).moduleIP; - string remoteHostName = (*list1).hostName; - string remoteModuleType = remoteModuleName.substr(0, MAX_MODULE_TYPE_SIZE); - - string debug_logfile; - string logfile; + cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl; if ( remote_installer_debug == "1" ) - { - logfile = "/tmp/"; - logfile += remoteModuleName + "_" + EEPackageType + "_install.log"; - debug_logfile = " > " + logfile; - } + cout << "Install log file is located here: " + logfile << endl << endl; - if ( remoteModuleType == "um" || - (remoteModuleType == "pm" && IserverTypeInstall == oam::INSTALL_COMBINE_DM_UM_PM) || - (remoteModuleType == "pm" && pmwithum) ) + if ( EEPackageType != "binary" ) + { + string temppwprompt = pwprompt; + + if ( pwprompt == " " ) + temppwprompt = "none"; + + //run remote installer script + cmd = installDir + "/bin/package_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + AmazonInstall + " " + EEPackageType + " " + nodeps + " " + remote_installer_debug + " " + debug_logfile; + + if ( thread_remote_installer ) + { + thr_data[thread_id].command = cmd; + + int status = pthread_create (&thr[thread_id], NULL, (void* (*)(void*)) &remoteInstallThread, &thr_data[thread_id]); + + if ( status != 0 ) + { + cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl; + exit (1); + } + + thread_id++; + } + else + { + int rtnCode = system(cmd.c_str()); + + if (WEXITSTATUS(rtnCode) != 0) + { + cout << endl << "Error returned from package_installer.sh" << endl; + exit(1); + } + } + } + else + { + // do a binary package install + string binservertype = serverTypeInstall; + + if ( pmwithum ) + binservertype = "pmwithum"; + + cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + + remoteModuleIP + " " + password + " " + columnstorePackage + " " + installType + " " + AmazonInstall + " " + remote_installer_debug + + " " + installDir + " " + debug_logfile; + + if ( thread_remote_installer ) + { + thr_data[thread_id].command = cmd; + + int status = pthread_create (&thr[thread_id], NULL, (void* (*)(void*)) &remoteInstallThread, &thr_data[thread_id]); + + if ( status != 0 ) + { + cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl; + exit (1); + } + + thread_id++; + } + else + { + int rtnCode = system(cmd.c_str()); + + if (WEXITSTATUS(rtnCode) != 0) + { + cout << endl << "Error returned from package_installer.sh" << endl; + exit(1); + } + } + } + } + else + { + if ( (remoteModuleType == "pm" && IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) || + (remoteModuleType == "pm" && !pmwithum ) ) { cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl; @@ -3344,11 +3418,6 @@ int main(int argc, char* argv[]) if ( EEPackageType != "binary" ) { - string temppwprompt = pwprompt; - - if ( pwprompt == " " ) - temppwprompt = "none"; - //run remote installer script cmd = installDir + "/bin/package_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + AmazonInstall + " " + EEPackageType + " " + nodeps + " " + remote_installer_debug + " " + debug_logfile; @@ -3375,90 +3444,6 @@ int main(int argc, char* argv[]) cout << endl << "Error returned from package_installer.sh" << endl; exit(1); } - - //check for mysql password on remote UM - /* if ( pwprompt == " " ) { - //start mysqld - cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/mysql-Columnstore start'"; - int rtnCode = system(cmd.c_str()); - if (WEXITSTATUS(rtnCode) != 0) { - cout << endl << "Error returned from mysql-Columnstore start" << endl; - exit(1); - } - - //try to login - cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root " + pwprompt + " -e status' 1 > /tmp/idbmysql.log 2>&1"; - rtnCode = system(cmd.c_str()); - if (WEXITSTATUS(rtnCode) != 0) { - cout << endl << "Error returned from remote_command.sh" << endl; - exit(1); - } - - if (oam.checkLogStatus("/tmp/idbmysql.log", "ERROR .my.cnf") ) { - // password needed check and get password from remote UM - cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "bin/getMySQLpw > /tmp/mysqlpw.log 2>&1"; - rtnCode = system(cmd.c_str()); - if (WEXITSTATUS(rtnCode) != 0) { - cout << endl << "MariaDB ColumnStore login failure, MySQL Root password is set." << endl; - cout << "Need MariaDB ColumnStore password configuration file " + HOME + "/.my.cnf on " << remoteModuleName << endl; - exit(1); - } - - //get password from local tmp file - try { - mysqlpw = oam.getMySQLPassword(); - } - catch(...) - { - mysqlpw = oam::UnassignedName; - } - - if ( mysqlpw != oam::UnassignedName ) - { - mysqlpw = "'" + mysqlpw + "'"; - pwprompt = "--password=" + mysqlpw; - } - - cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root " + pwprompt + " -e status' 1 > /tmp/idbmysql.log 2>&1"; - rtnCode = system(cmd.c_str()); - if (WEXITSTATUS(rtnCode) != 0) { - cout << endl << "MariaDB ColumnStore login failure, password mismatch in " + HOME + ".my.cnf on " << remoteModuleName << endl; - exit(1); - } - } - else - { - if (!oam.checkLogStatus("/tmp/idbmysql.log", "Columnstore") ) { - cout << endl << "ERROR: MariaDB ColumnStore runtime error, exit..." << endl << endl; - system("cat /tmp/idbmysql.log"); - exit (1); - } - else - { - cout << endl << "Additional MariaDB ColumnStore Installation steps Successfully Completed on '" + remoteModuleName + "'" << endl << endl; - - cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/mysql-Columnstore stop'"; - int rtnCode = system(cmd.c_str()); - if (WEXITSTATUS(rtnCode) != 0) { - cout << endl << "Error returned from mysql-Columnstore stop" << endl; - exit(1); - } - unlink("/tmp/idbmysql.log"); - break; - } - } - - //re-run post-mysql-install with password - cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/bin/post-mysql-install " + pwprompt + "' < /tmp/post-mysql-install.log"; - rtnCode = system(cmd.c_str()); - if (WEXITSTATUS(rtnCode) != 0) { - cout << endl << "Error returned from post-mysql-install, check /tmp/post-mysql-install.log" << endl; - exit(1); - } - else - cout << endl << "post-mysql-install Successfully Completed" << endl; - } - */ } } else @@ -3469,9 +3454,10 @@ int main(int argc, char* argv[]) if ( pmwithum ) binservertype = "pmwithum"; - cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + - remoteModuleIP + " " + password + " " + columnstorePackage + " " + installType + " " + AmazonInstall + " " + remote_installer_debug + - " " + installDir + " " + debug_logfile; + cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + remoteModuleIP + + " " + password + " " + columnstorePackage + " " + installType + " " + AmazonInstall + " " + + remote_installer_debug + " " + installDir + " " + + debug_logfile; if ( thread_remote_installer ) { @@ -3499,111 +3485,23 @@ int main(int argc, char* argv[]) } } } - else - { - if ( (remoteModuleType == "pm" && IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM) || - (remoteModuleType == "pm" && !pmwithum ) ) - { - cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl; - - if ( remote_installer_debug == "1" ) - cout << "Install log file is located here: " + logfile << endl << endl; - - if ( EEPackageType != "binary" ) - { - //run remote installer script - cmd = installDir + "/bin/package_installer.sh " + remoteModuleName + " " + remoteModuleIP + " " + password + " " + version + " initial " + AmazonInstall + " " + EEPackageType + " " + nodeps + " " + remote_installer_debug + " " + debug_logfile; - - if ( thread_remote_installer ) - { - thr_data[thread_id].command = cmd; - - int status = pthread_create (&thr[thread_id], NULL, (void* (*)(void*)) &remoteInstallThread, &thr_data[thread_id]); - - if ( status != 0 ) - { - cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl; - exit (1); - } - - thread_id++; - } - else - { - int rtnCode = system(cmd.c_str()); - - if (WEXITSTATUS(rtnCode) != 0) - { - cout << endl << "Error returned from package_installer.sh" << endl; - exit(1); - } - } - } - else - { - // do a binary package install - string binservertype = serverTypeInstall; - - if ( pmwithum ) - binservertype = "pmwithum"; - - cmd = installDir + "/bin/binary_installer.sh " + remoteModuleName + " " + remoteModuleIP + - " " + password + " " + columnstorePackage + " " + installType + " " + AmazonInstall + " " + - remote_installer_debug + " " + installDir + " " + - debug_logfile; - - if ( thread_remote_installer ) - { - thr_data[thread_id].command = cmd; - - int status = pthread_create (&thr[thread_id], NULL, (void* (*)(void*)) &remoteInstallThread, &thr_data[thread_id]); - - if ( status != 0 ) - { - cout << "remoteInstallThread failed for " << remoteModuleName << ", exiting" << endl; - exit (1); - } - - thread_id++; - } - else - { - int rtnCode = system(cmd.c_str()); - - if (WEXITSTATUS(rtnCode) != 0) - { - cout << endl << "Error returned from package_installer.sh" << endl; - exit(1); - } - } - } - } - } - } - - if ( thread_remote_installer ) - { - - //wait until remove install Thread Count is at zero or hit timeout - cout << endl << "MariaDB ColumnStore Package being installed, please wait ..."; - cout.flush(); - - /* block until all threads complete */ - for (thread_id = 0; thread_id < (int) childmodulelist.size(); ++thread_id) - { - pthread_join(thr[thread_id], NULL); - } - - cout << " DONE" << endl; } } - else + + if ( thread_remote_installer ) { - if (DataRedundancy && install != "y") + + //wait until remove install Thread Count is at zero or hit timeout + cout << endl << "MariaDB ColumnStore Package being installed, please wait ..."; + cout.flush(); + + /* block until all threads complete */ + for (thread_id = 0; thread_id < (int) childmodulelist.size(); ++thread_id) { - cout << endl << "Must choose to install with DataRedundancy configured." << endl; - exit(1); + pthread_join(thr[thread_id], NULL); } + + cout << " DONE" << endl; } } else @@ -3682,182 +3580,26 @@ int main(int argc, char* argv[]) // cout << endl << "===== MariaDB ColumnStore System Startup =====" << endl << endl; - string start = "y"; - cout << "System Installation is complete. If any part of the install failed," << endl; - cout << "the problem should be investigated and resolved before continuing." << endl << endl; + cout << "System Installation is complete." << endl; + cout << "Performing System Start-up." << endl; - if ( nonDistribute ) - cout << "Non-Distrubuted Install: make sure all other modules have MariaDB ColumnStore" << endl; - - cout << "package installed and the associated service started." << endl << endl; - - while (true) + if (hdfs && !nonDistribute ) { - pcommand = callReadline("Would you like to startup the MariaDB ColumnStore System? [y,n] (y) > "); + cout << endl << "----- Starting MariaDB ColumnStore Service on all Modules -----" << endl << endl; + string cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > /tmp/postConfigure.pdsh 2>&1"; + system(cmd.c_str()); - if (pcommand) + if (oam.checkLogStatus("/tmp/postConfigure.pdsh", "exit") ) { - if (strlen(pcommand) > 0) start = pcommand; - - callFree(pcommand); - } - - if ( start == "y" || start == "n" ) - break; - else - cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; - - start = "y"; - - if ( noPrompting ) - exit(1); - } - - if ( start == "y" ) - { - - if (hdfs && !nonDistribute ) - { - cout << endl << "----- Starting MariaDB ColumnStore Service on all Modules -----" << endl << endl; - string cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > /tmp/postConfigure.pdsh 2>&1"; - system(cmd.c_str()); - - if (oam.checkLogStatus("/tmp/postConfigure.pdsh", "exit") ) - { - cout << endl << "ERROR: Starting MariaDB ColumnStore Service failue, check /tmp/postConfigure.pdsh. exit..." << endl; - exit (1); - } - } - else - { - /* if ( !nonDistribute ) - { - if ( password.empty() ) { - while(true) - { - char *pass1, *pass2; - - if ( noPrompting ) { - cout << "Enter your password, hit 'enter' to default to using a ssh key, or 'exit' > " << endl; - if ( password.empty() ) - password = "ssh"; - break; - } - - //check for command line option password - if ( !password.empty() ) - break; - - pass1=getpass("Enter your password, hit 'enter' to default to using a ssh key, or 'exit' > "); - if ( strcmp(pass1, "") == 0 ) { - password = "ssh"; - break; - } - - if ( strcmp(pass1, "exit") == 0 ) - exit(0); - string p1 = pass1; - pass2=getpass("Confirm password > "); - string p2 = pass2; - if ( p1 == p2 ) { - password = p2; - break; - } - else - cout << "Password mismatch, please re-enter" << endl; - } - - //add single quote for special characters - if ( password != "ssh" ) - { - password = "'" + password + "'"; - } - } - - ChildModuleList::iterator list1 = childmodulelist.begin(); - - for (; list1 != childmodulelist.end() ; list1++) - { - string remoteModuleName = (*list1).moduleName; - string remoteModuleIP = (*list1).moduleIP; - string remoteHostName = (*list1).hostName; - - //run remote command script - cout << endl << "----- Starting MariaDB ColumnStore on '" + remoteModuleName + "' -----" << endl << endl; - - if ( install == "n" ) - { // didnt do a full install, push the config file - cmd = installDir + "/bin/remote_scp_put.sh " + remoteModuleIP + " " + installDir + "/etc/Columnstore.xml > /dev/null 2>&1"; - system(cmd.c_str()); - } - - cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/bin/columnstore restart' 0"; - int rtnCode = system(cmd.c_str()); - - if (WEXITSTATUS(rtnCode) != 0) - cout << "Error with running remote_command.sh" << endl; - else - cout << "MariaDB ColumnStore successfully started" << endl; - } - } - */ - //start MariaDB ColumnStore on local server - cout << endl << "----- Starting MariaDB ColumnStore on local server -----" << endl << endl; - cmd = installDir + "/bin/columnstore restart > /dev/null 2>&1"; - int rtnCode = system(cmd.c_str()); - - if (WEXITSTATUS(rtnCode) != 0) - { - cout << "Error Starting MariaDB ColumnStore local module" << endl; - cout << "Installation Failed, exiting" << endl; - exit (1); - } - else - cout << "MariaDB ColumnStore successfully started" << endl; + cout << endl << "ERROR: Starting MariaDB ColumnStore Service failue, check /tmp/postConfigure.pdsh. exit..." << endl; + exit (1); } } else - { - cout << endl << "You choose not to Start the MariaDB ColumnStore Software at this time." << endl; - exit (1); - } - } - else // Single Server start - { - cout << endl << "===== MariaDB ColumnStore System Startup =====" << endl << endl; - - string start = "y"; - cout << "System Installation is complete." << endl; - cout << "If an error occurred while running the MariaDB ColumnStore setup scripts," << endl; - cout << "this will need to be corrected and postConfigure will need to be re-run." << endl << endl; - - while (true) - { - pcommand = callReadline("Would you like to startup the MariaDB ColumnStore System? [y,n] (y) > "); - - if (pcommand) - { - if (strlen(pcommand) > 0) start = pcommand; - - callFree(pcommand); - } - - if ( start == "y" || start == "n" ) - break; - else - cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl; - - start = "y"; - - if ( noPrompting ) - exit(1); - } - - if ( start == "y" ) { //start MariaDB ColumnStore on local server - cout << endl << "----- Starting MariaDB ColumnStore on local Server '" + parentOAMModuleName + "' -----" << endl << endl; - string cmd = installDir + "/bin/columnstore restart > /dev/null 2>&1"; + cout << endl << "----- Starting MariaDB ColumnStore on local server -----" << endl << endl; + cmd = installDir + "/bin/columnstore restart > /dev/null 2>&1"; int rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) != 0) @@ -3867,13 +3609,29 @@ int main(int argc, char* argv[]) exit (1); } else - cout << endl << "MariaDB ColumnStore successfully started" << endl; + cout << "MariaDB ColumnStore successfully started" << endl; } - else + } + else // Single Server start + { + cout << endl << "===== MariaDB ColumnStore System Startup =====" << endl << endl; + + cout << "System Installation is complete." << endl; + cout << "Performing System Start-up." << endl; + + //start MariaDB ColumnStore on local server + cout << endl << "----- Starting MariaDB ColumnStore on local Server '" + parentOAMModuleName + "' -----" << endl << endl; + string cmd = installDir + "/bin/columnstore restart > /dev/null 2>&1"; + int rtnCode = system(cmd.c_str()); + + if (WEXITSTATUS(rtnCode) != 0) { - cout << endl << "You choose not to Start the MariaDB ColumnStore Software at this time." << endl; + cout << "Error Starting MariaDB ColumnStore local module" << endl; + cout << "Installation Failed, exiting" << endl; exit (1); } + else + cout << endl << "MariaDB ColumnStore successfully started" << endl; } cout << endl << "MariaDB ColumnStore Database Platform Starting, please wait ."; @@ -3925,23 +3683,14 @@ int main(int argc, char* argv[]) if ( oam.checkLogStatus("/tmp/dbbuilder.log", "System catalog appears to exist") ) { -// cout << endl << "Run MySQL Upgrade.. "; cout.flush(); - - //send message to procmon's to run upgrade script -// int status = sendUpgradeRequest(IserverTypeInstall, pmwithum); - -// if ( status != 0 ) { -// cout << endl << "MariaDB ColumnStore Install Failed" << endl << endl; -// exit(1); -// } -// else -// cout << " DONE" << endl; } else { cout << endl << "System Catalog Create Failure" << endl; cout << "Check latest log file in /tmp/dbbuilder.log.*" << endl; + cout << " IMPORTANT: Once issue has been resolved, rerun postConfigure" << endl << endl; + exit (1); } } @@ -3956,11 +3705,12 @@ int main(int argc, char* argv[]) cout.flush(); //send message to procmon's to run mysql replication script - int status = sendReplicationRequest(IserverTypeInstall, password, mysqlPort, pmwithum); + int status = sendReplicationRequest(IserverTypeInstall, password, pmwithum); if ( status != 0 ) { - cout << endl << " MariaDB ColumnStore Install Failed" << endl << endl; + cout << endl << " MariaDB ColumnStore Replication Setup Failed, check logs" << endl << endl; + cout << " IMPORTANT: Once issue has been resolved, rerun postConfigure" << endl << endl; exit(1); } else @@ -3980,7 +3730,10 @@ int main(int argc, char* argv[]) } else { - cout << " FAILED" << endl; + cout << " FAILED" << endl << endl; + + cout << " IMPORTANT: There was a system startup failed, once issue has been resolved, rerun postConfigure" << endl << endl; + cout << endl << "MariaDB ColumnStore System failed to start, check log files in /var/log/mariadb/columnstore" << endl; cout << "Enter the following command to define MariaDB ColumnStore Alias Commands" << endl << endl; @@ -4526,24 +4279,26 @@ bool makeRClocal(string moduleType, string moduleName, int IserverTypeInstall) if ( lines.begin() == lines.end()) return true; - string fileName = "/tmp/rc.local"; + string RCfileName = "/etc/rc.d/rc.local"; + std::ofstream file; - ofstream newFile (fileName.c_str()); + file.open(RCfileName.c_str(), std::ios::out | std::ios::app); - //create new file - int fd = open(fileName.c_str(), O_RDWR | O_CREAT, 0664); + if (file.fail()) + { + RCfileName = "/etc/rc.local"; - copy(lines.begin(), lines.end(), ostream_iterator(newFile, "\n")); - newFile.close(); + file.open(RCfileName.c_str(), std::ios::out | std::ios::app); - close(fd); + if (file.fail()) + return true; + } - if (rootUser) - system("cat /tmp/rc.local >> /etc/rc.d/rc.local > /dev/null"); - else - system("sudo cat /tmp/rc.local >> /etc/rc.d/rc.local > /dev/null"); + file.exceptions(file.exceptions() | std::ios::failbit | std::ifstream::badbit); - unlink(fileName.c_str()); + copy(lines.begin(), lines.end(), ostream_iterator(file, "\n")); + + file.close(); return true; } @@ -6033,17 +5788,35 @@ void remoteInstallThread(void* arg) { thread_data_t* data = (thread_data_t*)arg; - int rtnCode = system((data->command).c_str()); - - if (WEXITSTATUS(rtnCode) != 0) + for ( int retry = 0 ; retry < 5 ; retry++ ) { - pthread_mutex_lock(&THREAD_LOCK); - cout << endl << "Failure with a remote module install, check install log files in /tmp" << endl; - exit(1); + int rtnCode = system((data->command).c_str()); + + if (WEXITSTATUS(rtnCode) == 0) + { + //success + pthread_exit(0); + } + else + { + if (WEXITSTATUS(rtnCode) == 2) + { + //timeout retry + continue; + } + else + { + //failure + pthread_mutex_lock(&THREAD_LOCK); + cout << endl << "Failure with a remote module install, check install log files in /tmp" << endl; + exit(1); + } + } } - // exit thread - pthread_exit(0); + pthread_mutex_lock(&THREAD_LOCK); + cout << endl << "Failure with a remote module install, check install log files in /tmp" << endl; + exit(1); } std::string launchInstance(ModuleIP moduleip) diff --git a/procmgr/main.cpp b/procmgr/main.cpp index c6bcd8fa6..b8fcaaa81 100644 --- a/procmgr/main.cpp +++ b/procmgr/main.cpp @@ -537,7 +537,7 @@ static void startMgrProcessThread() ModuleTypeConfig PMSmoduletypeconfig; ALARMManager aManager; - int waitTime = 60; + int waitTime = 180; log.writeLog(__LINE__, "startMgrProcessThread launched", LOG_TYPE_DEBUG); @@ -1636,7 +1636,7 @@ void pingDeviceThread() //restart module processes int retry = 0; - int ModuleProcMonWaitCount = 6; + int ModuleProcMonWaitCount = 12; try { @@ -1644,7 +1644,7 @@ void pingDeviceThread() } catch (...) { - ModuleProcMonWaitCount = 6; + ModuleProcMonWaitCount = 12; } for ( ; retry < ModuleProcMonWaitCount ; retry ++ ) @@ -1793,10 +1793,17 @@ void pingDeviceThread() processManager.distributeConfigFile("system"); sleep(1); - // if a PM module was started successfully, restart ACTIVE ExeMgr(s) / mysqld + // if a PM module was started successfully, restart ACTIVE DBRM(s), ExeMgr(s) / mysqld if ( moduleName.find("pm") == 0 ) { - processManager.restartProcessType("ExeMgr", moduleName); + processManager.restartProcessType("DBRMControllerNode", moduleName); + processManager.restartProcessType("DBRMWorkerNode"); + processManager.stopProcessType("DDLProc"); + processManager.stopProcessType("DMLProc"); + processManager.stopProcessType("ExeMgr"); + processManager.restartProcessType("PrimProc"); + sleep(1); + processManager.restartProcessType("ExeMgr"); } string moduleType = moduleName.substr(0, MAX_MODULE_TYPE_SIZE); @@ -1830,9 +1837,11 @@ void pingDeviceThread() // if a PM module was started successfully, DMLProc/DDLProc if ( moduleName.find("pm") == 0 ) { - processManager.restartProcessType("DDLProc", moduleName); + processManager.restartProcessType("WriteEngineServer"); sleep(1); - processManager.restartProcessType("DMLProc", moduleName); + processManager.restartProcessType("DDLProc"); + sleep(1); + processManager.restartProcessType("DMLProc"); } //enable query stats @@ -1843,6 +1852,88 @@ void pingDeviceThread() processManager.setSystemState(oam::ACTIVE); + //reset standby module + string newStandbyModule = processManager.getStandbyModule(); + + //send message to start new Standby Process-Manager, if needed + if ( !newStandbyModule.empty() && newStandbyModule != "NONE") + { + processManager.setStandbyModule(newStandbyModule); + } + else + { + Config* sysConfig = Config::makeConfig(); + + // clear Standby OAM Module + sysConfig->setConfig("SystemConfig", "StandbyOAMModuleName", oam::UnassignedName); + sysConfig->setConfig("ProcStatusControlStandby", "IPAddr", oam::UnassignedIpAddr); + + //update Calpont Config table + try + { + sysConfig->write(); + } + catch (...) + { + log.writeLog(__LINE__, "ERROR: sysConfig->write", LOG_TYPE_ERROR); + } + } + + if ( moduletypeconfig.RunType == SIMPLEX ) + { + //start SIMPLEX runtype processes on a SIMPLEX runtype module + string moduletype = moduleName.substr(0, MAX_MODULE_TYPE_SIZE); + DeviceNetworkList::iterator pt = moduletypeconfig.ModuleNetworkList.begin(); + + for ( ; pt != moduletypeconfig.ModuleNetworkList.end() ; pt++) + { + string launchModuleName = (*pt).DeviceName; + string launchModuletype = launchModuleName.substr(0, MAX_MODULE_TYPE_SIZE); + + if ( moduletype != launchModuletype ) + continue; + + //skip if active pm module (local module) + if ( launchModuleName == config.moduleName() ) + continue; + + //check if module is active before starting any SIMPLEX STANDBY apps + try + { + int launchopState = oam::ACTIVE; + bool degraded; + oam.getModuleStatus(launchModuleName, launchopState, degraded); + + if (launchopState != oam::ACTIVE && launchopState != oam::STANDBY ) + { + continue; + } + } + catch (exception& ex) + { +// string error = ex.what(); +// log.writeLog(__LINE__, "EXCEPTION ERROR on : " + error, LOG_TYPE_ERROR); + } + catch (...) + { +// log.writeLog(__LINE__, "EXCEPTION ERROR on getModuleStatus on module " + moduleName + ": Caught unknown exception!", LOG_TYPE_ERROR); + } + + int status; + log.writeLog(__LINE__, "Starting up STANDBY process on module " + launchModuleName, LOG_TYPE_DEBUG); + + for ( int j = 0 ; j < 20 ; j ++ ) + { + status = processManager.startModule(launchModuleName, oam::FORCEFUL, oam::AUTO_OFFLINE); + + if ( status == API_SUCCESS) + break; + } + + log.writeLog(__LINE__, "pingDeviceThread: ACK received from '" + launchModuleName + "' Process-Monitor, return status = " + oam.itoa(status), LOG_TYPE_DEBUG); + } + } + //clear count moduleInfoList[moduleName] = 0; } diff --git a/procmgr/processmanager.cpp b/procmgr/processmanager.cpp index 88f5cef70..d6fae0223 100644 --- a/procmgr/processmanager.cpp +++ b/procmgr/processmanager.cpp @@ -2840,7 +2840,7 @@ void processMSG(messageqcpp::IOSocket* cfIos) // target = root password oam::DeviceNetworkList devicenetworklist; - status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true, target, false); + status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, false, target, false); log.writeLog(__LINE__, "Disable MySQL Replication status: " + oam.itoa(status) ); @@ -3784,27 +3784,38 @@ void ProcessManager::recycleProcess(string module) //restart ExeMgrs/mysql if module is a pm if ( moduleType == "pm" ) { + restartProcessType("DBRMControllerNode", module); + restartProcessType("DBRMWorkerNode"); + stopProcessType("DDLProc"); + stopProcessType("DMLProc"); + stopProcessType("ExeMgr"); + restartProcessType("PrimProc"); + sleep(1); restartProcessType("ExeMgr"); + sleep(1); restartProcessType("mysql"); } else + { + restartProcessType("DBRMControllerNode", module); + restartProcessType("DBRMWorkerNode"); restartProcessType("ExeMgr"); + } if ( PrimaryUMModuleName == module ) { restartProcessType("DDLProc", module); -// restartProcessType("DDLProc", module, false); sleep(1); restartProcessType("DMLProc", module); -// restartProcessType("DMLProc", module, false); } if ( moduleType == "pm" && PrimaryUMModuleName != module) { - reinitProcessType("DDLProc"); + restartProcessType("WriteEngineServer"); + sleep(1); + restartProcessType("DDLProc"); sleep(1); restartProcessType("DMLProc", module); -// restartProcessType("DMLProc", module, false); } return; @@ -4551,6 +4562,10 @@ int ProcessManager::stopProcessType( std::string processName, bool manualFlag ) { if ( systemprocessstatus.processstatus[i].ProcessName == processName) { + //skip if in a COLD_STANDBY state + if ( systemprocessstatus.processstatus[i].ProcessOpState == oam::COLD_STANDBY ) + continue; + // found one, request restart of it processManager.stopProcess(systemprocessstatus.processstatus[i].Module, processName, @@ -4639,6 +4654,7 @@ int ProcessManager::restartProcessType( std::string processName, std::string ski SystemProcessStatus systemprocessstatus; ProcessStatus processstatus; int retStatus = API_SUCCESS; + bool setPMProcIPs = true; log.writeLog(__LINE__, "restartProcessType: Restart all " + processName, LOG_TYPE_DEBUG); @@ -4694,8 +4710,7 @@ int ProcessManager::restartProcessType( std::string processName, std::string ski ( systemprocessstatus.processstatus[i].ProcessOpState == oam::COLD_STANDBY && !manualFlag ) ) continue; - if ( processName.find("DDLProc") == 0 || - processName.find("DMLProc") == 0 ) + if ( (processName.find("DDLProc") == 0 || processName.find("DMLProc") == 0) && setPMProcIPs ) { string procModuleType = systemprocessstatus.processstatus[i].Module.substr(0, MAX_MODULE_TYPE_SIZE); @@ -4725,12 +4740,11 @@ int ProcessManager::restartProcessType( std::string processName, std::string ski // if DDL or DMLProc, change IP Address if ( retStatus == oam::API_SUCCESS ) { - if ( processName.find("DDLProc") == 0 || - processName.find("DMLProc") == 0 ) + if ( (processName.find("DDLProc") == 0 || processName.find("DMLProc") == 0) && setPMProcIPs ) { - processManager.setPMProcIPs(systemprocessstatus.processstatus[i].Module, processName); - return retStatus; + setPMProcIPs = false; + continue; } } } @@ -5481,6 +5495,9 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str //distribute config file distributeConfigFile("system"); + string cmd = "rm -f " + homedir + "/.ssh/known_hosts > /dev/null 2>&1"; + system(cmd.c_str()); + if ( DistributedInstall == "y" ) { @@ -5972,12 +5989,11 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str } //delay to give time for ProcMon to start after the config is sent and procmon restarts - log.writeLog(__LINE__, "addModule - sleep 10 - give ProcMon time to CONFIGURE and restart", LOG_TYPE_DEBUG); - sleep(10); + log.writeLog(__LINE__, "addModule - sleep 60 - give ProcMon time to CONFIGURE and restart", LOG_TYPE_DEBUG); + sleep(60); -// sleep(5); -// log.writeLog(__LINE__, "Setup MySQL Replication for new Modules being Added", LOG_TYPE_DEBUG); -// processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true, password ); + log.writeLog(__LINE__, "Setup MySQL Replication for new Modules being Added", LOG_TYPE_DEBUG); + processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true, password ); return API_SUCCESS; } @@ -7713,15 +7729,6 @@ void startSystemThread(oam::DeviceNetworkList Devicenetworklist) processManager.setSystemState(rtn); } - //run command to build system table if they don't already exist - sleep(5); - int ret = processManager.buildSystemTables("pm1"); - - if (ret == oam::API_SUCCESS ) - log.writeLog(__LINE__, "System Catalog Successfully Built", LOG_TYPE_DEBUG); - else - log.writeLog(__LINE__, "System Catalog not built, already existed", LOG_TYPE_DEBUG); - // exit thread log.writeLog(__LINE__, "startSystemThread Exit", LOG_TYPE_DEBUG); startsystemthreadStatus = status; @@ -8938,7 +8945,7 @@ int ProcessManager::setPMProcIPs( std::string moduleName, std::string processNam pthread_mutex_unlock(&THREAD_LOCK); - log.writeLog(__LINE__, "setPMProcIPs failed", LOG_TYPE_DEBUG); + //log.writeLog(__LINE__, "setPMProcIPs failed", LOG_TYPE_DEBUG); return API_SUCCESS; @@ -10032,7 +10039,7 @@ int ProcessManager::OAMParentModuleChange() if (amazon && AmazonPMFailover == "n") { log.writeLog(__LINE__, " ", LOG_TYPE_DEBUG); - log.writeLog(__LINE__, "*** OAMParentModule outage, AmazonPMFailover not set, wating for instance to restart ***", LOG_TYPE_DEBUG); + log.writeLog(__LINE__, "*** OAMParentModule outage, AmazonPMFailover not set, waiting for instance to restart ***", LOG_TYPE_DEBUG); string currentIPAddr = oam.getEC2InstanceIpAddress(downOAMParentHostname); @@ -11218,21 +11225,6 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist */ log.writeLog(__LINE__, "Setup MySQL Replication", LOG_TYPE_DEBUG); - // mysql port number - string MySQLPort; - - try - { - oam.getSystemConfig("MySQLPort", MySQLPort); - } - catch (...) - { - MySQLPort = "3306"; - } - - if ( MySQLPort.empty() ) - MySQLPort = "3306"; - //get master info if ( masterModule == oam::UnassignedName) { @@ -11289,6 +11281,15 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist if ( remoteModuleName == masterModule ) continue; + // don't do PMs unless PMwithUM flag is set + if ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM ) + { + string moduleType = remoteModuleName.substr(0, MAX_MODULE_TYPE_SIZE); + + if ( moduleType == "pm" && PMwithUM == "n" ) + continue; + } + ByteStream msg; ByteStream::byte requestID = oam::MASTERDIST; msg << requestID; @@ -11396,7 +11397,6 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist msg1 << masterLogFile; msg1 << masterLogPos; - msg1 << MySQLPort; } returnStatus = sendMsgProcMon( remoteModuleName, msg1, requestID, 60 ); @@ -11450,7 +11450,6 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist msg1 << masterLogFile; msg1 << masterLogPos; - msg1 << MySQLPort; } returnStatus = sendMsgProcMon( remoteModuleName, msg1, requestID, 60 ); diff --git a/procmon/processmonitor.cpp b/procmon/processmonitor.cpp index e4403739c..279e8c814 100644 --- a/procmon/processmonitor.cpp +++ b/procmon/processmonitor.cpp @@ -1690,26 +1690,26 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO } - case RUNUPGRADE: - { - log.writeLog(__LINE__, "MSG RECEIVED: Run upgrade script "); + /* case RUNUPGRADE: + { + log.writeLog(__LINE__, "MSG RECEIVED: Run upgrade script "); - string mysqlpw; - msg >> mysqlpw; + string mysqlpw; + msg >> mysqlpw; - // run upgrade script - int ret = runUpgrade(mysqlpw); + // run upgrade script + int ret = runUpgrade(mysqlpw); - ackMsg << (ByteStream::byte) ACK; - ackMsg << (ByteStream::byte) RUNUPGRADE; - ackMsg << (ByteStream::byte) ret; - mq.write(ackMsg); + ackMsg << (ByteStream::byte) ACK; + ackMsg << (ByteStream::byte) RUNUPGRADE; + ackMsg << (ByteStream::byte) ret; + mq.write(ackMsg); - log.writeLog(__LINE__, "RUNUPGRADE: ACK back to ProcMgr return status = " + oam.itoa((int) ret)); - - break; - } + log.writeLog(__LINE__, "RUNUPGRADE: ACK back to ProcMgr return status = " + oam.itoa((int) ret)); + break; + } + */ case PROCUNMOUNT: { string dbrootID; @@ -1921,7 +1921,8 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO string masterLogFile = oam::UnassignedName; string masterLogPos = oam::UnassignedName; - if ( (PMwithUM == "n") && (config.moduleType() == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) ) + if ( ( (PMwithUM == "n") && (config.moduleType() == "pm") ) && + ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) ) { ackMsg << (ByteStream::byte) ACK; ackMsg << (ByteStream::byte) MASTERREP; @@ -1993,10 +1994,9 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO msg >> masterLogFile; string masterLogPos; msg >> masterLogPos; - string port; - msg >> port; - if ( (PMwithUM == "n") && (config.moduleType() == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) ) + if ( ( (PMwithUM == "n") && (config.moduleType() == "pm") ) && + ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) ) { ackMsg << (ByteStream::byte) ACK; ackMsg << (ByteStream::byte) SLAVEREP; @@ -2022,7 +2022,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO } // run Slave Rep script - ret = runSlaveRep(masterLogFile, masterLogPos, port); + ret = runSlaveRep(masterLogFile, masterLogPos); ackMsg << (ByteStream::byte) ACK; ackMsg << (ByteStream::byte) SLAVEREP; @@ -2043,7 +2043,8 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO string module; msg >> module; - if ( (PMwithUM == "n") && (config.moduleType() == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) ) + if ( ( (PMwithUM == "n") && (config.moduleType() == "pm") ) && + ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) ) { ackMsg << (ByteStream::byte) ACK; ackMsg << (ByteStream::byte) MASTERDIST; @@ -5045,49 +5046,41 @@ void ProcessMonitor::checkProcessFailover( std::string processName) * purpose: run upgrade script * ******************************************************************************************/ -int ProcessMonitor::runUpgrade(std::string mysqlpw) +/*int ProcessMonitor::runUpgrade(std::string mysqlpw) { - Oam oam; + Oam oam; - for ( int i = 0 ; i < 10 ; i++ ) - { - //run upgrade script - string cmd = startup::StartUp::installDir() + "/bin/upgrade-columnstore.sh doupgrade --password=" + - mysqlpw + " --installdir=" + startup::StartUp::installDir() + " > " + "/tmp/upgrade-columnstore.log 2>&1"; - system(cmd.c_str()); + for ( int i = 0 ; i < 10 ; i++ ) + { + //run upgrade script + string cmd = startup::StartUp::installDir() + "/bin/upgrade-columnstore.sh doupgrade --password=" + + mysqlpw + " --installdir=" + startup::StartUp::installDir() + " > " + "/tmp/upgrade-columnstore.log 2>&1"; + system(cmd.c_str()); - cmd = "/tmp/upgrade-columnstore.log"; + cmd = "/tmp/upgrade-columnstore.log"; + if (oam.checkLogStatus(cmd, "OK")) { + log.writeLog(__LINE__, "upgrade-columnstore.sh: Successful return", LOG_TYPE_DEBUG); + return oam::API_SUCCESS; + } + else { + if (oam.checkLogStatus(cmd, "ERROR 1045") ) { + log.writeLog(__LINE__, "upgrade-columnstore.sh: Missing Password error, return success", LOG_TYPE_DEBUG); + return oam::API_SUCCESS; + } - if (oam.checkLogStatus(cmd, "OK")) - { - log.writeLog(__LINE__, "upgrade-columnstore.sh: Successful return", LOG_TYPE_DEBUG); - return oam::API_SUCCESS; - } - else - { - if (oam.checkLogStatus(cmd, "ERROR 1045") ) - { - log.writeLog(__LINE__, "upgrade-columnstore.sh: Missing Password error, return success", LOG_TYPE_DEBUG); - return oam::API_SUCCESS; - } - - log.writeLog(__LINE__, "upgrade-columnstore.sh: Error return, check log /tmp/upgrade-status.log", LOG_TYPE_ERROR); - - //restart mysqld and retry - try - { - oam.actionMysqlCalpont(MYSQL_RESTART); - } - catch (...) - {} - - sleep(1); - } - } - - return oam::API_FAILURE; + log.writeLog(__LINE__, "upgrade-columnstore.sh: Error return, check log /tmp/upgrade-status.log", LOG_TYPE_ERROR); + //restart mysqld and retry + try { + oam.actionMysqlCalpont(MYSQL_RESTART); + } + catch(...) + {} + sleep(1); + } + } + return oam::API_FAILURE; } - +*/ /****************************************************************************************** * @brief changeMyCnf @@ -5112,51 +5105,8 @@ int ProcessMonitor::changeMyCnf(std::string type) string dbDir = startup::StartUp::installDir() + "/mysql/db"; - /* if ( type == "master" ) - { - // set master replication entries - vector lines; - char line[200]; - string buf; - while (file.getline(line, 200)) - { - buf = line; - string::size_type pos = buf.find("server-id =",0); - if ( pos != string::npos ) { - buf = "server-id = 1"; - } - - // pos = buf.find("# binlog_format=ROW",0); - // if ( pos != string::npos ) { - // buf = "binlog_format=ROW"; - // } - - pos = buf.find("infinidb_local_query=1",0); - if ( pos != string::npos && pos == 0) { - buf = "# infinidb_local_query=1"; - } - - //output to temp file - lines.push_back(buf); - } - - file.close(); - unlink (mycnfFile.c_str()); - ofstream newFile (mycnfFile.c_str()); - - //create new file - int fd = open(mycnfFile.c_str(), O_RDWR|O_CREAT, 0664); - - copy(lines.begin(), lines.end(), ostream_iterator(newFile, "\n")); - newFile.close(); - - close(fd); - } - - if ( type == "slave" ) - { - */ //get slave id based on ExeMgrx setup - string slaveID = "0"; + //get server-id based on ExeMgrx setup + string serverID = "0"; string localModuleName = config.moduleName(); for ( int id = 1 ; ; id++ ) @@ -5172,36 +5122,20 @@ int ProcessMonitor::changeMyCnf(std::string type) if ( moduleName == localModuleName ) { - slaveID = oam.itoa(id); + serverID = oam.itoa(id); break; } } catch (...) {} } - if ( slaveID == "0" ) + if ( serverID == "0" ) { log.writeLog(__LINE__, "changeMyCnf: ExeMgr for local module doesn't exist", LOG_TYPE_ERROR); return oam::API_FAILURE; } - // get local host name - /* string HOSTNAME = "localhost"; - try - { - ModuleConfig moduleconfig; - oam.getSystemConfig(config.moduleName(), moduleconfig); - HostConfigList::iterator pt1 = moduleconfig.hostConfigList.begin(); - HOSTNAME = (*pt1).HostName; - } - catch(...) - {} - - char* p= getenv("HOSTNAME"); - if (p && *p) - HOSTNAME = p; - */ - // set slave replication entries + // set server-id and other options in my.cnf vector lines; char line[200]; string buf; @@ -5213,35 +5147,58 @@ int ProcessMonitor::changeMyCnf(std::string type) if ( pos != string::npos ) { - buf = "server-id = " + slaveID; + buf = "server-id = " + serverID; + + string command = "SET GLOBAL server_id=" + serverID + ";"; + int ret = runMariaDBCommandLine(command); + + if (ret != 0) + { + log.writeLog(__LINE__, "changeMyCnf: runMariaDBCommandLine Error", LOG_TYPE_ERROR); + return oam::API_FAILURE; + } } // set local query flag if on pm if ( (PMwithUM == "y") && config.moduleType() == "pm" ) { - pos = buf.find("# infinidb_local_query=1", 0); + pos = buf.find("infinidb_local_query", 0); if ( pos != string::npos ) { buf = "infinidb_local_query=1"; + + string command = "SET GLOBAL " + buf + ";"; + + int ret = runMariaDBCommandLine(command); + + if (ret != 0) + { + log.writeLog(__LINE__, "changeMyCnf: runMariaDBCommandLine Error", LOG_TYPE_ERROR); + return oam::API_FAILURE; + } } } else { // disable, if needed - pos = buf.find("infinidb_local_query=1", 0); + pos = buf.find("infinidb_local_query", 0); if ( pos != string::npos ) { - buf = "# infinidb_local_query=1"; + buf = "infinidb_local_query=0"; + + string command = "SET GLOBAL " + buf + ";"; + int ret = runMariaDBCommandLine(command); + + if (ret != 0) + { + log.writeLog(__LINE__, "changeMyCnf: runMariaDBCommandLine Error", LOG_TYPE_ERROR); + return oam::API_FAILURE; + } } } -// pos = buf.find("binlog_format=ROW",0); -// if ( pos != string::npos && pos == 0 ) { -// buf = "# binlog_format=ROW"; -// } - //output to temp file lines.push_back(buf); } @@ -5257,69 +5214,7 @@ int ProcessMonitor::changeMyCnf(std::string type) newFile.close(); close(fd); -// } - /* if ( type == "disable" ) - { - // set master replication entries - vector lines; - char line[200]; - string buf; - while (file.getline(line, 200)) - { - buf = line; - string::size_type pos = buf.find("server-id",0); - if ( pos != string::npos ) { - string::size_type pos1 = buf.find("1",pos); - if ( pos1 == string::npos ) { - buf = "# server-id = 1"; - } - } - - pos = buf.find("log-bin=mysql-bin",0); - if ( pos != string::npos ) { - buf = "# log-bin=mysql-bin"; - } - - pos = buf.find("binlog_format=ROW",0); - if ( pos != string::npos && pos == 0 ) { - buf = "# binlog_format=ROW"; - } - - pos = buf.find("infinidb_local_query=1",0); - if ( pos != string::npos && pos == 0) { - buf = "# infinidb_local_query=1"; - } - - pos = buf.find("# relay-log",0); - if ( pos != string::npos ) { - buf = buf; - } - else - { - pos = buf.find("relay-log",0); - if ( pos != string::npos ) { - buf = "# " + buf; - } - } - - //output to temp file - lines.push_back(buf); - } - - file.close(); - unlink (mycnfFile.c_str()); - ofstream newFile (mycnfFile.c_str()); - - //create new file - int fd = open(mycnfFile.c_str(), O_RDWR|O_CREAT, 0664); - - copy(lines.begin(), lines.end(), ostream_iterator(newFile, "\n")); - newFile.close(); - - close(fd); - } - */ // set owner and permission string cmd = "chmod 664 " + mycnfFile + " >/dev/null 2>&1"; @@ -5336,19 +5231,76 @@ int ProcessMonitor::changeMyCnf(std::string type) system(cmd.c_str()); // restart mysql - try - { - oam.actionMysqlCalpont(MYSQL_RESTART); - sleep(5); // give after mysql restart - } - catch (...) - {} - + /* try { + oam.actionMysqlCalpont(MYSQL_RESTART); + sleep(5); // give after mysql restart + } + catch(...) + {} + */ log.writeLog(__LINE__, "changeMyCnf function successfully completed", LOG_TYPE_DEBUG); return oam::API_SUCCESS; } +/****************************************************************************************** +* @brief runMariaDBCommandLine +* +* purpose: run MariaDB Command Line script +* +******************************************************************************************/ +int ProcessMonitor::runMariaDBCommandLine(std::string command) +{ + Oam oam; + + log.writeLog(__LINE__, "runMariaDBCommandLine function called: cmd = " + command, LOG_TYPE_DEBUG); + + // mysql port number + string MySQLPort; + + try + { + oam.getSystemConfig("MySQLPort", MySQLPort); + } + catch (...) + { + MySQLPort = "3306"; + } + + if ( MySQLPort.empty() ) + MySQLPort = "3306"; + + string cmd = startup::StartUp::installDir() + "/bin/mariadb-command-line.sh --installdir=" + startup::StartUp::installDir() + " --command='" + command + "' --port=" + MySQLPort + " > /tmp/mariadb-command-line.sh.log 2>&1"; + + log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG); + + system(cmd.c_str()); + + string logFile = "/tmp/mariadb-command-line.sh.log"; + + if (oam.checkLogStatus(logFile, "ERROR 1045") ) + { + log.writeLog(__LINE__, "mariadb-command-line.sh: MySQL Password Error, check .my.cnf", LOG_TYPE_ERROR); + return oam::API_FAILURE; + } + else + { + if (oam.checkLogStatus(logFile, "OK")) + { + log.writeLog(__LINE__, "mariadb-command-line.sh: Successful return", LOG_TYPE_DEBUG); + return oam::API_SUCCESS; + } + else + { + log.writeLog(__LINE__, "mariadb-command-line.sh: Error return, check log /tmp/mariadb-command-line.sh.log", LOG_TYPE_ERROR); + return oam::API_FAILURE; + } + } + + return oam::API_FAILURE; +} + + /****************************************************************************************** * @brief runMasterRep * @@ -5361,19 +5313,6 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master log.writeLog(__LINE__, "runMasterRep function called", LOG_TYPE_DEBUG); - //get mysql user password - string mysqlpw = oam::UnassignedName; - - try - { - mysqlpw = oam.getMySQLPassword(); - } - catch (...) - {} - - if ( mysqlpw == oam::UnassignedName ) - mysqlpw = ""; - SystemModuleTypeConfig systemModuleTypeConfig; try @@ -5390,6 +5329,21 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master // log.writeLog(__LINE__, "EXCEPTION ERROR on getSystemConfig: Caught unknown exception!", LOG_TYPE_ERROR); } + // mysql port number + string MySQLPort; + + try + { + oam.getSystemConfig("MySQLPort", MySQLPort); + } + catch (...) + { + MySQLPort = "3306"; + } + + if ( MySQLPort.empty() ) + MySQLPort = "3306"; + // create user for each module by ip address for ( unsigned int i = 0 ; i < systemModuleTypeConfig.moduletypeconfig.size(); i++) { @@ -5408,66 +5362,44 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master string moduleType = systemModuleTypeConfig.moduletypeconfig[i].ModuleType; - if ( (PMwithUM == "n") && (moduleType == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) ) + if ( ( (PMwithUM == "n") && (moduleType == "pm") ) && + ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) ) continue; HostConfigList::iterator pt1 = (*pt).hostConfigList.begin(); - while (true) // need in case there is a password retry + for ( ; pt1 != (*pt).hostConfigList.end() ; pt1++ ) { - for ( ; pt1 != (*pt).hostConfigList.end() ; pt1++ ) + string ipAddr = (*pt1).IPAddr; + + string logFile = "/tmp/master-rep-columnstore-" + moduleName + ".log"; + string cmd = startup::StartUp::installDir() + "/bin/master-rep-columnstore.sh --installdir=" + startup::StartUp::installDir() + " --hostIP=" + ipAddr + " --port=" + MySQLPort + " > " + logFile + " 2>&1"; + log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG); + + system(cmd.c_str()); + + if (oam.checkLogStatus(logFile, "ERROR 1045") ) { - string ipAddr = (*pt1).IPAddr; - - string logFile = "/tmp/master-rep-columnstore-" + moduleName + ".log"; - string cmd = startup::StartUp::installDir() + "/bin/master-rep-columnstore.sh --password=" + - mysqlpw + " --installdir=" + startup::StartUp::installDir() + " --hostIP=" + ipAddr + " > " + logFile + " 2>&1"; - log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG); - - system(cmd.c_str()); - - if (oam.checkLogStatus(logFile, "ERROR 1045") ) - { - if ( passwordError ) - { - log.writeLog(__LINE__, "master-rep-columnstore.sh: MySQL Password Error", LOG_TYPE_ERROR); - return oam::API_FAILURE; - } - - log.writeLog(__LINE__, "master-rep-columnstore.sh: Missing Password error, go check for a password and retry", LOG_TYPE_DEBUG); - passwordError = true; - break; - } - else - { - if (oam.checkLogStatus(logFile, "OK")) - log.writeLog(__LINE__, "master-rep-columnstore.sh: Successful return for node " + moduleName, LOG_TYPE_DEBUG); - else - { - log.writeLog(__LINE__, "master-rep-columnstore.sh: Error return, check log " + logFile, LOG_TYPE_ERROR); - return oam::API_FAILURE; - } - } - } - - //got check for password and bypass config check - if ( passwordError ) - { - try - { - mysqlpw = oam.getMySQLPassword(); - } - catch (...) - {} - - if ( mysqlpw == oam::UnassignedName ) + if ( passwordError ) { log.writeLog(__LINE__, "master-rep-columnstore.sh: MySQL Password Error", LOG_TYPE_ERROR); return oam::API_FAILURE; } + + log.writeLog(__LINE__, "master-rep-columnstore.sh: Missing Password error, go check for a password and retry", LOG_TYPE_DEBUG); + passwordError = true; + break; } else - break; + { + if (oam.checkLogStatus(logFile, "OK")) + log.writeLog(__LINE__, "master-rep-columnstore.sh: Successful return for node " + moduleName, LOG_TYPE_DEBUG); + else + { + log.writeLog(__LINE__, "master-rep-columnstore.sh: Error return, check log " + logFile, LOG_TYPE_ERROR); + return oam::API_FAILURE; + } + } } } } @@ -5541,25 +5473,12 @@ int ProcessMonitor::runMasterRep(std::string& masterLogFile, std::string& master * purpose: run Slave Replication script * ******************************************************************************************/ -int ProcessMonitor::runSlaveRep(std::string& masterLogFile, std::string& masterLogPos, std::string& port) +int ProcessMonitor::runSlaveRep(std::string& masterLogFile, std::string& masterLogPos) { Oam oam; log.writeLog(__LINE__, "runSlaveRep function called", LOG_TYPE_DEBUG); - //get mysql user password - string mysqlpw = oam::UnassignedName; - - try - { - mysqlpw = oam.getMySQLPassword(); - } - catch (...) - {} - - if ( mysqlpw == oam::UnassignedName ) - mysqlpw = ""; - // get master replicaion module IP Address string PrimaryUMModuleName; oam.getSystemConfig("PrimaryUMModuleName", PrimaryUMModuleName); @@ -5576,12 +5495,26 @@ int ProcessMonitor::runSlaveRep(std::string& masterLogFile, std::string& masterL catch (...) {} + // mysql port number + string MySQLPort; + + try + { + oam.getSystemConfig("MySQLPort", MySQLPort); + } + catch (...) + { + MySQLPort = "3306"; + } + + if ( MySQLPort.empty() ) + MySQLPort = "3306"; + bool passwordError = false; while (true) { - string cmd = startup::StartUp::installDir() + "/bin/slave-rep-columnstore.sh --password=" + - mysqlpw + " --installdir=" + startup::StartUp::installDir() + " --masteripaddr=" + masterIPAddress + " --masterlogfile=" + masterLogFile + " --masterlogpos=" + masterLogPos + + " --port=" + port + " > /tmp/slave-rep-columnstore.log 2>&1"; + string cmd = startup::StartUp::installDir() + "/bin/slave-rep-columnstore.sh --installdir=" + startup::StartUp::installDir() + " --masteripaddr=" + masterIPAddress + " --masterlogfile=" + masterLogFile + " --masterlogpos=" + masterLogPos + " --port=" + MySQLPort + " > /tmp/slave-rep-columnstore.log 2>&1"; log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG); @@ -5613,25 +5546,6 @@ int ProcessMonitor::runSlaveRep(std::string& masterLogFile, std::string& masterL return oam::API_FAILURE; } } - - //got check for password and bypass config check - if ( passwordError ) - { - try - { - mysqlpw = oam.getMySQLPassword(); - } - catch (...) - {} - - if ( mysqlpw == oam::UnassignedName ) - { - log.writeLog(__LINE__, "slave-rep-columnstore.sh: MySQL Password Error", LOG_TYPE_ERROR); - return oam::API_FAILURE; - } - } - else - break; } return oam::API_FAILURE; @@ -5649,21 +5563,22 @@ int ProcessMonitor::runDisableRep() log.writeLog(__LINE__, "runDisableRep function called", LOG_TYPE_DEBUG); - //get mysql user password - string mysqlpw = oam::UnassignedName; + // mysql port number + string MySQLPort; try { - mysqlpw = oam.getMySQLPassword(); + oam.getSystemConfig("MySQLPort", MySQLPort); } catch (...) - {} + { + MySQLPort = "3306"; + } - if ( mysqlpw == oam::UnassignedName ) - mysqlpw = ""; + if ( MySQLPort.empty() ) + MySQLPort = "3306"; - string cmd = startup::StartUp::installDir() + "/bin/disable-rep-columnstore.sh --password=" + - mysqlpw + " --installdir=" + startup::StartUp::installDir() + " > /tmp/disable-rep-columnstore.log 2>&1"; + string cmd = startup::StartUp::installDir() + "/bin/disable-rep-columnstore.sh --installdir=" + startup::StartUp::installDir() + " > /tmp/disable-rep-columnstore.log 2>&1"; log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG); @@ -5719,6 +5634,8 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul // log.writeLog(__LINE__, "EXCEPTION ERROR on getSystemConfig: Caught unknown exception!", LOG_TYPE_ERROR); } + int slave = 0; + if ( slaveModule == "all" ) { // Distrubuted MySQL Front-end DB to Slave Modules @@ -5731,7 +5648,8 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul string moduleType = systemModuleTypeConfig.moduletypeconfig[i].ModuleType; - if ( (PMwithUM == "n") && (moduleType == "pm") && ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) ) + if ( ( (PMwithUM == "n") && (moduleType == "pm") ) && + ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM) ) continue; DeviceNetworkList::iterator pt = systemModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.begin(); @@ -5744,6 +5662,8 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul if ( moduleName == config.moduleName() ) continue; + slave++; + HostConfigList::iterator pt1 = (*pt).hostConfigList.begin(); for ( ; pt1 != (*pt).hostConfigList.end() ; pt1++ ) @@ -5758,7 +5678,10 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul string logFile = "/tmp/master-dist_" + moduleName + ".log"; if (!oam.checkLogStatus(logFile, "FAILED")) + { log.writeLog(__LINE__, "runMasterDist: Success rsync to module: " + moduleName, LOG_TYPE_DEBUG); + break; + } else { log.writeLog(__LINE__, "runMasterDist: Failure rsync to module: " + moduleName, LOG_TYPE_ERROR); @@ -5770,26 +5693,40 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul } else { - // get slave IP address - ModuleConfig moduleconfig; - oam.getSystemConfig(slaveModule, moduleconfig); - HostConfigList::iterator pt1 = moduleconfig.hostConfigList.begin(); - string ipAddr = (*pt1).IPAddr; + // don't do PMs unless PMwithUM flag is set - string cmd = startup::StartUp::installDir() + "/bin/rsync.sh " + ipAddr + " " + password + " " + startup::StartUp::installDir() + " 1 > /tmp/master-dist_" + slaveModule + ".log"; - system(cmd.c_str()); + string moduleType = slaveModule.substr(0, MAX_MODULE_TYPE_SIZE); - string logFile = "/tmp/master-dist_" + slaveModule + ".log"; - - if (!oam.checkLogStatus(logFile, "FAILED")) - log.writeLog(__LINE__, "runMasterDist: Success rsync to module: " + slaveModule, LOG_TYPE_DEBUG); - else + if ( (moduleType == "um") || + ( (PMwithUM == "y") && (moduleType == "pm") ) || + ( config.ServerInstallType() == oam::INSTALL_COMBINE_DM_UM_PM) ) { - log.writeLog(__LINE__, "runMasterDist: Failure rsync to module: " + slaveModule, LOG_TYPE_ERROR); - return oam::API_FAILURE; + slave++; + + // get slave IP address + ModuleConfig moduleconfig; + oam.getSystemConfig(slaveModule, moduleconfig); + HostConfigList::iterator pt1 = moduleconfig.hostConfigList.begin(); + string ipAddr = (*pt1).IPAddr; + + string cmd = startup::StartUp::installDir() + "/bin/rsync.sh " + ipAddr + " " + password + " " + startup::StartUp::installDir() + " 1 > /tmp/master-dist_" + slaveModule + ".log"; + system(cmd.c_str()); + + string logFile = "/tmp/master-dist_" + slaveModule + ".log"; + + if (!oam.checkLogStatus(logFile, "FAILED")) + log.writeLog(__LINE__, "runMasterDist: Success rsync to module: " + slaveModule, LOG_TYPE_DEBUG); + else + { + log.writeLog(__LINE__, "runMasterDist: Failure rsync to module: " + slaveModule, LOG_TYPE_ERROR); + return oam::API_FAILURE; + } } } + if (slave == 0 ) + log.writeLog(__LINE__, "runMasterDist: No configured slave nodes", LOG_TYPE_DEBUG); + return oam::API_SUCCESS; } diff --git a/procmon/processmonitor.h b/procmon/processmonitor.h index 81eba542e..04c72bb29 100644 --- a/procmon/processmonitor.h +++ b/procmon/processmonitor.h @@ -493,13 +493,19 @@ public: /** *@brief run upgrade script */ - int runUpgrade(std::string mysqlpw); +// int runUpgrade(std::string mysqlpw); /** *@brief change my.cnf */ int changeMyCnf(std::string type); + + /** + *@brief run MariaDB Command Line script + */ + int runMariaDBCommandLine(std::string command); + /** *@brief run Master Replication script */ @@ -513,7 +519,7 @@ public: /** *@brief run Slave Replication script */ - int runSlaveRep(std::string& masterLogFile, std::string& masterLogPos, std::string& port); + int runSlaveRep(std::string& masterLogFile, std::string& masterLogPos); /** *@brief run Disable Replication script diff --git a/utils/scenarios/common/sh/execSQLScript_m.sh b/utils/scenarios/common/sh/execSQLScript_m.sh index da731b527..f742c1a66 100755 --- a/utils/scenarios/common/sh/execSQLScript_m.sh +++ b/utils/scenarios/common/sh/execSQLScript_m.sh @@ -22,5 +22,5 @@ # # Execute script on test database # - /usr/local/mariadb/columnstore/mysql/bin/mysql --defaults-file=/usr/local/mariadb/columnstore/mysql/my.cnf -f -u root $1 <$6 > $logFileName.test.log 2>&1 + /usr/local/mariadb/columnstore/mysql/bin/mysql --defaults-extra-file=/usr/local/mariadb/columnstore/mysql/my.cnf -f -u root $1 <$6 > $logFileName.test.log 2>&1 diff $logFileName.ref.log $logFileName.test.log > $logFileName.diff.log diff --git a/utils/scenarios/common/sh/testExecEngine.sh b/utils/scenarios/common/sh/testExecEngine.sh index f618b3998..8136ed3e1 100755 --- a/utils/scenarios/common/sh/testExecEngine.sh +++ b/utils/scenarios/common/sh/testExecEngine.sh @@ -186,7 +186,7 @@ function execOneTestRun { fi if [ $dbmsType = "M" ]; then pathSfn=$1\/$sess - /usr/local/mariadb/columnstore/mysql/bin/mysql --defaults-file=/usr/local/mariadb/columnstore/mysql/my.cnf -u root $testDB <$sfn 2> $pathSfn\/$sfn.err.log |grep "^Calpont" > $pathSfn\/$sfn.log & + /usr/local/mariadb/columnstore/mysql/bin/mysql --defaults-extra-file=/usr/local/mariadb/columnstore/mysql/my.cnf -u root $testDB <$sfn 2> $pathSfn\/$sfn.err.log |grep "^Calpont" > $pathSfn\/$sfn.log & else su - oracle -c "sqlplus /nolog @/home/qa/srv/common/script/callogin.sql $testDB $testDB xe srvqaperf2 <$sfn" |grep "^Calpont" > $1\/$sess\/$sfn.log & fi diff --git a/utils/scenarios/perf/sh/pfExeSQLscript.sh b/utils/scenarios/perf/sh/pfExeSQLscript.sh index 8b80bc1cf..8b8064a51 100755 --- a/utils/scenarios/perf/sh/pfExeSQLscript.sh +++ b/utils/scenarios/perf/sh/pfExeSQLscript.sh @@ -19,5 +19,5 @@ # # Execute script on test database # - /usr/local/mariadb/columnstore/mysql/bin/mysql --defaults-file=/usr/local/mariadb/columnstore/mysql/my.cnf -u root $1 <$2 > $logFileName.test.log + /usr/local/mariadb/columnstore/mysql/bin/mysql --defaults-extra-file=/usr/local/mariadb/columnstore/mysql/my.cnf -u root $1 <$2 > $logFileName.test.log exit 0 diff --git a/writeengine/dictionary/we_dctnry.cpp b/writeengine/dictionary/we_dctnry.cpp index 84f6634e0..f9f69718d 100644 --- a/writeengine/dictionary/we_dctnry.cpp +++ b/writeengine/dictionary/we_dctnry.cpp @@ -657,6 +657,8 @@ int Dctnry::insertDctnry2(Signature& sig) int rc = 0; int write_size; bool lbid_in_token = false; + size_t origSigSize = sig.size; + unsigned char* origSig = sig.signature; sig.token.bc = 0; @@ -751,6 +753,8 @@ int Dctnry::insertDctnry2(Signature& sig) } } + sig.size = origSigSize; + sig.signature = origSig; return NO_ERROR; } @@ -860,8 +864,7 @@ int Dctnry::insertDctnry(const char* buf, //...Search for the string in our string cache //if it fits into one block (< 8KB) - if ((m_arraySize < MAX_STRING_CACHE_SIZE) && - (curSig.size <= MAX_SIGNATURE_SIZE)) + if (curSig.size <= MAX_SIGNATURE_SIZE) { //Stats::startParseEvent("getTokenFromArray"); found = getTokenFromArray(curSig); @@ -1431,8 +1434,7 @@ int Dctnry::updateDctnry(unsigned char* sigValue, int& sigSize, // Look for string in cache // As long as the string <= 8000 bytes - if ((m_arraySize < MAX_STRING_CACHE_SIZE) && - (sigSize <= MAX_SIGNATURE_SIZE)) + if (sigSize <= MAX_SIGNATURE_SIZE) { bool found = false; found = getTokenFromArray(sig);