1#!/bin/bash -eu 2 3declare -r DIST_BASE=$(cd $(dirname $0)/../..; pwd -P) 4TEST_BASE=${TEST_BASE:-"$DIST_BASE"} 5 6. $TEST_BASE/conf/main.conf 7 8declare -r SCRIPTS="$DIST_BASE/scripts" 9. $SCRIPTS/jobs.sh 10. $SCRIPTS/action.sh 11. $SCRIPTS/signal.sh 12. $SCRIPTS/misc.sh 13 14function get_status 15{ 16 cmd=$(echo "show status like '$2'") 17 echo $(mysql -s -s -u$DBMS_TEST_USER -p$DBMS_TEST_PSWD -h${NODE_INCOMING_HOST[$1]} -P${NODE_INCOMING_PORT[$1]} -e "$cmd" | awk '{print $2;}'); 18} 19 20echo "regression test for #281" 21echo "restarting cluster" 22 23$SCRIPTS/command.sh restart 24 25 26mysql -s -s -u$DBMS_TEST_USER -p$DBMS_TEST_PSWD \ 27 -h${NODE_INCOMING_HOST[1]} -P${NODE_INCOMING_PORT[1]} test \ 28 -e "DROP TABLE IF EXISTS t281"; 29 30signal_node STOP 1 31pause 20 1 32 33signal_node CONT 1 34 35pause 10 1 36 37status=$(get_status 1 "wsrep_cluster_status"); 38ready=$(get_status 1 "wsrep_ready"); 39 40echo $status $ready 41 42if test $status=="Primary" && test $ready=="ON" 43then 44 45 mysql -s -s -u$DBMS_TEST_USER -p$DBMS_TEST_PSWD \ 46 -h${NODE_INCOMING_HOST[1]} -P${NODE_INCOMING_PORT[1]} test \ 47 -e "CREATE TABLE t281 (a int)"; 48 if test $? != 0; then 49 echo "Failed to execute command"; 50 exit 1; 51 fi 52else 53 echo "Wrong state"; 54 exit 1; 55fi 56 57mysql -s -s -u$DBMS_TEST_USER -p$DBMS_TEST_PSWD \ 58 -h${NODE_INCOMING_HOST[1]} -P${NODE_INCOMING_PORT[1]} test \ 59 -e "DROP TABLE IF EXISTS t281"; 60 61$SCRIPTS/command.sh stop 62 63exit 0; 64