diff options
author | Igor Babaev <igor@askmonty.org> | 2019-02-03 18:41:18 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2019-02-03 18:41:18 -0800 |
commit | 37deed3f37561f264f65e162146bbc2ad35fb1a2 (patch) | |
tree | c1cfb6c0995bfcc4ac3fb335f518a8b404413e32 /mysql-test/suite/galera/include | |
parent | 658128af43b4d7c6db445164f8ed25ed4d1e3109 (diff) | |
parent | 5b996782be6b752ce50a0ecaa222b0688aa9e75d (diff) | |
download | mariadb-git-37deed3f37561f264f65e162146bbc2ad35fb1a2.tar.gz |
Merge branch '10.4' into bb-10.4-mdev16188
Diffstat (limited to 'mysql-test/suite/galera/include')
11 files changed, 214 insertions, 23 deletions
diff --git a/mysql-test/suite/galera/include/galera_base_port.inc b/mysql-test/suite/galera/include/galera_base_port.inc new file mode 100644 index 00000000000..caf986ee950 --- /dev/null +++ b/mysql-test/suite/galera/include/galera_base_port.inc @@ -0,0 +1,8 @@ +# +# Extract base_port from galera node. +# + +# Convert "... base_port = N; ..." to "N; ..." +--let $s1 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('base_port =', @@wsrep_provider_options) + LENGTH('base_port = '))` +# Convert "N; ..." to "N" +--let $_NODE_GALERAPORT = `SELECT SUBSTR('$s1', 1, LOCATE(';', '$s1') - 1)` diff --git a/mysql-test/suite/galera/include/galera_concurrent_test.inc b/mysql-test/suite/galera/include/galera_concurrent_test.inc new file mode 100644 index 00000000000..3d1bc7674a1 --- /dev/null +++ b/mysql-test/suite/galera/include/galera_concurrent_test.inc @@ -0,0 +1,90 @@ +# +# Perform a quick concurrent test on two nodes using a set of predefined statements. +# +# Such tests are not deterministic, so we are hoping to catch assertions, slave apply errors +# and cases where the two nodes diverge +# +# Parameters: +# - $wsrep_trx_fragment_size +# - $count +# - $query_node_1 +# - $query_node_1a (optional) +# - $query_node_2 +# + +if (!$count) { + --let $count = 50; +} + +if (!$node_1a_connected) { + --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 + --let $node_1a_connected = 1 +} + +--echo Running a concurrent test with the following queries: +--echo $query_node_1 +--echo $query_node_1a +--echo $query_node_2 + +--connection node_1 +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; + +SET SESSION wsrep_sync_wait = 0; +--eval SET SESSION wsrep_trx_fragment_size = $wsrep_trx_fragment_size; + +--connection node_1a +SET SESSION wsrep_sync_wait = 0; +--eval SET SESSION wsrep_trx_fragment_size = $wsrep_trx_fragment_size; + +--connection node_2 +SET SESSION wsrep_sync_wait = 0; +--eval SET SESSION wsrep_trx_fragment_size = $wsrep_trx_fragment_size; + +--disable_query_log +--let $i = `SELECT $count` +while ($i) +{ + --connection node_1 + --send_eval $query_node_1 + + --connection node_1a + if ($query_node_1a) { + --send_eval $query_node_1a + } + + --connection node_2 + --send_eval $query_node_2 + + --connection node_1 + --error 0,ER_QUERY_INTERRUPTED,ER_LOCK_DEADLOCK,ER_DUP_ENTRY + --reap + + --connection node_1a + if ($query_node_1a) { + --error 0,ER_QUERY_INTERRUPTED,ER_LOCK_DEADLOCK,ER_DUP_ENTRY + --reap + } + + --connection node_2 + --error 0,ER_QUERY_INTERRUPTED,ER_LOCK_DEADLOCK,ER_DUP_ENTRY + --reap + --dec $i +} + +SET SESSION wsrep_sync_wait = 15; +--enable_query_log + +--let $diff_servers = 1 2 +--source include/diff_servers.inc + +DROP TABLE t1; + +--let $query_node_1 = "" +--let $query_node_1a = "" +--let $query_node_2 = "" + +--echo Concurrent test end diff --git a/mysql-test/suite/galera/include/galera_dump_sr_table.inc b/mysql-test/suite/galera/include/galera_dump_sr_table.inc new file mode 100644 index 00000000000..48a55006eae --- /dev/null +++ b/mysql-test/suite/galera/include/galera_dump_sr_table.inc @@ -0,0 +1,28 @@ +# +# Dump the contents of the SR table using mysqldump +# + +--let $sr_min = `SELECT MIN(seqno) FROM mysql.wsrep_streaming_log` +--let $sr_max = `SELECT MAX(seqno) FROM mysql.wsrep_streaming_log` + +--let $seqno = $sr_min +while ($seqno <= $sr_max) +{ + --let $sr_fragment_file = $MYSQLTEST_VARDIR/tmp/sr_fragment.log + --exec rm -rf $sr_fragment_file + --disable_query_log + --eval SELECT frag FROM mysql.wsrep_streaming_log WHERE seqno = $seqno INTO DUMPFILE '$sr_fragment_file' + --enable_query_log + + --let $sr_binlog_file = $MYSQLTEST_VARDIR/tmp/sr_binlog.log + --exec rm -rf $sr_binlog_file + + --exec cp std_data/binlog-header.log $sr_binlog_file + --exec cat $sr_fragment_file >> $sr_binlog_file + + --replace_regex /SET TIMESTAMP=[0-9]+/SET TIMESTAMP=<TIMESTAMP>/ /#[0-9]+ +[0-9]+:[0-9]+:[0-9]+/<ISO TIMESTAMP>/ /pseudo_thread_id=[0-9]+/pseudo_thread_id=<PSEUDO_THREAD_ID>/ /thread_id=[0-9]+/thread_id=<QUERY_THREAD_ID>/ /table id [0-9]+/table id <TABLE_ID>/ /mapped to number [0-9]+/mapped to number <TABLE_ID>/ /auto_increment_increment=[0-9]+/auto_increment_increment=<AUTO_INCREMENT_INCREMENT>/ /auto_increment_offset=[0-9]+/auto_increment_offset=<AUTO_INCREMENT_OFFSET>/ /exec_time=[0-9]+/exec_time=<EXEC_TIME>/ + --exec $MYSQL_BINLOG --skip-gtids $sr_binlog_file --base64-output=decode-rows --start-position=120 | grep -v 'SET @' 2>&1 + + --inc $seqno +} + diff --git a/mysql-test/suite/galera/include/galera_have_debug_sync.inc b/mysql-test/suite/galera/include/galera_have_debug_sync.inc deleted file mode 100644 index 7c0156052d8..00000000000 --- a/mysql-test/suite/galera/include/galera_have_debug_sync.inc +++ /dev/null @@ -1,9 +0,0 @@ ---disable_query_log - ---let $galera_have_debug_sync = `SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'` - ---if (!$galera_have_debug_sync) { - --skip "Test requires Galera debug library with debug_sync functionality" -} - ---enable_query_log diff --git a/mysql-test/suite/galera/include/galera_load_provider.inc b/mysql-test/suite/galera/include/galera_load_provider.inc index aeab7e6ea19..0f843597d9c 100644 --- a/mysql-test/suite/galera/include/galera_load_provider.inc +++ b/mysql-test/suite/galera/include/galera_load_provider.inc @@ -2,7 +2,75 @@ --disable_query_log --eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig'; + +# +# count occurences of successful node starts in error log +# +perl; + use strict; + my $test_log=$ENV{'LOG_FILE'} or die "LOG_FILE not set"; + my $test_log_copy=$test_log . '.copy'; + if (-e $test_log_copy) { + unlink $test_log_copy; + } + +EOF +--copy_file $LOG_FILE $LOG_FILE.copy + +# +# now join to the cluster +# --eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; + +--enable_query_log + +# +# Cluster address change above, will launch SST/IST +# if mysqldump ST has been configured, mysqld will close all +# client connections, and it will be hard for us to poll for +# cluster status during SST process, therefore wait_until_connected_again.inc +# and wait_until_ready.inc may fail in this phase +# To workaround this, we do first lazy polling here just to see when +# client connections will be possible, and after that check for node readyness +# +--disable_result_log +--disable_query_log + +--error 0,1 +perl; + use strict; + my $logfile = $ENV{'LOG_FILE'} or die ("no error log file set"); + + my $counter = 1000; + #my $found = false + + while ($counter > 0) { + + open(FILE, "$logfile") or die("Unable to open $logfile : $!\n"); + my $new_sync_count = () = grep(/Synchronized with group/g,<FILE>); + close(FILE); + + open(FILEN, "$logfile.copy") or die("Unable to open $logfile.copy : $!\n"); + my $old_sync_count = () = grep(/Synchronized with group/g,<FILEN>); + close(FILEN); + + if ($new_sync_count > $old_sync_count ) { + exit(0); + } + $counter--; + sleep(5); + } + exit(1); +EOF +if ($errno) +{ +--echo "SST failed $errno" +} + +--remove_file $LOG_FILE.copy + --enable_query_log +--enable_result_log +#--eval SET GLOBAL log_error = $log_error_; --source include/galera_wait_ready.inc diff --git a/mysql-test/suite/galera/include/galera_resume.inc b/mysql-test/suite/galera/include/galera_resume.inc deleted file mode 100644 index 232cb46479e..00000000000 --- a/mysql-test/suite/galera/include/galera_resume.inc +++ /dev/null @@ -1,9 +0,0 @@ ---echo Resuming node ... ---perl - my $pid_filename = $ENV{'_SUSPEND_NODE_PIDFILE'}; - my $mysqld_pid = `cat $pid_filename`; - chomp($mysqld_pid); - system("kill -18 $mysqld_pid"); - exit(0); -EOF - diff --git a/mysql-test/suite/galera/include/galera_sst_restore.inc b/mysql-test/suite/galera/include/galera_sst_restore.inc index 7c9a08090ad..83d07f086d1 100644 --- a/mysql-test/suite/galera/include/galera_sst_restore.inc +++ b/mysql-test/suite/galera/include/galera_sst_restore.inc @@ -20,7 +20,7 @@ CALL mtr.add_suppression("Can't open and lock time zone table"); CALL mtr.add_suppression("Can't open and lock privilege tables"); CALL mtr.add_suppression("Info table is not ready to be used"); CALL mtr.add_suppression("Native table .* has the wrong structure"); - +CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist"); --disable_query_log --eval SET GLOBAL wsrep_sst_method = '$wsrep_sst_method_orig'; --eval SET GLOBAL wsrep_sst_receive_address = '$wsrep_sst_receive_address_orig'; diff --git a/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc index c8869746bd1..d6d7552f7b6 100644 --- a/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc +++ b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc @@ -55,6 +55,14 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); --connection node_2 --source suite/galera/include/galera_load_provider.inc +# +# client connections were killed by provider load, so have to re-open here +# +--disconnect node_2 +--connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2 +--enable_reconnect + --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc diff --git a/mysql-test/suite/galera/include/galera_unload_provider.inc b/mysql-test/suite/galera/include/galera_unload_provider.inc index edc7eb31e0e..cd841f51fbc 100644 --- a/mysql-test/suite/galera/include/galera_unload_provider.inc +++ b/mysql-test/suite/galera/include/galera_unload_provider.inc @@ -3,5 +3,13 @@ --let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` --let $wsrep_provider_orig = `SELECT @@wsrep_provider` --let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` +--let $wsrep_error_log_orig = `SELECT @@log_error` +if(!$wsrep_log_error_orig) +{ + # MySQL Server on windows is started with --console and thus + # does not know the location of its .err log, use default location + let $wsrep_log_error_orig = $MYSQLTEST_VARDIR/log/mysqld.2.err; +} +--let LOG_FILE= $wsrep_log_error_orig SET GLOBAL wsrep_provider = 'none'; diff --git a/mysql-test/suite/galera/include/have_filekeymanagement.inc b/mysql-test/suite/galera/include/have_filekeymanagement.inc new file mode 100644 index 00000000000..f5507ca4548 --- /dev/null +++ b/mysql-test/suite/galera/include/have_filekeymanagement.inc @@ -0,0 +1,3 @@ +# +# Used in galera/suite.pm to check file key management plugin +# diff --git a/mysql-test/suite/galera/include/have_xtrabackup.inc b/mysql-test/suite/galera/include/have_xtrabackup.inc deleted file mode 100644 index 0dd693f2c63..00000000000 --- a/mysql-test/suite/galera/include/have_xtrabackup.inc +++ /dev/null @@ -1,4 +0,0 @@ -# -# suite.pm will make sure that all tests including this file -# will be skipped as needed -# |