diff options
Diffstat (limited to 'mysql-test')
506 files changed, 13694 insertions, 10125 deletions
diff --git a/mysql-test/extra/binlog_tests/binlog_xa_recover.inc b/mysql-test/extra/binlog_tests/binlog_xa_recover.inc deleted file mode 100644 index de2703377cc..00000000000 --- a/mysql-test/extra/binlog_tests/binlog_xa_recover.inc +++ /dev/null @@ -1,281 +0,0 @@ -# -# This include file is used by more than one test suite -# (currently binlog and binlog_encryption). -# Please check all dependent tests after modifying it -# - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_row.inc -# Valgrind does not work well with test that crashes the server ---source include/not_valgrind.inc - -# (We do not need to restore these settings, as we crash the server). -SET GLOBAL max_binlog_size= 4096; -SET GLOBAL innodb_flush_log_at_trx_commit= 1; -RESET MASTER; - -CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; -# Insert some data to force a couple binlog rotations (3), so we get some -# normal binlog checkpoints before starting the test. -INSERT INTO t1 VALUES (100, REPEAT("x", 4100)); -# Wait for the master-bin.000002 binlog checkpoint to appear. ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000002" ---let $field= Info ---let $condition= = "master-bin.000002" ---source include/wait_show_condition.inc -INSERT INTO t1 VALUES (101, REPEAT("x", 4100)); ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003" ---let $field= Info ---let $condition= = "master-bin.000003" ---source include/wait_show_condition.inc -INSERT INTO t1 VALUES (102, REPEAT("x", 4100)); ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" ---let $field= Info ---let $condition= = "master-bin.000004" ---source include/wait_show_condition.inc - -# Now start a bunch of transactions that span multiple binlog -# files. Leave then in the state prepared-but-not-committed in the engine -# and crash the server. Check that crash recovery is able to recover all -# of them. -# -# We use debug_sync to get all the transactions into the prepared state before -# we commit any of them. This is because the prepare step flushes the InnoDB -# redo log - including any commits made before, so recovery would become -# unnecessary, decreasing the value of this test. -# -# We arrange to have con1 with a prepared transaction in master-bin.000004, -# con2 and con3 with a prepared transaction in master-bin.000005, and a new -# empty master-bin.000006. So the latest binlog checkpoint should be -# master-bin.000006. - -connect(con1,localhost,root,,); -# First wait after prepare and before write to binlog. -SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont"; -# Then complete InnoDB commit in memory (but not commit checkpoint / write to -# disk), and hang until crash, leaving a transaction to be XA recovered. -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever"; -send INSERT INTO t1 VALUES (1, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con1_wait"; - -connect(con2,localhost,root,,); -SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont"; -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever"; -send INSERT INTO t1 VALUES (2, NULL); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con2_wait"; - -connect(con3,localhost,root,,); -SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont"; -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever"; -send INSERT INTO t1 VALUES (3, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con3_wait"; - -connect(con4,localhost,root,,); -SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont"; -SET SESSION debug_dbug="+d,crash_commit_after_log"; -send INSERT INTO t1 VALUES (4, NULL); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con4_wait"; - -SET DEBUG_SYNC= "now SIGNAL con1_cont"; -SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; -SET DEBUG_SYNC= "now SIGNAL con2_cont"; -SET DEBUG_SYNC= "now WAIT_FOR con2_ready"; -SET DEBUG_SYNC= "now SIGNAL con3_cont"; -SET DEBUG_SYNC= "now WAIT_FOR con3_ready"; - -# Check that everything is committed in binary log. ---source include/show_binary_logs.inc ---let $binlog_file= master-bin.000003 ---let $binlog_start= 4 ---source include/show_binlog_events.inc ---let $binlog_file= master-bin.000004 ---source include/show_binlog_events.inc ---let $binlog_file= master-bin.000005 ---source include/show_binlog_events.inc ---let $binlog_file= master-bin.000006 ---source include/show_binlog_events.inc - - -# Check that server will not purge too much. -PURGE BINARY LOGS TO "master-bin.000006"; ---source include/show_binary_logs.inc - -# Now crash the server with one more transaction in prepared state. ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait-binlog_xa_recover.test -EOF ---error 0,2006,2013 -SET DEBUG_SYNC= "now SIGNAL con4_cont"; -connection con4; ---error 2006,2013 -reap; - ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart-group_commit_binlog_pos.test -EOF - -connection default; ---enable_reconnect ---source include/wait_until_connected_again.inc - -# Check that all transactions are recovered. -SELECT a FROM t1 ORDER BY a; - ---echo Test that with multiple binlog checkpoints, recovery starts from the last one. -SET GLOBAL max_binlog_size= 4096; -SET GLOBAL innodb_flush_log_at_trx_commit= 1; -RESET MASTER; - -# Rotate to binlog master-bin.000003 while delaying binlog checkpoints. -# So we get multiple binlog checkpoints in master-bin.000003. -# Then complete the checkpoints, crash, and check that we only scan -# the necessary binlog file (ie. that we use the _last_ checkpoint). - -connect(con10,localhost,root,,); -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont"; -send INSERT INTO t1 VALUES (10, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con10_ready"; - -connect(con11,localhost,root,,); -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont"; -send INSERT INTO t1 VALUES (11, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con11_ready"; - -connect(con12,localhost,root,,); -SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont"; -send INSERT INTO t1 VALUES (12, REPEAT("x", 4100)); - -connection default; -SET DEBUG_SYNC= "now WAIT_FOR con12_ready"; -INSERT INTO t1 VALUES (13, NULL); - ---source include/show_binary_logs.inc ---let $binlog_file= master-bin.000004 ---let $binlog_start= 4 ---source include/show_binlog_events.inc - -SET DEBUG_SYNC= "now SIGNAL con10_cont"; -connection con10; -reap; -connection default; - -# We need to sync the test case with the background processing of the -# commit checkpoint, otherwise we get nondeterministic results. -SET @old_dbug= @@global.DEBUG_DBUG; -SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed"; - -SET DEBUG_SYNC= "now SIGNAL con12_cont"; -connection con12; -reap; -connection default; -SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed"; -SET GLOBAL debug_dbug= @old_dbug; - -SET DEBUG_SYNC= "now SIGNAL con11_cont"; -connection con11; -reap; - -connection default; -# Wait for the last (master-bin.000004) binlog checkpoint to appear. ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" ---let $field= Info ---let $condition= = "master-bin.000004" ---source include/wait_show_condition.inc - ---echo Checking that master-bin.000004 is the last binlog checkpoint ---source include/show_binlog_events.inc - ---echo Now crash the server -# It is not too easy to test XA recovery, as it runs early during server -# startup, before any connections can be made. -# What we do is set a DBUG error insert which will crash if XA recovery -# starts from any other binlog than master-bin.000004 (check the file -# binlog_xa_recover-master.opt). Then we will fail here if XA recovery -# would start from the wrong place. ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait-binlog_xa_recover.test -EOF -SET SESSION debug_dbug="+d,crash_commit_after_log"; ---error 2006,2013 -INSERT INTO t1 VALUES (14, NULL); - ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart-group_commit_binlog_pos.test -EOF - -connection default; ---enable_reconnect ---source include/wait_until_connected_again.inc - -# Check that all transactions are recovered. -SELECT a FROM t1 ORDER BY a; - - ---echo *** Check that recovery works if we crashed early during rotate, before ---echo *** binlog checkpoint event could be written. - -SET GLOBAL max_binlog_size= 4096; -SET GLOBAL innodb_flush_log_at_trx_commit= 1; -RESET MASTER; - -# We need some initial data to reach binlog master-bin.000004. Otherwise -# crash recovery fails due to the error insert used for previous test. -INSERT INTO t1 VALUES (21, REPEAT("x", 4100)); -INSERT INTO t1 VALUES (22, REPEAT("x", 4100)); -# Wait for the master-bin.000003 binlog checkpoint to appear. ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003" ---let $field= Info ---let $condition= = "master-bin.000003" ---source include/wait_show_condition.inc -INSERT INTO t1 VALUES (23, REPEAT("x", 4100)); -# Wait for the last (master-bin.000004) binlog checkpoint to appear. ---let $wait_for_all= 0 ---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" ---let $field= Info ---let $condition= = "master-bin.000004" ---source include/wait_show_condition.inc - ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait-binlog_xa_recover.test -EOF -SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event"; ---error 2006,2013 -INSERT INTO t1 VALUES (24, REPEAT("x", 4100)); - ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart-group_commit_binlog_pos.test -EOF - ---enable_reconnect ---source include/wait_until_connected_again.inc - -# Check that all transactions are recovered. -SELECT a FROM t1 ORDER BY a; - ---source include/show_binary_logs.inc ---let $binlog_file= master-bin.000004 ---let $binlog_start= 4 ---source include/show_binlog_events.inc - -# Cleanup -connection default; -DROP TABLE t1; diff --git a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test index 0f46b00f683..4c93ad86209 100644 --- a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test +++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test @@ -49,14 +49,14 @@ connection master; --echo *** Single statement on transactional table *** --disable_query_log ---error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE, 1534 eval INSERT INTO t1 (a, data) VALUES (1, CONCAT($data, $data, $data, $data, $data)); --enable_query_log --echo *** Single statement on non-transactional table *** --disable_query_log ---error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE, 1534 eval INSERT INTO t2 (a, data) VALUES (2, CONCAT($data, $data, $data, $data, $data, $data)); --enable_query_log diff --git a/mysql-test/extra/rpl_tests/rpl_semi_sync.inc b/mysql-test/extra/rpl_tests/rpl_semi_sync.inc index 12053c54f4e..85a83167d42 100644 --- a/mysql-test/extra/rpl_tests/rpl_semi_sync.inc +++ b/mysql-test/extra/rpl_tests/rpl_semi_sync.inc @@ -10,7 +10,6 @@ source include/have_innodb.inc; source include/master-slave.inc; let $engine_type= InnoDB; -#let $engine_type= MyISAM; # Suppress warnings that might be generated during the test connection master; @@ -94,7 +93,6 @@ enable_query_log; echo [ status of semi-sync on master should be OFF ]; show status like 'Rpl_semi_sync_master_clients'; show status like 'Rpl_semi_sync_master_status'; ---replace_result 305 304 show status like 'Rpl_semi_sync_master_yes_tx'; # reset master to make sure the following test will start with a clean environment @@ -201,16 +199,23 @@ connection slave; source include/stop_slave.inc; connection master; +--source include/kill_binlog_dump_threads.inc set global rpl_semi_sync_master_timeout= 5000; # The first semi-sync check should be on because after slave stop, # there are no transactions on the master. echo [ master status should be ON ]; -show status like 'Rpl_semi_sync_master_status'; + +let $status_var= Rpl_semi_sync_master_status; +let $status_var_value= ON; +source include/wait_for_status_var.inc; + +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 0; +source include/wait_for_status_var.inc; + show status like 'Rpl_semi_sync_master_no_tx'; ---replace_result 305 304 show status like 'Rpl_semi_sync_master_yes_tx'; -show status like 'Rpl_semi_sync_master_clients'; echo [ semi-sync replication of these transactions will fail ]; insert into t1 values (500); @@ -225,7 +230,6 @@ source include/wait_for_status_var.inc; echo [ master status should be OFF ]; show status like 'Rpl_semi_sync_master_status'; show status like 'Rpl_semi_sync_master_no_tx'; ---replace_result 305 304 show status like 'Rpl_semi_sync_master_yes_tx'; # Semi-sync status on master is now OFF, so all these transactions @@ -246,7 +250,6 @@ insert into t1 values (100); echo [ master status should be OFF ]; show status like 'Rpl_semi_sync_master_status'; show status like 'Rpl_semi_sync_master_no_tx'; ---replace_result 305 304 show status like 'Rpl_semi_sync_master_yes_tx'; --echo # @@ -274,9 +277,11 @@ connection master; # The master semi-sync status should be on again after slave catches up. echo [ master status should be ON again after slave catches up ]; -show status like 'Rpl_semi_sync_master_status'; + +let $status_var= Rpl_semi_sync_master_status; +let $status_var_value= ON; +source include/wait_for_status_var.inc; show status like 'Rpl_semi_sync_master_no_tx'; ---replace_result 305 304 show status like 'Rpl_semi_sync_master_yes_tx'; show status like 'Rpl_semi_sync_master_clients'; @@ -332,11 +337,7 @@ replace_result $engine_type ENGINE_TYPE; eval create table t1 (a int) engine = $engine_type; drop table t1; -##show status like 'Rpl_semi_sync_master_status'; - sync_slave_with_master; ---replace_column 2 # -show status like 'Rpl_relay%'; echo [ test reset master ]; connection master; @@ -353,19 +354,7 @@ source include/stop_slave.inc; reset slave; # Kill the dump thread on master for previous slave connection and -# wait for it to exit -connection master; -let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; -if ($_tid) -{ - --replace_result $_tid _tid - eval kill query $_tid; - - # After dump thread exit, Rpl_semi_sync_master_clients will be 0 - let $status_var= Rpl_semi_sync_master_clients; - let $status_var_value= 0; - source include/wait_for_status_var.inc; -} +--source include/kill_binlog_dump_threads.inc connection slave; source include/start_slave.inc; @@ -404,17 +393,7 @@ connection master; reset master; # Kill the dump thread on master for previous slave connection and wait for it to exit -let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; -if ($_tid) -{ - --replace_result $_tid _tid - eval kill query $_tid; - - # After dump thread exit, Rpl_semi_sync_master_clients will be 0 - let $status_var= Rpl_semi_sync_master_clients; - let $status_var_value= 0; - source include/wait_for_status_var.inc; -} +--source include/kill_binlog_dump_threads.inc # Do not binlog the following statement because it will generate # different events for ROW and STATEMENT format @@ -459,21 +438,16 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; connection master; # Kill the dump thread on master for previous slave connection and wait for it to exit -let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; -if ($_tid) -{ - --replace_result $_tid _tid - eval kill query $_tid; - - # After dump thread exit, Rpl_semi_sync_master_clients will be 0 - let $status_var= Rpl_semi_sync_master_clients; - let $status_var_value= 0; - source include/wait_for_status_var.inc; -} +--source include/kill_binlog_dump_threads.inc echo [ Semi-sync status on master should be ON ]; -show status like 'Rpl_semi_sync_master_clients'; +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 0; +source include/wait_for_status_var.inc; show status like 'Rpl_semi_sync_master_status'; +let $status_var= Rpl_semi_sync_master_status; +let $status_var_value= ON; +source include/wait_for_status_var.inc; set global rpl_semi_sync_master_enabled= 0; connection slave; diff --git a/mysql-test/include/ctype_utf8mb4.inc b/mysql-test/include/ctype_utf8mb4.inc index 862afe96f6c..2e924d6ddde 100644 --- a/mysql-test/include/ctype_utf8mb4.inc +++ b/mysql-test/include/ctype_utf8mb4.inc @@ -1585,7 +1585,7 @@ drop table t1; --echo # --echo # Check strnxfrm() with odd length --echo # -set max_sort_length=9; +set max_sort_length=65; select @@max_sort_length; eval create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine $engine; insert into t1 values ('a'),('b'),('c'); diff --git a/mysql-test/lib/My/Debugger.pm b/mysql-test/lib/My/Debugger.pm new file mode 100644 index 00000000000..7331238e1c8 --- /dev/null +++ b/mysql-test/lib/My/Debugger.pm @@ -0,0 +1,266 @@ +package My::Debugger; + +use strict; +use warnings; +use Text::Wrap; +use Cwd; +use My::Platform; + +# 1. options to support: +# --xxx[=ARGS] +# --manual-xxx[=ARGS] +# --client-xxx[=ARGS] +# --boot-xxx[=ARGS] +# TODO --manual-client-xxx[=ARGS] +# TODO --manual-boot-xxx[=ARGS] +# TODO --exec-xxx[=ARGS] (for $ENV{MYSQL}, etc) +# +# ARGS is a semicolon-separated list of commands for the +# command file. If the first command starts from '-' it'll +# be for a command line, not for a command file. +# +# 2. terminal to use: xterm +# TODO MTR_TERM="xterm -title {title} -e {command}" +# +# 3. debugger combinations are *not allowed* +# (thus no --valgrind --gdb) +# +# 4. variables for the command line / file templates: +# {vardir} -> vardir +# {exe} -> /path/to/binary/to/execute +# {args} -> command-line arguments, "-quoted +# {input} +# {type} -> client, mysqld.1, etc +# {script} -> vardir/tmp/{debugger}init.$type +# {log} -> vardir/log/$type.{debugger} +# {options} -> user options for the debugger. +# +# if {options} isn't used, they're auto-placed before {exe} +# or at the end if no {exe} + +my %debuggers = ( + gdb => { + term => 1, + options => '-x {script} {exe}', + script => 'set args {args} < {input}', + }, + ddd => { + options => '--command {script} {exe}', + script => 'set args {args} < {input}', + }, + dbx => { + term => 1, + options => '-c "stop in main; run {exe} {args} < {input}"', + }, + devenv => { + options => '/debugexe {exe} {args}', + }, + windbg => { + options => '{exe} {args}', + }, + lldb => { + term => 1, + options => '-s {script} {exe}', + script => 'process launch --stop-at-entry -- {args}', + }, + valgrind => { + options => '--tool=memcheck --show-reachable=yes --leak-check=yes --num-callers=16 --quiet --suppressions='.cwd().'/valgrind.supp {exe} {args} --loose-wait-for-pos-timeout=1500', + pre => sub { + my $debug_libraries_path= "/usr/lib/debug"; + $ENV{LD_LIBRARY_PATH} .= ":$debug_libraries_path" if -d $debug_libraries_path; + } + }, + strace => { + options => '-f -o {log} {exe} {args}', + }, + rr => { + options => '_RR_TRACE_DIR={log} rr record {exe} {args}', + run => 'env', + pre => sub { + ::mtr_error('rr requires kernel.perf_event_paranoid <= 1') + if ::mtr_grab_file('/proc/sys/kernel/perf_event_paranoid') > 1; + } + }, + valgdb => { + term => 1, + run => 'gdb', + options => '-x {script} {exe}', + script => <<EEE, +py +import subprocess,shlex,time +valg=subprocess.Popen(shlex.split("""valgrind --tool=memcheck --show-reachable=yes --leak-check=yes --num-callers=16 --quiet --suppressions=valgrind.supp --vgdb-error=0 {exe} {args} --loose-wait-for-pos-timeout=1500""")) +time.sleep(2) +gdb.execute("target remote | /usr/lib64/valgrind/../../bin/vgdb --pid=" + str(valg.pid)) +EEE + pre => sub { + my $debug_libraries_path= "/usr/lib/debug"; + $ENV{LD_LIBRARY_PATH} .= ":$debug_libraries_path" if -d $debug_libraries_path; + } + }, + + # aliases + vsjitdebugger => 'windbg', + ktrace => 'strace', +); + +my %opts; +my %opt_vals; +my $help = "\n\nOptions for running debuggers\n\n"; + +for my $k (sort keys %debuggers) { + my $v = $debuggers{$k}; + $v = $debuggers{$k} = $debuggers{$v} if not ref $v; # resolve aliases + + sub register_opt($$) { + my ($name, $msg) = @_; + $opts{"$name=s"} = \$opt_vals{$name}; + $help .= wrap(sprintf(" %-23s", $name), ' 'x25, "$msg under $name\n"); + } + + $v->{script} = '' unless $v->{script}; + $v->{options} =~ s/(\{exe\}|$)/ {options} $&/ unless $v->{options} =~ /\{options\}/; + + register_opt "$k" => "Start mysqld"; + register_opt "client-$k" => "Start mysqltest client"; + register_opt "boot-$k" => "Start bootstrap server"; + register_opt "manual-$k" => "Before running test(s) let user manually start mysqld"; +} + +sub subst($%) { + use warnings FATAL => 'uninitialized'; + my ($templ, %vars) = @_; + $templ =~ s/\{(\w+)\}/$vars{$1}/g; + $templ; +} + +sub do_args($$$$$) { + my ($args, $exe, $input, $type, $opt) = @_; + my $k = $opt =~ /^(?:client|boot|manual)-(.*)$/ ? $1 : $opt; + my $v = $debuggers{$k}; + + # on windows mtr args are quoted (for system), otherwise not (for exec) + sub quote($) { $_[0] =~ / / ? "\"$_[0]\"" : $_[0] } + sub unquote($) { $_[0] =~ s/^"(.*)"$/$1/; $_[0] } + sub quote_from_mtr($) { IS_WINDOWS() ? $_[0] : quote($_[0]) } + sub unquote_for_mtr($) { IS_WINDOWS() ? $_[0] : unquote($_[0]) } + + my %vars = ( + vardir => $::opt_vardir, + exe => $$exe, + args => join(' ', map { quote_from_mtr $_ } @$$args, '--gdb'), + input => $input, + script => "$::opt_vardir/tmp/${k}init.$type", + log => "$::opt_vardir/log/$type.$k", + options => '', + ); + my @params = split /;/, $opt_vals{$opt}; + $vars{options} = shift @params if @params and $params[0] =~ /^-/; + + my $script = join "\n", @params; + if ($v->{script}) { + ::mtr_tofile($vars{script}, subst($v->{script}, %vars)."\n".$script); + } elsif ($script) { + die "$k is not using a script file, nowhere to write the script \n---\n$script\n---\n"; + } + + my $options = subst($v->{options}, %vars); + @$$args = map { unquote_for_mtr $_ } $options =~ /("[^"]+"|\S+)/g; + my $run = $v->{run} || $k; + + if ($opt =~ /^manual-/) { + print "\nTo start $k for $type, type in another window:\n"; + print "$run $options\n"; + $$exe= undef; # Indicate the exe should not be started + } elsif ($v->{term}) { + unshift @$$args, '-title', $type, '-e', $run; + $$exe = 'xterm'; + } else { + $$exe = $run; + } +} + +sub options() { %opts } +sub help() { $help } + +sub fix_options(@) { + my $re=join '|', keys %opts; + $re =~ s/=s//g; + map { $_ . (/^--($re)$/ and '=;') } @_; +} + +sub pre_setup() { + my $used; + for my $k (keys %debuggers) { + for my $opt ($k, "manual-$k", "boot-$k", "client-$k") { + if ($opt_vals{$opt}) + { + $used = 1; + if ($debuggers{$k}->{pre}) { + $debuggers{$k}->{pre}->(); + delete $debuggers{$k}->{pre}; + } + } + } + } + + if ($used) { + $ENV{ASAN_OPTIONS}= 'abort_on_error=1:'.($ENV{ASAN_OPTIONS} || ''); + ::mtr_error("Can't use --extern when using debugger") if $ENV{USE_RUNNING_SERVER}; + + $::opt_retry= 1; + $::opt_retry_failure= 1; + $::opt_testcase_timeout= 7 * 24 * 60; # in minutes + $::opt_suite_timeout= 7 * 24 * 60; # in minutes + $::opt_shutdown_timeout= 24 * 60 *60; # in seconds + $::opt_start_timeout= 24 * 60 * 60; # in seconds + } +} + +sub setup_boot_args($$$) { + my ($args, $exe, $input) = @_; + my $found; + + for my $k (keys %debuggers) { + if ($opt_vals{"boot-$k"}) { + die "--boot-$k and --$found cannot be used at the same time\n" if $found; + + $found="boot-$k"; + do_args($args, $exe, $input, 'bootstrap', $found); + } + } +} + +sub setup_client_args($$) { + my ($args, $exe) = @_; + my $found; + my $embedded = $::opt_embedded_server ? ' with --embedded' : ''; + + for my $k (keys %debuggers) { + my @opt_names=("client-$k"); + push @opt_names, $k if $embedded; + for my $opt (@opt_names) { + if ($opt_vals{$opt}) { + die "--$opt and --$found cannot be used at the same time$embedded\n" if $found; + $found=$opt; + do_args($args, $exe, IS_WINDOWS() ? 'NUL' : '/dev/null', 'client', $found); + } + } + } +} + +sub setup_args($$$) { + my ($args, $exe, $type) = @_; + my $found; + + for my $k (keys %debuggers) { + for my $opt ($k, "manual-$k") { + if ($opt_vals{$opt}) { + die "--$opt and --$found cannot be used at the same time\n" if $found; + $found=$opt; + do_args($args, $exe, IS_WINDOWS() ? 'NUL' : '/dev/null', $type, $found); + } + } + } +} + +1; diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index a58fb369a13..98ed77eea0f 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -514,6 +514,10 @@ sub mtr_report_stats ($$$$) { # if a test case has to be retried it should have the result MTR_RES_FAILED in jUnit XML if ($test->{'result'} eq "MTR_RES_FAILED" || $test->{'retries'} > 0) { my $logcontents = $test->{'logfile-failed'} || $test->{'logfile'}; + # remove any double ] that would end the cdata + $logcontents =~ s/]]/\x{fffd}/g; + # replace wide characters that aren't allowed in XML 1.0 + $logcontents =~ s/[\x00-\x08\x0B\x0C\x0E-\x1F]/\x{fffd}/g; $xml_report .= qq(>\n\t\t\t<failure message="" type="MTR_RES_FAILED">\n<![CDATA[$logcontents]]>\n\t\t\t</failure>\n\t\t</testcase>\n); } elsif ($test->{'result'} eq "MTR_RES_SKIPPED" && $test->{'disable'}) { @@ -530,9 +534,9 @@ sub mtr_report_stats ($$$$) { # save to file my $xml_file = $::opt_xml_report; - open XML_FILE, ">", $xml_file or die "Cannot create file $xml_file: $!"; - print XML_FILE $xml_report; - close XML_FILE; + open (my $XML_UFILE, '>:encoding(UTF-8)', $xml_file) or die 'Cannot create file $xml_file: $!'; + print $XML_UFILE $xml_report; + close $XML_UFILE or warn "File close failed!"; } if (@$extra_warnings) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 900ef736a45..fd25c28dc06 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -48,9 +48,7 @@ BEGIN { "Could not find the lib/ directory \n"; exit(1); } -} -BEGIN { # Check backward compatibility support # By setting the environment variable MTR_VERSION # it's possible to use a previous version of @@ -95,6 +93,7 @@ use My::Tee; use My::Find; use My::SysInfo; use My::CoreDump; +use My::Debugger; use mtr_cases; use mtr_report; use mtr_match; @@ -108,6 +107,9 @@ require "mtr_io.pl"; require "mtr_gprof.pl"; require "mtr_misc.pl"; +my $opt_valgrind; +my $valgrind_reports= 0; + $SIG{INT}= sub { mtr_error("Got ^C signal"); }; $SIG{HUP}= sub { mtr_error("Hangup detected on controlling terminal"); }; @@ -259,28 +261,6 @@ our $opt_gcov; our $opt_gprof; our %gprof_dirs; -our $glob_debugger= 0; -our $opt_gdb; -my $opt_rr; -my $opt_rr_dir; -my @rr_record_args; -our $opt_client_gdb; -my $opt_boot_gdb; -my $opt_boot_rr; -our $opt_dbx; -our $opt_client_dbx; -my $opt_boot_dbx; -our $opt_ddd; -our $opt_client_ddd; -my $opt_boot_ddd; -our $opt_manual_gdb; -our $opt_manual_lldb; -our $opt_manual_dbx; -our $opt_manual_ddd; -our $opt_manual_debug; -our $opt_debugger; -our $opt_client_debugger; - my $config; # The currently running config my $current_config_name; # The currently running config file template @@ -306,49 +286,28 @@ our $opt_report_times= 0; my $opt_sleep; -my $opt_testcase_timeout= $ENV{MTR_TESTCASE_TIMEOUT} || 15; # minutes -my $opt_suite_timeout = $ENV{MTR_SUITE_TIMEOUT} || 360; # minutes -my $opt_shutdown_timeout= $ENV{MTR_SHUTDOWN_TIMEOUT} || 10; # seconds -my $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds +our $opt_retry= 1; +our $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2); +our $opt_testcase_timeout= $ENV{MTR_TESTCASE_TIMEOUT} || 15; # minutes +our $opt_suite_timeout = $ENV{MTR_SUITE_TIMEOUT} || 360; # minutes +our $opt_shutdown_timeout= $ENV{MTR_SHUTDOWN_TIMEOUT} || 10; # seconds +our $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds sub suite_timeout { return $opt_suite_timeout * 60; }; my $opt_wait_all; my $opt_user_args; my $opt_repeat= 1; -my $opt_retry= 1; -my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2); my $opt_reorder= 1; my $opt_force_restart= 0; our $opt_user = "root"; -our $opt_valgrind= 0; -my $opt_valgrind_mysqld= 0; -my $opt_valgrind_mysqltest= 0; -my @valgrind_args; -my $opt_strace= 0; -my $opt_stracer; -my $opt_client_strace = 0; -my @strace_args; -my $opt_valgrind_path; -my $valgrind_reports= 0; -my $opt_callgrind; my %mysqld_logs; my $opt_debug_sync_timeout= 300; # Default timeout for WAIT_FOR actions. my $warn_seconds = 60; -sub testcase_timeout ($) { - my ($tinfo)= @_; - if (exists $tinfo->{'case-timeout'}) { - # Return test specific timeout if *longer* that the general timeout - my $test_to= $tinfo->{'case-timeout'}; - $test_to*= 10 if $opt_valgrind; - return $test_to * 60 if $test_to > $opt_testcase_timeout; - } - return $opt_testcase_timeout * 60; -} - +sub testcase_timeout ($) { return $opt_testcase_timeout * 60; } sub check_timeout ($) { return testcase_timeout($_[0]); } our $opt_warnings= 1; @@ -802,6 +761,7 @@ sub run_test_server ($$$) { # Client disconnected mtr_verbose("Child closed socket"); $s->remove($sock); + $sock->close; if (--$childs == 0){ return ("Completed", $test_failure, $completed, $extra_warnings); } @@ -971,6 +931,7 @@ sub run_test_server ($$$) { # Test failure due to warnings, force is off return ("Warnings in log", 1, $completed, $extra_warnings); } + next; } elsif ($line =~ /^SPENT/) { add_total_times($line); @@ -1164,7 +1125,7 @@ sub run_worker ($) { } mark_time_used('restart'); my $valgrind_reports= 0; - if ($opt_valgrind_mysqld) { + if ($opt_valgrind) { $valgrind_reports= valgrind_exit_reports(); print $server "VALGREP\n" if $valgrind_reports; } @@ -1226,8 +1187,6 @@ sub print_global_resfile { resfile_global("debug", $opt_debug ? 1 : 0); resfile_global("gcov", $opt_gcov ? 1 : 0); resfile_global("gprof", $opt_gprof ? 1 : 0); - resfile_global("valgrind", $opt_valgrind ? 1 : 0); - resfile_global("callgrind", $opt_callgrind ? 1 : 0); resfile_global("mem", $opt_mem); resfile_global("tmpdir", $opt_tmpdir); resfile_global("vardir", $opt_vardir); @@ -1317,30 +1276,6 @@ sub command_line_setup { 'debug' => \$opt_debug, 'debug-common' => \$opt_debug_common, 'debug-server' => \$opt_debug_server, - 'gdb=s' => \$opt_gdb, - 'rr' => \$opt_rr, - 'rr-arg=s' => \@rr_record_args, - 'rr-dir=s' => \$opt_rr_dir, - 'client-gdb' => \$opt_client_gdb, - 'manual-gdb' => \$opt_manual_gdb, - 'manual-lldb' => \$opt_manual_lldb, - 'boot-gdb' => \$opt_boot_gdb, - 'boot-rr' => \$opt_boot_rr, - 'manual-debug' => \$opt_manual_debug, - 'ddd' => \$opt_ddd, - 'client-ddd' => \$opt_client_ddd, - 'manual-ddd' => \$opt_manual_ddd, - 'boot-ddd' => \$opt_boot_ddd, - 'dbx' => \$opt_dbx, - 'client-dbx' => \$opt_client_dbx, - 'manual-dbx' => \$opt_manual_dbx, - 'debugger=s' => \$opt_debugger, - 'boot-dbx' => \$opt_boot_dbx, - 'client-debugger=s' => \$opt_client_debugger, - 'strace' => \$opt_strace, - 'strace-option=s' => \@strace_args, - 'client-strace' => \$opt_client_strace, - 'stracer=s' => \$opt_stracer, 'max-save-core=i' => \$opt_max_save_core, 'max-save-datadir=i' => \$opt_max_save_datadir, 'max-test-fail=i' => \$opt_max_test_fail, @@ -1349,23 +1284,6 @@ sub command_line_setup { # Coverage, profiling etc 'gcov' => \$opt_gcov, 'gprof' => \$opt_gprof, - 'valgrind|valgrind-all' => \$opt_valgrind, - 'valgrind-mysqltest' => \$opt_valgrind_mysqltest, - 'valgrind-mysqld' => \$opt_valgrind_mysqld, - 'valgrind-options=s' => sub { - my ($opt, $value)= @_; - # Deprecated option unless it's what we know pushbuild uses - if ($value eq "--gen-suppressions=all --show-reachable=yes") { - push(@valgrind_args, $_) for (split(' ', $value)); - return; - } - die("--valgrind-options=s is deprecated. Use ", - "--valgrind-option=s, to be specified several", - " times if necessary"); - }, - 'valgrind-option=s' => \@valgrind_args, - 'valgrind-path=s' => \$opt_valgrind_path, - 'callgrind' => \$opt_callgrind, 'debug-sync-timeout=i' => \$opt_debug_sync_timeout, # Directories @@ -1414,12 +1332,13 @@ sub command_line_setup { # list-options is internal, not listed in help 'list-options' => \$opt_list_options, 'skip-test-list=s' => \@opt_skip_test_list, - 'xml-report=s' => \$opt_xml_report + 'xml-report=s' => \$opt_xml_report, + + My::Debugger::options() ); # fix options (that take an optional argument and *only* after = sign - my %fixopt = ( '--gdb' => '--gdb=#' ); - @ARGV = map { $fixopt{$_} or $_ } @ARGV; + @ARGV = My::Debugger::fix_options(@ARGV); GetOptions(%options) or usage("Can't read options"); usage("") if $opt_usage; list_options(\%options) if $opt_list_options; @@ -1744,39 +1663,6 @@ sub command_line_setup { { mtr_error("Can't use --extern with --embedded-server"); } - - - if ($opt_gdb) - { - $opt_client_gdb= $opt_gdb; - $opt_gdb= undef; - } - - if ($opt_ddd) - { - $opt_client_ddd= $opt_ddd; - $opt_ddd= undef; - } - - if ($opt_dbx) { - mtr_warning("Silently converting --dbx to --client-dbx in embedded mode"); - $opt_client_dbx= $opt_dbx; - $opt_dbx= undef; - } - - if ($opt_debugger) - { - $opt_client_debugger= $opt_debugger; - $opt_debugger= undef; - } - - if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_lldb || - $opt_manual_ddd || $opt_manual_debug || $opt_debugger || $opt_dbx || - $opt_manual_dbx) - { - mtr_error("You need to use the client debug options for the", - "embedded server. Ex: --client-gdb"); - } } # -------------------------------------------------------------------------- @@ -1797,42 +1683,6 @@ sub command_line_setup { } # -------------------------------------------------------------------------- - # Check debug related options - # -------------------------------------------------------------------------- - if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd || $opt_rr || - $opt_manual_gdb || $opt_manual_lldb || $opt_manual_ddd || - $opt_manual_debug || $opt_dbx || $opt_client_dbx || $opt_manual_dbx || - $opt_debugger || $opt_client_debugger ) - { - $ENV{ASAN_OPTIONS}= 'abort_on_error=1:'.($ENV{ASAN_OPTIONS} || ''); - if ( using_extern() ) - { - mtr_error("Can't use --extern when using debugger"); - } - # Indicate that we are using debugger - $glob_debugger= 1; - $opt_retry= 1; - $opt_retry_failure= 1; - # Set one week timeout (check-testcase timeout will be 1/10th) - $opt_testcase_timeout= 7 * 24 * 60; - $opt_suite_timeout= 7 * 24 * 60; - # One day to shutdown - $opt_shutdown_timeout= 24 * 60; - # One day for PID file creation (this is given in seconds not minutes) - $opt_start_timeout= 24 * 60 * 60; - if ($opt_rr && open(my $fh, '<', '/proc/sys/kernel/perf_event_paranoid')) - { - my $perf_event_paranoid= <$fh>; - close $fh; - chomp $perf_event_paranoid; - if ($perf_event_paranoid == 0) - { - mtr_error("rr requires kernel.perf_event_paranoid set to 1"); - } - } - } - - # -------------------------------------------------------------------------- # Modified behavior with --start options # -------------------------------------------------------------------------- if ($opt_start or $opt_start_dirty or $opt_start_exit) { @@ -1893,87 +1743,6 @@ sub command_line_setup { "for option --testsuite-timeout") if ($opt_suite_timeout <= 0); - # -------------------------------------------------------------------------- - # Check valgrind arguments - # -------------------------------------------------------------------------- - if ( $opt_valgrind or $opt_valgrind_path or @valgrind_args) - { - mtr_report("Turning on valgrind for all executables"); - $opt_valgrind= 1; - $opt_valgrind_mysqld= 1; - $opt_valgrind_mysqltest= 1; - } - elsif ( $opt_valgrind_mysqld ) - { - mtr_report("Turning on valgrind for mysqld(s) only"); - $opt_valgrind= 1; - } - elsif ( $opt_valgrind_mysqltest ) - { - mtr_report("Turning on valgrind for mysqltest and mysql_client_test only"); - $opt_valgrind= 1; - } - - if ($opt_valgrind) - { - # Increase the timeouts when running with valgrind - $opt_testcase_timeout*= 10; - $opt_suite_timeout*= 6; - $opt_start_timeout*= 10; - $warn_seconds*= 10; - } - - if ( $opt_callgrind ) - { - mtr_report("Turning on valgrind with callgrind for mysqld(s)"); - $opt_valgrind= 1; - $opt_valgrind_mysqld= 1; - - # Set special valgrind options unless options passed on command line - push(@valgrind_args, "--trace-children=yes") - unless @valgrind_args; - unshift(@valgrind_args, "--tool=callgrind"); - } - - # default to --tool=memcheck - if ($opt_valgrind && ! grep(/^--tool=/i, @valgrind_args)) - { - # Set valgrind_option unless already defined - push(@valgrind_args, ("--show-reachable=yes", "--leak-check=yes", - "--num-callers=16")) - unless @valgrind_args; - unshift(@valgrind_args, "--tool=memcheck"); - } - - if ( $opt_valgrind ) - { - # Make valgrind run in quiet mode so it only print errors - push(@valgrind_args, "--quiet" ); - - push(@valgrind_args, "--suppressions=${glob_mysql_test_dir}/valgrind.supp") - if -f "$glob_mysql_test_dir/valgrind.supp"; - - mtr_report("Running valgrind with options \"", - join(" ", @valgrind_args), "\""); - } - - if (@strace_args || $opt_stracer) - { - $opt_strace=1; - } - - # InnoDB does not bother to do individual de-allocations at exit. Instead it - # relies on a custom allocator to track every allocation, and frees all at - # once during exit. - # In XtraDB, an option use-sys-malloc is introduced (and on by default) to - # disable this (for performance). But this exposes Valgrind to all the - # missing de-allocations, so we need to disable it to at least get - # meaningful leak checking for the rest of the server. - if ($opt_valgrind_mysqld) - { - push(@opt_extra_mysqld_opt, "--loose-skip-innodb-use-sys-malloc"); - } - if ($opt_debug_common) { $opt_debug= 1; @@ -2188,21 +1957,6 @@ sub executable_setup () { $exe_patch='patch' if `patch -v`; - # - # Check if libtool is available in this distribution/clone - # we need it when valgrinding or debugging non installed binary - # Otherwise valgrind will valgrind the libtool wrapper or bash - # and gdb will not find the real executable to debug - # - if ( -x "../libtool") - { - $exe_libtool= "../libtool"; - if ($opt_valgrind or $glob_debugger or $opt_strace) - { - mtr_report("Using \"$exe_libtool\" when running valgrind, strace or debugger"); - } - } - # Look for the client binaries $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql"); @@ -2327,9 +2081,6 @@ sub mysql_client_test_arguments(){ my $args; mtr_init_args(\$args); - if ( $opt_valgrind_mysqltest ) { - valgrind_arguments($args, \$exe); - } mtr_add_arg($args, "--defaults-file=%s", $path_config_file); mtr_add_arg($args, "--testcase"); mtr_add_arg($args, "--vardir=$opt_vardir"); @@ -2375,6 +2126,8 @@ sub environment_setup { umask(022); + $ENV{'USE_RUNNING_SERVER'}= using_extern(); + my @ld_library_paths; if ($path_client_libdir) @@ -2405,30 +2158,12 @@ sub environment_setup { } } - # -------------------------------------------------------------------------- - # Valgrind need to be run with debug libraries otherwise it's almost - # impossible to add correct supressions, that means if "/usr/lib/debug" - # is available, it should be added to - # LD_LIBRARY_PATH - # - # But pthread is broken in libc6-dbg on Debian <= 3.1 (see Debian - # bug 399035, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=399035), - # so don't change LD_LIBRARY_PATH on that platform. - # -------------------------------------------------------------------------- - my $debug_libraries_path= "/usr/lib/debug"; - my $deb_version; - if ( $opt_valgrind and -d $debug_libraries_path and - (! -e '/etc/debian_version' or - ($deb_version= - mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or - $deb_version > 3.1 ) ) - { - push(@ld_library_paths, $debug_libraries_path); - } - $ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths, $ENV{'LD_LIBRARY_PATH'} ? split(':', $ENV{'LD_LIBRARY_PATH'}) : ()); + + My::Debugger::pre_setup(); + mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}"); $ENV{'DYLD_LIBRARY_PATH'}= join(":", @ld_library_paths, @@ -2463,7 +2198,6 @@ sub environment_setup { $ENV{'LC_CTYPE'}= "C"; $ENV{'LC_COLLATE'}= "C"; - $ENV{'USE_RUNNING_SERVER'}= using_extern(); $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir; $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'port'}; $ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir; @@ -2614,10 +2348,6 @@ sub environment_setup { $ENV{'INNOCHECKSUM'}= native_path($exe_innochecksum); } - # Create an environment variable to make it possible - # to detect that valgrind is being used from test cases - $ENV{'VALGRIND_TEST'}= $opt_valgrind; - # Add dir of this perl to aid mysqltest in finding perl my $perldir= dirname($^X); my $pathsep= ":"; @@ -3363,6 +3093,7 @@ sub mysql_install_db { mtr_add_arg($args, "--tmpdir=%s", "$opt_vardir/tmp/"); mtr_add_arg($args, "--core-file"); mtr_add_arg($args, "--console"); + mtr_add_arg($args, "--character-set-server=latin1"); if ( $opt_debug ) { @@ -3413,25 +3144,7 @@ sub mysql_install_db { if (! -e $bootstrap_sql_file) { - if ($opt_boot_gdb) { - gdb_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(), - $bootstrap_sql_file); - } - if ($opt_boot_dbx) { - dbx_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(), - $bootstrap_sql_file); - } - if ($opt_boot_ddd) { - ddd_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(), - $bootstrap_sql_file); - } - if ($opt_boot_rr) { - $args= ["record", @rr_record_args, $exe_mysqld_bootstrap, @$args]; - $exe_mysqld_bootstrap= "rr"; - my $rr_dir= $opt_rr_dir ? $opt_rr_dir : "$opt_vardir/rr.boot"; - $ENV{'_RR_TRACE_DIR'}= $rr_dir; - mkpath($rr_dir); - } + My::Debugger::setup_boot_args(\$args, \$exe_mysqld_bootstrap, $bootstrap_sql_file); my $path_sql= my_find_file($install_basedir, ["mysql", "sql/share", "share/mariadb", @@ -4184,6 +3897,7 @@ sub run_testcase ($$) { if (start_servers($tinfo)) { report_failure_and_restart($tinfo); + unlink $path_current_testlog; return 1; } } @@ -5148,7 +4862,7 @@ sub after_failure ($) { sub report_failure_and_restart ($) { my $tinfo= shift; - if ($opt_valgrind_mysqld && ($tinfo->{'warnings'} || $tinfo->{'timeout'}) && + if ($opt_valgrind && ($tinfo->{'warnings'} || $tinfo->{'timeout'}) && $opt_core_on_failure == 0) { # In these cases we may want valgrind report from normal termination @@ -5278,12 +4992,6 @@ sub mysqld_arguments ($$$) { # Check if "extra_opt" contains --log-bin my $skip_binlog= not grep /^--(loose-)?log-bin/, @$extra_opts; - # Indicate to mysqld it will be debugged in debugger - if ( $glob_debugger ) - { - mtr_add_arg($args, "--gdb"); - } - my $found_skip_core= 0; foreach my $arg ( @$extra_opts ) { @@ -5332,7 +5040,6 @@ sub mysqld_start ($$) { mtr_verbose(My::Options::toStr("mysqld_start", @$extra_opts)); my $exe= find_mysqld($mysqld->value('basedir')); - my $wait_for_pid_file= 1; mtr_error("Internal error: mysqld should never be started for embedded") if $opt_embedded_server; @@ -5340,15 +5047,6 @@ sub mysqld_start ($$) { my $args; mtr_init_args(\$args); - if ( $opt_valgrind_mysqld and not $opt_gdb and not $opt_manual_gdb ) - { - valgrind_arguments($args, \$exe); - } - if ( $opt_strace) - { - strace_arguments($args, \$exe, $mysqld->name()); - } - mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); # Add any additional options from an in-test restart @@ -5372,49 +5070,8 @@ sub mysqld_start ($$) { # options from *.opt and *.combination files. $ENV{'MYSQLD_LAST_CMD'}= "$exe @$args"; - if ( $opt_gdb || $opt_manual_gdb ) - { - gdb_arguments(\$args, \$exe, $mysqld->name()); - } - elsif ( $opt_manual_lldb ) - { - lldb_arguments(\$args, \$exe, $mysqld->name()); - } - elsif ( $opt_ddd || $opt_manual_ddd ) - { - ddd_arguments(\$args, \$exe, $mysqld->name()); - } - elsif ( $opt_dbx || $opt_manual_dbx ) { - dbx_arguments(\$args, \$exe, $mysqld->name()); - } - elsif ( $opt_debugger ) - { - debugger_arguments(\$args, \$exe, $mysqld->name()); - } - elsif ( $opt_manual_debug ) - { - print "\nStart " .$mysqld->name()." in your debugger\n" . - "dir: $glob_mysql_test_dir\n" . - "exe: $exe\n" . - "args: " . join(" ", @$args) . "\n\n" . - "Waiting ....\n"; - - # Indicate the exe should not be started - $exe= undef; - } - elsif ( $opt_rr ) - { - $args= ["record", @rr_record_args, "$exe", @$args]; - $exe= "rr"; - my $rr_dir= $opt_rr_dir ? $opt_rr_dir : "$opt_vardir/rr". $mysqld->after('mysqld'); - $ENV{'_RR_TRACE_DIR'}= $rr_dir; - mkpath($rr_dir); - } - else - { - # Default to not wait until pid file has been created - $wait_for_pid_file= 0; - } + My::Debugger::setup_args(\$args, \$exe, $mysqld->name()); + $ENV{'VALGRIND_TEST'}= $opt_valgrind = int(($exe || '') eq 'valgrind'); # Remove the old pidfile if any unlink($mysqld->value('pid-file')); @@ -5463,11 +5120,8 @@ sub mysqld_start ($$) { mtr_verbose("Started $mysqld->{proc}"); } - if ( $wait_for_pid_file && - !sleep_until_file_created($mysqld->value('pid-file'), - $opt_start_timeout, - $mysqld->{'proc'}, - $warn_seconds)) + if (!sleep_until_file_created($mysqld->value('pid-file'), + $opt_start_timeout, $mysqld->{'proc'}, $warn_seconds)) { my $mname= $mysqld->name(); mtr_error("Failed to start mysqld $mname with command $exe"); @@ -5914,13 +5568,6 @@ sub start_mysqltest ($) { mtr_add_arg($args, "--sleep=%d", $opt_sleep); } - if ( $opt_valgrind ) - { - # We are running server under valgrind, which causes some replication - # test to be much slower, notable rpl_mdev6020. Increase timeout. - mtr_add_arg($args, "--wait-for-pos-timeout=1500"); - } - if ( $opt_ssl ) { # Turn on SSL for _all_ test cases if option --ssl was used @@ -5953,31 +5600,6 @@ sub start_mysqltest ($) { # ---------------------------------------------------------------------- $ENV{'MYSQL_TEST'}= mtr_args2str($exe_mysqltest, @$args); - # ---------------------------------------------------------------------- - # Add arguments that should not go into the MYSQL_TEST env var - # ---------------------------------------------------------------------- - if ( $opt_valgrind_mysqltest ) - { - # Prefix the Valgrind options to the argument list. - # We do this here, since we do not want to Valgrind the nested invocations - # of mysqltest; that would mess up the stderr output causing test failure. - my @args_saved = @$args; - mtr_init_args(\$args); - valgrind_arguments($args, \$exe); - mtr_add_arg($args, "%s", $_) for @args_saved; - } - - # ---------------------------------------------------------------------- - # Prefix the strace options to the argument list. - # ---------------------------------------------------------------------- - if ( $opt_client_strace ) - { - my @args_saved = @$args; - mtr_init_args(\$args); - strace_arguments($args, \$exe, "mysqltest"); - mtr_add_arg($args, "%s", $_) for @args_saved; - } - if ($opt_force > 1) { mtr_add_arg($args, "--continue-on-error"); @@ -6013,21 +5635,7 @@ sub start_mysqltest ($) { } } - if ( $opt_client_gdb ) - { - gdb_arguments(\$args, \$exe, "client"); - } - elsif ( $opt_client_ddd ) - { - ddd_arguments(\$args, \$exe, "client"); - } - if ( $opt_client_dbx ) { - dbx_arguments(\$args, \$exe, "client"); - } - elsif ( $opt_client_debugger ) - { - debugger_arguments(\$args, \$exe, "client"); - } + My::Debugger::setup_client_args(\$args, \$exe); my $proc= My::SafeProcess->new ( @@ -6043,287 +5651,6 @@ sub start_mysqltest ($) { } # -# Modify the exe and args so that program is run in gdb in xterm -# -sub gdb_arguments { - my $args= shift; - my $exe= shift; - my $type= shift; - my $input= shift; - - my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type"; - - # Remove the old gdbinit file - unlink($gdb_init_file); - - # Put $args into a single string - $input = $input ? "< $input" : ""; - - if ($type eq 'client') { - mtr_tofile($gdb_init_file, "set args @$$args $input"); - } elsif ($opt_valgrind_mysqld) { - my $v = $$exe; - my $vargs = []; - valgrind_arguments($vargs, \$v); - mtr_tofile($gdb_init_file, <<EOF); -shell @My::SafeProcess::safe_process_cmd --parent-pid=`pgrep -x gdb` -- $v --vgdb-error=0 @$vargs @$$args & -shell sleep 1 -target remote | /usr/lib64/valgrind/../../bin/vgdb -EOF - } else { - mtr_tofile($gdb_init_file, - join("\n", - "set args @$$args $input", - split /;/, $opt_gdb || "" - )); - } - - if ( $opt_manual_gdb ) - { - print "\nTo start gdb for $type, type in another window:\n"; - print "gdb -cd $glob_mysql_test_dir -x $gdb_init_file $$exe\n"; - - # Indicate the exe should not be started - $$exe= undef; - return; - } - - $$args= []; - mtr_add_arg($$args, "-title"); - mtr_add_arg($$args, "$type"); - mtr_add_arg($$args, "-e"); - - if ( $exe_libtool ) - { - mtr_add_arg($$args, $exe_libtool); - mtr_add_arg($$args, "--mode=execute"); - } - - mtr_add_arg($$args, "gdb"); - mtr_add_arg($$args, "-x"); - mtr_add_arg($$args, "$gdb_init_file"); - mtr_add_arg($$args, "$$exe"); - - $$exe= "xterm"; -} - -# -# Modify the exe and args so that program is run in lldb -# -sub lldb_arguments { - my $args= shift; - my $exe= shift; - my $type= shift; - my $input= shift; - - my $lldb_init_file= "$opt_vardir/tmp/lldbinit.$type"; - unlink($lldb_init_file); - - # Put $args into a single string - my $str= join(" ", @$$args); - $input = $input ? "< $input" : ""; - - # write init file for mysqld or client - mtr_tofile($lldb_init_file, "process launch --stop-at-entry -- $str $input\n"); - - print "\nTo start lldb for $type, type in another window:\n"; - print "cd $glob_mysql_test_dir && lldb -s $lldb_init_file $$exe\n"; - - # Indicate the exe should not be started - $$exe= undef; - return; -} - -# -# Modify the exe and args so that program is run in ddd -# -sub ddd_arguments { - my $args= shift; - my $exe= shift; - my $type= shift; - my $input= shift; - - my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type"; - - # Remove the old gdbinit file - unlink($gdb_init_file); - - # Put $args into a single string - my $str= join(" ", @$$args); - $input = $input ? "< $input" : ""; - - # write init file for mysqld or client - mtr_tofile($gdb_init_file, "file $$exe\nset args $str $input\n"); - - if ( $opt_manual_ddd ) - { - print "\nTo start ddd for $type, type in another window:\n"; - print "ddd -cd $glob_mysql_test_dir -x $gdb_init_file $$exe\n"; - - # Indicate the exe should not be started - $$exe= undef; - return; - } - - my $save_exe= $$exe; - $$args= []; - if ( $exe_libtool ) - { - $$exe= $exe_libtool; - mtr_add_arg($$args, "--mode=execute"); - mtr_add_arg($$args, "ddd"); - } - else - { - $$exe= "ddd"; - } - mtr_add_arg($$args, "--command=$gdb_init_file"); - mtr_add_arg($$args, "$save_exe"); -} - - -# -# Modify the exe and args so that program is run in dbx in xterm -# -sub dbx_arguments { - my $args= shift; - my $exe= shift; - my $type= shift; - my $input= shift; - - # Put $args into a single string - my $str= join " ", @$$args; - my $runline= $input ? "run $str < $input" : "run $str"; - - if ( $opt_manual_dbx ) { - print "\nTo start dbx for $type, type in another window:\n"; - print "cd $glob_mysql_test_dir; dbx -c \"stop in main; " . - "$runline\" $$exe\n"; - - # Indicate the exe should not be started - $$exe= undef; - return; - } - - $$args= []; - mtr_add_arg($$args, "-title"); - mtr_add_arg($$args, "$type"); - mtr_add_arg($$args, "-e"); - - if ( $exe_libtool ) { - mtr_add_arg($$args, $exe_libtool); - mtr_add_arg($$args, "--mode=execute"); - } - - mtr_add_arg($$args, "dbx"); - mtr_add_arg($$args, "-c"); - mtr_add_arg($$args, "stop in main; $runline"); - mtr_add_arg($$args, "$$exe"); - - $$exe= "xterm"; -} - - -# -# Modify the exe and args so that program is run in the selected debugger -# -sub debugger_arguments { - my $args= shift; - my $exe= shift; - my $debugger= $opt_debugger || $opt_client_debugger; - - if ( $debugger =~ /vcexpress|vc|devenv/ ) - { - # vc[express] /debugexe exe arg1 .. argn - - # Add name of the exe and /debugexe before args - unshift(@$$args, "$$exe"); - unshift(@$$args, "/debugexe"); - - # Set exe to debuggername - $$exe= $debugger; - - } - elsif ( $debugger =~ /windbg|vsjitdebugger/ ) - { - # windbg exe arg1 .. argn - - # Add name of the exe before args - unshift(@$$args, "$$exe"); - - # Set exe to debuggername - $$exe= $debugger; - - } - else - { - mtr_error("Unknown argument \"$debugger\" passed to --debugger"); - } -} - -# -# Modify the exe and args so that program is run in valgrind -# -sub valgrind_arguments { - my $args= shift; - my $exe= shift; - - # Ensure the jemalloc works with mysqld - if ($$exe =~ /mysqld/) - { - my %somalloc=( - 'system jemalloc' => 'libjemalloc*', - 'bundled jemalloc' => 'NONE' - ); - my ($syn) = $somalloc{$mysqld_variables{'version-malloc-library'}}; - mtr_add_arg($args, '--soname-synonyms=somalloc=%s', $syn) if $syn; - } - - # Add valgrind options, can be overridden by user - mtr_add_arg($args, '%s', $_) for (@valgrind_args); - - mtr_add_arg($args, $$exe); - - $$exe= $opt_valgrind_path || "valgrind"; - - if ($exe_libtool) - { - # Add "libtool --mode-execute" before the test to execute - # if running in valgrind(to avoid valgrinding bash) - unshift(@$args, "--mode=execute", $$exe); - $$exe= $exe_libtool; - } -} - -# -# Modify the exe and args so that program is run in strace -# -sub strace_arguments { - my $args= shift; - my $exe= shift; - my $mysqld_name= shift; - my $output= sprintf("%s/log/%s.strace", $path_vardir_trace, $mysqld_name); - - mtr_add_arg($args, "-f"); - mtr_add_arg($args, "-o%s", $output); - - # Add strace options - mtr_add_arg($args, '%s', $_) for (@strace_args); - - mtr_add_arg($args, $$exe); - - $$exe= $opt_stracer || "strace"; - - if ($exe_libtool) - { - # Add "libtool --mode-execute" before the test to execute - # if running in valgrind(to avoid valgrinding bash) - unshift(@$args, "--mode=execute", $$exe); - $$exe= $exe_libtool; - } -} - -# # Search server logs for valgrind reports printed at mysqld termination # sub valgrind_exit_reports() { @@ -6404,7 +5731,7 @@ sub usage ($) { local $"= ','; # for @DEFAULT_SUITES below - print <<HERE; + print <<HERE . My::Debugger::help() . <<HERE; $0 [ OPTIONS ] [ TESTCASE ] @@ -6531,32 +5858,11 @@ Options to run test on running server Options for debugging the product - boot-dbx Start bootstrap server in dbx - boot-ddd Start bootstrap server in ddd - boot-gdb Start bootstrap server in gdb - client-dbx Start mysqltest client in dbx - client-ddd Start mysqltest client in ddd - client-debugger=NAME Start mysqltest in the selected debugger - client-gdb Start mysqltest client in gdb - dbx Start the mysqld(s) in dbx - ddd Start the mysqld(s) in ddd debug Dump trace output for all servers and client programs debug-common Same as debug, but sets 'd' debug flags to "query,info,error,enter,exit" debug-server Use debug version of server, but without turning on tracing - debugger=NAME Start mysqld in the selected debugger - gdb[=gdb_arguments] Start the mysqld(s) in gdb - manual-debug Let user manually start mysqld in debugger, before - running test(s) - manual-gdb Let user manually start mysqld in gdb, before running - test(s) - manual-ddd Let user manually start mysqld in ddd, before running - test(s) - manual-dbx Let user manually start mysqld in dbx, before running - test(s) - manual-lldb Let user manually start mysqld in lldb, before running - test(s) max-save-core Limit the number of core files saved (to avoid filling up disks for heavily crashing server). Defaults to $opt_max_save_core. Set its default with @@ -6570,38 +5876,7 @@ Options for debugging the product $opt_max_test_fail, set to 0 for no limit. Set it's default with MTR_MAX_TEST_FAIL core-in-failure Generate a core even if run server is run with valgrind - -Options for valgrind - - valgrind Run the "mysqltest" and "mysqld" executables using - valgrind with default options - valgrind-all Synonym for --valgrind - valgrind-mysqltest Run the "mysqltest" and "mysql_client_test" executable - with valgrind - valgrind-mysqld Run the "mysqld" executable with valgrind - valgrind-options=ARGS Deprecated, use --valgrind-option - valgrind-option=ARGS Option to give valgrind, replaces default option(s), - can be specified more then once - valgrind-path=<EXE> Path to the valgrind executable - callgrind Instruct valgrind to use callgrind - -Options for strace - - strace Run the "mysqld" executables using strace. Default - options are -f -o 'vardir'/log/'mysqld-name'.strace. - client-strace Trace the "mysqltest". - strace-option=ARGS Option to give strace, appends to existing options. - stracer=<EXE> Specify name and path to the trace program to use. - Default is "strace". Example: $0 --stracer=ktrace. - -Options for rr (Record and Replay) - rr Run the "mysqld" executables using rr. Default run - option is "rr record mysqld mysqld_options" - boot-rr Start bootstrap server in rr - rr-arg=ARG Option to give rr record, can be specified more then once - rr-dir=DIR The directory where rr recordings are stored. Defaults - to 'vardir'/rr.0 (rr.boot for bootstrap instance and - rr.1, ..., rr.N for slave instances). +HERE Misc options user=USER User for connecting to mysqld(default: $opt_user) diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result index 3e4bf5f0d43..0c7ca03a2c5 100644 --- a/mysql-test/r/contributors.result +++ b/mysql-test/r/contributors.result @@ -1,21 +1,16 @@ SHOW CONTRIBUTORS; Name Location Comment -Booking.com https://www.booking.com Founding member, Platinum Sponsor of the MariaDB Foundation Alibaba Cloud https://www.alibabacloud.com/ Platinum Sponsor of the MariaDB Foundation Tencent Cloud https://cloud.tencent.com Platinum Sponsor of the MariaDB Foundation Microsoft https://microsoft.com/ Platinum Sponsor of the MariaDB Foundation MariaDB Corporation https://mariadb.com Founding member, Platinum Sponsor of the MariaDB Foundation +ServiceNow https://servicenow.com Platinum Sponsor of the MariaDB Foundation Visma https://visma.com Gold Sponsor of the MariaDB Foundation DBS https://dbs.com Gold Sponsor of the MariaDB Foundation IBM https://www.ibm.com Gold Sponsor of the MariaDB Foundation -Tencent Games http://game.qq.com/ Gold Sponsor of the MariaDB Foundation -Nexedi https://www.nexedi.com Silver Sponsor of the MariaDB Foundation -Acronis https://www.acronis.com Silver Sponsor of the MariaDB Foundation -Verkkokauppa.com https://www.verkkokauppa.com Bronze Sponsor of the MariaDB Foundation -Virtuozzo https://virtuozzo.com Bronze Sponsor of the MariaDB Foundation -Tencent Game DBA http://tencentdba.com/about Bronze Sponsor of the MariaDB Foundation -Tencent TDSQL http://tdsql.org Bronze Sponsor of the MariaDB Foundation -Percona https://www.percona.com/ Bronze Sponsor of the MariaDB Foundation +Automattic https://automattic.com Silver Sponsor of the MariaDB Foundation +Percona https://www.percona.com/ Sponsor of the MariaDB Foundation +Galera Cluster https://galeracluster.com Sponsor of the MariaDB Foundation Google USA Sponsoring encryption, parallel replication and GTID Facebook USA Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 3e5efbe74dd..edbceba7ee5 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1,7 +1,4 @@ call mtr.add_suppression("table or database name 't-1'"); -drop table if exists t1,t2,t3,t4,t5; -drop database if exists mysqltest; -drop view if exists v1; create table t1 (b char(0)); insert into t1 values (""),(null); select * from t1; @@ -1290,7 +1287,7 @@ drop table if exists t1,t2,t3; # Fix modified for MariaDB: we support this syntax create table t1 (a int) transactional=0; Warnings: -Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1' +Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=0' create table t2 (a int) page_checksum=1; create table t3 (a int) row_format=page; drop table t1,t2,t3; @@ -2066,10 +2063,29 @@ alter table t1 add key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0064 (f64) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'; ERROR HY000: Cannot create table `t1`: index information is too long. Decrease number of indexes or use shorter index names or shorter comments. drop table t1; -End of 5.5 tests +# +# End of 5.5 tests +# +# +# MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS +# create table t1; ERROR 42000: A table must have at least 1 column +# +# MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT +# create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j; Warnings: Note 1831 Duplicate index `i_2`. This is deprecated and will be disallowed in a future release drop table t1; +# +# End of 10.0 tests +# +# +# MDEV-18428 Memory: If transactional=0 is specified in CREATE TABLE, it is not possible to ALTER TABLE +# +create table t1 (c int(10) unsigned) engine=memory transactional=0; +ERROR HY000: Table storage engine 'MEMORY' does not support the create option 'TRANSACTIONAL=0' +# +# End of 10.2 tests +# diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result index 746fcbcf051..da954c1f14b 100644 --- a/mysql-test/r/cte_nonrecursive.result +++ b/mysql-test/r/cte_nonrecursive.result @@ -571,7 +571,7 @@ with t as (select a from t1 where b >= 'c') select * from t2,t where t2.c=t.a; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`b` >= 'c')select `t2`.`c` AS `c`,`t`.`a` AS `a` from (`t2` join `t`) where `t2`.`c` = `t`.`a` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `test`.`t2`.`c` AS `c`,`t`.`a` AS `a` from (`test`.`t2` join `t`) where `test`.`t2`.`c` = `t`.`a` latin1 latin1_swedish_ci select * from v1; c a 4 4 @@ -588,7 +588,7 @@ with t as (select a, count(*) from t1 where b >= 'c' group by a) select * from t2,t where t2.c=t.a; show create view v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with t as (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` where `t1`.`b` >= 'c' group by `t1`.`a`)select `t2`.`c` AS `c`,`t`.`a` AS `a`,`t`.`count(*)` AS `count(*)` from (`t2` join `t`) where `t2`.`c` = `t`.`a` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with t as (select `test`.`t1`.`a` AS `a`,count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`b` >= 'c' group by `test`.`t1`.`a`)select `test`.`t2`.`c` AS `c`,`t`.`a` AS `a`,`t`.`count(*)` AS `count(*)` from (`test`.`t2` join `t`) where `test`.`t2`.`c` = `t`.`a` latin1 latin1_swedish_ci select * from v2; c a count(*) 4 4 2 @@ -606,7 +606,7 @@ with t(c) as (select a from t1 where b >= 'c') select * from t r1 where r1.c=4; show create view v3; View Create View character_set_client collation_connection -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with t as (select `t1`.`a` AS `c` from `t1` where `t1`.`b` >= 'c')select `r1`.`c` AS `c` from `t` `r1` where `r1`.`c` = 4 latin1 latin1_swedish_ci +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with t as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c` from `t` `r1` where `r1`.`c` = 4 latin1 latin1_swedish_ci select * from v3; c 4 @@ -618,7 +618,7 @@ with t(c) as (select a from t1 where b >= 'c') select * from t r1, t r2 where r1.c=r2.c and r2.c=4; show create view v4; View Create View character_set_client collation_connection -v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c') `r2`) where `r1`.`c` = `r2`.`c` and `r2`.`c` = 4 latin1 latin1_swedish_ci +v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join `t` `r2`) where `r1`.`c` = `r2`.`c` and `r2`.`c` = 4 latin1 latin1_swedish_ci select * from v4; c d 4 4 @@ -1126,7 +1126,7 @@ NULL UNION RESULT <union2,5> ALL NULL NULL NULL NULL NULL NULL NULL UNION RESULT <union9,12> ALL NULL NULL NULL NULL NULL NULL NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 with cte_e as (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union select `cte_e2`.`a` AS `a` from (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7) `cte_e2` +Note 1003 with cte_e as (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union select `cte_e2`.`a` AS `a` from `cte_e` `cte_e2` drop table t1; # # MDEV-13753: embedded CTE in a VIEW created in prepared statement @@ -1349,7 +1349,7 @@ r.r_regionkey in select r_regionkey from t where r_name <> "ASIA"); show create view v; View Create View character_set_client collation_connection -v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `n`.`n_nationkey` AS `n_nationkey`,`n`.`n_name` AS `n_name`,`n`.`n_regionkey` AS `n_regionkey`,`r`.`r_regionkey` AS `r_regionkey`,`r`.`r_name` AS `r_name` from (`nation` `n` join `region` `r`) where `n`.`n_regionkey` = `r`.`r_regionkey` and `r`.`r_regionkey` in (with t as (select `region`.`r_regionkey` AS `r_regionkey`,`region`.`r_name` AS `r_name` from `region` where `region`.`r_regionkey` <= 3)select `t`.`r_regionkey` from `t` where `t`.`r_name` <> 'ASIA') latin1 latin1_swedish_ci +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `n`.`n_nationkey` AS `n_nationkey`,`n`.`n_name` AS `n_name`,`n`.`n_regionkey` AS `n_regionkey`,`r`.`r_regionkey` AS `r_regionkey`,`r`.`r_name` AS `r_name` from (`test`.`nation` `n` join `test`.`region` `r`) where `n`.`n_regionkey` = `r`.`r_regionkey` and `r`.`r_regionkey` in (with t as (select `test`.`region`.`r_regionkey` AS `r_regionkey`,`test`.`region`.`r_name` AS `r_name` from `test`.`region` where `test`.`region`.`r_regionkey` <= 3)select `t`.`r_regionkey` from `t` where `t`.`r_name` <> 'ASIA') latin1 latin1_swedish_ci select * from v; n_nationkey n_name n_regionkey r_regionkey r_name 0 ALGERIA 0 0 AFRICA @@ -1690,4 +1690,77 @@ ERROR 3D000: No database selected DROP TABLE test.t; connection default; disconnect con1; +# +# MDEV-22781: create view with CTE without default database +# +drop database test; +create database db1; +create table db1.t1 (a int); +insert into db1.t1 values (3),(7),(1); +create view db1.v1 as with t as (select * from db1.t1) select * from t; +show create view db1.v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db1`.`v1` AS with t as (select `db1`.`t1`.`a` AS `a` from `db1`.`t1`)select `t`.`a` AS `a` from `t` latin1 latin1_swedish_ci +select * from db1.v1; +a +3 +7 +1 +drop view db1.v1; +prepare stmt from " +create view db1.v1 as with t as (select * from db1.t1) select * from t; +"; +execute stmt; +deallocate prepare stmt; +show create view db1.v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db1`.`v1` AS with t as (select `db1`.`t1`.`a` AS `a` from `db1`.`t1`)select `t`.`a` AS `a` from `t` latin1 latin1_swedish_ci +select * from db1.v1; +a +3 +7 +1 +drop view db1.v1; +drop table db1.t1; +drop database db1; +create database test; +use test; +# +# MDEV-24597: CTE with union used multiple times in query +# +with cte(a) as +(select 1 as d union select 2 as d) +select a from cte as r1 +union +select a from cte as r2; +a +1 +2 +create table t1 (a int, b int) engine=myisam; +insert into t1 values +(3,30), (7,70), (1,10), (7,71), (2,20), (7,72), (3,33), (4,44), +(5,50), (4,40), (3,33), (4,42), (4,43), (5,51); +with cte(c) as +(select a from t1 where b < 30 union select a from t1 where b > 40) +select * from cte as r1, cte as r2 where r1.c = r2.c; +c c +1 1 +2 2 +7 7 +4 4 +5 5 +with cte(a,c) as +( +select a, count(*) from t1 group by a having count(*) = 1 +union +select a, count(*) from t1 group by a having count(*) = 3 +) +select a, c from cte as r1 where a < 3 +union +select a, c from cte as r2 where a > 4; +a c +1 1 +2 1 +7 3 +drop table t1; # End of 10.2 tests diff --git a/mysql-test/r/cte_nonrecursive_not_embedded.result b/mysql-test/r/cte_nonrecursive_not_embedded.result new file mode 100644 index 00000000000..c96a1ec2849 --- /dev/null +++ b/mysql-test/r/cte_nonrecursive_not_embedded.result @@ -0,0 +1,48 @@ +# +# MDEV-20751: query using many CTEs with grant_tables enabled +# +connection default; +CREATE DATABASE db; +USE db; +CREATE TABLE t1 (a int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (3), (7), (1); +CREATE TABLE t2 (a int) ENGINE=MYISAM; +INSERT INTO t2 VALUES (2), (8), (4); +CREATE USER 'u1'@'localhost'; +GRANT USAGE ON db.* TO 'u1'@'localhost'; +GRANT SELECT ON db.t1 TO 'u1'@'localhost'; +FLUSH PRIVILEGES; +connect u1,'localhost',u1,,; +connection u1; +USE db; +WITH +cte1 AS +(SELECT a FROM t1), +cte2 AS +(SELECT cte1.a FROM t1,cte1 WHERE cte1.a = t1.a), +cte3 AS +(SELECT cte2.a FROM t1,cte1,cte2 WHERE cte1.a = t1.a AND t1.a = cte2.a), +cte4 AS +(SELECT cte2.a FROM t1,cte2 WHERE cte2.a = t1.a) +SELECT * FROM cte4 as r; +a +3 +7 +1 +WITH +cte1 AS +(SELECT a FROM t2), +cte2 AS +(SELECT cte1.a FROM t2,cte1 WHERE cte1.a = t2.a), +cte3 AS +(SELECT cte2.a FROM t2,cte1,cte2 WHERE cte1.a = t2.a AND t2.a = cte2.a), +cte4 AS +(SELECT cte2.a FROM t2,cte2 WHERE cte2.a = t2.a) +SELECT * FROM cte4 as r; +ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table 't2' +disconnect u1; +connection default; +DROP USER 'u1'@'localhost'; +DROP DATABASE db; +USE test; +# End of 10.2 tests diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result index 640493142bd..b6b4ed7fb37 100644 --- a/mysql-test/r/cte_recursive.result +++ b/mysql-test/r/cte_recursive.result @@ -818,7 +818,7 @@ where p.id = a.father or p.id = a.mother select * from ancestors; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with recursive ancestors as (select `folks`.`id` AS `id`,`folks`.`name` AS `name`,`folks`.`dob` AS `dob`,`folks`.`father` AS `father`,`folks`.`mother` AS `mother` from `folks` where `folks`.`name` = 'Me' and `folks`.`dob` = '2000-01-01' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `a`) where `p`.`id` = `a`.`father` or `p`.`id` = `a`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with recursive ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' and `test`.`folks`.`dob` = '2000-01-01' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`test`.`folks` `p` join `ancestors` `a`) where `p`.`id` = `a`.`father` or `p`.`id` = `a`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci select * from v1; id name dob father mother 100 Me 2000-01-01 20 30 @@ -849,7 +849,7 @@ where p.id = ma.mother select * from ancestors; show create view v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with recursive ancestors as (select `folks`.`id` AS `id`,`folks`.`name` AS `name`,`folks`.`dob` AS `dob`,`folks`.`father` AS `father`,`folks`.`mother` AS `mother` from `folks` where `folks`.`name` = 'Me' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `fa`) where `p`.`id` = `fa`.`father` union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `ma`) where `p`.`id` = `ma`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with recursive ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`test`.`folks` `p` join `ancestors` `fa`) where `p`.`id` = `fa`.`father` union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`test`.`folks` `p` join `ancestors` `ma`) where `p`.`id` = `ma`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci select * from v2; id name dob father mother 100 Me 2000-01-01 20 30 @@ -1301,7 +1301,7 @@ select ancestors.name, ancestors.dob from ancestors; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY <derived4> ALL NULL NULL NULL NULL 24 4 DERIVED folks ALL NULL NULL NULL NULL 12 Using where -6 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 12 +6 UNION <derived3> ALL NULL NULL NULL NULL 12 5 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 24 NULL UNION RESULT <union4,6,5> ALL NULL NULL NULL NULL NULL 3 DERIVED folks ALL NULL NULL NULL NULL 12 Using where @@ -3964,5 +3964,495 @@ YEAR d1 d2 DROP PROCEDURE p; DROP TABLE t1,t2,t3,t4; # +# MDEV-23619: recursive CTE used only in the second operand of UNION +# +create table t1 ( +a bigint(10) not null auto_increment, +b int(5) not null, +c bigint(10) default null, +primary key (a) +) engine myisam; +insert into t1 values +(1,3,12), (2,7,15), (3,1,3), (4,3,1); +explain with recursive r_cte as +( select * from t1 as s +union +select t1.* from t1, r_cte as r where t1.c = r.a ) +select 0 as b FROM dual union all select b FROM r_cte as t; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +2 DERIVED s ALL NULL NULL NULL NULL 4 +3 RECURSIVE UNION t1 ALL NULL NULL NULL NULL 4 Using where +3 RECURSIVE UNION <derived2> ref key0 key0 8 test.t1.c 2 +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +4 UNION <derived2> ALL NULL NULL NULL NULL 4 +with recursive r_cte as +( select * from t1 as s +union +select t1.* from t1, r_cte as r where t1.c = r.a ) +select 0 as b FROM dual union all select b FROM r_cte as t; +b +0 +3 +7 +1 +3 +analyze format=json with recursive r_cte as +( select * from t1 as s +union +select t1.* from t1, r_cte as r where t1.c = r.a ) +select 0 as b FROM dual union all select b FROM r_cte as t; +ANALYZE +{ + "query_block": { + "union_result": { + "table_name": "<union1,4>", + "access_type": "ALL", + "r_loops": 0, + "r_rows": null, + "query_specifications": [ + { + "query_block": { + "select_id": 1, + "table": { + "message": "No tables used" + } + } + }, + { + "query_block": { + "select_id": 4, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "r_loops": 1, + "rows": 4, + "r_rows": 4, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "materialized": { + "query_block": { + "recursive_union": { + "table_name": "<union2,3>", + "access_type": "ALL", + "r_loops": 0, + "r_rows": null, + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "s", + "access_type": "ALL", + "r_loops": 1, + "rows": 4, + "r_rows": 4, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + } + }, + { + "query_block": { + "select_id": 3, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 4, + "r_rows": 4, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "attached_condition": "t1.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "8", + "used_key_parts": ["a"], + "ref": ["test.t1.c"], + "r_loops": 4, + "rows": 2, + "r_rows": 0.5, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + } + } + ] + } + } + } + } + } + } + ] + } + } +} +prepare stmt from "with recursive r_cte as +( select * from t1 as s +union +select t1.* from t1, r_cte as r where t1.c = r.a ) +select 0 as b FROM dual union all select b FROM r_cte as t"; +execute stmt; +b +0 +3 +7 +1 +3 +execute stmt; +b +0 +3 +7 +1 +3 +deallocate prepare stmt; +#checking hanging cte that uses a recursive cte +explain with h_cte as +( with recursive r_cte as +( select * from t1 as s +union +select t1.* from t1, r_cte as r where t1.c = r.a ) +select 0 as b FROM dual union all select b FROM r_cte as t) +select * from t1 as tt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY tt ALL NULL NULL NULL NULL 4 +with h_cte as +( with recursive r_cte as +( select * from t1 as s +union +select t1.* from t1, r_cte as r where t1.c = r.a ) +select 0 as b FROM dual union all select b FROM r_cte as t) +select * from t1 as tt; +a b c +1 3 12 +2 7 15 +3 1 3 +4 3 1 +analyze format=json with h_cte as +( with recursive r_cte as +( select * from t1 as s +union +select t1.* from t1, r_cte as r where t1.c = r.a ) +select 0 as b FROM dual union all select b FROM r_cte as t) +select * from t1 as tt; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "tt", + "access_type": "ALL", + "r_loops": 1, + "rows": 4, + "r_rows": 4, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + } +} +prepare stmt from "with h_cte as +( with recursive r_cte as +( select * from t1 as s +union +select t1.* from t1, r_cte as r where t1.c = r.a ) +select 0 as b FROM dual union all select b FROM r_cte as t) +select * from t1 as tt"; +execute stmt; +a b c +1 3 12 +2 7 15 +3 1 3 +4 3 1 +execute stmt; +a b c +1 3 12 +2 7 15 +3 1 3 +4 3 1 +deallocate prepare stmt; +drop table t1; +# +# MDEV-24019: query with recursive CTE when no default database is set +# +drop database test; +with recursive a as +(select 1 from dual union select * from a as r) +select * from a; +1 +1 +create database db1; +create table db1.t1 (a int); +insert into db1.t1 values (3), (7), (1); +with recursive cte as +(select * from db1.t1 union select * from (select * from cte) as t) +select * from cte; +a +3 +7 +1 +explain with recursive cte as +(select * from db1.t1 union select * from (select * from cte) as t) +select * from cte; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 +2 DERIVED t1 ALL NULL NULL NULL NULL 3 +3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 3 +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +prepare stmt from "with recursive cte as +(select * from db1.t1 union select * from (select * from cte) as t) +select * from cte"; +execute stmt; +a +3 +7 +1 +execute stmt; +a +3 +7 +1 +deallocate prepare stmt; +drop database db1; +create database test; +use test; +# +# MDEV-23406: query with mutually recursive CTEs when big_tables=1 +# +set @save_big_tables=@@big_tables; +set big_tables=1; +create table folks(id int, name char(32), dob date, father int, mother int); +insert into folks values +(100, 'Me', '2000-01-01', 20, 30), +(20, 'Dad', '1970-02-02', 10, 9), +(30, 'Mom', '1975-03-03', 8, 7), +(10, 'Grandpa Bill', '1940-04-05', null, null), +(9, 'Grandma Ann', '1941-10-15', null, null), +(25, 'Uncle Jim', '1968-11-18', 8, 7), +(98, 'Sister Amy', '2001-06-20', 20, 30), +(7, 'Grandma Sally', '1943-08-23', null, 6), +(8, 'Grandpa Ben', '1940-10-21', null, null), +(6, 'Grandgrandma Martha', '1923-05-17', null, null), +(67, 'Cousin Eddie', '1992-02-28', 25, 27), +(27, 'Auntie Melinda', '1971-03-29', null, null); +with recursive +ancestor_couples(h_id, h_name, h_dob, h_father, h_mother, +w_id, w_name, w_dob, w_father, w_mother) +as +( +select h.*, w.* +from folks h, folks w, coupled_ancestors a +where a.father = h.id AND a.mother = w.id +union +select h.*, w.* +from folks v, folks h, folks w +where v.name = 'Me' and +(v.father = h.id AND v.mother= w.id) +), +coupled_ancestors (id, name, dob, father, mother) +as +( +select h_id, h_name, h_dob, h_father, h_mother +from ancestor_couples +union +select w_id, w_name, w_dob, w_father, w_mother +from ancestor_couples +) +select h_name, h_dob, w_name, w_dob +from ancestor_couples; +h_name h_dob w_name w_dob +Dad 1970-02-02 Mom 1975-03-03 +Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15 +Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23 +explain with recursive +ancestor_couples(h_id, h_name, h_dob, h_father, h_mother, +w_id, w_name, w_dob, w_father, w_mother) +as +( +select h.*, w.* +from folks h, folks w, coupled_ancestors a +where a.father = h.id AND a.mother = w.id +union +select h.*, w.* +from folks v, folks h, folks w +where v.name = 'Me' and +(v.father = h.id AND v.mother= w.id) +), +coupled_ancestors (id, name, dob, father, mother) +as +( +select h_id, h_name, h_dob, h_father, h_mother +from ancestor_couples +union +select w_id, w_name, w_dob, w_father, w_mother +from ancestor_couples +) +select h_name, h_dob, w_name, w_dob +from ancestor_couples; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 1728 +4 DERIVED <derived3> ALL NULL NULL NULL NULL 1728 +5 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 1728 +NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL +3 DERIVED v ALL NULL NULL NULL NULL 12 Using where +3 DERIVED h ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +3 DERIVED w ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join) +2 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 2 +2 RECURSIVE UNION h ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +2 RECURSIVE UNION w ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join) +NULL UNION RESULT <union3,2> ALL NULL NULL NULL NULL NULL +prepare stmt from "with recursive +ancestor_couples(h_id, h_name, h_dob, h_father, h_mother, +w_id, w_name, w_dob, w_father, w_mother) +as +( +select h.*, w.* +from folks h, folks w, coupled_ancestors a +where a.father = h.id AND a.mother = w.id +union +select h.*, w.* +from folks v, folks h, folks w +where v.name = 'Me' and +(v.father = h.id AND v.mother= w.id) +), +coupled_ancestors (id, name, dob, father, mother) +as +( +select h_id, h_name, h_dob, h_father, h_mother +from ancestor_couples +union +select w_id, w_name, w_dob, w_father, w_mother +from ancestor_couples +) +select h_name, h_dob, w_name, w_dob +from ancestor_couples"; +execute stmt; +h_name h_dob w_name w_dob +Dad 1970-02-02 Mom 1975-03-03 +Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15 +Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23 +execute stmt; +h_name h_dob w_name w_dob +Dad 1970-02-02 Mom 1975-03-03 +Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15 +Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23 +deallocate prepare stmt; +with recursive +ancestor_couples(h_id, h_name, h_dob, h_father, h_mother, +w_id, w_name, w_dob, w_father, w_mother) +as +( +select h.*, w.* +from folks h, folks w, coupled_ancestors a +where a.father = h.id AND a.mother = w.id +), +coupled_ancestors (id, name, dob, father, mother) +as +( +select * +from folks +where name = 'Me' + union all +select h_id, h_name, h_dob, h_father, h_mother +from ancestor_couples +union all +select w_id, w_name, w_dob, w_father, w_mother +from ancestor_couples +) +select h_name, h_dob, w_name, w_dob +from ancestor_couples; +h_name h_dob w_name w_dob +Dad 1970-02-02 Mom 1975-03-03 +Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15 +Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23 +explain with recursive +ancestor_couples(h_id, h_name, h_dob, h_father, h_mother, +w_id, w_name, w_dob, w_father, w_mother) +as +( +select h.*, w.* +from folks h, folks w, coupled_ancestors a +where a.father = h.id AND a.mother = w.id +), +coupled_ancestors (id, name, dob, father, mother) +as +( +select * +from folks +where name = 'Me' + union all +select h_id, h_name, h_dob, h_father, h_mother +from ancestor_couples +union all +select w_id, w_name, w_dob, w_father, w_mother +from ancestor_couples +) +select h_name, h_dob, w_name, w_dob +from ancestor_couples; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 +3 DERIVED folks ALL NULL NULL NULL NULL 12 Using where +4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 +5 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 +NULL UNION RESULT <union3,4,5> ALL NULL NULL NULL NULL NULL +2 DERIVED h ALL NULL NULL NULL NULL 12 +2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +2 DERIVED w ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join) +prepare stmt from "with recursive +ancestor_couples(h_id, h_name, h_dob, h_father, h_mother, +w_id, w_name, w_dob, w_father, w_mother) +as +( +select h.*, w.* +from folks h, folks w, coupled_ancestors a +where a.father = h.id AND a.mother = w.id +), +coupled_ancestors (id, name, dob, father, mother) +as +( +select * +from folks +where name = 'Me' + union all +select h_id, h_name, h_dob, h_father, h_mother +from ancestor_couples +union all +select w_id, w_name, w_dob, w_father, w_mother +from ancestor_couples +) +select h_name, h_dob, w_name, w_dob +from ancestor_couples"; +execute stmt; +h_name h_dob w_name w_dob +Dad 1970-02-02 Mom 1975-03-03 +Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15 +Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23 +execute stmt; +h_name h_dob w_name w_dob +Dad 1970-02-02 Mom 1975-03-03 +Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15 +Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23 +deallocate prepare stmt; +drop table folks; +set big_tables=@save_big_tables; +# # End of 10.2 tests # diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index 491e01b7361..9fa055b9526 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -1492,6 +1492,8 @@ ab AE AE SET max_sort_length=8; +Warnings: +Warning 1292 Truncated incorrect max_sort_length value: '8' SELECT * FROM t1 ORDER BY s1; s1 ab diff --git a/mysql-test/r/ctype_utf16le.result b/mysql-test/r/ctype_utf16le.result index d98c113840b..a43ed6ee538 100644 --- a/mysql-test/r/ctype_utf16le.result +++ b/mysql-test/r/ctype_utf16le.result @@ -1765,6 +1765,8 @@ ab AE AE SET max_sort_length=8; +Warnings: +Warning 1292 Truncated incorrect max_sort_length value: '8' SELECT * FROM t1 ORDER BY s1; s1 ab diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result index 8f40a90859b..584ca12f8c3 100644 --- a/mysql-test/r/ctype_utf32.result +++ b/mysql-test/r/ctype_utf32.result @@ -1306,7 +1306,7 @@ create table t1 (a varchar(334) character set utf32 primary key); ERROR 42000: Specified key was too long; max key length is 1000 bytes create table t1 (a varchar(333) character set utf32, key(a)); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes insert into t1 values (repeat('a',333)), (repeat('b',333)); flush tables; check table t1; @@ -1505,6 +1505,8 @@ ab AE AE SET max_sort_length=8; +Warnings: +Warning 1292 Truncated incorrect max_sort_length value: '8' SELECT * FROM t1 ORDER BY s1; s1 ab diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index d7f13b4053f..7189629b570 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -6755,9 +6755,11 @@ DFFFDFFF9CFF9DFF9EFF # Checking strnxfrm() with odd length # set max_sort_length=9; +Warnings: +Warning 1292 Truncated incorrect max_sort_length value: '9' select @@max_sort_length; @@max_sort_length -9 +64 create table t1 (a varchar(128) character set utf8 collate utf8_general_ci); insert into t1 values ('a'),('b'),('c'); select * from t1 order by a; diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result index 691ac51e241..2762873b9c7 100644 --- a/mysql-test/r/ctype_utf8mb4.result +++ b/mysql-test/r/ctype_utf8mb4.result @@ -1478,7 +1478,7 @@ a varchar(255) NOT NULL default '', KEY a (a) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes insert into t1 values (_utf8mb4 0xe880bd); insert into t1 values (_utf8mb4 0x5b); select hex(a) from t1; @@ -1526,7 +1526,7 @@ Warnings: Note 1051 Unknown table 'test.t1' CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); INSERT INTO t1 VALUES('uu'); check table t1; @@ -2371,10 +2371,10 @@ drop table t1; # # Check strnxfrm() with odd length # -set max_sort_length=9; +set max_sort_length=65; select @@max_sort_length; @@max_sort_length -9 +65 create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci); insert into t1 values ('a'),('b'),('c'); select * from t1 order by a; @@ -2726,7 +2726,7 @@ DEFAULT CHARACTER SET utf8, MODIFY subject varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, MODIFY p varchar(255) CHARACTER SET utf8; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/r/ctype_utf8mb4_heap.result b/mysql-test/r/ctype_utf8mb4_heap.result index 4aef2d8cb66..9eb7d48370f 100644 --- a/mysql-test/r/ctype_utf8mb4_heap.result +++ b/mysql-test/r/ctype_utf8mb4_heap.result @@ -2203,10 +2203,10 @@ drop table t1; # # Check strnxfrm() with odd length # -set max_sort_length=9; +set max_sort_length=65; select @@max_sort_length; @@max_sort_length -9 +65 create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine heap; insert into t1 values ('a'),('b'),('c'); select * from t1 order by a; diff --git a/mysql-test/r/ctype_utf8mb4_innodb.result b/mysql-test/r/ctype_utf8mb4_innodb.result index 7c95906a742..e9e54cb86fc 100644 --- a/mysql-test/r/ctype_utf8mb4_innodb.result +++ b/mysql-test/r/ctype_utf8mb4_innodb.result @@ -1438,7 +1438,7 @@ a varchar(255) NOT NULL default '', KEY a (a) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci; Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes insert into t1 values (_utf8mb4 0xe880bd); insert into t1 values (_utf8mb4 0x5b); select hex(a) from t1; @@ -1486,7 +1486,7 @@ Warnings: Note 1051 Unknown table 'test.t1' CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); INSERT INTO t1 VALUES('uu'); check table t1; @@ -2331,10 +2331,10 @@ drop table t1; # # Check strnxfrm() with odd length # -set max_sort_length=9; +set max_sort_length=65; select @@max_sort_length; @@max_sort_length -9 +65 create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine InnoDB; insert into t1 values ('a'),('b'),('c'); select * from t1 order by a; diff --git a/mysql-test/r/ctype_utf8mb4_myisam.result b/mysql-test/r/ctype_utf8mb4_myisam.result index f06a1fc53f3..408b4f9c68b 100644 --- a/mysql-test/r/ctype_utf8mb4_myisam.result +++ b/mysql-test/r/ctype_utf8mb4_myisam.result @@ -1438,7 +1438,7 @@ a varchar(255) NOT NULL default '', KEY a (a) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes insert into t1 values (_utf8mb4 0xe880bd); insert into t1 values (_utf8mb4 0x5b); select hex(a) from t1; @@ -1486,7 +1486,7 @@ Warnings: Note 1051 Unknown table 'test.t1' CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); INSERT INTO t1 VALUES('uu'); check table t1; @@ -2331,10 +2331,10 @@ drop table t1; # # Check strnxfrm() with odd length # -set max_sort_length=9; +set max_sort_length=65; select @@max_sort_length; @@max_sort_length -9 +65 create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine MyISAM; insert into t1 values ('a'),('b'),('c'); select * from t1 order by a; diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result index d4e8feff740..25237aa11a9 100644 --- a/mysql-test/r/derived_cond_pushdown.result +++ b/mysql-test/r/derived_cond_pushdown.result @@ -10593,4 +10593,45 @@ a abc DROP VIEW v1; DROP TABLE t1; +# +# MDEV-19179: pushdown into UNION of aggregation selects whose +# corresponding columns have different names +# +create table t1 (a int); +insert into t1 values (3), (7), (1); +select * +from (select min(a) as x from t1 union all select max(a) as y from t1) t +where x>0; +x +1 +7 +explain extended select * +from (select min(a) as x from t1 union all select max(a) as y from t1) t +where x>0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 100.00 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 +3 UNION t1 ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select `t`.`x` AS `x` from (select min(`test`.`t1`.`a`) AS `x` from `test`.`t1` having `x` > 0 union all select max(`test`.`t1`.`a`) AS `x` from `test`.`t1` having `x` > 0) `t` where `t`.`x` > 0 +prepare stmt from "select * +from (select min(a) as x from t1 union all select max(a) as y from t1) t +where x>0"; +execute stmt; +x +1 +7 +execute stmt; +x +1 +7 +deallocate prepare stmt; +create view v1(m) as +select min(a) as x from t1 union all select max(a) as y from t1; +select * from v1 where m > 0; +m +1 +7 +drop view v1; +drop table t1; # End of 10.2 tests diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 992f935b14e..da33e7bbc2c 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -1280,5 +1280,17 @@ Name_exp_1 DROP VIEW v1; DROP TABLE t1; # +# MDEV-4677 GROUP_CONCAT not showing any output with group_concat_max_len >= 4Gb +# +set group_concat_max_len=1024*1024*1024*4; +Warnings: +Warning 1292 Truncated incorrect group_concat_max_len value: '4294967296' +create table t1 (i int, j int); +insert into t1 values (1,1),(1,2); +select i, group_concat(j) from t1 group by i; +i group_concat(j) +1 1,2 +drop table t1; +# # End of 10.2 tests # diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 0f9fdefb81a..fb07ba76fb2 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -2458,3 +2458,37 @@ select count(*)+sleep(0) from t1; count(*)+sleep(0) 2 drop table t1; +# +# MDEV-25112: MIN/MAX optimization for query containing BETWEEN in WHERE +# +create table t1 (a int) engine=myisam; +insert into t1 values (267), (273), (287), (303), (308); +select max(a) from t1 where a < 303 and (a between 267 AND 287); +max(a) +287 +explain select max(a) from t1 where a < 303 and (a between 267 AND 287); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +select min(a) from t1 where a > 267 and (a between 273 AND 303); +min(a) +273 +explain select min(a) from t1 where a > 267 and (a between 273 AND 303); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +create index idx on t1(a); +select max(a) from t1 where a < 303 and (a between 267 AND 287); +max(a) +287 +explain select max(a) from t1 where a < 303 and (a between 267 AND 287); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +select min(a) from t1 where a > 267 and (a between 273 AND 303); +min(a) +273 +explain select min(a) from t1 where a > 267 and (a between 273 AND 303); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +drop table t1; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result index 0ba8e41f164..5bcd98ca238 100644 --- a/mysql-test/r/func_like.result +++ b/mysql-test/r/func_like.result @@ -289,3 +289,21 @@ a b c d 3 f_ 1 0 1 3 f\_ 0 1 0 drop table t1; +create table t1 (f int); +insert t1 values (1),(2); +select 1 from (select distinct * from t1) as x where f < (select 1 like 2 escape (3=1)); +1 +drop table t1; +create table t1(f1 int); +insert into t1 values(1); +update (select 1 like 2 escape (1 in (select 1 from t1))) x, t1 as d set d.f1 = 1; +ERROR HY000: Incorrect arguments to ESCAPE +select * from (select 1 like 2 escape (1 in (select 1 from t1))) x; +1 like 2 escape (1 in (select 1 from t1)) +0 +drop table t1; +create table t1 (f int); +insert t1 values (1),(2); +create view v1 as select * from t1 where (1 like 2 escape (3 in (('h', 'b') in (select 'k', 'k' union select 'g', 'j'))) and f >= 0); +drop view v1; +drop table t1; diff --git a/mysql-test/r/gis-json.result b/mysql-test/r/gis-json.result index 1d6e2193fc9..e52a7c809c6 100644 --- a/mysql-test/r/gis-json.result +++ b/mysql-test/r/gis-json.result @@ -62,9 +62,9 @@ SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}')) GEOMETRYCOLLECTION(POINT(102 0.5)) SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5)); -ERROR HY000: Incorrect option value: '5' for function ST_GeometryFromJSON +ERROR HY000: Incorrect option value: '5' for function ST_GeomFromGeoJSON SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1)); -ERROR 22023: Invalid GIS data provided to function ST_GeometryFromJSON. +ERROR 22023: Invalid GIS data provided to function ST_GeomFromGeoJSON. SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2)); ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2)) POINT(5.3 15) @@ -104,6 +104,9 @@ a NULL Warnings: Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array. +SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }"); +ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }") +NULL # # End of 10.2 tests # diff --git a/mysql-test/r/gis-precise.result b/mysql-test/r/gis-precise.result index d5e1751d800..aaeb6e852a1 100644 --- a/mysql-test/r/gis-precise.result +++ b/mysql-test/r/gis-precise.result @@ -807,3 +807,114 @@ SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))); ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))) POLYGON((9 9,5 2,4 5,9 9)) +# +# MDEV-13467 Feature request: Support for ST_Distance_Sphere() +# +SELECT ST_DISTANCE_SPHERE(); +ERROR 42000: Incorrect parameter count in the call to native function 'ST_DISTANCE_SPHERE' +SELECT ST_DISTANCE_SPHERE(NULL); +ERROR 42000: Incorrect parameter count in the call to native function 'ST_DISTANCE_SPHERE' +SELECT ST_DISTANCE_SPHERE(NULL, NULL); +ST_DISTANCE_SPHERE(NULL, NULL) +NULL +SELECT ST_DISTANCE_SPHERE(NULL, NULL, 3); +ST_DISTANCE_SPHERE(NULL, NULL, 3) +NULL +SELECT ST_DISTANCE_SPHERE(NULL, 1, 3); +ST_DISTANCE_SPHERE(NULL, 1, 3) +NULL +SELECT ST_DISTANCE_SPHERE(1, NULL, 3); +ST_DISTANCE_SPHERE(1, NULL, 3) +NULL +SELECT ST_DISTANCE_SPHERE(1, 1); +ERROR 22023: Invalid GIS data provided to function ST_Distance_Sphere. +SELECT ST_DISTANCE_SPHERE(1, 1, 3); +ERROR 22023: Invalid GIS data provided to function ST_Distance_Sphere. +SELECT ST_DISTANCE_SPHERE(1, 1, NULL); +ST_DISTANCE_SPHERE(1, 1, NULL) +NULL +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')); +ERROR HY000: Internal error: st_distance_sphere +# Test Points and radius +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')) +157249.0357231545 +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10) +157225.0865419108 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1) +0.024682056391766436 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0); +ERROR HY000: Internal error: Radius must be greater than zero. +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1); +ERROR HY000: Internal error: Radius must be greater than zero. +# Test longitude/lattitude +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) +157225.0865419108 +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10) +222355.4901806686 +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) +222389.3645969269 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)')) +157249.0357231545 +# Test Points - Multipoints +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)')) +157249.0357231545 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)')) +157249.0357231545 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)')) +157249.0357231545 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)')) +157249.0357231545 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1) +0.024682056391766436 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1) +0.024682056391766436 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1) +0.024682056391766436 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1) +0.024682056391766436 +# Test Multipoints - Multipoints +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')); +ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')) +0 +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10) +314282.5644496733 +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10) +314282.5644496733 +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17); +TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17) +0.04933028646581131 +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0); +ERROR HY000: Internal error: Radius must be greater than zero. +set @pt1 = ST_GeomFromText('POINT(190 -30)'); +set @pt2 = ST_GeomFromText('POINT(-30 50)'); +SELECT ST_Distance_Sphere(@pt1, @pt2); +ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_Distance_Sphere. +set @pt1 = ST_GeomFromText('POINT(135 -30)'); +set @pt2 = ST_GeomFromText('POINT(-30 91)'); +SELECT ST_Distance_Sphere(@pt1, @pt2); +ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_Distance_Sphere. +set @zenica = ST_GeomFromText('POINT(17.907743 44.203438)'); +set @sarajevo = ST_GeomFromText('POINT(18.413076 43.856258)'); +SELECT TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10); +TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10) +55878.5933759170 +SELECT TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10); +TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10) +55878.5933759170 diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index c996627486c..55e7703a377 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -2875,3 +2875,47 @@ WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY c GROUP BY t.table_name; ERROR HY001: Out of sort memory, consider increasing server sort buffer size SET max_sort_length= @save_max_sort_length; +# +# MDEV-23826: ORDER BY in view definition leads to wrong result with GROUP BY on query using view +# +CREATE TABLE t1 +( +id INT PRIMARY KEY AUTO_INCREMENT, +dt datetime, +INDEX(dt), +foo int +); +INSERT INTO t1 VALUES (1,'2020-09-26 12:00:00',1); +INSERT INTO t1 VALUES (2,'2020-09-26 13:00:00',1); +INSERT INTO t1 VALUES (3,'2020-09-27 13:00:00',1); +INSERT INTO t1 VALUES (4,'2020-09-27 12:00:00',1); +INSERT INTO t1 VALUES (5,'2020-09-28 12:00:00',1); +INSERT INTO t1 VALUES (6,'2020-09-28 13:00:00',1); +INSERT INTO t1 VALUES (7,'2020-09-25 12:00:00',1); +INSERT INTO t1 VALUES (8,'2020-09-25 13:00:00',1); +INSERT INTO t1 VALUES (9,'2020-09-26 13:00:00',1); +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE VIEW v2 AS SELECT * FROM t1 ORDER BY dt; +SELECT dt, sum(foo) AS foo FROM v1 WHERE dt>DATE_SUB('2020-09-27 00:00:00', INTERVAL 3 DAY) GROUP BY dt; +dt foo +2020-09-25 12:00:00 1 +2020-09-25 13:00:00 1 +2020-09-26 12:00:00 1 +2020-09-26 13:00:00 2 +2020-09-27 12:00:00 1 +2020-09-27 13:00:00 1 +2020-09-28 12:00:00 1 +2020-09-28 13:00:00 1 +SELECT dt, sum(foo) AS foo FROM v2 WHERE dt>DATE_SUB('2020-09-27 00:00:00', INTERVAL 3 DAY) GROUP BY dt; +dt foo +2020-09-25 12:00:00 1 +2020-09-25 13:00:00 1 +2020-09-26 12:00:00 1 +2020-09-26 13:00:00 2 +2020-09-27 12:00:00 1 +2020-09-27 13:00:00 1 +2020-09-28 12:00:00 1 +2020-09-28 13:00:00 1 +DROP TABLE t1; +DROP VIEW v1,v2; +# End of 10.2 tests diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 7644ff4e7a2..1594ebf75e0 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -843,6 +843,7 @@ information_schema.columns where data_type = 'longtext' and table_schema != 'performance_schema'; table_schema table_name column_name information_schema ALL_PLUGINS PLUGIN_DESCRIPTION +information_schema CHECK_CONSTRAINTS CHECK_CLAUSE information_schema COLUMNS COLUMN_DEFAULT information_schema COLUMNS COLUMN_TYPE information_schema COLUMNS GENERATION_EXPRESSION @@ -2193,7 +2194,19 @@ SCHEMA_NAME SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION Warnings: -Warning 1931 Query execution was interrupted. The query examined at least 666 rows, which exceeds LIMIT ROWS EXAMINED (10). The query result may be incomplete +Warning 1931 Query execution was interrupted. The query examined at least ### rows, which exceeds LIMIT ROWS EXAMINED (10). The query result may be incomplete +# +# MDEV-24179: AAssertion `m_status == DA_ERROR || m_status == DA_OK || +# m_status == DA_OK_BULK' failed in Diagnostics_area::message() +# +call mtr.add_suppression("Sort aborted.*"); +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema; +SELECT * FROM v LIMIT ROWS EXAMINED 9; +ERROR HY000: Sort aborted: +DROP VIEW v; # # End of 10.2 Test # diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result index c7a5b1a80ca..76e6cd000f9 100644 --- a/mysql-test/r/innodb_ext_key.result +++ b/mysql-test/r/innodb_ext_key.result @@ -790,3 +790,19 @@ EXPLAIN } drop table t1; SET optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +# +# MDEV-11172: EXPLAIN shows non-sensical value for key_len with type=index +# +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +CREATE TABLE t2 ( +pk VARCHAR(50), +a VARCHAR(20), +KEY k1(a), +PRIMARY KEY(pk) +)ENGINE=INNODB; +INSERT INTO t2 SELECT a,a FROM t1; +EXPLAIN SELECT pk FROM t2 FORCE INDEX(k1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index NULL k1 23 NULL # Using index +DROP TABLE t1,t2; diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result index e41c79a59f9..6b458e0733a 100644 --- a/mysql-test/r/join_cache.result +++ b/mysql-test/r/join_cache.result @@ -6054,4 +6054,87 @@ select f2 from t2,t1 where f2 = 0; f2 drop table t1, t2; set join_buffer_size=@save_join_buffer_size; +# +# MDEV-21104: BNLH used for multi-join query with embedded outer join +# and possible 'not exists' optimization +# +set join_cache_level=4; +CREATE TABLE t1 (a int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b int, c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2),(2,4); +CREATE TABLE t3 (d int, KEY(d)) ENGINE=MyISAM; +INSERT INTO t3 VALUES (1),(2); +CREATE TABLE t4 (e int primary key) ENGINE=MyISAM; +INSERT INTO t4 VALUES (1),(2); +ANALYZE TABLE t1,t2,t3,t4; +Table Op Msg_type Msg_text +test.t1 analyze status OK +test.t2 analyze status OK +test.t3 analyze status OK +test.t4 analyze status OK +SELECT * FROM t2 LEFT JOIN t3 ON c = d; +b c d +1 2 2 +2 4 NULL +SELECT * FROM (t2 LEFT JOIN t3 ON c = d ) JOIN t4; +b c d e +1 2 2 1 +2 4 NULL 1 +1 2 2 2 +2 4 NULL 2 +EXPLAIN SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 hash_index d #hash#d:d 5:5 test.t2.c 2 Using where; Using index; Using join buffer (incremental, BNLH join) +1 SIMPLE t4 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t2.b 2 Using index; Using join buffer (incremental, BNLH join) +SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e; +a b c d e +1 1 2 2 1 +2 1 2 2 1 +1 2 4 NULL 2 +2 2 4 NULL 2 +EXPLAIN SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e +WHERE e IS NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 hash_index d #hash#d:d 5:5 test.t2.c 2 Using where; Using index; Using join buffer (incremental, BNLH join) +1 SIMPLE t4 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t2.b 2 Using where; Using index; Not exists; Using join buffer (incremental, BNLH join) +SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e +WHERE e IS NULL; +a b c d e +DROP TABLE t1,t2,t3,t4; +set join_cache_level=@save_join_cache_level; +# +# MDEV-24767: forced BNLH used for equi-join supported by compound index +# +create table t1 (a int, b int, c int ) engine=myisam ; +create table t2 (a int, b int, c int, primary key (c,a,b)) engine=myisam ; +insert into t1 values (3,4,2), (5,6,4); +insert into t2 values (3,4,2), (5,6,4); +select t1.a, t1.b, t1.c from t1,t2 +where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c; +a b c +3 4 2 +5 6 4 +explain select t1.a, t1.b, t1.c from t1,t2 +where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.c,test.t1.a,test.t1.b 1 Using index +set join_cache_level=3; +select t1.a, t1.b, t1.c from t1,t2 +where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c; +a b c +3 4 2 +5 6 4 +explain select t1.a, t1.b, t1.c from t1,t2 +where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 hash_index PRIMARY #hash#PRIMARY:PRIMARY 12:12 test.t1.c,test.t1.a,test.t1.b 2 Using index; Using join buffer (flat, BNLH join) +drop table t1,t2; +set join_cache_level=@save_join_cache_level; set @@optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result index e3fbb830df5..bda6bddb7de 100644 --- a/mysql-test/r/kill.result +++ b/mysql-test/r/kill.result @@ -415,3 +415,8 @@ ALTER TABLE t2 DROP c; UNLOCK TABLES; DROP VIEW v1; DROP TABLE t1, t2; +# +# KILL QUERY ID USER +# +kill query id user 'foo'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''foo'' at line 1 diff --git a/mysql-test/r/lock_view.result b/mysql-test/r/lock_view.result index 4d375bace42..364c2cddf60 100644 --- a/mysql-test/r/lock_view.result +++ b/mysql-test/r/lock_view.result @@ -229,3 +229,37 @@ drop user definer@localhost; drop database mysqltest1; drop database mysqltest2; drop database mysqltest3; +# +# MDEV-24331 mysqldump fails with "Got error: 1356" if the database contains a view with a subquery +# +create user u1@localhost; +grant all privileges on test.* to u1@localhost; +connect con1,localhost,u1; +use test; +create table t1 (id int not null); +create view v1 as select * from (select * from t1) dt; +lock table v1 read; +disconnect con1; +connection default; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v1` ( + `id` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +/*!50001 DROP TABLE IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`u1`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v1` AS select `dt`.`id` AS `id` from (select `test`.`t1`.`id` AS `id` from `test`.`t1`) `dt` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +drop view v1; +drop table t1; +drop user u1@localhost; diff --git a/mysql-test/r/mix2_myisam.result b/mysql-test/r/mix2_myisam.result index 34764466d2a..dbc992ece23 100644 --- a/mysql-test/r/mix2_myisam.result +++ b/mysql-test/r/mix2_myisam.result @@ -1989,7 +1989,7 @@ a b drop table t1; create table t1 (v varchar(65530), key(v)); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes drop table t1; SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR create table t1 (v varchar(65536)); diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index dc99dc06b6d..1a0fb5f0c04 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1695,7 +1695,7 @@ a b drop table t1; create table t1 (v varchar(65530), key(v)); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes drop table if exists t1; set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for create table t1 (v varchar(65536)); @@ -1968,7 +1968,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a varchar(2048), key `a` (a)); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1978,7 +1978,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a varchar(2048), key `a` (a) key_block_size=1024); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1988,7 +1988,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=1024; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -2034,7 +2034,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=8192; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -2046,7 +2046,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -2076,7 +2076,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -2322,6 +2322,7 @@ Key Start Len Index Type 1 2 30 multip. varchar 2 33 30 multip. char NULL DROP TABLE t1; +set statement sql_mode='' for create table t1 (n int not null, c char(1)) transactional=1; Warnings: Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1' diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index b6fb56a63e0..3961c7e8c27 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -476,8 +476,6 @@ even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@loca DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost; DROP PROCEDURE test.pr; use test; -call mtr.add_suppression('Column last_update in table `mysql`.`innodb_table_stats` is INT NOT NULL but should be'); -alter table mysql.innodb_table_stats modify last_update int not null; create table extralongname_extralongname_extralongname_extralongname_ext ( id int(10) unsigned not null, created_date date not null, @@ -713,9 +711,9 @@ user CREATE TABLE `user` ( `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `max_statement_time` decimal(12,6) NOT NULL DEFAULT 0.000000, - `password_last_changed` timestamp NULL DEFAULT NULL, + `password_last_changed` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `password_lifetime` smallint(5) unsigned DEFAULT NULL, - `account_locked` enum('N','Y') COLLATE utf8_bin NOT NULL DEFAULT 'N', + `account_locked` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' CREATE ROLE `aRole`; @@ -728,6 +726,132 @@ mysql.session N root N mysql.sys N aRole Y +DROP ROLE aRole; +# +# MDEV-24122: Fix previously MySQL-5.7 data directories that upgraded prior to MDEV-23201 +# +# +DROP TABLE IF EXISTS mysql.user; +FLUSH TABLES mysql.user; +ALTER TABLE mysql.user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; +ALTER TABLE mysql.user ADD default_role char(80) binary DEFAULT '' NOT NULL; +ALTER TABLE mysql.user ADD max_statement_time decimal(12,6) DEFAULT 0 NOT NULL; +FLUSH PRIVILEGES; +Phase 1/7: Checking and upgrading mysql database +Processing databases +mysql +mysql.column_stats OK +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.gtid_slave_pos OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.host OK +mysql.index_stats OK +mysql.innodb_index_stats OK +mysql.innodb_table_stats OK +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.proxies_priv OK +mysql.roles_mapping OK +mysql.servers OK +mysql.table_stats OK +mysql.tables_priv OK +mysql.time_zone OK +mysql.time_zone_leap_second OK +mysql.time_zone_name OK +mysql.time_zone_transition OK +mysql.time_zone_transition_type OK +mysql.user OK +Phase 2/7: Installing used storage engines... Skipped +Phase 3/7: Fixing views +Phase 4/7: Running 'mysql_fix_privilege_tables' +Phase 5/7: Fixing table and database names +Phase 6/7: Checking and upgrading tables +Processing databases +information_schema +mtr +mtr.global_suppressions OK +mtr.test_suppressions OK +performance_schema +test +Phase 7/7: Running 'FLUSH PRIVILEGES' +OK +SHOW CREATE TABLE mysql.user; +Table Create Table +user CREATE TABLE `user` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '', + `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '', + `ssl_cipher` blob NOT NULL, + `x509_issuer` blob NOT NULL, + `x509_subject` blob NOT NULL, + `max_questions` int(11) unsigned NOT NULL DEFAULT 0, + `max_updates` int(11) unsigned NOT NULL DEFAULT 0, + `max_connections` int(11) unsigned NOT NULL DEFAULT 0, + `max_user_connections` int(11) NOT NULL DEFAULT 0, + `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '', + `authentication_string` text COLLATE utf8_bin NOT NULL, + `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `max_statement_time` decimal(12,6) NOT NULL DEFAULT 0.000000, + `password_last_changed` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `password_lifetime` smallint(5) unsigned DEFAULT NULL, + `account_locked` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + PRIMARY KEY (`Host`,`User`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' +CREATE ROLE `aRole`; +SET DEFAULT ROLE aRole; +SHOW GRANTS; +Grants for root@localhost +GRANT aRole TO 'root'@'localhost' WITH ADMIN OPTION +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +GRANT USAGE ON *.* TO 'aRole' +SET DEFAULT ROLE aRole FOR 'root'@'localhost' +SET DEFAULT ROLE NONE; +SHOW GRANTS; +Grants for root@localhost +GRANT aRole TO 'root'@'localhost' WITH ADMIN OPTION +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +GRANT USAGE ON *.* TO 'aRole' DROP ROLE `aRole`; FLUSH PRIVILEGES; End of 10.2 tests diff --git a/mysql-test/r/mysqldump-system,win.rdiff b/mysql-test/r/mysqldump-system,win.rdiff new file mode 100644 index 00000000000..5a80c71ae57 --- /dev/null +++ b/mysql-test/r/mysqldump-system,win.rdiff @@ -0,0 +1,120 @@ +diff --git a/mysql-test/r/mysqldump-system.result b/mysql-test/r/mysqldump-system.result +index 88cf950c621..5f8b579fa67 100644 +--- a/mysql-test/r/mysqldump-system.result ++++ b/mysql-test/r/mysqldump-system.result +@@ -7,8 +7,6 @@ + delete from mysql.user where host not in ('localhost'); + flush privileges; + create user USER; +-install plugin /*M!100401 IF NOT EXISTS */ unix_socket soname 'auth_socket.so';; +-alter user USER identified via unix_socket; + CREATE ROLE role_1; + CREATE ROLE role_2 WITH ADMIN role_1; + GRANT SHOW DATABASES ON *.* TO role_1; +@@ -48,9 +46,8 @@ + /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; + /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +-INSTALL PLUGIN unix_socket SONAME 'auth_socket.so'; + CREATE USER 'root'@'localhost'; +-CREATE USER 'USER'@'%' IDENTIFIED VIA unix_socket; ++CREATE USER 'USER'@'%'; + SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role; + CREATE ROLE IF NOT EXISTS mariadb_dump_import_role; + GRANT mariadb_dump_import_role TO CURRENT_USER(); +@@ -68,7 +65,7 @@ + /*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */; + GRANT role_1 TO 'USER'@'%'; + GRANT role_2 TO 'USER'@'%'; +-GRANT USAGE ON *.* TO 'USER'@'%' IDENTIFIED VIA unix_socket; ++GRANT USAGE ON *.* TO 'USER'@'%'; + /*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */; + /*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */; + GRANT role_2 TO 'role_1' WITH ADMIN OPTION; +@@ -168,8 +165,6 @@ + /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; + /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +-/*M!100401 UNINSTALL PLUGIN IF EXIST unix_socket */; +-INSTALL PLUGIN unix_socket SONAME 'auth_socket.so'; + DELIMITER | + /*M!100101 IF current_user()="'root'@'localhost'" THEN + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'root'@'localhost''"; +@@ -183,7 +178,7 @@ + END IF */| + DELIMITER ; + /*!50701 DROP USER IF EXISTS 'USER'@'%' */; +-CREATE /*M!100103 OR REPLACE */ USER 'USER'@'%' IDENTIFIED VIA unix_socket; ++CREATE /*M!100103 OR REPLACE */ USER 'USER'@'%'; + SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role; + CREATE ROLE IF NOT EXISTS mariadb_dump_import_role; + GRANT mariadb_dump_import_role TO CURRENT_USER(); +@@ -203,7 +198,7 @@ + /*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */; + GRANT role_1 TO 'USER'@'%'; + GRANT role_2 TO 'USER'@'%'; +-GRANT USAGE ON *.* TO 'USER'@'%' IDENTIFIED VIA unix_socket; ++GRANT USAGE ON *.* TO 'USER'@'%'; + /*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */; + /*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */; + GRANT role_2 TO 'role_1' WITH ADMIN OPTION; +@@ -304,9 +299,8 @@ + /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; + /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +-INSTALL PLUGIN unix_socket /*M!100401 IF NOT EXISTS */ SONAME 'auth_socket.so'; + CREATE USER IF NOT EXISTS 'root'@'localhost'; +-CREATE USER IF NOT EXISTS 'USER'@'%' IDENTIFIED VIA unix_socket; ++CREATE USER IF NOT EXISTS 'USER'@'%'; + SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role; + CREATE ROLE IF NOT EXISTS mariadb_dump_import_role; + GRANT mariadb_dump_import_role TO CURRENT_USER(); +@@ -324,7 +318,7 @@ + /*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */; + GRANT role_1 TO 'USER'@'%'; + GRANT role_2 TO 'USER'@'%'; +-GRANT USAGE ON *.* TO 'USER'@'%' IDENTIFIED VIA unix_socket; ++GRANT USAGE ON *.* TO 'USER'@'%'; + /*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */; + /*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */; + GRANT role_2 TO 'role_1' WITH ADMIN OPTION; +@@ -413,12 +407,12 @@ + CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin, + mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats; + Table Checksum +-mysql.user 205632094 ++mysql.user 926820922 + mysql.roles_mapping 3150178430 + mysql.time_zone_transition 3895294076 +-mysql.plugin 1520695737 ++mysql.plugin 0 + mysql.servers 2783974349 +-mysql.func 3241572444 ++mysql.func 310494789 + mysql.innodb_table_stats 347867921 + mysql.table_stats 664320059 + # Opps.... +@@ -442,12 +436,12 @@ + CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin, + mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats; + Table Checksum +-mysql.user 205632094 ++mysql.user 926820922 + mysql.roles_mapping 3150178430 + mysql.time_zone_transition 3895294076 +-mysql.plugin 1520695737 ++mysql.plugin 0 + mysql.servers 2783974349 +-mysql.func 3241572444 ++mysql.func 310494789 + mysql.innodb_table_stats 347867921 + mysql.table_stats 664320059 + DROP FUNCTION IF EXISTS metaphon; +@@ -461,7 +455,6 @@ + DROP ROLE role_2; + DROP ROLE role_1; + drop user USER; +-uninstall plugin unix_socket; + insert into mysql.user select * from backup_users; + flush privileges; + drop table backup_users; diff --git a/mysql-test/r/mysqldump-system.result b/mysql-test/r/mysqldump-system.result new file mode 100644 index 00000000000..74cfc4e9882 --- /dev/null +++ b/mysql-test/r/mysqldump-system.result @@ -0,0 +1,467 @@ +# +# MDEV-23630: mysqldump to logically dump system tables +# +# +create table backup_users like mysql.user; +insert into backup_users select * from mysql.user where host not in ('localhost'); +delete from mysql.user where host not in ('localhost'); +flush privileges; +create user USER; +install plugin /*M!100401 IF NOT EXISTS */ unix_socket soname 'auth_socket.so';; +alter user USER identified via unix_socket; +CREATE ROLE role_1; +CREATE ROLE role_2 WITH ADMIN role_1; +GRANT SHOW DATABASES ON *.* TO role_1; +GRANT role_1 TO USER; +GRANT role_2 TO USER; +SET DEFAULT ROLE role_2 FOR USER; +ALTER TABLE mysql.roles_mapping ORDER BY Host, User, Role; +set @save_innodb_stats_persistent= @@innodb_stats_persistent; +create table mysql.tz like mysql.time_zone_transition; +alter table mysql.tz engine=innodb; +insert into mysql.tz select * from mysql.time_zone_transition; +set global innodb_stats_persistent=1; +ANALYZE TABLE mysql.tz PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +mysql.tz analyze status Engine-independent statistics collected +mysql.tz analyze status OK +delete from mysql.index_stats where prefix_arity!=1; +delete from mysql.column_stats where column_name!='Time_zone_id'; +set time_zone="+03:00"; +update mysql.innodb_index_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz"; +update mysql.innodb_table_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz"; +set global innodb_stats_persistent= @save_innodb_stats_persistent; +alter table mysql.time_zone_name ORDER BY Name; +CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(Host 'localhost'); +CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +# +# mysqldump of system tables with --system=all +# + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +INSTALL PLUGIN unix_socket SONAME 'auth_socket.so'; +CREATE USER 'root'@'localhost'; +CREATE USER 'USER'@'%' IDENTIFIED VIA unix_socket; +SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role; +CREATE ROLE IF NOT EXISTS mariadb_dump_import_role; +GRANT mariadb_dump_import_role TO CURRENT_USER(); +SET ROLE mariadb_dump_import_role; +/*!80001 CREATE ROLE 'role_1' */; +/*M!100005 CREATE ROLE 'role_1' WITH ADMIN mariadb_dump_import_role */; +/*M!100005 GRANT 'role_1' TO 'root'@'localhost' WITH ADMIN OPTION */; +/*!80001 CREATE ROLE 'role_2' */; +/*M!100005 CREATE ROLE 'role_2' WITH ADMIN mariadb_dump_import_role */; +/*M!100005 GRANT 'role_2' TO 'role_1' WITH ADMIN OPTION */; +GRANT role_1 TO 'root'@'localhost' WITH ADMIN OPTION; +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION; +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION; +/*M!100005 SET DEFAULT ROLE NONE FOR 'root'@'localhost' */; +/*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */; +GRANT role_1 TO 'USER'@'%'; +GRANT role_2 TO 'USER'@'%'; +GRANT USAGE ON *.* TO 'USER'@'%' IDENTIFIED VIA unix_socket; +/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */; +/*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */; +GRANT role_2 TO 'role_1' WITH ADMIN OPTION; +GRANT SHOW DATABASES ON *.* TO 'role_1'; +GRANT USAGE ON *.* TO 'role_2'; +GRANT USAGE ON *.* TO 'role_2'; +SET ROLE NONE; +DROP ROLE mariadb_dump_import_role; +/*M!100203 EXECUTE IMMEDIATE CONCAT('SET ROLE ', @current_role) */; +CREATE FUNCTION metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB'; +CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (Host 'localhost', Port 3306); + +USE mysql; + +LOCK TABLES `column_stats` WRITE; +/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */; +REPLACE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,0,NULL,NULL); +/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `index_stats` WRITE; +/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */; +REPLACE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500); +/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `table_stats` WRITE; +/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */; +REPLACE INTO `table_stats` VALUES ('mysql','tz',393); +/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `innodb_index_stats` WRITE; +/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */; +REPLACE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index'); +/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `innodb_table_stats` WRITE; +/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */; +REPLACE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0); +/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */; +UNLOCK TABLES; + +USE mysql; + +LOCK TABLES `time_zone` WRITE; +/*!40000 ALTER TABLE `time_zone` DISABLE KEYS */; +REPLACE INTO `time_zone` VALUES (1,'N'),(2,'N'),(3,'N'),(4,'Y'),(5,'N'); +/*!40000 ALTER TABLE `time_zone` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `time_zone_name` WRITE; +/*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */; +REPLACE INTO `time_zone_name` VALUES ('Europe/Moscow',3),('Japan',5),('leap/Europe/Moscow',4),('MET',1),('Universal',2),('UTC',2); +/*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `time_zone_leap_second` WRITE; +/*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */; +REPLACE INTO `time_zone_leap_second` VALUES (78796800,1),(94694401,2),(126230402,3),(157766403,4),(189302404,5),(220924805,6),(252460806,7),(283996807,8),(315532808,9),(362793609,10),(394329610,11),(425865611,12),(489024012,13),(567993613,14),(631152014,15),(662688015,16),(709948816,17),(741484817,18),(773020818,19),(820454419,20),(867715220,21),(915148821,22); +/*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `time_zone_transition` WRITE; +/*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */; +REPLACE INTO `time_zone_transition` VALUES (1,-1693706400,0),(1,-1680483600,1),(1,-1663455600,2),(1,-1650150000,3),(1,-1632006000,2),(1,-1618700400,3),(1,-938905200,2),(1,-857257200,3),(1,-844556400,2),(1,-828226800,3),(1,-812502000,2),(1,-796777200,3),(1,228877200,2),(1,243997200,3),(1,260326800,2),(1,276051600,3),(1,291776400,2),(1,307501200,3),(1,323830800,2),(1,338950800,3),(1,354675600,2),(1,370400400,3),(1,386125200,2),(1,401850000,3),(1,417574800,2),(1,433299600,3),(1,449024400,2),(1,465354000,3),(1,481078800,2),(1,496803600,3),(1,512528400,2),(1,528253200,3),(1,543978000,2),(1,559702800,3),(1,575427600,2),(1,591152400,3),(1,606877200,2),(1,622602000,3),(1,638326800,2),(1,654656400,3),(1,670381200,2),(1,686106000,3),(1,701830800,2),(1,717555600,3),(1,733280400,2),(1,749005200,3),(1,764730000,2),(1,780454800,3),(1,796179600,2),(1,811904400,3),(1,828234000,2),(1,846378000,3),(1,859683600,2),(1,877827600,3),(1,891133200,2),(1,909277200,3),(1,922582800,2),(1,941331600,3),(1,954032400,2),(1,972781200,3),(1,985482000,2),(1,1004230800,3),(1,1017536400,2),(1,1035680400,3),(1,1048986000,2),(1,1067130000,3),(1,1080435600,2),(1,1099184400,3),(1,1111885200,2),(1,1130634000,3),(1,1143334800,2),(1,1162083600,3),(1,1174784400,2),(1,1193533200,3),(1,1206838800,2),(1,1224982800,3),(1,1238288400,2),(1,1256432400,3),(1,1269738000,2),(1,1288486800,3),(1,1301187600,2),(1,1319936400,3),(1,1332637200,2),(1,1351386000,3),(1,1364691600,2),(1,1382835600,3),(1,1396141200,2),(1,1414285200,3),(1,1427590800,2),(1,1445734800,3),(1,1459040400,2),(1,1477789200,3),(1,1490490000,2),(1,1509238800,3),(1,1521939600,2),(1,1540688400,3),(1,1553994000,2),(1,1572138000,3),(1,1585443600,2),(1,1603587600,3),(1,1616893200,2),(1,1635642000,3),(1,1648342800,2),(1,1667091600,3),(1,1679792400,2),(1,1698541200,3),(1,1711846800,2),(1,1729990800,3),(1,1743296400,2),(1,1761440400,3),(1,1774746000,2),(1,1792890000,3),(1,1806195600,2),(1,1824944400,3),(1,1837645200,2),(1,1856394000,3),(1,1869094800,2),(1,1887843600,3),(1,1901149200,2),(1,1919293200,3),(1,1932598800,2),(1,1950742800,3),(1,1964048400,2),(1,1982797200,3),(1,1995498000,2),(1,2014246800,3),(1,2026947600,2),(1,2045696400,3),(1,2058397200,2),(1,2077146000,3),(1,2090451600,2),(1,2108595600,3),(1,2121901200,2),(1,2140045200,3),(3,-1688265000,2),(3,-1656819048,1),(3,-1641353448,2),(3,-1627965048,3),(3,-1618716648,1),(3,-1596429048,3),(3,-1593829848,5),(3,-1589860800,4),(3,-1542427200,5),(3,-1539493200,6),(3,-1525323600,5),(3,-1522728000,4),(3,-1491188400,7),(3,-1247536800,4),(3,354920400,5),(3,370728000,4),(3,386456400,5),(3,402264000,4),(3,417992400,5),(3,433800000,4),(3,449614800,5),(3,465346800,8),(3,481071600,9),(3,496796400,8),(3,512521200,9),(3,528246000,8),(3,543970800,9),(3,559695600,8),(3,575420400,9),(3,591145200,8),(3,606870000,9),(3,622594800,8),(3,638319600,9),(3,654649200,8),(3,670374000,10),(3,686102400,11),(3,695779200,8),(3,701812800,5),(3,717534000,4),(3,733273200,9),(3,748998000,8),(3,764722800,9),(3,780447600,8),(3,796172400,9),(3,811897200,8),(3,828226800,9),(3,846370800,8),(3,859676400,9),(3,877820400,8),(3,891126000,9),(3,909270000,8),(3,922575600,9),(3,941324400,8),(3,954025200,9),(3,972774000,8),(3,985474800,9),(3,1004223600,8),(3,1017529200,9),(3,1035673200,8),(3,1048978800,9),(3,1067122800,8),(3,1080428400,9),(3,1099177200,8),(3,1111878000,9),(3,1130626800,8),(3,1143327600,9),(3,1162076400,8),(3,1174777200,9),(3,1193526000,8),(3,1206831600,9),(3,1224975600,8),(3,1238281200,9),(3,1256425200,8),(3,1269730800,9),(3,1288479600,8),(3,1301180400,9),(3,1319929200,8),(3,1332630000,9),(3,1351378800,8),(3,1364684400,9),(3,1382828400,8),(3,1396134000,9),(3,1414278000,8),(3,1427583600,9),(3,1445727600,8),(3,1459033200,9),(3,1477782000,8),(3,1490482800,9),(3,1509231600,8),(3,1521932400,9),(3,1540681200,8),(3,1553986800,9),(3,1572130800,8),(3,1585436400,9),(3,1603580400,8),(3,1616886000,9),(3,1635634800,8),(3,1648335600,9),(3,1667084400,8),(3,1679785200,9),(3,1698534000,8),(3,1711839600,9),(3,1729983600,8),(3,1743289200,9),(3,1761433200,8),(3,1774738800,9),(3,1792882800,8),(3,1806188400,9),(3,1824937200,8),(3,1837638000,9),(3,1856386800,8),(3,1869087600,9),(3,1887836400,8),(3,1901142000,9),(3,1919286000,8),(3,1932591600,9),(3,1950735600,8),(3,1964041200,9),(3,1982790000,8),(3,1995490800,9),(3,2014239600,8),(3,2026940400,9),(3,2045689200,8),(3,2058390000,9),(3,2077138800,8),(3,2090444400,9),(3,2108588400,8),(3,2121894000,9),(3,2140038000,8),(4,-1688265000,2),(4,-1656819048,1),(4,-1641353448,2),(4,-1627965048,3),(4,-1618716648,1),(4,-1596429048,3),(4,-1593829848,5),(4,-1589860800,4),(4,-1542427200,5),(4,-1539493200,6),(4,-1525323600,5),(4,-1522728000,4),(4,-1491188400,7),(4,-1247536800,4),(4,354920409,5),(4,370728010,4),(4,386456410,5),(4,402264011,4),(4,417992411,5),(4,433800012,4),(4,449614812,5),(4,465346812,8),(4,481071612,9),(4,496796413,8),(4,512521213,9),(4,528246013,8),(4,543970813,9),(4,559695613,8),(4,575420414,9),(4,591145214,8),(4,606870014,9),(4,622594814,8),(4,638319615,9),(4,654649215,8),(4,670374016,10),(4,686102416,11),(4,695779216,8),(4,701812816,5),(4,717534017,4),(4,733273217,9),(4,748998018,8),(4,764722818,9),(4,780447619,8),(4,796172419,9),(4,811897219,8),(4,828226820,9),(4,846370820,8),(4,859676420,9),(4,877820421,8),(4,891126021,9),(4,909270021,8),(4,922575622,9),(4,941324422,8),(4,954025222,9),(4,972774022,8),(4,985474822,9),(4,1004223622,8),(4,1017529222,9),(4,1035673222,8),(4,1048978822,9),(4,1067122822,8),(4,1080428422,9),(4,1099177222,8),(4,1111878022,9),(4,1130626822,8),(4,1143327622,9),(4,1162076422,8),(4,1174777222,9),(4,1193526022,8),(4,1206831622,9),(4,1224975622,8),(4,1238281222,9),(4,1256425222,8),(4,1269730822,9),(4,1288479622,8),(4,1301180422,9),(4,1319929222,8),(4,1332630022,9),(4,1351378822,8),(4,1364684422,9),(4,1382828422,8),(4,1396134022,9),(4,1414278022,8),(4,1427583622,9),(4,1445727622,8),(4,1459033222,9),(4,1477782022,8),(4,1490482822,9),(4,1509231622,8),(4,1521932422,9),(4,1540681222,8),(4,1553986822,9),(4,1572130822,8),(4,1585436422,9),(4,1603580422,8),(4,1616886022,9),(4,1635634822,8),(4,1648335622,9),(4,1667084422,8),(4,1679785222,9),(4,1698534022,8),(4,1711839622,9),(4,1729983622,8),(4,1743289222,9),(4,1761433222,8),(4,1774738822,9),(4,1792882822,8),(4,1806188422,9),(4,1824937222,8),(4,1837638022,9),(4,1856386822,8),(4,1869087622,9),(4,1887836422,8),(4,1901142022,9),(4,1919286022,8),(4,1932591622,9),(4,1950735622,8),(4,1964041222,9),(4,1982790022,8),(4,1995490822,9),(4,2014239622,8),(4,2026940422,9),(4,2045689222,8),(4,2058390022,9),(4,2077138822,8),(4,2090444422,9),(4,2108588422,8),(4,2121894022,9),(4,2140038022,8),(5,-1009875600,1); +/*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `time_zone_transition_type` WRITE; +/*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */; +REPLACE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'),(1,1,3600,0,'MET'),(1,2,7200,1,'MEST'),(1,3,3600,0,'MET'),(2,0,0,0,'UTC'),(3,0,9000,0,'MMT'),(3,1,12648,1,'MST'),(3,2,9048,0,'MMT'),(3,3,16248,1,'MDST'),(3,4,10800,0,'MSK'),(3,5,14400,1,'MSD'),(3,6,18000,1,'MSD'),(3,7,7200,0,'EET'),(3,8,10800,0,'MSK'),(3,9,14400,1,'MSD'),(3,10,10800,1,'EEST'),(3,11,7200,0,'EET'),(4,0,9000,0,'MMT'),(4,1,12648,1,'MST'),(4,2,9048,0,'MMT'),(4,3,16248,1,'MDST'),(4,4,10800,0,'MSK'),(4,5,14400,1,'MSD'),(4,6,18000,1,'MSD'),(4,7,7200,0,'EET'),(4,8,10800,0,'MSK'),(4,9,14400,1,'MSD'),(4,10,10800,1,'EEST'),(4,11,7200,0,'EET'),(5,0,32400,0,'CJT'),(5,1,32400,0,'JST'); +/*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +# +# mysqldump of system tables with --system=all --replace +# + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +/*M!100401 UNINSTALL PLUGIN IF EXIST unix_socket */; +INSTALL PLUGIN unix_socket SONAME 'auth_socket.so'; +DELIMITER | +/*M!100101 IF current_user()="'root'@'localhost'" THEN + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'root'@'localhost''"; +END IF */| +DELIMITER ; +/*!50701 DROP USER IF EXISTS 'root'@'localhost' */; +CREATE /*M!100103 OR REPLACE */ USER 'root'@'localhost'; +DELIMITER | +/*M!100101 IF current_user()="'USER'@'%'" THEN + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'USER'@'%''"; +END IF */| +DELIMITER ; +/*!50701 DROP USER IF EXISTS 'USER'@'%' */; +CREATE /*M!100103 OR REPLACE */ USER 'USER'@'%' IDENTIFIED VIA unix_socket; +SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role; +CREATE ROLE IF NOT EXISTS mariadb_dump_import_role; +GRANT mariadb_dump_import_role TO CURRENT_USER(); +SET ROLE mariadb_dump_import_role; +/*!80001 DROP ROLE IF EXISTS 'role_1' */; +/*!80001 CREATE ROLE 'role_1' */; +/*M!100103 CREATE OR REPLACE ROLE 'role_1' WITH ADMIN mariadb_dump_import_role */; +/*M!100005 GRANT 'role_1' TO 'root'@'localhost' WITH ADMIN OPTION */; +/*!80001 DROP ROLE IF EXISTS 'role_2' */; +/*!80001 CREATE ROLE 'role_2' */; +/*M!100103 CREATE OR REPLACE ROLE 'role_2' WITH ADMIN mariadb_dump_import_role */; +/*M!100005 GRANT 'role_2' TO 'role_1' WITH ADMIN OPTION */; +GRANT role_1 TO 'root'@'localhost' WITH ADMIN OPTION; +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION; +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION; +/*M!100005 SET DEFAULT ROLE NONE FOR 'root'@'localhost' */; +/*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */; +GRANT role_1 TO 'USER'@'%'; +GRANT role_2 TO 'USER'@'%'; +GRANT USAGE ON *.* TO 'USER'@'%' IDENTIFIED VIA unix_socket; +/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */; +/*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */; +GRANT role_2 TO 'role_1' WITH ADMIN OPTION; +GRANT SHOW DATABASES ON *.* TO 'role_1'; +GRANT USAGE ON *.* TO 'role_2'; +GRANT USAGE ON *.* TO 'role_2'; +SET ROLE NONE; +DROP ROLE mariadb_dump_import_role; +/*M!100203 EXECUTE IMMEDIATE CONCAT('SET ROLE ', @current_role) */; +/*!50701 DROP FUNCTION IF EXISTS metaphon */; +CREATE /*M!100103 OR REPLACE */ FUNCTION metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB'; +CREATE /*M!100103 OR REPLACE */ SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (Host 'localhost', Port 3306); + +USE mysql; + +LOCK TABLES `column_stats` WRITE; +/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */; +REPLACE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,0,NULL,NULL); +/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `index_stats` WRITE; +/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */; +REPLACE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500); +/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `table_stats` WRITE; +/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */; +REPLACE INTO `table_stats` VALUES ('mysql','tz',393); +/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `innodb_index_stats` WRITE; +/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */; +REPLACE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index'); +/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `innodb_table_stats` WRITE; +/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */; +REPLACE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0); +/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */; +UNLOCK TABLES; + +USE mysql; + +LOCK TABLES `time_zone` WRITE; +/*!40000 ALTER TABLE `time_zone` DISABLE KEYS */; +REPLACE INTO `time_zone` VALUES (1,'N'),(2,'N'),(3,'N'),(4,'Y'),(5,'N'); +/*!40000 ALTER TABLE `time_zone` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `time_zone_name` WRITE; +/*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */; +REPLACE INTO `time_zone_name` VALUES ('Europe/Moscow',3),('Japan',5),('leap/Europe/Moscow',4),('MET',1),('Universal',2),('UTC',2); +/*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `time_zone_leap_second` WRITE; +/*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */; +REPLACE INTO `time_zone_leap_second` VALUES (78796800,1),(94694401,2),(126230402,3),(157766403,4),(189302404,5),(220924805,6),(252460806,7),(283996807,8),(315532808,9),(362793609,10),(394329610,11),(425865611,12),(489024012,13),(567993613,14),(631152014,15),(662688015,16),(709948816,17),(741484817,18),(773020818,19),(820454419,20),(867715220,21),(915148821,22); +/*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `time_zone_transition` WRITE; +/*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */; +REPLACE INTO `time_zone_transition` VALUES (1,-1693706400,0),(1,-1680483600,1),(1,-1663455600,2),(1,-1650150000,3),(1,-1632006000,2),(1,-1618700400,3),(1,-938905200,2),(1,-857257200,3),(1,-844556400,2),(1,-828226800,3),(1,-812502000,2),(1,-796777200,3),(1,228877200,2),(1,243997200,3),(1,260326800,2),(1,276051600,3),(1,291776400,2),(1,307501200,3),(1,323830800,2),(1,338950800,3),(1,354675600,2),(1,370400400,3),(1,386125200,2),(1,401850000,3),(1,417574800,2),(1,433299600,3),(1,449024400,2),(1,465354000,3),(1,481078800,2),(1,496803600,3),(1,512528400,2),(1,528253200,3),(1,543978000,2),(1,559702800,3),(1,575427600,2),(1,591152400,3),(1,606877200,2),(1,622602000,3),(1,638326800,2),(1,654656400,3),(1,670381200,2),(1,686106000,3),(1,701830800,2),(1,717555600,3),(1,733280400,2),(1,749005200,3),(1,764730000,2),(1,780454800,3),(1,796179600,2),(1,811904400,3),(1,828234000,2),(1,846378000,3),(1,859683600,2),(1,877827600,3),(1,891133200,2),(1,909277200,3),(1,922582800,2),(1,941331600,3),(1,954032400,2),(1,972781200,3),(1,985482000,2),(1,1004230800,3),(1,1017536400,2),(1,1035680400,3),(1,1048986000,2),(1,1067130000,3),(1,1080435600,2),(1,1099184400,3),(1,1111885200,2),(1,1130634000,3),(1,1143334800,2),(1,1162083600,3),(1,1174784400,2),(1,1193533200,3),(1,1206838800,2),(1,1224982800,3),(1,1238288400,2),(1,1256432400,3),(1,1269738000,2),(1,1288486800,3),(1,1301187600,2),(1,1319936400,3),(1,1332637200,2),(1,1351386000,3),(1,1364691600,2),(1,1382835600,3),(1,1396141200,2),(1,1414285200,3),(1,1427590800,2),(1,1445734800,3),(1,1459040400,2),(1,1477789200,3),(1,1490490000,2),(1,1509238800,3),(1,1521939600,2),(1,1540688400,3),(1,1553994000,2),(1,1572138000,3),(1,1585443600,2),(1,1603587600,3),(1,1616893200,2),(1,1635642000,3),(1,1648342800,2),(1,1667091600,3),(1,1679792400,2),(1,1698541200,3),(1,1711846800,2),(1,1729990800,3),(1,1743296400,2),(1,1761440400,3),(1,1774746000,2),(1,1792890000,3),(1,1806195600,2),(1,1824944400,3),(1,1837645200,2),(1,1856394000,3),(1,1869094800,2),(1,1887843600,3),(1,1901149200,2),(1,1919293200,3),(1,1932598800,2),(1,1950742800,3),(1,1964048400,2),(1,1982797200,3),(1,1995498000,2),(1,2014246800,3),(1,2026947600,2),(1,2045696400,3),(1,2058397200,2),(1,2077146000,3),(1,2090451600,2),(1,2108595600,3),(1,2121901200,2),(1,2140045200,3),(3,-1688265000,2),(3,-1656819048,1),(3,-1641353448,2),(3,-1627965048,3),(3,-1618716648,1),(3,-1596429048,3),(3,-1593829848,5),(3,-1589860800,4),(3,-1542427200,5),(3,-1539493200,6),(3,-1525323600,5),(3,-1522728000,4),(3,-1491188400,7),(3,-1247536800,4),(3,354920400,5),(3,370728000,4),(3,386456400,5),(3,402264000,4),(3,417992400,5),(3,433800000,4),(3,449614800,5),(3,465346800,8),(3,481071600,9),(3,496796400,8),(3,512521200,9),(3,528246000,8),(3,543970800,9),(3,559695600,8),(3,575420400,9),(3,591145200,8),(3,606870000,9),(3,622594800,8),(3,638319600,9),(3,654649200,8),(3,670374000,10),(3,686102400,11),(3,695779200,8),(3,701812800,5),(3,717534000,4),(3,733273200,9),(3,748998000,8),(3,764722800,9),(3,780447600,8),(3,796172400,9),(3,811897200,8),(3,828226800,9),(3,846370800,8),(3,859676400,9),(3,877820400,8),(3,891126000,9),(3,909270000,8),(3,922575600,9),(3,941324400,8),(3,954025200,9),(3,972774000,8),(3,985474800,9),(3,1004223600,8),(3,1017529200,9),(3,1035673200,8),(3,1048978800,9),(3,1067122800,8),(3,1080428400,9),(3,1099177200,8),(3,1111878000,9),(3,1130626800,8),(3,1143327600,9),(3,1162076400,8),(3,1174777200,9),(3,1193526000,8),(3,1206831600,9),(3,1224975600,8),(3,1238281200,9),(3,1256425200,8),(3,1269730800,9),(3,1288479600,8),(3,1301180400,9),(3,1319929200,8),(3,1332630000,9),(3,1351378800,8),(3,1364684400,9),(3,1382828400,8),(3,1396134000,9),(3,1414278000,8),(3,1427583600,9),(3,1445727600,8),(3,1459033200,9),(3,1477782000,8),(3,1490482800,9),(3,1509231600,8),(3,1521932400,9),(3,1540681200,8),(3,1553986800,9),(3,1572130800,8),(3,1585436400,9),(3,1603580400,8),(3,1616886000,9),(3,1635634800,8),(3,1648335600,9),(3,1667084400,8),(3,1679785200,9),(3,1698534000,8),(3,1711839600,9),(3,1729983600,8),(3,1743289200,9),(3,1761433200,8),(3,1774738800,9),(3,1792882800,8),(3,1806188400,9),(3,1824937200,8),(3,1837638000,9),(3,1856386800,8),(3,1869087600,9),(3,1887836400,8),(3,1901142000,9),(3,1919286000,8),(3,1932591600,9),(3,1950735600,8),(3,1964041200,9),(3,1982790000,8),(3,1995490800,9),(3,2014239600,8),(3,2026940400,9),(3,2045689200,8),(3,2058390000,9),(3,2077138800,8),(3,2090444400,9),(3,2108588400,8),(3,2121894000,9),(3,2140038000,8),(4,-1688265000,2),(4,-1656819048,1),(4,-1641353448,2),(4,-1627965048,3),(4,-1618716648,1),(4,-1596429048,3),(4,-1593829848,5),(4,-1589860800,4),(4,-1542427200,5),(4,-1539493200,6),(4,-1525323600,5),(4,-1522728000,4),(4,-1491188400,7),(4,-1247536800,4),(4,354920409,5),(4,370728010,4),(4,386456410,5),(4,402264011,4),(4,417992411,5),(4,433800012,4),(4,449614812,5),(4,465346812,8),(4,481071612,9),(4,496796413,8),(4,512521213,9),(4,528246013,8),(4,543970813,9),(4,559695613,8),(4,575420414,9),(4,591145214,8),(4,606870014,9),(4,622594814,8),(4,638319615,9),(4,654649215,8),(4,670374016,10),(4,686102416,11),(4,695779216,8),(4,701812816,5),(4,717534017,4),(4,733273217,9),(4,748998018,8),(4,764722818,9),(4,780447619,8),(4,796172419,9),(4,811897219,8),(4,828226820,9),(4,846370820,8),(4,859676420,9),(4,877820421,8),(4,891126021,9),(4,909270021,8),(4,922575622,9),(4,941324422,8),(4,954025222,9),(4,972774022,8),(4,985474822,9),(4,1004223622,8),(4,1017529222,9),(4,1035673222,8),(4,1048978822,9),(4,1067122822,8),(4,1080428422,9),(4,1099177222,8),(4,1111878022,9),(4,1130626822,8),(4,1143327622,9),(4,1162076422,8),(4,1174777222,9),(4,1193526022,8),(4,1206831622,9),(4,1224975622,8),(4,1238281222,9),(4,1256425222,8),(4,1269730822,9),(4,1288479622,8),(4,1301180422,9),(4,1319929222,8),(4,1332630022,9),(4,1351378822,8),(4,1364684422,9),(4,1382828422,8),(4,1396134022,9),(4,1414278022,8),(4,1427583622,9),(4,1445727622,8),(4,1459033222,9),(4,1477782022,8),(4,1490482822,9),(4,1509231622,8),(4,1521932422,9),(4,1540681222,8),(4,1553986822,9),(4,1572130822,8),(4,1585436422,9),(4,1603580422,8),(4,1616886022,9),(4,1635634822,8),(4,1648335622,9),(4,1667084422,8),(4,1679785222,9),(4,1698534022,8),(4,1711839622,9),(4,1729983622,8),(4,1743289222,9),(4,1761433222,8),(4,1774738822,9),(4,1792882822,8),(4,1806188422,9),(4,1824937222,8),(4,1837638022,9),(4,1856386822,8),(4,1869087622,9),(4,1887836422,8),(4,1901142022,9),(4,1919286022,8),(4,1932591622,9),(4,1950735622,8),(4,1964041222,9),(4,1982790022,8),(4,1995490822,9),(4,2014239622,8),(4,2026940422,9),(4,2045689222,8),(4,2058390022,9),(4,2077138822,8),(4,2090444422,9),(4,2108588422,8),(4,2121894022,9),(4,2140038022,8),(5,-1009875600,1); +/*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `time_zone_transition_type` WRITE; +/*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */; +REPLACE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'),(1,1,3600,0,'MET'),(1,2,7200,1,'MEST'),(1,3,3600,0,'MET'),(2,0,0,0,'UTC'),(3,0,9000,0,'MMT'),(3,1,12648,1,'MST'),(3,2,9048,0,'MMT'),(3,3,16248,1,'MDST'),(3,4,10800,0,'MSK'),(3,5,14400,1,'MSD'),(3,6,18000,1,'MSD'),(3,7,7200,0,'EET'),(3,8,10800,0,'MSK'),(3,9,14400,1,'MSD'),(3,10,10800,1,'EEST'),(3,11,7200,0,'EET'),(4,0,9000,0,'MMT'),(4,1,12648,1,'MST'),(4,2,9048,0,'MMT'),(4,3,16248,1,'MDST'),(4,4,10800,0,'MSK'),(4,5,14400,1,'MSD'),(4,6,18000,1,'MSD'),(4,7,7200,0,'EET'),(4,8,10800,0,'MSK'),(4,9,14400,1,'MSD'),(4,10,10800,1,'EEST'),(4,11,7200,0,'EET'),(5,0,32400,0,'CJT'),(5,1,32400,0,'JST'); +/*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +# +# mysqldump of system tables with --system=all --insert-ignore +# + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +INSTALL PLUGIN unix_socket /*M!100401 IF NOT EXISTS */ SONAME 'auth_socket.so'; +CREATE USER IF NOT EXISTS 'root'@'localhost'; +CREATE USER IF NOT EXISTS 'USER'@'%' IDENTIFIED VIA unix_socket; +SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role; +CREATE ROLE IF NOT EXISTS mariadb_dump_import_role; +GRANT mariadb_dump_import_role TO CURRENT_USER(); +SET ROLE mariadb_dump_import_role; +/*!80001 CREATE ROLE IF NOT EXISTS 'role_1' */; +/*M!100005 CREATE ROLE IF NOT EXISTS 'role_1' WITH ADMIN mariadb_dump_import_role */; +/*M!100005 GRANT 'role_1' TO 'root'@'localhost' WITH ADMIN OPTION */; +/*!80001 CREATE ROLE IF NOT EXISTS 'role_2' */; +/*M!100005 CREATE ROLE IF NOT EXISTS 'role_2' WITH ADMIN mariadb_dump_import_role */; +/*M!100005 GRANT 'role_2' TO 'role_1' WITH ADMIN OPTION */; +GRANT role_1 TO 'root'@'localhost' WITH ADMIN OPTION; +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION; +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION; +/*M!100005 SET DEFAULT ROLE NONE FOR 'root'@'localhost' */; +/*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */; +GRANT role_1 TO 'USER'@'%'; +GRANT role_2 TO 'USER'@'%'; +GRANT USAGE ON *.* TO 'USER'@'%' IDENTIFIED VIA unix_socket; +/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */; +/*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */; +GRANT role_2 TO 'role_1' WITH ADMIN OPTION; +GRANT SHOW DATABASES ON *.* TO 'role_1'; +GRANT USAGE ON *.* TO 'role_2'; +GRANT USAGE ON *.* TO 'role_2'; +SET ROLE NONE; +DROP ROLE mariadb_dump_import_role; +/*M!100203 EXECUTE IMMEDIATE CONCAT('SET ROLE ', @current_role) */; +CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB'; +CREATE SERVER /*M!100103 IF NOT EXISTS */ s1 FOREIGN DATA WRAPPER mysql OPTIONS (Host 'localhost', Port 3306); + +USE mysql; + +LOCK TABLES `column_stats` WRITE; +/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */; +INSERT IGNORE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,0,NULL,NULL); +/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `index_stats` WRITE; +/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */; +INSERT IGNORE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500); +/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `table_stats` WRITE; +/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */; +INSERT IGNORE INTO `table_stats` VALUES ('mysql','tz',393); +/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `innodb_index_stats` WRITE; +/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */; +INSERT IGNORE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index'); +/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `innodb_table_stats` WRITE; +/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */; +INSERT IGNORE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0); +/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */; +UNLOCK TABLES; + +USE mysql; + +LOCK TABLES `time_zone` WRITE; +/*!40000 ALTER TABLE `time_zone` DISABLE KEYS */; +INSERT IGNORE INTO `time_zone` VALUES (1,'N'),(2,'N'),(3,'N'),(4,'Y'),(5,'N'); +/*!40000 ALTER TABLE `time_zone` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `time_zone_name` WRITE; +/*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */; +INSERT IGNORE INTO `time_zone_name` VALUES ('Europe/Moscow',3),('Japan',5),('leap/Europe/Moscow',4),('MET',1),('Universal',2),('UTC',2); +/*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `time_zone_leap_second` WRITE; +/*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */; +INSERT IGNORE INTO `time_zone_leap_second` VALUES (78796800,1),(94694401,2),(126230402,3),(157766403,4),(189302404,5),(220924805,6),(252460806,7),(283996807,8),(315532808,9),(362793609,10),(394329610,11),(425865611,12),(489024012,13),(567993613,14),(631152014,15),(662688015,16),(709948816,17),(741484817,18),(773020818,19),(820454419,20),(867715220,21),(915148821,22); +/*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `time_zone_transition` WRITE; +/*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */; +INSERT IGNORE INTO `time_zone_transition` VALUES (1,-1693706400,0),(1,-1680483600,1),(1,-1663455600,2),(1,-1650150000,3),(1,-1632006000,2),(1,-1618700400,3),(1,-938905200,2),(1,-857257200,3),(1,-844556400,2),(1,-828226800,3),(1,-812502000,2),(1,-796777200,3),(1,228877200,2),(1,243997200,3),(1,260326800,2),(1,276051600,3),(1,291776400,2),(1,307501200,3),(1,323830800,2),(1,338950800,3),(1,354675600,2),(1,370400400,3),(1,386125200,2),(1,401850000,3),(1,417574800,2),(1,433299600,3),(1,449024400,2),(1,465354000,3),(1,481078800,2),(1,496803600,3),(1,512528400,2),(1,528253200,3),(1,543978000,2),(1,559702800,3),(1,575427600,2),(1,591152400,3),(1,606877200,2),(1,622602000,3),(1,638326800,2),(1,654656400,3),(1,670381200,2),(1,686106000,3),(1,701830800,2),(1,717555600,3),(1,733280400,2),(1,749005200,3),(1,764730000,2),(1,780454800,3),(1,796179600,2),(1,811904400,3),(1,828234000,2),(1,846378000,3),(1,859683600,2),(1,877827600,3),(1,891133200,2),(1,909277200,3),(1,922582800,2),(1,941331600,3),(1,954032400,2),(1,972781200,3),(1,985482000,2),(1,1004230800,3),(1,1017536400,2),(1,1035680400,3),(1,1048986000,2),(1,1067130000,3),(1,1080435600,2),(1,1099184400,3),(1,1111885200,2),(1,1130634000,3),(1,1143334800,2),(1,1162083600,3),(1,1174784400,2),(1,1193533200,3),(1,1206838800,2),(1,1224982800,3),(1,1238288400,2),(1,1256432400,3),(1,1269738000,2),(1,1288486800,3),(1,1301187600,2),(1,1319936400,3),(1,1332637200,2),(1,1351386000,3),(1,1364691600,2),(1,1382835600,3),(1,1396141200,2),(1,1414285200,3),(1,1427590800,2),(1,1445734800,3),(1,1459040400,2),(1,1477789200,3),(1,1490490000,2),(1,1509238800,3),(1,1521939600,2),(1,1540688400,3),(1,1553994000,2),(1,1572138000,3),(1,1585443600,2),(1,1603587600,3),(1,1616893200,2),(1,1635642000,3),(1,1648342800,2),(1,1667091600,3),(1,1679792400,2),(1,1698541200,3),(1,1711846800,2),(1,1729990800,3),(1,1743296400,2),(1,1761440400,3),(1,1774746000,2),(1,1792890000,3),(1,1806195600,2),(1,1824944400,3),(1,1837645200,2),(1,1856394000,3),(1,1869094800,2),(1,1887843600,3),(1,1901149200,2),(1,1919293200,3),(1,1932598800,2),(1,1950742800,3),(1,1964048400,2),(1,1982797200,3),(1,1995498000,2),(1,2014246800,3),(1,2026947600,2),(1,2045696400,3),(1,2058397200,2),(1,2077146000,3),(1,2090451600,2),(1,2108595600,3),(1,2121901200,2),(1,2140045200,3),(3,-1688265000,2),(3,-1656819048,1),(3,-1641353448,2),(3,-1627965048,3),(3,-1618716648,1),(3,-1596429048,3),(3,-1593829848,5),(3,-1589860800,4),(3,-1542427200,5),(3,-1539493200,6),(3,-1525323600,5),(3,-1522728000,4),(3,-1491188400,7),(3,-1247536800,4),(3,354920400,5),(3,370728000,4),(3,386456400,5),(3,402264000,4),(3,417992400,5),(3,433800000,4),(3,449614800,5),(3,465346800,8),(3,481071600,9),(3,496796400,8),(3,512521200,9),(3,528246000,8),(3,543970800,9),(3,559695600,8),(3,575420400,9),(3,591145200,8),(3,606870000,9),(3,622594800,8),(3,638319600,9),(3,654649200,8),(3,670374000,10),(3,686102400,11),(3,695779200,8),(3,701812800,5),(3,717534000,4),(3,733273200,9),(3,748998000,8),(3,764722800,9),(3,780447600,8),(3,796172400,9),(3,811897200,8),(3,828226800,9),(3,846370800,8),(3,859676400,9),(3,877820400,8),(3,891126000,9),(3,909270000,8),(3,922575600,9),(3,941324400,8),(3,954025200,9),(3,972774000,8),(3,985474800,9),(3,1004223600,8),(3,1017529200,9),(3,1035673200,8),(3,1048978800,9),(3,1067122800,8),(3,1080428400,9),(3,1099177200,8),(3,1111878000,9),(3,1130626800,8),(3,1143327600,9),(3,1162076400,8),(3,1174777200,9),(3,1193526000,8),(3,1206831600,9),(3,1224975600,8),(3,1238281200,9),(3,1256425200,8),(3,1269730800,9),(3,1288479600,8),(3,1301180400,9),(3,1319929200,8),(3,1332630000,9),(3,1351378800,8),(3,1364684400,9),(3,1382828400,8),(3,1396134000,9),(3,1414278000,8),(3,1427583600,9),(3,1445727600,8),(3,1459033200,9),(3,1477782000,8),(3,1490482800,9),(3,1509231600,8),(3,1521932400,9),(3,1540681200,8),(3,1553986800,9),(3,1572130800,8),(3,1585436400,9),(3,1603580400,8),(3,1616886000,9),(3,1635634800,8),(3,1648335600,9),(3,1667084400,8),(3,1679785200,9),(3,1698534000,8),(3,1711839600,9),(3,1729983600,8),(3,1743289200,9),(3,1761433200,8),(3,1774738800,9),(3,1792882800,8),(3,1806188400,9),(3,1824937200,8),(3,1837638000,9),(3,1856386800,8),(3,1869087600,9),(3,1887836400,8),(3,1901142000,9),(3,1919286000,8),(3,1932591600,9),(3,1950735600,8),(3,1964041200,9),(3,1982790000,8),(3,1995490800,9),(3,2014239600,8),(3,2026940400,9),(3,2045689200,8),(3,2058390000,9),(3,2077138800,8),(3,2090444400,9),(3,2108588400,8),(3,2121894000,9),(3,2140038000,8),(4,-1688265000,2),(4,-1656819048,1),(4,-1641353448,2),(4,-1627965048,3),(4,-1618716648,1),(4,-1596429048,3),(4,-1593829848,5),(4,-1589860800,4),(4,-1542427200,5),(4,-1539493200,6),(4,-1525323600,5),(4,-1522728000,4),(4,-1491188400,7),(4,-1247536800,4),(4,354920409,5),(4,370728010,4),(4,386456410,5),(4,402264011,4),(4,417992411,5),(4,433800012,4),(4,449614812,5),(4,465346812,8),(4,481071612,9),(4,496796413,8),(4,512521213,9),(4,528246013,8),(4,543970813,9),(4,559695613,8),(4,575420414,9),(4,591145214,8),(4,606870014,9),(4,622594814,8),(4,638319615,9),(4,654649215,8),(4,670374016,10),(4,686102416,11),(4,695779216,8),(4,701812816,5),(4,717534017,4),(4,733273217,9),(4,748998018,8),(4,764722818,9),(4,780447619,8),(4,796172419,9),(4,811897219,8),(4,828226820,9),(4,846370820,8),(4,859676420,9),(4,877820421,8),(4,891126021,9),(4,909270021,8),(4,922575622,9),(4,941324422,8),(4,954025222,9),(4,972774022,8),(4,985474822,9),(4,1004223622,8),(4,1017529222,9),(4,1035673222,8),(4,1048978822,9),(4,1067122822,8),(4,1080428422,9),(4,1099177222,8),(4,1111878022,9),(4,1130626822,8),(4,1143327622,9),(4,1162076422,8),(4,1174777222,9),(4,1193526022,8),(4,1206831622,9),(4,1224975622,8),(4,1238281222,9),(4,1256425222,8),(4,1269730822,9),(4,1288479622,8),(4,1301180422,9),(4,1319929222,8),(4,1332630022,9),(4,1351378822,8),(4,1364684422,9),(4,1382828422,8),(4,1396134022,9),(4,1414278022,8),(4,1427583622,9),(4,1445727622,8),(4,1459033222,9),(4,1477782022,8),(4,1490482822,9),(4,1509231622,8),(4,1521932422,9),(4,1540681222,8),(4,1553986822,9),(4,1572130822,8),(4,1585436422,9),(4,1603580422,8),(4,1616886022,9),(4,1635634822,8),(4,1648335622,9),(4,1667084422,8),(4,1679785222,9),(4,1698534022,8),(4,1711839622,9),(4,1729983622,8),(4,1743289222,9),(4,1761433222,8),(4,1774738822,9),(4,1792882822,8),(4,1806188422,9),(4,1824937222,8),(4,1837638022,9),(4,1856386822,8),(4,1869087622,9),(4,1887836422,8),(4,1901142022,9),(4,1919286022,8),(4,1932591622,9),(4,1950735622,8),(4,1964041222,9),(4,1982790022,8),(4,1995490822,9),(4,2014239622,8),(4,2026940422,9),(4,2045689222,8),(4,2058390022,9),(4,2077138822,8),(4,2090444422,9),(4,2108588422,8),(4,2121894022,9),(4,2140038022,8),(5,-1009875600,1); +/*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `time_zone_transition_type` WRITE; +/*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */; +INSERT IGNORE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'),(1,1,3600,0,'MET'),(1,2,7200,1,'MEST'),(1,3,3600,0,'MET'),(2,0,0,0,'UTC'),(3,0,9000,0,'MMT'),(3,1,12648,1,'MST'),(3,2,9048,0,'MMT'),(3,3,16248,1,'MDST'),(3,4,10800,0,'MSK'),(3,5,14400,1,'MSD'),(3,6,18000,1,'MSD'),(3,7,7200,0,'EET'),(3,8,10800,0,'MSK'),(3,9,14400,1,'MSD'),(3,10,10800,1,'EEST'),(3,11,7200,0,'EET'),(4,0,9000,0,'MMT'),(4,1,12648,1,'MST'),(4,2,9048,0,'MMT'),(4,3,16248,1,'MDST'),(4,4,10800,0,'MSK'),(4,5,14400,1,'MSD'),(4,6,18000,1,'MSD'),(4,7,7200,0,'EET'),(4,8,10800,0,'MSK'),(4,9,14400,1,'MSD'),(4,10,10800,1,'EEST'),(4,11,7200,0,'EET'),(5,0,32400,0,'CJT'),(5,1,32400,0,'JST'); +/*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin, +mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats; +Table Checksum +mysql.user 205632094 +mysql.roles_mapping 3150178430 +mysql.time_zone_transition 3895294076 +mysql.plugin 1520695737 +mysql.servers 2783974349 +mysql.func 3241572444 +mysql.innodb_table_stats 347867921 +mysql.table_stats 664320059 +# Opps.... +CREATE USER mariadb_test_restore IDENTIFIED BY 'getitback'; +GRANT ALL ON *.* TO mariadb_test_restore WITH GRANT OPTION; +GRANT PROXY ON ''@'%' TO mariadb_test_restore WITH GRANT OPTION; +GRANT SUPER, CREATE USER /*M!100502 ,FEDERATED ADMIN */ ON *.* TO mariadb_test_restore WITH GRANT OPTION; +drop user USER; +delete from mysql.table_stats; +delete from mysql.innodb_table_stats; +delete from mysql.time_zone_transition; +delete from mysql.time_zone_transition_type; +delete from mysql.time_zone; +delete from mysql.time_zone_name; +delete from mysql.time_zone_leap_second; +DROP FUNCTION IF EXISTS metaphon; +DROP SERVER s1; +set time_zone= @@global.time_zone; +# Restore from mysqldump +DROP USER mariadb_test_restore; +CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin, +mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats; +Table Checksum +mysql.user 205632094 +mysql.roles_mapping 3150178430 +mysql.time_zone_transition 3895294076 +mysql.plugin 1520695737 +mysql.servers 2783974349 +mysql.func 3241572444 +mysql.innodb_table_stats 347867921 +mysql.table_stats 664320059 +DROP FUNCTION IF EXISTS metaphon; +DROP SERVER s1; +DELETE FROM mysql.column_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos'); +DELETE FROM mysql.index_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos'); +DELETE FROM mysql.table_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos'); +DELETE FROM mysql.innodb_index_stats WHERE database_name='mysql' and table_name in ('tz','gtid_slave_pos'); +DELETE FROM mysql.innodb_table_stats WHERE database_name='mysql' and table_name in ('tz','gtid_slave_pos'); +drop table mysql.tz; +DROP ROLE role_2; +DROP ROLE role_1; +drop user USER; +uninstall plugin unix_socket; +insert into mysql.user select * from backup_users; +flush privileges; +drop table backup_users; diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index e527dbffe43..da80ff09db9 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -5410,8 +5410,9 @@ proc one DROP DATABASE bug25717383; Usage: mysqldump [OPTIONS] database [tables] -OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...] -OR mysqldump [OPTIONS] --all-databases [OPTIONS] +OR mysqldump [OPTIONS] --databases DB1 [DB2 DB3...] +OR mysqldump [OPTIONS] --all-databases +OR mysqldump [OPTIONS] --system=[SYSTEMOPTIONS]] For more options, use mysqldump --help # # MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine @@ -5713,4 +5714,271 @@ DELIMITER ; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; +# +# MDEV-20939: Race condition between mysqldump import and InnoDB +# persistent statistics calculation +# +# +# Without --replace and --insert-ignore +# + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `innodb_index_stats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `innodb_index_stats` ( + `database_name` varchar(64) COLLATE utf8_bin NOT NULL, + `table_name` varchar(199) COLLATE utf8_bin NOT NULL, + `index_name` varchar(64) COLLATE utf8_bin NOT NULL, + `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `stat_name` varchar(64) COLLATE utf8_bin NOT NULL, + `stat_value` bigint(20) unsigned NOT NULL, + `sample_size` bigint(20) unsigned DEFAULT NULL, + `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `innodb_table_stats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `innodb_table_stats` ( + `database_name` varchar(64) COLLATE utf8_bin NOT NULL, + `table_name` varchar(199) COLLATE utf8_bin NOT NULL, + `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `n_rows` bigint(20) unsigned NOT NULL, + `clustered_index_size` bigint(20) unsigned NOT NULL, + `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`database_name`,`table_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS `general_log` ( + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `command_type` varchar(64) NOT NULL, + `argument` mediumtext NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS `slow_log` ( + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, + `rows_sent` int(11) NOT NULL, + `rows_examined` int(11) NOT NULL, + `db` varchar(512) NOT NULL, + `last_insert_id` int(11) NOT NULL, + `insert_id` int(11) NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `sql_text` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +# +# With --replace +# + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `innodb_index_stats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `innodb_index_stats` ( + `database_name` varchar(64) COLLATE utf8_bin NOT NULL, + `table_name` varchar(199) COLLATE utf8_bin NOT NULL, + `index_name` varchar(64) COLLATE utf8_bin NOT NULL, + `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `stat_name` varchar(64) COLLATE utf8_bin NOT NULL, + `stat_value` bigint(20) unsigned NOT NULL, + `sample_size` bigint(20) unsigned DEFAULT NULL, + `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `innodb_index_stats` WRITE; +/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */; +/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `innodb_table_stats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `innodb_table_stats` ( + `database_name` varchar(64) COLLATE utf8_bin NOT NULL, + `table_name` varchar(199) COLLATE utf8_bin NOT NULL, + `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `n_rows` bigint(20) unsigned NOT NULL, + `clustered_index_size` bigint(20) unsigned NOT NULL, + `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`database_name`,`table_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `innodb_table_stats` WRITE; +/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */; +/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */; +UNLOCK TABLES; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS `general_log` ( + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `command_type` varchar(64) NOT NULL, + `argument` mediumtext NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS `slow_log` ( + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, + `rows_sent` int(11) NOT NULL, + `rows_examined` int(11) NOT NULL, + `db` varchar(512) NOT NULL, + `last_insert_id` int(11) NOT NULL, + `insert_id` int(11) NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `sql_text` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +# +# With --insert-ignore +# + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `innodb_index_stats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `innodb_index_stats` ( + `database_name` varchar(64) COLLATE utf8_bin NOT NULL, + `table_name` varchar(199) COLLATE utf8_bin NOT NULL, + `index_name` varchar(64) COLLATE utf8_bin NOT NULL, + `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `stat_name` varchar(64) COLLATE utf8_bin NOT NULL, + `stat_value` bigint(20) unsigned NOT NULL, + `sample_size` bigint(20) unsigned DEFAULT NULL, + `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `innodb_index_stats` WRITE; +/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */; +/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `innodb_table_stats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `innodb_table_stats` ( + `database_name` varchar(64) COLLATE utf8_bin NOT NULL, + `table_name` varchar(199) COLLATE utf8_bin NOT NULL, + `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `n_rows` bigint(20) unsigned NOT NULL, + `clustered_index_size` bigint(20) unsigned NOT NULL, + `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`database_name`,`table_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `innodb_table_stats` WRITE; +/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */; +/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */; +UNLOCK TABLES; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS `general_log` ( + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `command_type` varchar(64) NOT NULL, + `argument` mediumtext NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS `slow_log` ( + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, + `rows_sent` int(11) NOT NULL, + `rows_examined` int(11) NOT NULL, + `db` varchar(512) NOT NULL, + `last_insert_id` int(11) NOT NULL, + `insert_id` int(11) NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `sql_text` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + # End of 10.2 tests diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 7bc8f562f1b..b1441013bc8 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -763,18 +763,20 @@ col2 col col 2 2 2 1 3 3 drop table t1, t2; -create table t1 (a char(25)); +create table t1 (a char(70)); insert into t1 set a = repeat('x', 20); -insert into t1 set a = concat(repeat('x', 19), 'z'); -insert into t1 set a = concat(repeat('x', 19), 'ab'); -insert into t1 set a = concat(repeat('x', 19), 'aa'); +insert into t1 set a = concat(repeat('x', 63), 'z'); +insert into t1 set a = concat(repeat('x', 63), 'ab'); +insert into t1 set a = concat(repeat('x', 63), 'aa'); set max_sort_length=20; +Warnings: +Warning 1292 Truncated incorrect max_sort_length value: '20' select a from t1 order by a; a -xxxxxxxxxxxxxxxxxxxab -xxxxxxxxxxxxxxxxxxxaa xxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxz +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxab +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaa +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz drop table t1; create table t1 ( `sid` decimal(8,0) default null, @@ -3241,6 +3243,8 @@ drop table t1; SET @save_sort_buffer_size= @@sort_buffer_size; SET @save_max_sort_length= @@max_sort_length; SET max_sort_length=8; +Warnings: +Warning 1292 Truncated incorrect max_sort_length value: '8' SET sort_buffer_size=1024; CREATE TABLE t1(a INT, b DECIMAL(65), c BLOB); INSERT INTO t1 SELECT seq, seq, seq from seq_1_to_25; @@ -3308,6 +3312,8 @@ SET @save_max_sort_length= @@max_sort_length; SET @save_sort_buffer_size= @@sort_buffer_size; SET @save_max_length_for_sort_data= @@max_length_for_sort_data; SET max_sort_length=8; +Warnings: +Warning 1292 Truncated incorrect max_sort_length value: '8' SET sort_buffer_size=1024; SET max_length_for_sort_data=7000; CREATE TABLE t1(a VARCHAR(64), b VARCHAR(2048))DEFAULT CHARSET=utf8; @@ -3443,6 +3449,8 @@ INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4); SET max_length_for_sort_data= 30; SET sql_select_limit = 3; SET max_sort_length=8; +Warnings: +Warning 1292 Truncated incorrect max_sort_length value: '8' SELECT * FROM t1 ORDER BY a+1; a b 1 1 diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index 6770b64552f..a4405882189 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -853,7 +853,7 @@ PARTITION p0 VALUES IN (1,3,9,null), PARTITION p1 VALUES IN (2,4,0) ); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes INSERT INTO t2 VALUES ('k','s',3,'b','j'),('a','b',NULL,'v','j'),('c','m',9,'t',NULL), ('b','l',9,'b',NULL),('i','y',3,'o','w'),('c','m',NULL,'a','m'), diff --git a/mysql-test/r/precedence.result b/mysql-test/r/precedence.result index 986af631346..65c32ba2b04 100644 --- a/mysql-test/r/precedence.result +++ b/mysql-test/r/precedence.result @@ -8017,4 +8017,8 @@ create or replace view v1 as select 1 IS TRUE IS FALSE, 2 IS FALSE IS UNKNOWN, 3 Select view_definition from information_schema.views where table_schema='test' and table_name='v1'; view_definition select 1 is true is false AS `1 IS TRUE IS FALSE`,/*always not null*/ 1 is null AS `2 IS FALSE IS UNKNOWN`,/*always not null*/ 1 is null AS `3 IS UNKNOWN IS NULL`,/*always not null*/ 1 is null is true AS `4 IS NULL IS TRUE` +create or replace view v1 as select 2 IS TRUE = 3, 2 IS FALSE = 3, 2 IS UNKNOWN = 3, 2 IS NULL = 3, ISNULL(2) = 1; +Select view_definition from information_schema.views where table_schema='test' and table_name='v1'; +view_definition +select 2 is true = 3 AS `2 IS TRUE = 3`,2 is false = 3 AS `2 IS FALSE = 3`,/*always not null*/ 1 is null = 3 AS `2 IS UNKNOWN = 3`,/*always not null*/ 1 is null = 3 AS `2 IS NULL = 3`,/*always not null*/ 1 is null = 1 AS `ISNULL(2) = 1` drop view v1; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 8d4b52e1b2e..17284a3cad8 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -5390,5 +5390,34 @@ ERROR HY000: Default/ignore value is not supported for such parameter usage EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0; Database # +# MDEV-24779: main.subselect fails in buildbot with --ps-protocol +# +CREATE TABLE t1(a INT); +PREPARE stmt FROM "SELECT EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1))"; +EXECUTE stmt; +EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1)) +0 +EXECUTE stmt; +EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1)) +0 +DROP TABLE t1; +# +# MDEV-25006: Failed assertion on executing EXPLAIN DELETE statement as a prepared statement +# +CREATE TABLE t1(c1 CHAR(255) PRIMARY KEY); +PREPARE stmt FROM 'EXPLAIN DELETE b FROM t1 AS a JOIN t1 AS b'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE a system NULL NULL NULL NULL 0 const row not found +1 SIMPLE b system NULL NULL NULL NULL 0 const row not found +DROP TABLE t1; +CREATE TABLE t1(a INT); +PREPARE stmt FROM 'EXPLAIN DELETE FROM t1.* USING t1'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +# # End of 10.2 tests # diff --git a/mysql-test/r/ps_show_log.result b/mysql-test/r/ps_show_log.result new file mode 100644 index 00000000000..54eabaeded6 --- /dev/null +++ b/mysql-test/r/ps_show_log.result @@ -0,0 +1,65 @@ +# +# MDEV-24208 SHOW RELAYLOG EVENTS command is not supported in the prepared +# statement protocol yet +# +CREATE USER u1; +include/master-slave.inc +[connection master] +connection master; +CREATE TABLE t1(n INT); +DROP TABLE t1; +connection slave; +PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS'; +EXECUTE stmt_1; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc # # # +# # Gtid_list # # [] +# # Binlog_checkpoint # # # +# # Gtid # # GTID 0-1-1 +# # Query # # use `test`; CREATE TABLE t1(n INT) +# # Gtid # # GTID 0-1-2 +# # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ +# Execute the same prepared statement the second time to check that +# no internal structures used for handling the statement +# 'SHOW BINLOG EVENTS' were damaged. +EXECUTE stmt_1; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc # # # +# # Gtid_list # # [] +# # Binlog_checkpoint # # # +# # Gtid # # GTID 0-1-1 +# # Query # # use `test`; CREATE TABLE t1(n INT) +# # Gtid # # GTID 0-1-2 +# # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ +DEALLOCATE PREPARE stmt_1; +connection slave; +PREPARE stmt_1 FROM 'SHOW RELAYLOG EVENTS'; +EXECUTE stmt_1; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000001 # Format_desc # # # +slave-relay-bin.000001 # Rotate # # # +# Execute the same prepared statement the second time to check that +# no internal structures used for handling the statement +# 'SHOW RELAYLOG EVENTS' were damaged. +EXECUTE stmt_1; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000001 # Format_desc # # # +slave-relay-bin.000001 # Rotate # # # +DEALLOCATE PREPARE stmt_1; +# Create the user u1 without the REPLICATION SLAVE privilege required +# for running the statements SHOW BINLOG EVENTS/SHOW RELAYLOG EVENTS +# and check that attempt to execute the statements SHOW BINLOG EVENTS/ +# SHOW RELAYLOG EVENTS as a prepred statements by a user without required +# privileges results in error. +connect con2,localhost,u1,,test; +PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS'; +EXECUTE stmt_1; +ERROR 42000: Access denied; you need (at least one of) the REPLICATION SLAVE privilege(s) for this operation +PREPARE stmt_1 FROM 'SHOW RELAYLOG EVENTS'; +EXECUTE stmt_1; +ERROR 42000: Access denied; you need (at least one of) the REPLICATION SLAVE privilege(s) for this operation +DEALLOCATE PREPARE stmt_1; +include/rpl_end.inc +connection default; +DROP USER u1; +# End of 10.2 tests diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index d872735e507..11d9cead143 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -814,33 +814,33 @@ select @@character_set_results; NULL set character_set_results=default; set GLOBAL query_cache_size=1355776; -create table t1 (id int auto_increment primary key, c char(25)); +create table t1 (id int auto_increment primary key, c char(65)); insert into t1 set c = repeat('x',24); -insert into t1 set c = concat(repeat('x',24),'x'); -insert into t1 set c = concat(repeat('x',24),'w'); -insert into t1 set c = concat(repeat('x',24),'y'); +insert into t1 set c = concat(repeat('x',64),'x'); +insert into t1 set c = concat(repeat('x',64),'w'); +insert into t1 set c = concat(repeat('x',64),'y'); set max_sort_length=200; select c from t1 order by c, id; c xxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxw -xxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy reset query cache; -set max_sort_length=20; +set max_sort_length=64; select c from t1 order by c, id; c xxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxw -xxxxxxxxxxxxxxxxxxxxxxxxy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy set max_sort_length=200; select c from t1 order by c, id; c xxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxw -xxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy set max_sort_length=default; select '1' || '3' from t1; '1' || '3' diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 9ea0dc12a0b..6a3850c0ed9 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -3158,6 +3158,48 @@ pk a b 1 5 50 65 5 50 drop table t1; +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 ( +pk int primary key, +key1 int, +col1 varchar(255), +key (key1, pk) +); +insert into t2 (pk, key1) +select A.a+10 *B.a + 100*C.a, A.a+10 *B.a +100*C.a from t1 A, t1 B, t1 C; +# This must use ALL, not range: +explain select * from t2 force index (primary) where pk not in (1,2,3); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1000 Using where +drop table t1,t2; +# +# MDEV-24444: ASAN use-after-poison in Item_func_in::get_func_mm_tree with NOT IN +# +CREATE TABLE t1 (id INT, a CHAR(3), b INT, PRIMARY KEY(id), KEY(b), KEY(a)); +INSERT INTO t1 VALUES (1,'foo',10),(2,'bar',20); +CREATE TABLE t2 (code CHAR(8), num INT, PRIMARY KEY (code)); +INSERT INTO t2 VALUES ('100',1),('111',2); +SELECT * FROM t1 JOIN t2 ON (t2.code = t1.b) WHERE t1.a NOT IN ('baz', 'qux') OR t2.num != 3; +id a b code num +DROP TABLE t1, t2; +# +# MDEV-22251: get_key_scans_params: Conditional jump or move depends on uninitialised value +# +create table t1 (pk int, i int, v int, primary key (pk), key(v)); +insert into t1 (pk,i,v) values (1,1,2),(2,2,4),(3,3,6),(4,4,8),(5,5,10),(6,6,12),(7,7,14),(8,8,16); +create table t2 (a int, b int); +insert into t2 values (1,2),(2,4); +EXPLAIN +select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 ALL PRIMARY,v NULL NULL NULL 8 Range checked for each record (index map: 0x3) +select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk); +pk i v a b +1 1 2 1 2 +2 2 4 2 4 +drop table t1, t2; # # End of 10.2 tests # diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index 55613261ce9..24f42f34ce5 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -3170,6 +3170,48 @@ pk a b 70 4 40 71 2 20 drop table t1; +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 ( +pk int primary key, +key1 int, +col1 varchar(255), +key (key1, pk) +); +insert into t2 (pk, key1) +select A.a+10 *B.a + 100*C.a, A.a+10 *B.a +100*C.a from t1 A, t1 B, t1 C; +# This must use ALL, not range: +explain select * from t2 force index (primary) where pk not in (1,2,3); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1000 Using where +drop table t1,t2; +# +# MDEV-24444: ASAN use-after-poison in Item_func_in::get_func_mm_tree with NOT IN +# +CREATE TABLE t1 (id INT, a CHAR(3), b INT, PRIMARY KEY(id), KEY(b), KEY(a)); +INSERT INTO t1 VALUES (1,'foo',10),(2,'bar',20); +CREATE TABLE t2 (code CHAR(8), num INT, PRIMARY KEY (code)); +INSERT INTO t2 VALUES ('100',1),('111',2); +SELECT * FROM t1 JOIN t2 ON (t2.code = t1.b) WHERE t1.a NOT IN ('baz', 'qux') OR t2.num != 3; +id a b code num +DROP TABLE t1, t2; +# +# MDEV-22251: get_key_scans_params: Conditional jump or move depends on uninitialised value +# +create table t1 (pk int, i int, v int, primary key (pk), key(v)); +insert into t1 (pk,i,v) values (1,1,2),(2,2,4),(3,3,6),(4,4,8),(5,5,10),(6,6,12),(7,7,14),(8,8,16); +create table t2 (a int, b int); +insert into t2 values (1,2),(2,4); +EXPLAIN +select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 ALL PRIMARY,v NULL NULL NULL 8 Range checked for each record (index map: 0x3) +select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk); +pk i v a b +1 1 2 1 2 +2 2 4 2 4 +drop table t1, t2; # # End of 10.2 tests # diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result index 10af9265649..0f519c53f3e 100644 --- a/mysql-test/r/selectivity.result +++ b/mysql-test/r/selectivity.result @@ -1887,4 +1887,62 @@ a b set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; drop table t1; # End of 10.1 tests +# +# MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect +# +SET optimizer_use_condition_selectivity=4; +SET histogram_size=255; +CREATE TABLE t1 (a BIT(32), b INT); +INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82); +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 66.41 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` >= 81 +SELECT HEX(a), b from t1 where t1.a >= 81; +HEX(a) b +51 81 +52 82 +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +DROP TABLE t1; +# +# MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3 +# +CREATE TABLE t1(a int); +INSERT INTO t1 values (1),(2),(2),(3),(4); +SET optimizer_use_condition_selectivity=4; +SET histogram_size= 255; +set use_stat_tables='preferably'; +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 39.84 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +SET optimizer_use_condition_selectivity=3; +# filtered should show 25 % +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +FLUSH TABLES; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +set use_stat_tables= @save_use_stat_tables; +DROP TABLE t1; +# End of 10.2 tests set @@global.histogram_size=@save_histogram_size; diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result index ee0f56ae7ed..5452919aa6d 100644 --- a/mysql-test/r/selectivity_innodb.result +++ b/mysql-test/r/selectivity_innodb.result @@ -1897,6 +1897,64 @@ a b set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; drop table t1; # End of 10.1 tests +# +# MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect +# +SET optimizer_use_condition_selectivity=4; +SET histogram_size=255; +CREATE TABLE t1 (a BIT(32), b INT); +INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82); +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 66.41 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` >= 81 +SELECT HEX(a), b from t1 where t1.a >= 81; +HEX(a) b +51 81 +52 82 +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +DROP TABLE t1; +# +# MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3 +# +CREATE TABLE t1(a int); +INSERT INTO t1 values (1),(2),(2),(3),(4); +SET optimizer_use_condition_selectivity=4; +SET histogram_size= 255; +set use_stat_tables='preferably'; +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 39.84 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +SET optimizer_use_condition_selectivity=3; +# filtered should show 25 % +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +FLUSH TABLES; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +set use_stat_tables= @save_use_stat_tables; +DROP TABLE t1; +# End of 10.2 tests set @@global.histogram_size=@save_histogram_size; set optimizer_switch=@save_optimizer_switch_for_selectivity_test; set @tmp_ust= @@use_stat_tables; diff --git a/mysql-test/r/set_statement.result b/mysql-test/r/set_statement.result index 845c0f21e3e..cd4859c32e8 100644 --- a/mysql-test/r/set_statement.result +++ b/mysql-test/r/set_statement.result @@ -1217,3 +1217,28 @@ set @rnd=1; select @rnd; @rnd 0 +# +# MDEV-24860: Incorrect behaviour of SET STATEMENT in case +# it is executed as a prepared statement +# +PREPARE stmt FROM "SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1"; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +# Show definition of the table t1 created using Prepared Statement +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# Create the table t1 with the same definition as it used before +# using regular statement execution mode. +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1; +# Show that the table has the same definition as it is in case the table +# created in prepared statement mode. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result index 1c055ef7385..b058c8f001e 100644 --- a/mysql-test/r/skip_grants.result +++ b/mysql-test/r/skip_grants.result @@ -1,14 +1,4 @@ use test; -DROP VIEW IF EXISTS v1; -DROP VIEW IF EXISTS v2; -DROP VIEW IF EXISTS v3; -DROP TABLE IF EXISTS t1; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS p2; -DROP PROCEDURE IF EXISTS p3; -DROP FUNCTION IF EXISTS f1; -DROP FUNCTION IF EXISTS f2; -DROP FUNCTION IF EXISTS f3; CREATE TABLE t1(c INT); CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW @@ -58,10 +48,16 @@ DROP PROCEDURE p3; DROP FUNCTION f1; DROP FUNCTION f2; DROP FUNCTION f3; +# +# Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server +# set global event_scheduler=1; Warnings: Note 1408 Event Scheduler: Loaded 0 events set global event_scheduler=0; +# +# Bug#26285 Selecting information_schema crahes server +# select count(*) from information_schema.COLUMN_PRIVILEGES; count(*) 0 @@ -74,14 +70,21 @@ count(*) select count(*) from information_schema.USER_PRIVILEGES; count(*) 0 -End of 5.0 tests +# +# End of 5.0 tests +# # # Bug#29817 Queries with UDF fail with non-descriptive error # if mysql.proc is missing # select no_such_function(1); ERROR 42000: FUNCTION test.no_such_function does not exist -End of 5.1 tests +# +# End of 5.1 tests +# +# +# MDEV-8280 crash in 'show global status' with --skip-grant-tables +# show global status like 'Acl%'; Variable_name Value Acl_column_grants 0 @@ -93,3 +96,14 @@ Acl_role_grants 0 Acl_roles 0 Acl_table_grants 0 Acl_users 0 +# +# End of 10.1 tests +# +# +# MDEV-22966 Server crashes or hangs with SET ROLE when started with skip-grant-tables +# +set role x; +ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement +# +# End of 10.2 tests +# diff --git a/mysql-test/r/sp-ucs2.result b/mysql-test/r/sp-ucs2.result index ca448efa535..6c94a111f6f 100644 --- a/mysql-test/r/sp-ucs2.result +++ b/mysql-test/r/sp-ucs2.result @@ -100,20 +100,20 @@ RETURNS VARCHAR(64) CHARACTER SET ucs2 BEGIN RETURN 'str'; END| -ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1' +DROP FUNCTION f| CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2) RETURNS VARCHAR(64) COLLATE ucs2_unicode_ci BEGIN RETURN 'str'; END| -ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1' +DROP FUNCTION f| CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2) RETURNS VARCHAR(64) CHARACTER SET ucs2 BEGIN DECLARE f2 VARCHAR(64) COLLATE ucs2_unicode_ci; RETURN 'str'; END| -ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1' +DROP FUNCTION f| SET NAMES utf8; DROP FUNCTION IF EXISTS bug48766; CREATE FUNCTION bug48766 () diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index c4d3779e484..b679f3f54fc 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -8467,3 +8467,23 @@ $$ ERROR 22007: Incorrect integer value: 'y' for column ``.``.`a` at row 1 DROP TABLE t1; SET sql_mode=DEFAULT; +# +# MDEV-24220: error when opening a table for the second call of SP +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1),(2,2); +CREATE VIEW v1 AS SELECT MAX(a) as f FROM t1; +CREATE PROCEDURE p1() +BEGIN +SELECT * FROM v1; +END $ +CALL p1; +f +2 +ALTER TABLE t1 DROP a; +CALL p1; +ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +DROP PROCEDURE p1; +DROP VIEW v1; +DROP TABLE t1; +#End of 10.2 tests diff --git a/mysql-test/r/stat_tables.result b/mysql-test/r/stat_tables.result index bb3a0a80f7e..a52db46d119 100644 --- a/mysql-test/r/stat_tables.result +++ b/mysql-test/r/stat_tables.result @@ -825,5 +825,19 @@ length(a) set names latin1; set @@use_stat_tables=@save_use_stat_tables; drop table t1; +# +# MDEV-23753: SIGSEGV in Column_stat::store_stat_fields +# +CREATE TABLE t1 (a INT, b INT) PARTITION BY HASH (b) PARTITIONS 2; +LOCK TABLES t1 WRITE; +ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (a) INDEXES (); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (nonexisting) INDEXES (nonexisting); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze error Invalid argument +DROP TABLE t1; # please keep this at the last set @@global.histogram_size=@save_histogram_size; diff --git a/mysql-test/r/stat_tables_innodb.result b/mysql-test/r/stat_tables_innodb.result index 23b952cc891..3be6b0bd4b3 100644 --- a/mysql-test/r/stat_tables_innodb.result +++ b/mysql-test/r/stat_tables_innodb.result @@ -852,6 +852,20 @@ length(a) set names latin1; set @@use_stat_tables=@save_use_stat_tables; drop table t1; +# +# MDEV-23753: SIGSEGV in Column_stat::store_stat_fields +# +CREATE TABLE t1 (a INT, b INT) PARTITION BY HASH (b) PARTITIONS 2; +LOCK TABLES t1 WRITE; +ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (a) INDEXES (); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (nonexisting) INDEXES (nonexisting); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze error Invalid argument +DROP TABLE t1; # please keep this at the last set @@global.histogram_size=@save_histogram_size; set optimizer_switch=@save_optimizer_switch_for_stat_tables_test; diff --git a/mysql-test/r/status2.result b/mysql-test/r/status2.result index fa0fc4e1061..60309e14fe3 100644 --- a/mysql-test/r/status2.result +++ b/mysql-test/r/status2.result @@ -74,4 +74,12 @@ DROP TRIGGER trigg1; DROP FUNCTION testQuestion; DROP EVENT ev1; DROP TABLE t1,t2; -End of 6.0 tests +# +# End of 5.5 tests +# +select variable_value < 1024*1024*1024 from information_schema.global_status where variable_name='memory_used'; +variable_value < 1024*1024*1024 +1 +# +# End of 10.2 tests +# diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index d4d61eb4247..a03a2cff207 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -7331,4 +7331,42 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo pk i c pk i c 1 10 foo 1 10 foo DROP TABLE t; +# +# MDEV-25002: Outer reference in ON clause of subselect +# +create table t1 ( +pk int primary key, +a int +) engine=myisam; +insert into t1 values (1,1), (2,2); +create table t2 ( +pk int primary key, +b int +) engine=myisam; +insert into t2 values (1,1), (2,3); +create table t3 (a int); +insert into t3 values (1),(2); +select a, +(select count(*) from t1, t2 +where t2.pk=t3.a and t1.pk=1) as sq +from t3; +a sq +1 1 +2 1 +select a, +(select count(*) from t1 join t2 on t2.pk=t3.a +where t1.pk=1) as sq +from t3; +a sq +1 1 +2 1 +select a from t3 +where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1); +a +1 +select a from t3 +where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1); +a +1 +drop table t1,t2,t3; # End of 10.2 tests diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index c0df4f626b1..2e24cbcb40c 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -2686,4 +2686,39 @@ SELECT * FROM t2; f bar DROP TABLE t1, t2; +# +# MDEV-23449: alias do not exist and a query do not report an error +# +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); +SELECT a, b FROM t1 WHERE a IN (SELECT A.a FROM t1 A GROUP BY s.id); +ERROR 42S22: Unknown column 's.id' in 'group statement' +DROP TABLE t1; +# +# MDEV-24519: Server crashes in Charset::set_charset upon SELECT +# +CREATE TABLE t1 (a VARBINARY(8)); +INSERT INTO t1 VALUES ('foo'),('bar'); +CREATE TABLE t2 (b VARBINARY(8)); +EXPLAIN +SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2); +a +DROP TABLE t1,t2; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b VARBINARY(8)); +EXPLAIN +SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2); +a +DROP TABLE t1,t2; # End of 10.2 tests diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result index fa9ab8bec1d..f7da3fdb2e2 100644 --- a/mysql-test/r/subselect_no_exists_to_in.result +++ b/mysql-test/r/subselect_no_exists_to_in.result @@ -7331,6 +7331,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo pk i c pk i c 1 10 foo 1 10 foo DROP TABLE t; +# +# MDEV-25002: Outer reference in ON clause of subselect +# +create table t1 ( +pk int primary key, +a int +) engine=myisam; +insert into t1 values (1,1), (2,2); +create table t2 ( +pk int primary key, +b int +) engine=myisam; +insert into t2 values (1,1), (2,3); +create table t3 (a int); +insert into t3 values (1),(2); +select a, +(select count(*) from t1, t2 +where t2.pk=t3.a and t1.pk=1) as sq +from t3; +a sq +1 1 +2 1 +select a, +(select count(*) from t1 join t2 on t2.pk=t3.a +where t1.pk=1) as sq +from t3; +a sq +1 1 +2 1 +select a from t3 +where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1); +a +1 +select a from t3 +where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1); +a +1 +drop table t1,t2,t3; # End of 10.2 tests set optimizer_switch=default; select @@optimizer_switch like '%exists_to_in=off%'; diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index c4d5b2813fd..6ab304c190b 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -7324,6 +7324,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo pk i c pk i c 1 10 foo 1 10 foo DROP TABLE t; +# +# MDEV-25002: Outer reference in ON clause of subselect +# +create table t1 ( +pk int primary key, +a int +) engine=myisam; +insert into t1 values (1,1), (2,2); +create table t2 ( +pk int primary key, +b int +) engine=myisam; +insert into t2 values (1,1), (2,3); +create table t3 (a int); +insert into t3 values (1),(2); +select a, +(select count(*) from t1, t2 +where t2.pk=t3.a and t1.pk=1) as sq +from t3; +a sq +1 1 +2 1 +select a, +(select count(*) from t1 join t2 on t2.pk=t3.a +where t1.pk=1) as sq +from t3; +a sq +1 1 +2 1 +select a from t3 +where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1); +a +1 +select a from t3 +where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1); +a +1 +drop table t1,t2,t3; # End of 10.2 tests set optimizer_switch=default; select @@optimizer_switch like '%materialization=on%'; diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result index fd1c5279f4d..338ddd5808b 100644 --- a/mysql-test/r/subselect_no_opts.result +++ b/mysql-test/r/subselect_no_opts.result @@ -7322,5 +7322,43 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo pk i c pk i c 1 10 foo 1 10 foo DROP TABLE t; +# +# MDEV-25002: Outer reference in ON clause of subselect +# +create table t1 ( +pk int primary key, +a int +) engine=myisam; +insert into t1 values (1,1), (2,2); +create table t2 ( +pk int primary key, +b int +) engine=myisam; +insert into t2 values (1,1), (2,3); +create table t3 (a int); +insert into t3 values (1),(2); +select a, +(select count(*) from t1, t2 +where t2.pk=t3.a and t1.pk=1) as sq +from t3; +a sq +1 1 +2 1 +select a, +(select count(*) from t1 join t2 on t2.pk=t3.a +where t1.pk=1) as sq +from t3; +a sq +1 1 +2 1 +select a from t3 +where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1); +a +1 +select a from t3 +where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1); +a +1 +drop table t1,t2,t3; # End of 10.2 tests set @optimizer_switch_for_subselect_test=null; diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result index 48d5bc974a7..741b070a38b 100644 --- a/mysql-test/r/subselect_no_scache.result +++ b/mysql-test/r/subselect_no_scache.result @@ -7337,6 +7337,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo pk i c pk i c 1 10 foo 1 10 foo DROP TABLE t; +# +# MDEV-25002: Outer reference in ON clause of subselect +# +create table t1 ( +pk int primary key, +a int +) engine=myisam; +insert into t1 values (1,1), (2,2); +create table t2 ( +pk int primary key, +b int +) engine=myisam; +insert into t2 values (1,1), (2,3); +create table t3 (a int); +insert into t3 values (1),(2); +select a, +(select count(*) from t1, t2 +where t2.pk=t3.a and t1.pk=1) as sq +from t3; +a sq +1 1 +2 1 +select a, +(select count(*) from t1 join t2 on t2.pk=t3.a +where t1.pk=1) as sq +from t3; +a sq +1 1 +2 1 +select a from t3 +where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1); +a +1 +select a from t3 +where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1); +a +1 +drop table t1,t2,t3; # End of 10.2 tests set optimizer_switch=default; select @@optimizer_switch like '%subquery_cache=on%'; diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index 2df8073d8bf..ebabafb9c77 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -7322,6 +7322,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo pk i c pk i c 1 10 foo 1 10 foo DROP TABLE t; +# +# MDEV-25002: Outer reference in ON clause of subselect +# +create table t1 ( +pk int primary key, +a int +) engine=myisam; +insert into t1 values (1,1), (2,2); +create table t2 ( +pk int primary key, +b int +) engine=myisam; +insert into t2 values (1,1), (2,3); +create table t3 (a int); +insert into t3 values (1),(2); +select a, +(select count(*) from t1, t2 +where t2.pk=t3.a and t1.pk=1) as sq +from t3; +a sq +1 1 +2 1 +select a, +(select count(*) from t1 join t2 on t2.pk=t3.a +where t1.pk=1) as sq +from t3; +a sq +1 1 +2 1 +select a from t3 +where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1); +a +1 +select a from t3 +where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1); +a +1 +drop table t1,t2,t3; # End of 10.2 tests # # MDEV-19714: JOIN::pseudo_bits_cond is not visible in EXPLAIN FORMAT=JSON diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result index 764a1b2780e..8e4210c06fb 100644 --- a/mysql-test/r/table_elim.result +++ b/mysql-test/r/table_elim.result @@ -544,7 +544,7 @@ drop table t0,t1,t2,t3,t4,t5,t6; CREATE TABLE t1 (f1 int(11), PRIMARY KEY (f1)) ; CREATE TABLE t2 (f4 varchar(1024), KEY (f4)) ; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes INSERT IGNORE INTO t2 VALUES ('xcddwntkbxyorzdv'), ('cnxxcddwntkbxyor'),('r'),('r'), ('did'),('I'),('when'), ('hczkfqjeggivdvac'),('e'),('okay'),('up'); diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index 2a410d2ce97..519f0d547a2 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -176,9 +176,8 @@ Note 1265 Data truncated for column 'a' at row 2 insert ignore into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809"); Warnings: Warning 1264 Out of range value for column 'a' at row 1 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t1`.`a` at row 2 +Warning 1264 Out of range value for column 'a' at row 2 Note 1265 Data truncated for column 'a' at row 3 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t1`.`a` at row 4 insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0"); Warnings: Warning 1265 Data truncated for column 'a' at row 1 @@ -209,7 +208,7 @@ a 99999999.99 0.00 99999999.99 -0.00 +99999999.99 0.00 0.00 123.40 @@ -1078,5 +1077,89 @@ t1 CREATE TABLE `t1` ( DROP TABLE t1; DROP TABLE t1dec102; # +# MDEV-24790 CAST('0e1111111111' AS DECIMAL(38,0)) returns a wrong result +# +SELECT CAST('0e111111111' AS DECIMAL(38,0)) AS a; +a +0 +SELECT CAST('0e1111111111' AS DECIMAL(38,0)) AS a; +a +0 +SELECT CAST('.00000000000000000000000000000000000001e111111111111111111111' AS DECIMAL(38,0)) AS a; +a +99999999999999999999999999999999999999 +Warnings: +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '.00000000000000000000000000000000000001e111111111111111111111' +Warning 1264 Out of range value for column 'a' at row 1 +CREATE TABLE t1 (str VARCHAR(128), comment VARCHAR(128)); +INSERT INTO t1 VALUES +('0e111111111111111111111', 'Zero mantissa and a huge positive exponent'), +('1e111111111111111111111', 'Non-zero mantissa, huge positive exponent'), +('0e-111111111111111111111', 'Zero mantissa and a huge negative exponent'), +('1e-111111111111111111111', 'Non-zero mantissa and a huge negative exponent'); +BEGIN NOT ATOMIC +DECLARE done INT DEFAULT FALSE; +DECLARE vstr, vcomment VARCHAR(128); +DECLARE cur1 CURSOR FOR SELECT str, comment FROM t1 ORDER BY str; +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; +OPEN cur1; +read_loop: +LOOP +FETCH cur1 INTO vstr, vcomment; +IF done THEN +LEAVE read_loop; +END IF; +SELECT vstr AS `--------`, vcomment AS `--------`; +SELECT CAST(str AS DECIMAL(38,0)) FROM t1 WHERE str=vstr; +SHOW WARNINGS; +SELECT CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) FROM t1 WHERE str=vstr; +SHOW WARNINGS; +END LOOP; +END; +$$ +-------- -------- +0e-111111111111111111111 Zero mantissa and a huge negative exponent +CAST(str AS DECIMAL(38,0)) +0 +Level Code Message +CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) +0 +Level Code Message +Warning 1292 Truncated incorrect DECIMAL value: '0e-111111111111111111111garbage' +-------- -------- +0e111111111111111111111 Zero mantissa and a huge positive exponent +CAST(str AS DECIMAL(38,0)) +0 +Level Code Message +CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) +0 +Level Code Message +Warning 1292 Truncated incorrect DECIMAL value: '0e111111111111111111111garbage' +-------- -------- +1e-111111111111111111111 Non-zero mantissa and a huge negative exponent +CAST(str AS DECIMAL(38,0)) +0 +Level Code Message +CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) +0 +Level Code Message +Warning 1292 Truncated incorrect DECIMAL value: '1e-111111111111111111111garbage' +-------- -------- +1e111111111111111111111 Non-zero mantissa, huge positive exponent +CAST(str AS DECIMAL(38,0)) +99999999999999999999999999999999999999 +Level Code Message +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '1e111111111111111111111' +Warning 1264 Out of range value for column 'CAST(str AS DECIMAL(38,0))' at row 1 +CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) +99999999999999999999999999999999999999 +Level Code Message +Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated +Warning 1292 Truncated incorrect DECIMAL value: '1e111111111111111111111garbage' +Warning 1264 Out of range value for column 'CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))' at row 1 +DROP TABLE t1; +# # End of 10.2 tests # diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result index 99c3c50ea8c..75876d2efad 100644 --- a/mysql-test/r/type_year.result +++ b/mysql-test/r/type_year.result @@ -1,4 +1,3 @@ -drop table if exists t1; create table t1 (y year,y2 year(2)); Warnings: Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead @@ -28,6 +27,9 @@ y y2 2001 01 2069 69 drop table t1; +# +# Bug 2335 +# create table t1 (y year); insert ignore into t1 values (now()); Warnings: @@ -36,6 +38,9 @@ select if(y = now(), 1, 0) from t1; if(y = now(), 1, 0) 1 drop table t1; +# +# Bug #27176: Assigning a string to an year column has unexpected results +# create table t1(a year); insert into t1 values (2000.5), ('2000.5'), ('2001a'), ('2.001E3'); Warnings: @@ -47,7 +52,9 @@ a 2001 2001 drop table t1; -End of 5.0 tests +# +# End of 5.0 tests +# # # Bug #49480: WHERE using YEAR columns returns unexpected results # @@ -373,7 +380,8 @@ Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Pleas Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead DROP TABLE t1; # -End of 5.1 tests +# End of 5.1 tests +# create function y2k() returns int deterministic return 2000; create table t1 (a year(2), b int); Warnings: @@ -456,9 +464,6 @@ DROP TABLE t1; # End of 10.1 tests # # -# Start of 10.2 tests -# -# # MDEV-9392 Copying from DECIMAL to YEAR is not consistent about warnings # CREATE TABLE t1 (a YEAR); @@ -500,5 +505,63 @@ Warnings: Warning 1264 Out of range value for column 'a' at row 1 DROP TABLE t1; # +# Various widths of the YEAR +# +create or replace table t1 (a YEAR(0)); +Warnings: +Note 1287 'YEAR(0)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` year(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create or replace table t1 (a YEAR(1)); +Warnings: +Note 1287 'YEAR(1)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` year(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create or replace table t1 (a YEAR(2)); +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` year(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create or replace table t1 (a YEAR(3)); +Warnings: +Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` year(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create or replace table t1 (a YEAR(4)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` year(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create or replace table t1 (a YEAR(5)); +Warnings: +Note 1287 'YEAR(5)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` year(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create or replace table t1 (a YEAR(100)); +Warnings: +Note 1287 'YEAR(100)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` year(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +# # End of 10.2 tests # diff --git a/mysql-test/r/user_limits.result b/mysql-test/r/user_limits.result index bbf73d7c617..8658cc1497d 100644 --- a/mysql-test/r/user_limits.result +++ b/mysql-test/r/user_limits.result @@ -186,3 +186,30 @@ connection default; drop user mysqltest_1@localhost; drop table t1; set global max_user_connections= @my_max_user_connections; +# +# End of 10.1 tests +# +# +# MDEV-17852 Altered connection limits for user have no effect +# +create user foo@'%' with max_user_connections 1; +connect con1,localhost,foo; +select current_user(); +current_user() +foo@% +connect(localhost,foo,,test,MYSQL_PORT,MYSQL_SOCK); +connect con2,localhost,foo; +ERROR 42000: User 'foo' has exceeded the 'max_user_connections' resource (current value: 1) +connection default; +alter user foo with max_user_connections 2; +connect con3,localhost,foo; +select current_user(); +current_user() +foo@% +disconnect con3; +disconnect con1; +connection default; +drop user foo@'%'; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/userstat.result b/mysql-test/r/userstat.result index 01a66aa78ec..8aad76c3750 100644 --- a/mysql-test/r/userstat.result +++ b/mysql-test/r/userstat.result @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS t1; select variable_value from information_schema.global_status where variable_name="handler_read_key" into @global_read_key; show columns from information_schema.client_statistics; Field Type Null Key Default Extra @@ -234,3 +233,17 @@ select @@in_transaction; 0 drop table t1; set @@global.general_log=@save_general_log; +# +# MDEV-25242 Server crashes in check_grant upon invoking function with userstat enabled +# +create function f() returns int return (select 1 from performance_schema.threads); +set global userstat= 1; +select f() from information_schema.table_statistics; +ERROR 21000: Subquery returns more than 1 row +select f() from information_schema.index_statistics; +ERROR 21000: Subquery returns more than 1 row +set global userstat= 0; +drop function f; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 994d5949460..ef4f0a48534 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -6767,5 +6767,71 @@ DROP PROCEDURE sp; DROP VIEW v1; DROP TABLE t1; # +# MDEV-24314: create view with derived table without default database +# +drop database test; +create database db1; +create table db1.t1 (a int); +insert into db1.t1 values (3),(7),(1); +create view db1.v1 as select * from (select * from db1.t1) t; +show create view db1.v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db1`.`v1` AS select `t`.`a` AS `a` from (select `db1`.`t1`.`a` AS `a` from `db1`.`t1`) `t` latin1 latin1_swedish_ci +select * from db1.v1; +a +3 +7 +1 +drop view db1.v1; +prepare stmt from " +create view db1.v1 as select * from (select * from db1.t1) t; +"; +execute stmt; +deallocate prepare stmt; +show create view db1.v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db1`.`v1` AS select `t`.`a` AS `a` from (select `db1`.`t1`.`a` AS `a` from `db1`.`t1`) `t` latin1 latin1_swedish_ci +select * from db1.v1; +a +3 +7 +1 +drop view db1.v1; +drop table db1.t1; +drop database db1; +create database test; +use test; +# +# MDEV-16940: update of multi-table view returning error used in SP +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1), (2); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (2), (3); +CREATE VIEW v1 AS SELECT a, b FROM t1,t2; +CREATE PROCEDURE sp1() UPDATE v1 SET a = 8, b = 9; +CALL sp1; +ERROR HY000: Can not modify more than one base table through a join view 'test.v1' +CALL sp1; +ERROR HY000: Can not modify more than one base table through a join view 'test.v1' +DROP PROCEDURE sp1; +DROP VIEW v1; +DROP TABLE t1, t2; +# +# MDEV-23291: SUM column from a derived table returns invalid values +# +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,1), (2,2); +CREATE view v1 AS +SELECT a as x, (select x) as y, (select y) as z FROM t1; +SELECT sum(z) FROM (SELECT a as x, (select x) as y, (select y) as z FROM t1) q; +sum(z) +3 +SELECT sum(z) FROM v1; +sum(z) +3 +DROP TABLE t1; +DROP VIEW v1; +# # End of 10.2 tests # diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index 3023a86eaad..dd74c5c77fd 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -3866,5 +3866,31 @@ NULL DROP VIEW v1; DROP TABLE t1,t2; # +# MDEV-25032 Window functions without column references get removed from ORDER BY +# +create table t1 (id int, score double); +insert into t1 values +(1, 5), +(1, 6), +(1, 6), +(1, 6), +(1, 7), +(1, 8.1), +(1, 9), +(1, 10); +select id, row_number() over () rn +from t1 +order by rn desc; +id rn +1 8 +1 7 +1 6 +1 5 +1 4 +1 3 +1 2 +1 1 +drop table t1; +# # End of 10.2 tests # diff --git a/mysql-test/r/xa.result b/mysql-test/r/xa.result index 6ae4a06399c..8ff84862270 100644 --- a/mysql-test/r/xa.result +++ b/mysql-test/r/xa.result @@ -241,7 +241,7 @@ DROP TABLE t1; # # Bug#12352846 - TRANS_XA_START(THD*): # ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL() -# FAILED +# FAILED # DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 (a INT) ENGINE=InnoDB; @@ -291,3 +291,29 @@ connection default; XA END 'xid1'; XA ROLLBACK 'xid1'; DROP TABLE t1, t2, t3; +# +# MDEV 15532 XA: Assertion `!log->same_pk' failed in +# row_log_table_apply_delete +# +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +connect con1,localhost,root,,test; +XA START 'xid'; +UPDATE t1 SET a = 5; +connection default; +SET innodb_lock_wait_timeout= 2, lock_wait_timeout= 2; +ALTER TABLE non_existing_table1; +ERROR 42S02: Table 'test.non_existing_table1' doesn't exist +ALTER TABLE t1 FORCE;; +connection con1; +ALTER TABLE non_existing_table2; +ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state +DELETE FROM t1 LIMIT 1; +connection default; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con1; +XA END 'xid'; +XA ROLLBACK 'xid'; +DROP TABLE t1; +disconnect con1; +connection default; diff --git a/mysql-test/suite/binlog/disabled.def b/mysql-test/suite/binlog/disabled.def index 424e5549541..888298bbb09 100644 --- a/mysql-test/suite/binlog/disabled.def +++ b/mysql-test/suite/binlog/disabled.def @@ -9,5 +9,3 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -binlog_truncate_innodb : BUG#11764459 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed -binlog_spurious_ddl_errors : BUG#11761680 2013-01-18 astha Fixed on mysql-5.6 and trunk diff --git a/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result b/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result index 1a81eee1a58..798bd8ab853 100644 --- a/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result +++ b/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result @@ -1,5 +1,5 @@ SET @old_binlog_format= @@global.binlog_format; -INSTALL PLUGIN example SONAME 'ha_example.so'; +INSTALL PLUGIN example SONAME 'ha_example'; ################################################################################ # Verifies if ER_BINLOG_STMT_MODE_AND_ROW_ENGINE happens by setting the binlog # format to STATEMENT and the transaction isolation level to READ COMMITTED as @@ -18,7 +18,7 @@ ALTER TABLE t_row ADD COLUMN b INT; CREATE TRIGGER trig_row BEFORE INSERT ON t_row FOR EACH ROW INSERT INTO t_stmt VALUES (1); CREATE INDEX i ON t_row(a); CREATE TABLE t_row_new ENGINE = InnoDB SELECT * FROM t_row; -ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. +ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. DROP TABLE t_row; @@ -36,12 +36,11 @@ DROP TABLE t_row; SET binlog_format = ROW; CREATE TABLE t_stmt (a VARCHAR(100)) ENGINE = EXAMPLE; ALTER TABLE t_stmt ADD COLUMN b INT; -ERROR 42000: This version of MySQL doesn't yet support 'ALTER TABLE' CREATE TRIGGER trig_stmt BEFORE INSERT ON t_stmt FOR EACH ROW INSERT INTO t_stmt VALUES (1); CREATE INDEX i ON t_stmt(a); ERROR 42000: Too many key parts specified; max 0 parts allowed CREATE TABLE t_stmt_new ENGINE = EXAMPLE SELECT * FROM t_stmt; -ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging. +ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging DROP TABLE t_stmt; diff --git a/mysql-test/suite/binlog/r/binlog_truncate_innodb.result b/mysql-test/suite/binlog/r/binlog_truncate_innodb.result index 8beeeb1a428..87ce8e30dee 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_innodb.result @@ -7,9 +7,11 @@ INSERT INTO t2 VALUES (1),(2),(3); **** Truncate of empty table shall be logged TRUNCATE TABLE t1; TRUNCATE TABLE t2; -show binlog events from <binlog_start>; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2 DROP TABLE t1,t2; # @@ -18,18 +20,17 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2); -# Connection: default BEGIN; INSERT INTO t2 SELECT * FROM t1; -# Connection: truncate +connect truncate,localhost,root,,; TRUNCATE TABLE t1; -# Connection: default +connection default; INSERT INTO t2 SELECT * FROM t1; SELECT COUNT(*) FROM t2; COUNT(*) 4 COMMIT; -# Connection: truncate +connection truncate; # Reaping TRUNCATE TABLE SELECT COUNT(*) FROM t1; COUNT(*) @@ -37,16 +38,20 @@ COUNT(*) SELECT COUNT(*) FROM t2; COUNT(*) 4 -# Connection: default -show binlog events from <binlog_start>; +connection default; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +disconnect truncate; DROP TABLE t1,t2; # Even though the isolation level might be permissive, truncate # table follows a stricter isolation as its locking is based on @@ -59,9 +64,11 @@ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; TRUNCATE TABLE t1; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; TRUNCATE TABLE t2; -show binlog events from <binlog_start>; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2 DROP TABLE t1,t2; # @@ -71,18 +78,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2); SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -# Connection: default BEGIN; INSERT INTO t2 SELECT * FROM t1; -# Connection: truncate +connect truncate,localhost,root,,; TRUNCATE TABLE t1; -# Connection: default +connection default; INSERT INTO t2 SELECT * FROM t1; SELECT COUNT(*) FROM t2; COUNT(*) 4 COMMIT; -# Connection: truncate +connection truncate; # Reaping TRUNCATE TABLE SELECT COUNT(*) FROM t1; COUNT(*) @@ -90,16 +96,20 @@ COUNT(*) SELECT COUNT(*) FROM t2; COUNT(*) 4 -# Connection: default -show binlog events from <binlog_start>; +connection default; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +disconnect truncate; DROP TABLE t1,t2; CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; @@ -109,9 +119,11 @@ SET TRANSACTION ISOLATION LEVEL READ COMMITTED; TRUNCATE TABLE t1; SET TRANSACTION ISOLATION LEVEL READ COMMITTED; TRUNCATE TABLE t2; -show binlog events from <binlog_start>; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2 DROP TABLE t1,t2; # @@ -121,18 +133,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2); SET TRANSACTION ISOLATION LEVEL READ COMMITTED; -# Connection: default BEGIN; INSERT INTO t2 SELECT * FROM t1; -# Connection: truncate +connect truncate,localhost,root,,; TRUNCATE TABLE t1; -# Connection: default +connection default; INSERT INTO t2 SELECT * FROM t1; SELECT COUNT(*) FROM t2; COUNT(*) 4 COMMIT; -# Connection: truncate +connection truncate; # Reaping TRUNCATE TABLE SELECT COUNT(*) FROM t1; COUNT(*) @@ -140,16 +151,20 @@ COUNT(*) SELECT COUNT(*) FROM t2; COUNT(*) 4 -# Connection: default -show binlog events from <binlog_start>; +connection default; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +disconnect truncate; DROP TABLE t1,t2; CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; @@ -159,9 +174,11 @@ SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; TRUNCATE TABLE t1; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; TRUNCATE TABLE t2; -show binlog events from <binlog_start>; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2 DROP TABLE t1,t2; # @@ -171,18 +188,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2); SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; -# Connection: default BEGIN; INSERT INTO t2 SELECT * FROM t1; -# Connection: truncate +connect truncate,localhost,root,,; TRUNCATE TABLE t1; -# Connection: default +connection default; INSERT INTO t2 SELECT * FROM t1; SELECT COUNT(*) FROM t2; COUNT(*) 4 COMMIT; -# Connection: truncate +connection truncate; # Reaping TRUNCATE TABLE SELECT COUNT(*) FROM t1; COUNT(*) @@ -190,16 +206,20 @@ COUNT(*) SELECT COUNT(*) FROM t2; COUNT(*) 4 -# Connection: default -show binlog events from <binlog_start>; +connection default; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +disconnect truncate; DROP TABLE t1,t2; CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; @@ -209,9 +229,11 @@ SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; TRUNCATE TABLE t1; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; TRUNCATE TABLE t2; -show binlog events from <binlog_start>; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2 DROP TABLE t1,t2; # @@ -221,18 +243,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2); SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; -# Connection: default BEGIN; INSERT INTO t2 SELECT * FROM t1; -# Connection: truncate +connect truncate,localhost,root,,; TRUNCATE TABLE t1; -# Connection: default +connection default; INSERT INTO t2 SELECT * FROM t1; SELECT COUNT(*) FROM t2; COUNT(*) 4 COMMIT; -# Connection: truncate +connection truncate; # Reaping TRUNCATE TABLE SELECT COUNT(*) FROM t1; COUNT(*) @@ -240,16 +261,20 @@ COUNT(*) SELECT COUNT(*) FROM t2; COUNT(*) 4 -# Connection: default -show binlog events from <binlog_start>; +connection default; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +disconnect truncate; DROP TABLE t1,t2; SET BINLOG_FORMAT=STATEMENT; RESET MASTER; @@ -261,9 +286,11 @@ SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; TRUNCATE TABLE t1; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; TRUNCATE TABLE t2; -show binlog events from <binlog_start>; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2 DROP TABLE t1,t2; # @@ -273,18 +300,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2); SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; -# Connection: default BEGIN; INSERT INTO t2 SELECT * FROM t1; -# Connection: truncate +connect truncate,localhost,root,,; TRUNCATE TABLE t1; -# Connection: default +connection default; INSERT INTO t2 SELECT * FROM t1; SELECT COUNT(*) FROM t2; COUNT(*) 4 COMMIT; -# Connection: truncate +connection truncate; # Reaping TRUNCATE TABLE SELECT COUNT(*) FROM t1; COUNT(*) @@ -292,14 +318,16 @@ COUNT(*) SELECT COUNT(*) FROM t2; COUNT(*) 4 -# Connection: default -show binlog events from <binlog_start>; +connection default; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN +master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +disconnect truncate; DROP TABLE t1,t2; # Truncate is not supported for SBR if the isolation level is # READ UNCOMMITTED or READ COMMITTED. These specific isolation @@ -312,9 +340,11 @@ SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; TRUNCATE TABLE t1; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; TRUNCATE TABLE t2; -show binlog events from <binlog_start>; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2 DROP TABLE t1,t2; # @@ -324,18 +354,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2); SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; -# Connection: default BEGIN; INSERT INTO t2 SELECT * FROM t1; -# Connection: truncate +connect truncate,localhost,root,,; TRUNCATE TABLE t1; -# Connection: default +connection default; INSERT INTO t2 SELECT * FROM t1; SELECT COUNT(*) FROM t2; COUNT(*) 4 COMMIT; -# Connection: truncate +connection truncate; # Reaping TRUNCATE TABLE SELECT COUNT(*) FROM t1; COUNT(*) @@ -343,14 +372,16 @@ COUNT(*) SELECT COUNT(*) FROM t2; COUNT(*) 4 -# Connection: default -show binlog events from <binlog_start>; +connection default; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN +master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +disconnect truncate; DROP TABLE t1,t2; CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; @@ -360,9 +391,11 @@ SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; TRUNCATE TABLE t1; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; TRUNCATE TABLE t2; -show binlog events from <binlog_start>; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2 DROP TABLE t1,t2; # @@ -372,18 +405,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2); SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; -# Connection: default BEGIN; INSERT INTO t2 SELECT * FROM t1; -# Connection: truncate +connect truncate,localhost,root,,; TRUNCATE TABLE t1; -# Connection: default +connection default; INSERT INTO t2 SELECT * FROM t1; SELECT COUNT(*) FROM t2; COUNT(*) 4 COMMIT; -# Connection: truncate +connection truncate; # Reaping TRUNCATE TABLE SELECT COUNT(*) FROM t1; COUNT(*) @@ -391,13 +423,16 @@ COUNT(*) SELECT COUNT(*) FROM t2; COUNT(*) 4 -# Connection: default -show binlog events from <binlog_start>; +connection default; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN +master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +disconnect truncate; DROP TABLE t1,t2; -SET BINLOG_FORMAT=@old_binlog_format; +SET @@global.binlog_format = @old_binlog_format; +SET @@session.binlog_format = @old_binlog_format; diff --git a/mysql-test/suite/binlog/r/binlog_xa_recover.result b/mysql-test/suite/binlog/r/binlog_xa_recover.result index 25aa1389b71..f5060fd5160 100644 --- a/mysql-test/suite/binlog/r/binlog_xa_recover.result +++ b/mysql-test/suite/binlog/r/binlog_xa_recover.result @@ -146,29 +146,12 @@ master-bin.000004 # Xid # # COMMIT /* XID */ SET DEBUG_SYNC= "now SIGNAL con10_cont"; connection con10; connection default; -SET @old_dbug= @@global.DEBUG_DBUG; -SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed"; SET DEBUG_SYNC= "now SIGNAL con12_cont"; connection con12; connection default; -SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed"; -SET GLOBAL debug_dbug= @old_dbug; SET DEBUG_SYNC= "now SIGNAL con11_cont"; connection con11; connection default; -Checking that master-bin.000004 is the last binlog checkpoint -include/show_binlog_events.inc -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -master-bin.000004 # Gtid_list # # [#-#-#] -master-bin.000004 # Binlog_checkpoint # # master-bin.000001 -master-bin.000004 # Gtid # # BEGIN GTID #-#-# -master-bin.000004 # Annotate_rows # # INSERT INTO t1 VALUES (13, NULL) -master-bin.000004 # Table_map # # table_id: # (test.t1) -master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000004 # Xid # # COMMIT /* XID */ -master-bin.000004 # Binlog_checkpoint # # master-bin.000002 -master-bin.000004 # Binlog_checkpoint # # master-bin.000004 Now crash the server SET SESSION debug_dbug="+d,crash_commit_after_log"; INSERT INTO t1 VALUES (14, NULL); diff --git a/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors-master.opt b/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors-master.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test b/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test index e64e7838a31..29a860764a9 100644 --- a/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test +++ b/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test @@ -71,7 +71,6 @@ DROP TABLE t_row; SET binlog_format = ROW; CREATE TABLE t_stmt (a VARCHAR(100)) ENGINE = EXAMPLE; ---error ER_NOT_SUPPORTED_YET ALTER TABLE t_stmt ADD COLUMN b INT; CREATE TRIGGER trig_stmt BEFORE INSERT ON t_stmt FOR EACH ROW INSERT INTO t_stmt VALUES (1); diff --git a/mysql-test/suite/binlog/t/binlog_truncate_innodb-master.opt b/mysql-test/suite/binlog/t/binlog_truncate_innodb-master.opt deleted file mode 100644 index 69cc489a969..00000000000 --- a/mysql-test/suite/binlog/t/binlog_truncate_innodb-master.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb
\ No newline at end of file diff --git a/mysql-test/suite/binlog/t/binlog_truncate_innodb.test b/mysql-test/suite/binlog/t/binlog_truncate_innodb.test index 56dd5bda505..9e331738ab5 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_innodb.test +++ b/mysql-test/suite/binlog/t/binlog_truncate_innodb.test @@ -41,4 +41,5 @@ source extra/binlog_tests/binlog_truncate.test; let $before_truncate = SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; source extra/binlog_tests/binlog_truncate.test; -SET BINLOG_FORMAT=@old_binlog_format; +SET @@global.binlog_format = @old_binlog_format; +SET @@session.binlog_format = @old_binlog_format;
\ No newline at end of file diff --git a/mysql-test/suite/binlog/t/binlog_xa_recover-master.opt b/mysql-test/suite/binlog/t/binlog_xa_recover.opt index 3c44f9fad10..3c44f9fad10 100644 --- a/mysql-test/suite/binlog/t/binlog_xa_recover-master.opt +++ b/mysql-test/suite/binlog/t/binlog_xa_recover.opt diff --git a/mysql-test/suite/binlog/t/binlog_xa_recover.test b/mysql-test/suite/binlog/t/binlog_xa_recover.test index 0e0b80433ff..3b2a7e45392 100644 --- a/mysql-test/suite/binlog/t/binlog_xa_recover.test +++ b/mysql-test/suite/binlog/t/binlog_xa_recover.test @@ -1 +1,277 @@ ---source extra/binlog_tests/binlog_xa_recover.inc +# +# This include file is used by more than one test suite +# (currently binlog and binlog_encryption). +# Please check all dependent tests after modifying it +# + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_row.inc +--source include/have_perfschema.inc +# Valgrind does not work well with test that crashes the server +--source include/not_valgrind.inc + +# (We do not need to restore these settings, as we crash the server). +SET GLOBAL max_binlog_size= 4096; +SET GLOBAL innodb_flush_log_at_trx_commit= 1; +RESET MASTER; + +CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; +# Insert some data to force a couple binlog rotations (3), so we get some +# normal binlog checkpoints before starting the test. +INSERT INTO t1 VALUES (100, REPEAT("x", 4100)); +# Wait for the master-bin.000002 binlog checkpoint to appear. +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000002" +--let $field= Info +--let $condition= = "master-bin.000002" +--source include/wait_show_condition.inc +INSERT INTO t1 VALUES (101, REPEAT("x", 4100)); +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003" +--let $field= Info +--let $condition= = "master-bin.000003" +--source include/wait_show_condition.inc +INSERT INTO t1 VALUES (102, REPEAT("x", 4100)); +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" +--let $field= Info +--let $condition= = "master-bin.000004" +--source include/wait_show_condition.inc + +# Now start a bunch of transactions that span multiple binlog +# files. Leave then in the state prepared-but-not-committed in the engine +# and crash the server. Check that crash recovery is able to recover all +# of them. +# +# We use debug_sync to get all the transactions into the prepared state before +# we commit any of them. This is because the prepare step flushes the InnoDB +# redo log - including any commits made before, so recovery would become +# unnecessary, decreasing the value of this test. +# +# We arrange to have con1 with a prepared transaction in master-bin.000004, +# con2 and con3 with a prepared transaction in master-bin.000005, and a new +# empty master-bin.000006. So the latest binlog checkpoint should be +# master-bin.000006. + +connect(con1,localhost,root,,); +# First wait after prepare and before write to binlog. +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont"; +# Then complete InnoDB commit in memory (but not commit checkpoint / write to +# disk), and hang until crash, leaving a transaction to be XA recovered. +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever"; +send INSERT INTO t1 VALUES (1, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con1_wait"; + +connect(con2,localhost,root,,); +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont"; +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever"; +send INSERT INTO t1 VALUES (2, NULL); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con2_wait"; + +connect(con3,localhost,root,,); +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont"; +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever"; +send INSERT INTO t1 VALUES (3, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con3_wait"; + +connect(con4,localhost,root,,); +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont"; +SET SESSION debug_dbug="+d,crash_commit_after_log"; +send INSERT INTO t1 VALUES (4, NULL); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con4_wait"; + +SET DEBUG_SYNC= "now SIGNAL con1_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; +SET DEBUG_SYNC= "now SIGNAL con2_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con2_ready"; +SET DEBUG_SYNC= "now SIGNAL con3_cont"; +SET DEBUG_SYNC= "now WAIT_FOR con3_ready"; + +# Check that everything is committed in binary log. +--source include/show_binary_logs.inc +--let $binlog_file= master-bin.000003 +--let $binlog_start= 4 +--source include/show_binlog_events.inc +--let $binlog_file= master-bin.000004 +--source include/show_binlog_events.inc +--let $binlog_file= master-bin.000005 +--source include/show_binlog_events.inc +--let $binlog_file= master-bin.000006 +--source include/show_binlog_events.inc + + +# Check that server will not purge too much. +PURGE BINARY LOGS TO "master-bin.000006"; +--source include/show_binary_logs.inc + +# Now crash the server with one more transaction in prepared state. +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait-binlog_xa_recover.test +EOF +--error 0,2006,2013 +SET DEBUG_SYNC= "now SIGNAL con4_cont"; +connection con4; +--error 2006,2013 +reap; + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart-group_commit_binlog_pos.test +EOF + +connection default; +--enable_reconnect +--source include/wait_until_connected_again.inc + +# Check that all transactions are recovered. +SELECT a FROM t1 ORDER BY a; + +--echo Test that with multiple binlog checkpoints, recovery starts from the last one. +SET GLOBAL max_binlog_size= 4096; +SET GLOBAL innodb_flush_log_at_trx_commit= 1; +RESET MASTER; + +# Rotate to binlog master-bin.000003 while delaying binlog checkpoints. +# So we get multiple binlog checkpoints in master-bin.000003. +# Then complete the checkpoints, crash, and check that we only scan +# the necessary binlog file (ie. that we use the _last_ checkpoint). + +connect(con10,localhost,root,,); +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont"; +send INSERT INTO t1 VALUES (10, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con10_ready"; + +connect(con11,localhost,root,,); +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont"; +send INSERT INTO t1 VALUES (11, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con11_ready"; + +connect(con12,localhost,root,,); +SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont"; +send INSERT INTO t1 VALUES (12, REPEAT("x", 4100)); + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR con12_ready"; +INSERT INTO t1 VALUES (13, NULL); + +--source include/show_binary_logs.inc +--let $binlog_file= master-bin.000004 +--let $binlog_start= 4 +--source include/show_binlog_events.inc + +SET DEBUG_SYNC= "now SIGNAL con10_cont"; +connection con10; +reap; +connection default; + +# We need to sync the test case with the background processing of the +# commit checkpoint, otherwise we get nondeterministic results. +let $wait_condition= select count(*) = 1 from performance_schema.threads where processlist_state = "Waiting for background binlog tasks"; +--source include/wait_condition.inc + +SET DEBUG_SYNC= "now SIGNAL con12_cont"; +connection con12; +reap; +connection default; + +SET DEBUG_SYNC= "now SIGNAL con11_cont"; +connection con11; +reap; + +connection default; +# Wait for the last (master-bin.000004) binlog checkpoint to appear. +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" +--let $field= Info +--let $condition= = "master-bin.000004" +--source include/wait_show_condition.inc + +--echo Now crash the server +# It is not too easy to test XA recovery, as it runs early during server +# startup, before any connections can be made. +# What we do is set a DBUG error insert which will crash if XA recovery +# starts from any other binlog than master-bin.000004 (check the file +# binlog_xa_recover-master.opt). Then we will fail here if XA recovery +# would start from the wrong place. +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait-binlog_xa_recover.test +EOF +SET SESSION debug_dbug="+d,crash_commit_after_log"; +--error 2006,2013 +INSERT INTO t1 VALUES (14, NULL); + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart-group_commit_binlog_pos.test +EOF + +connection default; +--enable_reconnect +--source include/wait_until_connected_again.inc + +# Check that all transactions are recovered. +SELECT a FROM t1 ORDER BY a; + + +--echo *** Check that recovery works if we crashed early during rotate, before +--echo *** binlog checkpoint event could be written. + +SET GLOBAL max_binlog_size= 4096; +SET GLOBAL innodb_flush_log_at_trx_commit= 1; +RESET MASTER; + +# We need some initial data to reach binlog master-bin.000004. Otherwise +# crash recovery fails due to the error insert used for previous test. +INSERT INTO t1 VALUES (21, REPEAT("x", 4100)); +INSERT INTO t1 VALUES (22, REPEAT("x", 4100)); +# Wait for the master-bin.000003 binlog checkpoint to appear. +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003" +--let $field= Info +--let $condition= = "master-bin.000003" +--source include/wait_show_condition.inc +INSERT INTO t1 VALUES (23, REPEAT("x", 4100)); +# Wait for the last (master-bin.000004) binlog checkpoint to appear. +--let $wait_for_all= 0 +--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004" +--let $field= Info +--let $condition= = "master-bin.000004" +--source include/wait_show_condition.inc + +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait-binlog_xa_recover.test +EOF +SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event"; +--error 2006,2013 +INSERT INTO t1 VALUES (24, REPEAT("x", 4100)); + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart-group_commit_binlog_pos.test +EOF + +--enable_reconnect +--source include/wait_until_connected_again.inc + +# Check that all transactions are recovered. +SELECT a FROM t1 ORDER BY a; + +--source include/show_binary_logs.inc +--let $binlog_file= master-bin.000004 +--let $binlog_start= 4 +--source include/show_binlog_events.inc + +# Cleanup +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt b/mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt deleted file mode 100644 index 3c44f9fad10..00000000000 --- a/mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt +++ /dev/null @@ -1 +0,0 @@ ---skip-stack-trace --skip-core-file --loose-debug-dbug=+d,xa_recover_expect_master_bin_000004 diff --git a/mysql-test/suite/binlog_encryption/binlog_xa_recover.result b/mysql-test/suite/binlog_encryption/binlog_xa_recover.result index af36fe277a1..3e4ed42cf7c 100644 --- a/mysql-test/suite/binlog_encryption/binlog_xa_recover.result +++ b/mysql-test/suite/binlog_encryption/binlog_xa_recover.result @@ -151,30 +151,12 @@ master-bin.000004 # Xid # # COMMIT /* XID */ SET DEBUG_SYNC= "now SIGNAL con10_cont"; connection con10; connection default; -SET @old_dbug= @@global.DEBUG_DBUG; -SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed"; SET DEBUG_SYNC= "now SIGNAL con12_cont"; connection con12; connection default; -SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed"; -SET GLOBAL debug_dbug= @old_dbug; SET DEBUG_SYNC= "now SIGNAL con11_cont"; connection con11; connection default; -Checking that master-bin.000004 is the last binlog checkpoint -include/show_binlog_events.inc -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -master-bin.000004 # Start_encryption # # -master-bin.000004 # Gtid_list # # [#-#-#] -master-bin.000004 # Binlog_checkpoint # # master-bin.000001 -master-bin.000004 # Gtid # # BEGIN GTID #-#-# -master-bin.000004 # Annotate_rows # # INSERT INTO t1 VALUES (13, NULL) -master-bin.000004 # Table_map # # table_id: # (test.t1) -master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000004 # Xid # # COMMIT /* XID */ -master-bin.000004 # Binlog_checkpoint # # master-bin.000002 -master-bin.000004 # Binlog_checkpoint # # master-bin.000004 Now crash the server SET SESSION debug_dbug="+d,crash_commit_after_log"; INSERT INTO t1 VALUES (14, NULL); diff --git a/mysql-test/suite/binlog_encryption/binlog_xa_recover.test b/mysql-test/suite/binlog_encryption/binlog_xa_recover.test index 0e0b80433ff..c03adb6aff2 100644 --- a/mysql-test/suite/binlog_encryption/binlog_xa_recover.test +++ b/mysql-test/suite/binlog_encryption/binlog_xa_recover.test @@ -1 +1 @@ ---source extra/binlog_tests/binlog_xa_recover.inc +--source suite/binlog/t/binlog_xa_recover.test diff --git a/mysql-test/suite/binlog_encryption/rpl_semi_sync.result b/mysql-test/suite/binlog_encryption/rpl_semi_sync.result index 6d574681d73..ad6a89648ad 100644 --- a/mysql-test/suite/binlog_encryption/rpl_semi_sync.result +++ b/mysql-test/suite/binlog_encryption/rpl_semi_sync.result @@ -163,20 +163,15 @@ connection slave; connection slave; include/stop_slave.inc connection master; +include/kill_binlog_dump_threads.inc set global rpl_semi_sync_master_timeout= 5000; [ master status should be ON ] -show status like 'Rpl_semi_sync_master_status'; -Variable_name Value -Rpl_semi_sync_master_status ON show status like 'Rpl_semi_sync_master_no_tx'; Variable_name Value Rpl_semi_sync_master_no_tx 0 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value Rpl_semi_sync_master_yes_tx 14 -show status like 'Rpl_semi_sync_master_clients'; -Variable_name Value -Rpl_semi_sync_master_clients 1 [ semi-sync replication of these transactions will fail ] insert into t1 values (500); [ master status should be OFF ] @@ -234,9 +229,6 @@ max(a) 500 connection master; [ master status should be ON again after slave catches up ] -show status like 'Rpl_semi_sync_master_status'; -Variable_name Value -Rpl_semi_sync_master_status ON show status like 'Rpl_semi_sync_master_no_tx'; Variable_name Value Rpl_semi_sync_master_no_tx 12 @@ -303,8 +295,6 @@ connection master; create table t1 (a int) engine = ENGINE_TYPE; drop table t1; connection slave; -show status like 'Rpl_relay%'; -Variable_name Value [ test reset master ] connection master; reset master; @@ -320,8 +310,7 @@ Rpl_semi_sync_master_yes_tx 0 connection slave; include/stop_slave.inc reset slave; -connection master; -kill query _tid; +include/kill_binlog_dump_threads.inc connection slave; include/start_slave.inc connection master; @@ -353,7 +342,7 @@ include/stop_slave.inc reset slave; connection master; reset master; -kill query _tid; +include/kill_binlog_dump_threads.inc set sql_log_bin=0; grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; flush privileges; @@ -404,11 +393,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; Variable_name Value Rpl_semi_sync_slave_status OFF connection master; -kill query _tid; +include/kill_binlog_dump_threads.inc [ Semi-sync status on master should be ON ] -show status like 'Rpl_semi_sync_master_clients'; -Variable_name Value -Rpl_semi_sync_master_clients 0 show status like 'Rpl_semi_sync_master_status'; Variable_name Value Rpl_semi_sync_master_status ON diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result index 1856c30a36b..27eedc45028 100644 --- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result +++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result @@ -3872,6 +3872,32 @@ NULL DROP VIEW v1; DROP TABLE t1,t2; # +# MDEV-25032 Window functions without column references get removed from ORDER BY +# +create table t1 (id int, score double); +insert into t1 values +(1, 5), +(1, 6), +(1, 6), +(1, 6), +(1, 7), +(1, 8.1), +(1, 9), +(1, 10); +select id, row_number() over () rn +from t1 +order by rn desc; +id rn +1 8 +1 7 +1 6 +1 5 +1 4 +1 3 +1 2 +1 1 +drop table t1; +# # End of 10.2 tests # # diff --git a/mysql-test/suite/engines/funcs/disabled.def b/mysql-test/suite/engines/funcs/disabled.def index c43b0c92bc9..e1e2491b4a8 100644 --- a/mysql-test/suite/engines/funcs/disabled.def +++ b/mysql-test/suite/engines/funcs/disabled.def @@ -1,97 +1,4 @@ # List of disabled tests # test name : comment -rpl_redirect : Fails due to bug#49978 -crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb -ix_unique_lob : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value -ix_unique_string_length : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value -rpl_empty_master_crash : Test not applicable in 5.5+ -rpl_REDIRECT : Test not applicable in 5.5+ -rpl_create_database : Result Difference Due To Change In .inc file -rpl_loaddata_m : Result Difference Due To Change In .inc file -rpl_sp_effects : Result Difference Due To Change In .inc file -rpl_variables : Result Difference Due To Change In .inc file -rpl_loaddata_s : Result Difference Due To Change In .inc file -rpl_dual_pos_advance : Result Difference Due To Change In .inc file -rpl000011 : Result Difference Due To Change In .inc file -rpl000013 : Result Difference Due To Change In .inc file -rpl_000015 : Result Difference Due To Change In .inc file -rpl_LD_INFILE : Result Difference Due To Change In .inc file -rpl_alter : Result Difference Due To Change In .inc file -rpl_alter_db : Result Difference Due To Change In .inc file -rpl_alter_db : Result Difference Due To Change In .inc file -rpl_bit : Result Difference Due To Change In .inc file -rpl_bit_npk : Result Difference Due To Change In .inc file -rpl_change_master : Result Difference Due To Change In .inc file -rpl_do_grant : Result Difference Due To Change In .inc file -rpl_drop : Result Difference Due To Change In .inc file -rpl_drop_db : Result Difference Due To Change In .inc file -rpl_flushlog_loop : Result Difference Due To Change In .inc file -rpl_get_lock : Result Difference Due To Change In .inc file -rpl_get_lock : Result Difference Due To Change In .inc file -rpl_insert : Result Difference Due To Change In .inc file -rpl_insert_select : Result Difference Due To Change In .inc file -rpl_loaddata2 : Result Difference Due To Change In .inc file -rpl_loaddatalocal : Result Difference Due To Change In .inc file -rpl_loadfile : Result Difference Due To Change In .inc file -rpl_log_pos : Result Difference Due To Change In .inc file -rpl_many_optimize : Result Difference Due To Change In .inc file -rpl_master_pos_wait : Result Difference Due To Change In .inc file -rpl_misc_functions : Result Difference Due To Change In .inc file -rpl_ps : Result Difference Due To Change In .inc file -rpl_server_id1 : Result Difference Due To Change In .inc file -rpl_session_var : Result Difference Due To Change In .inc file -rpl_sf : Result Difference Due To Change In .inc file -rpl_slave_status : Result Difference Due To Change In .inc file -rpl_sp004 : Result Difference Due To Change In .inc file -rpl_start_stop_slave : Result Difference Due To Change In .inc file -rpl_stm_max_relay_size : Result Difference Due To Change In .inc file -rpl_stm_mystery22 : Result Difference Due To Change In .inc file -rpl_stm_no_op : Result Difference Due To Change In .inc file -rpl_stm_reset_slave : Result Difference Due To Change In .inc file -rpl_temp_table : Result Difference Due To Change In .inc file -rpl_temporary : Result Difference Due To Change In .inc file -rpl_trigger : Result Difference Due To Change In .inc file -rpl_trunc_temp : Result Difference Due To Change In .inc file -rpl_user_variables : Result Difference Due To Change In .inc file -rpl_server_id2 : Result Difference Due To Change In .inc file -rpl000010 : Result Difference Due To Change In .inc file -rpl_init_slave : Result Difference Due To Change In .inc file -rpl_multi_delete2 : Result Difference Due To Change In .inc file -rpl_view : Result Difference Due To Change In .inc file -rpl_ignore_table_update : Result Difference Due To Change In .inc file -rpl_err_ignoredtable : Result Difference Due To Change In .inc file -rpl_multi_update4 : Result Difference Due To Change In .inc file -rpl_multi_delete : Result Difference Due To Change In .inc file -rpl_ignore_grant : Result Difference Due To Change In .inc file -rpl_ignore_revoke : Result Difference Due To Change In .inc file -rpl_free_items : Result Difference Due To Change In .inc file -rpl_replicate_ignore_db : Result Difference Due To Change In .inc file -rpl000017 : Result Difference Due To Change In .inc file -rpl_skip_error : Result Difference Due To Change In .inc file - -rpl_loaddata_s : Test Present in rpl suite as well . Test Fails due to bin log truncation. -rpl_log_pos : Test Present in rpl suite as well . Test Fails due to bin log truncation. -rpl_row_NOW : Result Difference Due To Change In .inc file -rpl_row_USER : Result Difference Due To Change In .inc file -rpl_row_drop : Result Difference Due To Change In .inc file -rpl_row_func001 : Result Difference Due To Change In .inc file -rpl_row_max_relay_size : Result Difference Due To Change In .inc file -rpl_row_reset_slave : Result Difference Due To Change In .inc file -rpl_row_sp001 : Result Difference Due To Change In .inc file -rpl_row_sp005 : Result Difference Due To Change In .inc file -rpl_row_sp008 : Result Difference Due To Change In .inc file -rpl_row_sp009 : Result Difference Due To Change In .inc file -rpl_row_sp010 : Result Difference Due To Change In .inc file -rpl_row_sp011 : Result Difference Due To Change In .inc file -rpl_row_sp012 : Result Difference Due To Change In .inc file -rpl_row_stop_middle : Result Difference Due To Change In .inc file -rpl_row_trig001 : Result Difference Due To Change In .inc file -rpl_row_trig002 : Result Difference Due To Change In .inc file -rpl_row_trig003 : Result Difference Due To Change In .inc file -rpl_row_view01 : Result Difference Due To Change In .inc file -rpl_switch_stm_row_mixed : Result Difference Due To Change In .inc file -rpl_relayspace : Result Difference Due To Change In .inc file -rpl_row_inexist_tbl : Result Difference Due To Change In .inc file -rpl_sp : Result Difference Due To Change In .inc file -rpl_rbr_to_sbr : Result Difference Due To Change In .inc file +crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb [ERROR] InnoDB: Cannot add field `c726` in table `test`.`t1` because after adding it, the row size is 8135 which is greater than maximum allowed size (8126 bytes) for a record on index leaf page diff --git a/mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result b/mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result index 47079e34b38..6a2acb7ec86 100644 --- a/mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result +++ b/mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result @@ -1,5 +1,8 @@ -DROP TABLE IF EXISTS t1; +SET SESSION innodb_strict_mode=off; +call mtr.add_suppression("Row size too large (> 8126)*"); CREATE TABLE t1 (c1 VARCHAR(10),c2 VARCHAR(10),c3 VARCHAR(10),c4 VARCHAR(10),c5 VARCHAR(10),c6 VARCHAR(10),c7 VARCHAR(10),c8 VARCHAR(10),c9 VARCHAR(10),c10 VARCHAR(10),c11 VARCHAR(10),c12 VARCHAR(10),c13 VARCHAR(10),c14 VARCHAR(10),c15 VARCHAR(10),c16 VARCHAR(10),c17 VARCHAR(10),c18 VARCHAR(10),c19 VARCHAR(10),c20 VARCHAR(10),c21 VARCHAR(10),c22 VARCHAR(10),c23 VARCHAR(10),c24 VARCHAR(10),c25 VARCHAR(10),c26 VARCHAR(10),c27 VARCHAR(10),c28 VARCHAR(10),c29 VARCHAR(10),c30 VARCHAR(10),c31 VARCHAR(10),c32 VARCHAR(10),c33 VARCHAR(10),c34 VARCHAR(10),c35 VARCHAR(10),c36 VARCHAR(10),c37 VARCHAR(10),c38 VARCHAR(10),c39 VARCHAR(10),c40 VARCHAR(10),c41 VARCHAR(10),c42 VARCHAR(10),c43 VARCHAR(10),c44 VARCHAR(10),c45 VARCHAR(10),c46 VARCHAR(10),c47 VARCHAR(10),c48 VARCHAR(10),c49 VARCHAR(10),c50 VARCHAR(10),c51 VARCHAR(10),c52 VARCHAR(10),c53 VARCHAR(10),c54 VARCHAR(10),c55 VARCHAR(10),c56 VARCHAR(10),c57 VARCHAR(10),c58 VARCHAR(10),c59 VARCHAR(10),c60 VARCHAR(10),c61 VARCHAR(10),c62 VARCHAR(10),c63 VARCHAR(10),c64 VARCHAR(10),c65 VARCHAR(10),c66 VARCHAR(10),c67 VARCHAR(10),c68 VARCHAR(10),c69 VARCHAR(10),c70 VARCHAR(10),c71 VARCHAR(10),c72 VARCHAR(10),c73 VARCHAR(10),c74 VARCHAR(10),c75 VARCHAR(10),c76 VARCHAR(10),c77 VARCHAR(10),c78 VARCHAR(10),c79 VARCHAR(10),c80 VARCHAR(10),c81 VARCHAR(10),c82 VARCHAR(10),c83 VARCHAR(10),c84 VARCHAR(10),c85 VARCHAR(10),c86 VARCHAR(10),c87 VARCHAR(10),c88 VARCHAR(10),c89 VARCHAR(10),c90 VARCHAR(10),c91 VARCHAR(10),c92 VARCHAR(10),c93 VARCHAR(10),c94 VARCHAR(10),c95 VARCHAR(10),c96 VARCHAR(10),c97 VARCHAR(10),c98 VARCHAR(10),c99 VARCHAR(10),c100 VARCHAR(10),c101 VARCHAR(10),c102 VARCHAR(10),c103 VARCHAR(10),c104 VARCHAR(10),c105 VARCHAR(10),c106 VARCHAR(10),c107 VARCHAR(10),c108 VARCHAR(10),c109 VARCHAR(10),c110 VARCHAR(10),c111 VARCHAR(10),c112 VARCHAR(10),c113 VARCHAR(10),c114 VARCHAR(10),c115 VARCHAR(10),c116 VARCHAR(10),c117 VARCHAR(10),c118 VARCHAR(10),c119 VARCHAR(10),c120 VARCHAR(10),c121 VARCHAR(10),c122 VARCHAR(10),c123 VARCHAR(10),c124 VARCHAR(10),c125 VARCHAR(10),c126 VARCHAR(10),c127 VARCHAR(10),c128 VARCHAR(10),c129 VARCHAR(10),c130 VARCHAR(10),c131 VARCHAR(10),c132 VARCHAR(10),c133 VARCHAR(10),c134 VARCHAR(10),c135 VARCHAR(10),c136 VARCHAR(10),c137 VARCHAR(10),c138 VARCHAR(10),c139 VARCHAR(10),c140 VARCHAR(10),c141 VARCHAR(10),c142 VARCHAR(10),c143 VARCHAR(10),c144 VARCHAR(10),c145 VARCHAR(10),c146 VARCHAR(10),c147 VARCHAR(10),c148 VARCHAR(10),c149 VARCHAR(10),c150 VARCHAR(10),c151 VARCHAR(10),c152 VARCHAR(10),c153 VARCHAR(10),c154 VARCHAR(10),c155 VARCHAR(10),c156 VARCHAR(10),c157 VARCHAR(10),c158 VARCHAR(10),c159 VARCHAR(10),c160 VARCHAR(10),c161 VARCHAR(10),c162 VARCHAR(10),c163 VARCHAR(10),c164 VARCHAR(10),c165 VARCHAR(10),c166 VARCHAR(10),c167 VARCHAR(10),c168 VARCHAR(10),c169 VARCHAR(10),c170 VARCHAR(10),c171 VARCHAR(10),c172 VARCHAR(10),c173 VARCHAR(10),c174 VARCHAR(10),c175 VARCHAR(10),c176 VARCHAR(10),c177 VARCHAR(10),c178 VARCHAR(10),c179 VARCHAR(10),c180 VARCHAR(10),c181 VARCHAR(10),c182 VARCHAR(10),c183 VARCHAR(10),c184 VARCHAR(10),c185 VARCHAR(10),c186 VARCHAR(10),c187 VARCHAR(10),c188 VARCHAR(10),c189 VARCHAR(10),c190 VARCHAR(10),c191 VARCHAR(10),c192 VARCHAR(10),c193 VARCHAR(10),c194 VARCHAR(10),c195 VARCHAR(10),c196 VARCHAR(10),c197 VARCHAR(10),c198 VARCHAR(10),c199 VARCHAR(10),c200 VARCHAR(10),c201 VARCHAR(10),c202 VARCHAR(10),c203 VARCHAR(10),c204 VARCHAR(10),c205 VARCHAR(10),c206 VARCHAR(10),c207 VARCHAR(10),c208 VARCHAR(10),c209 VARCHAR(10),c210 VARCHAR(10),c211 VARCHAR(10),c212 VARCHAR(10),c213 VARCHAR(10),c214 VARCHAR(10),c215 VARCHAR(10),c216 VARCHAR(10),c217 VARCHAR(10),c218 VARCHAR(10),c219 VARCHAR(10),c220 VARCHAR(10),c221 VARCHAR(10),c222 VARCHAR(10),c223 VARCHAR(10),c224 VARCHAR(10),c225 VARCHAR(10),c226 VARCHAR(10),c227 VARCHAR(10),c228 VARCHAR(10),c229 VARCHAR(10),c230 VARCHAR(10),c231 VARCHAR(10),c232 VARCHAR(10),c233 VARCHAR(10),c234 VARCHAR(10),c235 VARCHAR(10),c236 VARCHAR(10),c237 VARCHAR(10),c238 VARCHAR(10),c239 VARCHAR(10),c240 VARCHAR(10),c241 VARCHAR(10),c242 VARCHAR(10),c243 VARCHAR(10),c244 VARCHAR(10),c245 VARCHAR(10),c246 VARCHAR(10),c247 VARCHAR(10),c248 VARCHAR(10),c249 VARCHAR(10),c250 VARCHAR(10),c251 VARCHAR(10),c252 VARCHAR(10),c253 VARCHAR(10),c254 VARCHAR(10),c255 VARCHAR(10),c256 VARCHAR(10),c257 VARCHAR(10),c258 VARCHAR(10),c259 VARCHAR(10),c260 VARCHAR(10),c261 VARCHAR(10),c262 VARCHAR(10),c263 VARCHAR(10),c264 VARCHAR(10),c265 VARCHAR(10),c266 VARCHAR(10),c267 VARCHAR(10),c268 VARCHAR(10),c269 VARCHAR(10),c270 VARCHAR(10),c271 VARCHAR(10),c272 VARCHAR(10),c273 VARCHAR(10),c274 VARCHAR(10),c275 VARCHAR(10),c276 VARCHAR(10),c277 VARCHAR(10),c278 VARCHAR(10),c279 VARCHAR(10),c280 VARCHAR(10),c281 VARCHAR(10),c282 VARCHAR(10),c283 VARCHAR(10),c284 VARCHAR(10),c285 VARCHAR(10),c286 VARCHAR(10),c287 VARCHAR(10),c288 VARCHAR(10),c289 VARCHAR(10),c290 VARCHAR(10),c291 VARCHAR(10),c292 VARCHAR(10),c293 VARCHAR(10),c294 VARCHAR(10),c295 VARCHAR(10),c296 VARCHAR(10),c297 VARCHAR(10),c298 VARCHAR(10),c299 VARCHAR(10),c300 VARCHAR(10),c301 VARCHAR(10),c302 VARCHAR(10),c303 VARCHAR(10),c304 VARCHAR(10),c305 VARCHAR(10),c306 VARCHAR(10),c307 VARCHAR(10),c308 VARCHAR(10),c309 VARCHAR(10),c310 VARCHAR(10),c311 VARCHAR(10),c312 VARCHAR(10),c313 VARCHAR(10),c314 VARCHAR(10),c315 VARCHAR(10),c316 VARCHAR(10),c317 VARCHAR(10),c318 VARCHAR(10),c319 VARCHAR(10),c320 VARCHAR(10),c321 VARCHAR(10),c322 VARCHAR(10),c323 VARCHAR(10),c324 VARCHAR(10),c325 VARCHAR(10),c326 VARCHAR(10),c327 VARCHAR(10),c328 VARCHAR(10),c329 VARCHAR(10),c330 VARCHAR(10),c331 VARCHAR(10),c332 VARCHAR(10),c333 VARCHAR(10),c334 VARCHAR(10),c335 VARCHAR(10),c336 VARCHAR(10),c337 VARCHAR(10),c338 VARCHAR(10),c339 VARCHAR(10),c340 VARCHAR(10),c341 VARCHAR(10),c342 VARCHAR(10),c343 VARCHAR(10),c344 VARCHAR(10),c345 VARCHAR(10),c346 VARCHAR(10),c347 VARCHAR(10),c348 VARCHAR(10),c349 VARCHAR(10),c350 VARCHAR(10),c351 VARCHAR(10),c352 VARCHAR(10),c353 VARCHAR(10),c354 VARCHAR(10),c355 VARCHAR(10),c356 VARCHAR(10),c357 VARCHAR(10),c358 VARCHAR(10),c359 VARCHAR(10),c360 VARCHAR(10),c361 VARCHAR(10),c362 VARCHAR(10),c363 VARCHAR(10),c364 VARCHAR(10),c365 VARCHAR(10),c366 VARCHAR(10),c367 VARCHAR(10),c368 VARCHAR(10),c369 VARCHAR(10),c370 VARCHAR(10),c371 VARCHAR(10),c372 VARCHAR(10),c373 VARCHAR(10),c374 VARCHAR(10),c375 VARCHAR(10),c376 VARCHAR(10),c377 VARCHAR(10),c378 VARCHAR(10),c379 VARCHAR(10),c380 VARCHAR(10),c381 VARCHAR(10),c382 VARCHAR(10),c383 VARCHAR(10),c384 VARCHAR(10),c385 VARCHAR(10),c386 VARCHAR(10),c387 VARCHAR(10),c388 VARCHAR(10),c389 VARCHAR(10),c390 VARCHAR(10),c391 VARCHAR(10),c392 VARCHAR(10),c393 VARCHAR(10),c394 VARCHAR(10),c395 VARCHAR(10),c396 VARCHAR(10),c397 VARCHAR(10),c398 VARCHAR(10),c399 VARCHAR(10),c400 VARCHAR(10),c401 VARCHAR(10),c402 VARCHAR(10),c403 VARCHAR(10),c404 VARCHAR(10),c405 VARCHAR(10),c406 VARCHAR(10),c407 VARCHAR(10),c408 VARCHAR(10),c409 VARCHAR(10),c410 VARCHAR(10),c411 VARCHAR(10),c412 VARCHAR(10),c413 VARCHAR(10),c414 VARCHAR(10),c415 VARCHAR(10),c416 VARCHAR(10),c417 VARCHAR(10),c418 VARCHAR(10),c419 VARCHAR(10),c420 VARCHAR(10),c421 VARCHAR(10),c422 VARCHAR(10),c423 VARCHAR(10),c424 VARCHAR(10),c425 VARCHAR(10),c426 VARCHAR(10),c427 VARCHAR(10),c428 VARCHAR(10),c429 VARCHAR(10),c430 VARCHAR(10),c431 VARCHAR(10),c432 VARCHAR(10),c433 VARCHAR(10),c434 VARCHAR(10),c435 VARCHAR(10),c436 VARCHAR(10),c437 VARCHAR(10),c438 VARCHAR(10),c439 VARCHAR(10),c440 VARCHAR(10),c441 VARCHAR(10),c442 VARCHAR(10),c443 VARCHAR(10),c444 VARCHAR(10),c445 VARCHAR(10),c446 VARCHAR(10),c447 VARCHAR(10),c448 VARCHAR(10),c449 VARCHAR(10),c450 VARCHAR(10),c451 VARCHAR(10),c452 VARCHAR(10),c453 VARCHAR(10),c454 VARCHAR(10),c455 VARCHAR(10),c456 VARCHAR(10),c457 VARCHAR(10),c458 VARCHAR(10),c459 VARCHAR(10),c460 VARCHAR(10),c461 VARCHAR(10),c462 VARCHAR(10),c463 VARCHAR(10),c464 VARCHAR(10),c465 VARCHAR(10),c466 VARCHAR(10),c467 VARCHAR(10),c468 VARCHAR(10),c469 VARCHAR(10),c470 VARCHAR(10),c471 VARCHAR(10),c472 VARCHAR(10),c473 VARCHAR(10),c474 VARCHAR(10),c475 VARCHAR(10),c476 VARCHAR(10),c477 VARCHAR(10),c478 VARCHAR(10),c479 VARCHAR(10),c480 VARCHAR(10),c481 VARCHAR(10),c482 VARCHAR(10),c483 VARCHAR(10),c484 VARCHAR(10),c485 VARCHAR(10),c486 VARCHAR(10),c487 VARCHAR(10),c488 VARCHAR(10),c489 VARCHAR(10),c490 VARCHAR(10),c491 VARCHAR(10),c492 VARCHAR(10),c493 VARCHAR(10),c494 VARCHAR(10),c495 VARCHAR(10),c496 VARCHAR(10),c497 VARCHAR(10),c498 VARCHAR(10),c499 VARCHAR(10),c500 VARCHAR(10),c501 VARCHAR(10),c502 VARCHAR(10),c503 VARCHAR(10),c504 VARCHAR(10),c505 VARCHAR(10),c506 VARCHAR(10),c507 VARCHAR(10),c508 VARCHAR(10),c509 VARCHAR(10),c510 VARCHAR(10),c511 VARCHAR(10),c512 VARCHAR(10),c513 VARCHAR(10),c514 VARCHAR(10),c515 VARCHAR(10),c516 VARCHAR(10),c517 VARCHAR(10),c518 VARCHAR(10),c519 VARCHAR(10),c520 VARCHAR(10),c521 VARCHAR(10),c522 VARCHAR(10),c523 VARCHAR(10),c524 VARCHAR(10),c525 VARCHAR(10),c526 VARCHAR(10),c527 VARCHAR(10),c528 VARCHAR(10),c529 VARCHAR(10),c530 VARCHAR(10),c531 VARCHAR(10),c532 VARCHAR(10),c533 VARCHAR(10),c534 VARCHAR(10),c535 VARCHAR(10),c536 VARCHAR(10),c537 VARCHAR(10),c538 VARCHAR(10),c539 VARCHAR(10),c540 VARCHAR(10),c541 VARCHAR(10),c542 VARCHAR(10),c543 VARCHAR(10),c544 VARCHAR(10),c545 VARCHAR(10),c546 VARCHAR(10),c547 VARCHAR(10),c548 VARCHAR(10),c549 VARCHAR(10),c550 VARCHAR(10),c551 VARCHAR(10),c552 VARCHAR(10),c553 VARCHAR(10),c554 VARCHAR(10),c555 VARCHAR(10),c556 VARCHAR(10),c557 VARCHAR(10),c558 VARCHAR(10),c559 VARCHAR(10),c560 VARCHAR(10),c561 VARCHAR(10),c562 VARCHAR(10),c563 VARCHAR(10),c564 VARCHAR(10),c565 VARCHAR(10),c566 VARCHAR(10),c567 VARCHAR(10),c568 VARCHAR(10),c569 VARCHAR(10),c570 VARCHAR(10),c571 VARCHAR(10),c572 VARCHAR(10),c573 VARCHAR(10),c574 VARCHAR(10),c575 VARCHAR(10),c576 VARCHAR(10),c577 VARCHAR(10),c578 VARCHAR(10),c579 VARCHAR(10),c580 VARCHAR(10),c581 VARCHAR(10),c582 VARCHAR(10),c583 VARCHAR(10),c584 VARCHAR(10),c585 VARCHAR(10),c586 VARCHAR(10),c587 VARCHAR(10),c588 VARCHAR(10),c589 VARCHAR(10),c590 VARCHAR(10),c591 VARCHAR(10),c592 VARCHAR(10),c593 VARCHAR(10),c594 VARCHAR(10),c595 VARCHAR(10),c596 VARCHAR(10),c597 VARCHAR(10),c598 VARCHAR(10),c599 VARCHAR(10),c600 VARCHAR(10),c601 VARCHAR(10),c602 VARCHAR(10),c603 VARCHAR(10),c604 VARCHAR(10),c605 VARCHAR(10),c606 VARCHAR(10),c607 VARCHAR(10),c608 VARCHAR(10),c609 VARCHAR(10),c610 VARCHAR(10),c611 VARCHAR(10),c612 VARCHAR(10),c613 VARCHAR(10),c614 VARCHAR(10),c615 VARCHAR(10),c616 VARCHAR(10),c617 VARCHAR(10),c618 VARCHAR(10),c619 VARCHAR(10),c620 VARCHAR(10),c621 VARCHAR(10),c622 VARCHAR(10),c623 VARCHAR(10),c624 VARCHAR(10),c625 VARCHAR(10),c626 VARCHAR(10),c627 VARCHAR(10),c628 VARCHAR(10),c629 VARCHAR(10),c630 VARCHAR(10),c631 VARCHAR(10),c632 VARCHAR(10),c633 VARCHAR(10),c634 VARCHAR(10),c635 VARCHAR(10),c636 VARCHAR(10),c637 VARCHAR(10),c638 VARCHAR(10),c639 VARCHAR(10),c640 VARCHAR(10),c641 VARCHAR(10),c642 VARCHAR(10),c643 VARCHAR(10),c644 VARCHAR(10),c645 VARCHAR(10),c646 VARCHAR(10),c647 VARCHAR(10),c648 VARCHAR(10),c649 VARCHAR(10),c650 VARCHAR(10),c651 VARCHAR(10),c652 VARCHAR(10),c653 VARCHAR(10),c654 VARCHAR(10),c655 VARCHAR(10),c656 VARCHAR(10),c657 VARCHAR(10),c658 VARCHAR(10),c659 VARCHAR(10),c660 VARCHAR(10),c661 VARCHAR(10),c662 VARCHAR(10),c663 VARCHAR(10),c664 VARCHAR(10),c665 VARCHAR(10),c666 VARCHAR(10),c667 VARCHAR(10),c668 VARCHAR(10),c669 VARCHAR(10),c670 VARCHAR(10),c671 VARCHAR(10),c672 VARCHAR(10),c673 VARCHAR(10),c674 VARCHAR(10),c675 VARCHAR(10),c676 VARCHAR(10),c677 VARCHAR(10),c678 VARCHAR(10),c679 VARCHAR(10),c680 VARCHAR(10),c681 VARCHAR(10),c682 VARCHAR(10),c683 VARCHAR(10),c684 VARCHAR(10),c685 VARCHAR(10),c686 VARCHAR(10),c687 VARCHAR(10),c688 VARCHAR(10),c689 VARCHAR(10),c690 VARCHAR(10),c691 VARCHAR(10),c692 VARCHAR(10),c693 VARCHAR(10),c694 VARCHAR(10),c695 VARCHAR(10),c696 VARCHAR(10),c697 VARCHAR(10),c698 VARCHAR(10),c699 VARCHAR(10),c700 VARCHAR(10),c701 VARCHAR(10),c702 VARCHAR(10),c703 VARCHAR(10),c704 VARCHAR(10),c705 VARCHAR(10),c706 VARCHAR(10),c707 VARCHAR(10),c708 VARCHAR(10),c709 VARCHAR(10),c710 VARCHAR(10),c711 VARCHAR(10),c712 VARCHAR(10),c713 VARCHAR(10),c714 VARCHAR(10),c715 VARCHAR(10),c716 VARCHAR(10),c717 VARCHAR(10),c718 VARCHAR(10),c719 VARCHAR(10),c720 VARCHAR(10),c721 VARCHAR(10),c722 VARCHAR(10),c723 VARCHAR(10),c724 VARCHAR(10),c725 VARCHAR(10),c726 VARCHAR(10),c727 VARCHAR(10),c728 VARCHAR(10),c729 VARCHAR(10),c730 VARCHAR(10),c731 VARCHAR(10),c732 VARCHAR(10),c733 VARCHAR(10),c734 VARCHAR(10),c735 VARCHAR(10),c736 VARCHAR(10),c737 VARCHAR(10),c738 VARCHAR(10),c739 VARCHAR(10),c740 VARCHAR(10),c741 VARCHAR(10),c742 VARCHAR(10),c743 VARCHAR(10),c744 VARCHAR(10),c745 VARCHAR(10),c746 VARCHAR(10),c747 VARCHAR(10),c748 VARCHAR(10),c749 VARCHAR(10),c750 VARCHAR(10),c751 VARCHAR(10),c752 VARCHAR(10),c753 VARCHAR(10),c754 VARCHAR(10),c755 VARCHAR(10),c756 VARCHAR(10),c757 VARCHAR(10),c758 VARCHAR(10),c759 VARCHAR(10),c760 VARCHAR(10),c761 VARCHAR(10),c762 VARCHAR(10),c763 VARCHAR(10),c764 VARCHAR(10),c765 VARCHAR(10),c766 VARCHAR(10),c767 VARCHAR(10),c768 VARCHAR(10),c769 VARCHAR(10),c770 VARCHAR(10),c771 VARCHAR(10),c772 VARCHAR(10),c773 VARCHAR(10),c774 VARCHAR(10),c775 VARCHAR(10),c776 VARCHAR(10),c777 VARCHAR(10),c778 VARCHAR(10),c779 VARCHAR(10),c780 VARCHAR(10),c781 VARCHAR(10),c782 VARCHAR(10),c783 VARCHAR(10),c784 VARCHAR(10),c785 VARCHAR(10),c786 VARCHAR(10),c787 VARCHAR(10),c788 VARCHAR(10),c789 VARCHAR(10),c790 VARCHAR(10),c791 VARCHAR(10),c792 VARCHAR(10),c793 VARCHAR(10),c794 VARCHAR(10),c795 VARCHAR(10),c796 VARCHAR(10),c797 VARCHAR(10),c798 VARCHAR(10),c799 VARCHAR(10),c800 VARCHAR(10),c801 VARCHAR(10),c802 VARCHAR(10),c803 VARCHAR(10),c804 VARCHAR(10),c805 VARCHAR(10),c806 VARCHAR(10),c807 VARCHAR(10),c808 VARCHAR(10),c809 VARCHAR(10),c810 VARCHAR(10),c811 VARCHAR(10),c812 VARCHAR(10),c813 VARCHAR(10),c814 VARCHAR(10),c815 VARCHAR(10),c816 VARCHAR(10),c817 VARCHAR(10),c818 VARCHAR(10),c819 VARCHAR(10),c820 VARCHAR(10),c821 VARCHAR(10),c822 VARCHAR(10),c823 VARCHAR(10),c824 VARCHAR(10),c825 VARCHAR(10),c826 VARCHAR(10),c827 VARCHAR(10),c828 VARCHAR(10),c829 VARCHAR(10),c830 VARCHAR(10),c831 VARCHAR(10),c832 VARCHAR(10),c833 VARCHAR(10),c834 VARCHAR(10),c835 VARCHAR(10),c836 VARCHAR(10),c837 VARCHAR(10),c838 VARCHAR(10),c839 VARCHAR(10),c840 VARCHAR(10),c841 VARCHAR(10),c842 VARCHAR(10),c843 VARCHAR(10),c844 VARCHAR(10),c845 VARCHAR(10),c846 VARCHAR(10),c847 VARCHAR(10),c848 VARCHAR(10),c849 VARCHAR(10),c850 VARCHAR(10),c851 VARCHAR(10),c852 VARCHAR(10),c853 VARCHAR(10),c854 VARCHAR(10),c855 VARCHAR(10),c856 VARCHAR(10),c857 VARCHAR(10),c858 VARCHAR(10),c859 VARCHAR(10),c860 VARCHAR(10),c861 VARCHAR(10),c862 VARCHAR(10),c863 VARCHAR(10),c864 VARCHAR(10),c865 VARCHAR(10),c866 VARCHAR(10),c867 VARCHAR(10),c868 VARCHAR(10),c869 VARCHAR(10),c870 VARCHAR(10),c871 VARCHAR(10),c872 VARCHAR(10),c873 VARCHAR(10),c874 VARCHAR(10),c875 VARCHAR(10),c876 VARCHAR(10),c877 VARCHAR(10),c878 VARCHAR(10),c879 VARCHAR(10),c880 VARCHAR(10),c881 VARCHAR(10),c882 VARCHAR(10),c883 VARCHAR(10),c884 VARCHAR(10),c885 VARCHAR(10),c886 VARCHAR(10),c887 VARCHAR(10),c888 VARCHAR(10),c889 VARCHAR(10),c890 VARCHAR(10),c891 VARCHAR(10),c892 VARCHAR(10),c893 VARCHAR(10),c894 VARCHAR(10),c895 VARCHAR(10),c896 VARCHAR(10),c897 VARCHAR(10),c898 VARCHAR(10),c899 VARCHAR(10),c900 VARCHAR(10),c901 VARCHAR(10),c902 VARCHAR(10),c903 VARCHAR(10),c904 VARCHAR(10),c905 VARCHAR(10),c906 VARCHAR(10),c907 VARCHAR(10),c908 VARCHAR(10),c909 VARCHAR(10),c910 VARCHAR(10),c911 VARCHAR(10),c912 VARCHAR(10),c913 VARCHAR(10),c914 VARCHAR(10),c915 VARCHAR(10),c916 VARCHAR(10),c917 VARCHAR(10),c918 VARCHAR(10),c919 VARCHAR(10),c920 VARCHAR(10),c921 VARCHAR(10),c922 VARCHAR(10),c923 VARCHAR(10),c924 VARCHAR(10),c925 VARCHAR(10),c926 VARCHAR(10),c927 VARCHAR(10),c928 VARCHAR(10),c929 VARCHAR(10),c930 VARCHAR(10),c931 VARCHAR(10),c932 VARCHAR(10),c933 VARCHAR(10),c934 VARCHAR(10),c935 VARCHAR(10),c936 VARCHAR(10),c937 VARCHAR(10),c938 VARCHAR(10),c939 VARCHAR(10),c940 VARCHAR(10),c941 VARCHAR(10),c942 VARCHAR(10),c943 VARCHAR(10),c944 VARCHAR(10),c945 VARCHAR(10),c946 VARCHAR(10),c947 VARCHAR(10),c948 VARCHAR(10),c949 VARCHAR(10),c950 VARCHAR(10),c951 VARCHAR(10),c952 VARCHAR(10),c953 VARCHAR(10),c954 VARCHAR(10),c955 VARCHAR(10),c956 VARCHAR(10),c957 VARCHAR(10),c958 VARCHAR(10),c959 VARCHAR(10),c960 VARCHAR(10),c961 VARCHAR(10),c962 VARCHAR(10),c963 VARCHAR(10),c964 VARCHAR(10),c965 VARCHAR(10),c966 VARCHAR(10),c967 VARCHAR(10),c968 VARCHAR(10),c969 VARCHAR(10),c970 VARCHAR(10),c971 VARCHAR(10),c972 VARCHAR(10),c973 VARCHAR(10),c974 VARCHAR(10),c975 VARCHAR(10),c976 VARCHAR(10),c977 VARCHAR(10),c978 VARCHAR(10),c979 VARCHAR(10),c980 VARCHAR(10),c981 VARCHAR(10),c982 VARCHAR(10),c983 VARCHAR(10),c984 VARCHAR(10),c985 VARCHAR(10),c986 VARCHAR(10),c987 VARCHAR(10),c988 VARCHAR(10),c989 VARCHAR(10),c990 VARCHAR(10),c991 VARCHAR(10),c992 VARCHAR(10),c993 VARCHAR(10),c994 VARCHAR(10),c995 VARCHAR(10),c996 VARCHAR(10),c997 VARCHAR(10),c998 VARCHAR(10),c999 VARCHAR(10),c1000 VARCHAR(10) ) ; +Warnings: +Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. INSERT INTO t1(c1) VALUES('abc'); SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 c33 c34 c35 c36 c37 c38 c39 c40 c41 c42 c43 c44 c45 c46 c47 c48 c49 c50 c51 c52 c53 c54 c55 c56 c57 c58 c59 c60 c61 c62 c63 c64 c65 c66 c67 c68 c69 c70 c71 c72 c73 c74 c75 c76 c77 c78 c79 c80 c81 c82 c83 c84 c85 c86 c87 c88 c89 c90 c91 c92 c93 c94 c95 c96 c97 c98 c99 c100 c101 c102 c103 c104 c105 c106 c107 c108 c109 c110 c111 c112 c113 c114 c115 c116 c117 c118 c119 c120 c121 c122 c123 c124 c125 c126 c127 c128 c129 c130 c131 c132 c133 c134 c135 c136 c137 c138 c139 c140 c141 c142 c143 c144 c145 c146 c147 c148 c149 c150 c151 c152 c153 c154 c155 c156 c157 c158 c159 c160 c161 c162 c163 c164 c165 c166 c167 c168 c169 c170 c171 c172 c173 c174 c175 c176 c177 c178 c179 c180 c181 c182 c183 c184 c185 c186 c187 c188 c189 c190 c191 c192 c193 c194 c195 c196 c197 c198 c199 c200 c201 c202 c203 c204 c205 c206 c207 c208 c209 c210 c211 c212 c213 c214 c215 c216 c217 c218 c219 c220 c221 c222 c223 c224 c225 c226 c227 c228 c229 c230 c231 c232 c233 c234 c235 c236 c237 c238 c239 c240 c241 c242 c243 c244 c245 c246 c247 c248 c249 c250 c251 c252 c253 c254 c255 c256 c257 c258 c259 c260 c261 c262 c263 c264 c265 c266 c267 c268 c269 c270 c271 c272 c273 c274 c275 c276 c277 c278 c279 c280 c281 c282 c283 c284 c285 c286 c287 c288 c289 c290 c291 c292 c293 c294 c295 c296 c297 c298 c299 c300 c301 c302 c303 c304 c305 c306 c307 c308 c309 c310 c311 c312 c313 c314 c315 c316 c317 c318 c319 c320 c321 c322 c323 c324 c325 c326 c327 c328 c329 c330 c331 c332 c333 c334 c335 c336 c337 c338 c339 c340 c341 c342 c343 c344 c345 c346 c347 c348 c349 c350 c351 c352 c353 c354 c355 c356 c357 c358 c359 c360 c361 c362 c363 c364 c365 c366 c367 c368 c369 c370 c371 c372 c373 c374 c375 c376 c377 c378 c379 c380 c381 c382 c383 c384 c385 c386 c387 c388 c389 c390 c391 c392 c393 c394 c395 c396 c397 c398 c399 c400 c401 c402 c403 c404 c405 c406 c407 c408 c409 c410 c411 c412 c413 c414 c415 c416 c417 c418 c419 c420 c421 c422 c423 c424 c425 c426 c427 c428 c429 c430 c431 c432 c433 c434 c435 c436 c437 c438 c439 c440 c441 c442 c443 c444 c445 c446 c447 c448 c449 c450 c451 c452 c453 c454 c455 c456 c457 c458 c459 c460 c461 c462 c463 c464 c465 c466 c467 c468 c469 c470 c471 c472 c473 c474 c475 c476 c477 c478 c479 c480 c481 c482 c483 c484 c485 c486 c487 c488 c489 c490 c491 c492 c493 c494 c495 c496 c497 c498 c499 c500 c501 c502 c503 c504 c505 c506 c507 c508 c509 c510 c511 c512 c513 c514 c515 c516 c517 c518 c519 c520 c521 c522 c523 c524 c525 c526 c527 c528 c529 c530 c531 c532 c533 c534 c535 c536 c537 c538 c539 c540 c541 c542 c543 c544 c545 c546 c547 c548 c549 c550 c551 c552 c553 c554 c555 c556 c557 c558 c559 c560 c561 c562 c563 c564 c565 c566 c567 c568 c569 c570 c571 c572 c573 c574 c575 c576 c577 c578 c579 c580 c581 c582 c583 c584 c585 c586 c587 c588 c589 c590 c591 c592 c593 c594 c595 c596 c597 c598 c599 c600 c601 c602 c603 c604 c605 c606 c607 c608 c609 c610 c611 c612 c613 c614 c615 c616 c617 c618 c619 c620 c621 c622 c623 c624 c625 c626 c627 c628 c629 c630 c631 c632 c633 c634 c635 c636 c637 c638 c639 c640 c641 c642 c643 c644 c645 c646 c647 c648 c649 c650 c651 c652 c653 c654 c655 c656 c657 c658 c659 c660 c661 c662 c663 c664 c665 c666 c667 c668 c669 c670 c671 c672 c673 c674 c675 c676 c677 c678 c679 c680 c681 c682 c683 c684 c685 c686 c687 c688 c689 c690 c691 c692 c693 c694 c695 c696 c697 c698 c699 c700 c701 c702 c703 c704 c705 c706 c707 c708 c709 c710 c711 c712 c713 c714 c715 c716 c717 c718 c719 c720 c721 c722 c723 c724 c725 c726 c727 c728 c729 c730 c731 c732 c733 c734 c735 c736 c737 c738 c739 c740 c741 c742 c743 c744 c745 c746 c747 c748 c749 c750 c751 c752 c753 c754 c755 c756 c757 c758 c759 c760 c761 c762 c763 c764 c765 c766 c767 c768 c769 c770 c771 c772 c773 c774 c775 c776 c777 c778 c779 c780 c781 c782 c783 c784 c785 c786 c787 c788 c789 c790 c791 c792 c793 c794 c795 c796 c797 c798 c799 c800 c801 c802 c803 c804 c805 c806 c807 c808 c809 c810 c811 c812 c813 c814 c815 c816 c817 c818 c819 c820 c821 c822 c823 c824 c825 c826 c827 c828 c829 c830 c831 c832 c833 c834 c835 c836 c837 c838 c839 c840 c841 c842 c843 c844 c845 c846 c847 c848 c849 c850 c851 c852 c853 c854 c855 c856 c857 c858 c859 c860 c861 c862 c863 c864 c865 c866 c867 c868 c869 c870 c871 c872 c873 c874 c875 c876 c877 c878 c879 c880 c881 c882 c883 c884 c885 c886 c887 c888 c889 c890 c891 c892 c893 c894 c895 c896 c897 c898 c899 c900 c901 c902 c903 c904 c905 c906 c907 c908 c909 c910 c911 c912 c913 c914 c915 c916 c917 c918 c919 c920 c921 c922 c923 c924 c925 c926 c927 c928 c929 c930 c931 c932 c933 c934 c935 c936 c937 c938 c939 c940 c941 c942 c943 c944 c945 c946 c947 c948 c949 c950 c951 c952 c953 c954 c955 c956 c957 c958 c959 c960 c961 c962 c963 c964 c965 c966 c967 c968 c969 c970 c971 c972 c973 c974 c975 c976 c977 c978 c979 c980 c981 c982 c983 c984 c985 c986 c987 c988 c989 c990 c991 c992 c993 c994 c995 c996 c997 c998 c999 c1000 diff --git a/mysql-test/suite/engines/funcs/r/ix_unique_lob.result b/mysql-test/suite/engines/funcs/r/ix_unique_lob.result index 4554a912906..1b03012a96f 100644 --- a/mysql-test/suite/engines/funcs/r/ix_unique_lob.result +++ b/mysql-test/suite/engines/funcs/r/ix_unique_lob.result @@ -7,7 +7,7 @@ t4 SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c1` tinyblob, + `c1` tinyblob DEFAULT NULL, UNIQUE KEY `i1` (`c1`(100)) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t4; @@ -21,7 +21,7 @@ t4 SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c1` blob, + `c1` blob DEFAULT NULL, UNIQUE KEY `i1` (`c1`(100)) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t4; @@ -35,7 +35,7 @@ t4 SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c1` mediumblob, + `c1` mediumblob DEFAULT NULL, UNIQUE KEY `i1` (`c1`(100)) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t4; @@ -49,7 +49,7 @@ t4 SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c1` longblob, + `c1` longblob DEFAULT NULL, UNIQUE KEY `i1` (`c1`(100)) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t4; @@ -63,7 +63,7 @@ t4 SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c1` tinytext, + `c1` tinytext DEFAULT NULL, UNIQUE KEY `i1` (`c1`(100)) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t4; @@ -77,7 +77,7 @@ t4 SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c1` text, + `c1` text DEFAULT NULL, UNIQUE KEY `i1` (`c1`(100)) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t4; @@ -91,7 +91,7 @@ t4 SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c1` mediumtext, + `c1` mediumtext DEFAULT NULL, UNIQUE KEY `i1` (`c1`(100)) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t4; @@ -105,7 +105,7 @@ t4 SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c1` longtext, + `c1` longtext DEFAULT NULL, UNIQUE KEY `i1` (`c1`(100)) ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t4; diff --git a/mysql-test/suite/engines/funcs/r/rpl000011.result b/mysql-test/suite/engines/funcs/r/rpl000011.result deleted file mode 100644 index dd0fa2fbe74..00000000000 --- a/mysql-test/suite/engines/funcs/r/rpl000011.result +++ /dev/null @@ -1,16 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -create table t1 (n int); -insert into t1 values(1); -stop slave; -start slave; -insert into t1 values(2); -select * from t1; -n -1 -2 -drop table t1; diff --git a/mysql-test/suite/engines/funcs/r/rpl000017.result b/mysql-test/suite/engines/funcs/r/rpl000017.result deleted file mode 100644 index 1c611357e64..00000000000 --- a/mysql-test/suite/engines/funcs/r/rpl000017.result +++ /dev/null @@ -1,18 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -stop slave; -grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; -grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab'; -start slave; -drop table if exists t1; -create table t1(n int); -insert into t1 values(24); -select * from t1; -n -24 -drop table t1; -delete from mysql.user where user="replicate"; diff --git a/mysql-test/suite/engines/funcs/r/rpl000010.result b/mysql-test/suite/engines/funcs/r/rpl_000010.result index 65191ea411f..ae989f25e1b 100644 --- a/mysql-test/suite/engines/funcs/r/rpl000010.result +++ b/mysql-test/suite/engines/funcs/r/rpl_000010.result @@ -1,14 +1,14 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] create table t1 (n int not null auto_increment primary key); insert into t1 values(NULL); insert into t1 values(2); +connection slave; select n from t1; n 1 2 +connection master; drop table t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_000011.result b/mysql-test/suite/engines/funcs/r/rpl_000011.result new file mode 100644 index 00000000000..83bc0c207ce --- /dev/null +++ b/mysql-test/suite/engines/funcs/r/rpl_000011.result @@ -0,0 +1,18 @@ +include/master-slave.inc +[connection master] +create table t1 (n int); +insert into t1 values(1); +connection slave; +include/stop_slave.inc +include/start_slave.inc +connection master; +insert into t1 values(2); +connection slave; +select * from t1; +n +1 +2 +connection master; +drop table t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl000013.result b/mysql-test/suite/engines/funcs/r/rpl_000013.result index 37838bb88e0..87103d7821f 100644 --- a/mysql-test/suite/engines/funcs/r/rpl000013.result +++ b/mysql-test/suite/engines/funcs/r/rpl_000013.result @@ -1,17 +1,19 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] create table t2(n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); insert into t2 select * from t1; +connection master1; create temporary table t1 (n int); insert into t1 values (4),(5); insert into t2 select * from t1 as t10; +disconnect master; +connection slave; +connection master1; insert into t2 values(6); +disconnect master1; +connection slave; select * from t2; n 1 @@ -23,6 +25,9 @@ n show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 +connect master2,localhost,root,,; +connection master2; drop table if exists t1,t2; Warnings: -Note 1051 Unknown table 't1' +Note 1051 Unknown table 'test.t1' +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_000015.result b/mysql-test/suite/engines/funcs/r/rpl_000015.result index bb3620ebc84..7d8fea8f195 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_000015.result +++ b/mysql-test/suite/engines/funcs/r/rpl_000015.result @@ -1,14 +1,11 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] reset master; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 107 -stop slave; +master-bin.000001 329 +connection slave; +include/stop_slave.inc reset slave; show slave status; Slave_IO_State # @@ -51,6 +48,16 @@ Last_SQL_Errno 0 Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id 1 +Master_SSL_Crl +Master_SSL_Crlpath +Using_Gtid No +Gtid_IO_Pos +Replicate_Do_Domain_Ids +Replicate_Ignore_Domain_Ids +Parallel_Mode conservative +SQL_Delay 0 +SQL_Remaining_Delay NULL +Slave_SQL_Running_State change master to master_host='127.0.0.1'; show slave status; Slave_IO_State # @@ -93,6 +100,16 @@ Last_SQL_Errno 0 Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id 1 +Master_SSL_Crl +Master_SSL_Crlpath +Using_Gtid No +Gtid_IO_Pos +Replicate_Do_Domain_Ids +Replicate_Ignore_Domain_Ids +Parallel_Mode conservative +SQL_Delay 0 +SQL_Remaining_Delay NULL +Slave_SQL_Running_State change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=MASTER_PORT; show slave status; @@ -136,7 +153,17 @@ Last_SQL_Errno 0 Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id 1 -start slave; +Master_SSL_Crl +Master_SSL_Crlpath +Using_Gtid No +Gtid_IO_Pos +Replicate_Do_Domain_Ids +Replicate_Ignore_Domain_Ids +Parallel_Mode conservative +SQL_Delay 0 +SQL_Remaining_Delay NULL +Slave_SQL_Running_State +include/start_slave.inc show slave status; Slave_IO_State Waiting for master to send event Master_Host 127.0.0.1 @@ -144,9 +171,9 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 107 +Read_Master_Log_Pos 329 Relay_Log_File slave-relay-bin.000002 -Relay_Log_Pos 254 +Relay_Log_Pos 629 Relay_Master_Log_File master-bin.000001 Slave_IO_Running Yes Slave_SQL_Running Yes @@ -159,8 +186,8 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 107 -Relay_Log_Space 410 +Exec_Master_Log_Pos 329 +Relay_Log_Space 938 Until_Condition None Until_Log_File Until_Log_Pos 0 @@ -178,15 +205,31 @@ Last_SQL_Errno 0 Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id 1 +Master_SSL_Crl +Master_SSL_Crlpath +Using_Gtid No +Gtid_IO_Pos +Replicate_Do_Domain_Ids +Replicate_Ignore_Domain_Ids +Parallel_Mode conservative +SQL_Delay 0 +SQL_Remaining_Delay NULL +Slave_SQL_Running_State Slave has read all relay log; waiting for the slave I/O thread to update it +connection master; drop table if exists t1; create table t1 (n int, PRIMARY KEY(n)); insert into t1 values (10),(45),(90); +connection slave; +connection slave; SELECT * FROM t1 ORDER BY n; n 10 n 45 n 90 +connection master; SELECT * FROM t1 ORDER BY n; n 10 n 45 n 90 drop table t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl000017.test b/mysql-test/suite/engines/funcs/r/rpl_000017.result index 2ba321cd8c3..d1c453208c7 100644 --- a/mysql-test/suite/engines/funcs/t/rpl000017.test +++ b/mysql-test/suite/engines/funcs/r/rpl_000017.result @@ -1,22 +1,19 @@ -source include/master-slave.inc; +include/master-slave.inc +[connection master] connection slave; -stop slave; connection master; grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab'; connection slave; -start slave; +include/start_slave.inc connection master; ---disable_warnings -drop table if exists t1; ---enable_warnings create table t1(n int); insert into t1 values(24); -sync_slave_with_master; +connection slave; select * from t1; +n +24 connection master; drop table t1; delete from mysql.user where user="replicate"; -sync_slave_with_master; - -# End of 4.1 tests +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result b/mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result index b092dd9e088..7204122b669 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result +++ b/mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a)); LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; @@ -62,6 +59,8 @@ abasements abasement abased abase +connection slave; +connection slave; SELECT * FROM test.t1 ORDER BY a DESC; a aberration @@ -114,4 +113,7 @@ abasements abasement abased abase +connection master; DROP TABLE test.t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result b/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result deleted file mode 100644 index 7a901b65810..00000000000 --- a/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result +++ /dev/null @@ -1,41 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -SHOW SLAVE STATUS; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error -SHOW SLAVE HOSTS; -Server_id Host Port Rpl_recovery_rank Master_id -2 127.0.0.1 SLAVE_PORT 0 1 -create table t1 ( n int); -insert into t1 values (1),(2),(3),(4); -insert into t1 values(5); -SELECT * FROM t1 ORDER BY n; -n -1 -2 -3 -4 -5 -SELECT * FROM t1 ORDER BY n; -n -1 -2 -3 -4 -SELECT * FROM t1 ORDER BY n; -n -1 -2 -3 -4 -SELECT * FROM t1 ORDER BY n; -n -1 -2 -3 -4 -5 -drop table t1; diff --git a/mysql-test/suite/engines/funcs/r/rpl_alter,innodb.rdiff b/mysql-test/suite/engines/funcs/r/rpl_alter,innodb.rdiff new file mode 100644 index 00000000000..0c70e2c0cfc --- /dev/null +++ b/mysql-test/suite/engines/funcs/r/rpl_alter,innodb.rdiff @@ -0,0 +1,72 @@ +@@ -29,7 +29,7 @@ + `a` int(10) unsigned NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +-) ENGINE=MyISAM DEFAULT CHARSET=latin1 ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 + insert into t1 (a) values (1),((1<<32)-1); + select * from t1; + a b +@@ -42,7 +42,7 @@ + `a` bigint(20) NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +-) ENGINE=MyISAM DEFAULT CHARSET=latin1 ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 + select * from t1; + a b + 1 NULL +@@ -54,7 +54,7 @@ + `a` int(10) unsigned NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +-) ENGINE=MyISAM DEFAULT CHARSET=latin1 ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 + select * from t1; + a b + 1 NULL +@@ -66,7 +66,7 @@ + `a` bigint(20) unsigned NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +-) ENGINE=MyISAM DEFAULT CHARSET=latin1 ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 + select * from t1; + a b + 1 NULL +@@ -83,7 +83,7 @@ + `a` bigint(20) unsigned NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +-) ENGINE=MyISAM DEFAULT CHARSET=latin1 ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 + connection master; + create table t2 (a int unsigned auto_increment primary key, b int); + show create table t2; +@@ -92,7 +92,7 @@ + `a` int(10) unsigned NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +-) ENGINE=MyISAM DEFAULT CHARSET=latin1 ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 + alter table t2 modify a bigint; + show create table t2; + Table Create Table +@@ -100,7 +100,7 @@ + `a` bigint(20) NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +-) ENGINE=MyISAM DEFAULT CHARSET=latin1 ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 + alter table t2 modify a bigint auto_increment; + show create table t2; + Table Create Table +@@ -108,7 +108,7 @@ + `a` bigint(20) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +-) ENGINE=MyISAM DEFAULT CHARSET=latin1 ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 + drop table t1,t2; + # + # MDEV-8432: Slave cannot replicate signed integer-type values diff --git a/mysql-test/suite/engines/funcs/r/rpl_alter.result b/mysql-test/suite/engines/funcs/r/rpl_alter.result index 6ef5ce3462a..4f709db9624 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_alter.result +++ b/mysql-test/suite/engines/funcs/r/rpl_alter.result @@ -1,10 +1,5 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -drop database if exists mysqltest; +include/master-slave.inc +[connection master] create database mysqltest; create table mysqltest.t1 ( n int); alter table mysqltest.t1 add m int; @@ -12,10 +7,126 @@ insert into mysqltest.t1 values (1,2); create table mysqltest.t2 (n int); insert into mysqltest.t2 values (45); rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2; +connection slave; select * from mysqltest.t2; n m 1 2 select * from mysqltest.t3; n 45 +connection master; drop database mysqltest; +connection slave; +connection master; +use test; +# +# Test bug where ALTER TABLE MODIFY didn't replicate properly +# +create table t1 (a int unsigned primary key, b int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(10) unsigned NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 (a) values (1),((1<<32)-1); +select * from t1; +a b +1 NULL +4294967295 NULL +alter table t1 modify a bigint; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +a b +1 NULL +4294967295 NULL +alter table t1 modify a int unsigned; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(10) unsigned NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +a b +1 NULL +4294967295 NULL +alter table t1 modify a bigint unsigned; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +a b +1 NULL +4294967295 NULL +connection slave; +use test; +select * from t1; +a b +1 NULL +4294967295 NULL +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +connection master; +create table t2 (a int unsigned auto_increment primary key, b int); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(10) unsigned NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t2 modify a bigint; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` bigint(20) NOT NULL, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t2 modify a bigint auto_increment; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` bigint(20) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1,t2; +# +# MDEV-8432: Slave cannot replicate signed integer-type values +# with high bit set to 1 +# Test replication when we have int on master and bigint on slave +# +create table t1 (a int unsigned primary key, b int); +connection slave; +SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; +alter table t1 modify a bigint unsigned; +connection master; +insert into t1 (a) values (1),((1<<32)-1); +connection slave; +select * from t1; +a b +1 NULL +4294967295 NULL +SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; +connection master; +drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_alter_db.result b/mysql-test/suite/engines/funcs/r/rpl_alter_db.result index 80b1a0e983f..56e82712bec 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_alter_db.result +++ b/mysql-test/suite/engines/funcs/r/rpl_alter_db.result @@ -1,9 +1,12 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -use mysql; +include/master-slave.inc +[connection master] +==== Verify that alter database does not stop replication ==== +create database temp_db; +use temp_db; alter database collate latin1_bin; -alter database collate latin1_swedish_ci; +connection slave; +==== Clean up ==== +connection master; +drop database temp_db; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_bit.result b/mysql-test/suite/engines/funcs/r/rpl_bit.result index 924de8a65f8..b83faa4a28a 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_bit.result +++ b/mysql-test/suite/engines/funcs/r/rpl_bit.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 ( dummyKey INTEGER NOT NULL, @@ -95,6 +92,7 @@ hex(bit3) 15 24 35 +connection slave; SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1; oSupp sSuppD GSuppDf VNotSupp x034 5 5 3 2 1 @@ -135,4 +133,7 @@ hex(bit3) 15 24 35 +connection master; DROP TABLE IF EXISTS test.t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_bit_npk.result b/mysql-test/suite/engines/funcs/r/rpl_bit_npk.result index 9599660f18f..5c7e6fc55b6 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_bit_npk.result +++ b/mysql-test/suite/engines/funcs/r/rpl_bit_npk.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 ( dummyKey INTEGER NOT NULL, @@ -98,6 +95,7 @@ hex(bit3) 15 24 35 +connection slave; SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1 ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034; @@ -140,6 +138,7 @@ hex(bit3) 15 24 35 +connection master; CREATE TABLE test.t2 (a INT, b BIT(1)); INSERT INTO test.t2 VALUES (1, b'0'); INSERT INTO test.t2 VALUES (1, b'1'); @@ -156,6 +155,7 @@ SELECT * FROM test.t3 ORDER BY a,b; a b 1 NULL 2 0 +connection slave; SELECT a, hex(b) FROM test.t2 ORDER BY a,b; a hex(b) 1 0 @@ -164,6 +164,9 @@ SELECT * FROM test.t3 ORDER BY a,b; a b 1 NULL 2 0 +connection master; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_change_master.result b/mysql-test/suite/engines/funcs/r/rpl_change_master.result index c187f16cc83..48cec72d917 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_change_master.result +++ b/mysql-test/suite/engines/funcs/r/rpl_change_master.result @@ -1,26 +1,29 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +call mtr.add_suppression("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum"); +connection master; create table t1(n int); +connection slave; select * from t1; n stop slave sql_thread; +connection master; insert into t1 values(1); insert into t1 values(2); -stop slave; -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 192 # None 0 No # No 0 0 1 +connection slave; +include/wait_for_slave_param.inc [Read_Master_Log_Pos] +include/stop_slave.inc change master to master_user='root'; -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 192 # None 0 No # No 0 0 1 start slave; select * from t1; n 1 2 +connection master; drop table t1; +connection slave; +connection master; +CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='', +MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH=''; +CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_create_database.result b/mysql-test/suite/engines/funcs/r/rpl_create_database.result index 15bb939eb57..28c11525d00 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_create_database.result +++ b/mysql-test/suite/engines/funcs/r/rpl_create_database.result @@ -1,13 +1,11 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] DROP DATABASE IF EXISTS mysqltest_prometheus; DROP DATABASE IF EXISTS mysqltest_sisyfos; DROP DATABASE IF EXISTS mysqltest_bob; +connection slave; DROP DATABASE IF EXISTS mysqltest_bob; +connection master; CREATE DATABASE mysqltest_prometheus; CREATE DATABASE mysqltest_sisyfos; CREATE DATABASE mysqltest_bob; @@ -20,25 +18,19 @@ INSERT INTO t2 VALUES(2); ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1; USE mysqltest_sisyfos; ALTER DATABASE mysqltest_bob CHARACTER SET latin1; -SHOW DATABASES; -Database -information_schema -mtr +SHOW DATABASES LIKE 'mysql%'; +Database (mysql%) mysql mysqltest_bob mysqltest_prometheus mysqltest_sisyfos -performance_schema -test -SHOW DATABASES; -Database -information_schema -mtr +connection slave; +SHOW DATABASES LIKE 'mysql%'; +Database (mysql%) mysql mysqltest_prometheus mysqltest_sisyfos -performance_schema -test +connection master; DROP DATABASE IF EXISTS mysqltest_sisyfos; USE mysqltest_prometheus; CREATE TABLE t1 (a INT); @@ -46,25 +38,18 @@ INSERT INTO t1 VALUES (1); CREATE DATABASE mysqltest_sisyfos; USE mysqltest_sisyfos; CREATE TABLE t2 (a INT); -SHOW DATABASES; -Database -information_schema -mtr +SHOW DATABASES LIKE 'mysql%'; +Database (mysql%) mysql mysqltest_bob mysqltest_prometheus mysqltest_sisyfos -performance_schema -test -SHOW DATABASES; -Database -information_schema -mtr +connection slave; +SHOW DATABASES LIKE 'mysql%'; +Database (mysql%) mysql mysqltest_prometheus mysqltest_sisyfos -performance_schema -test USE mysqltest_prometheus; SHOW TABLES; Tables_in_mysqltest_prometheus @@ -73,6 +58,9 @@ USE mysqltest_sisyfos; SHOW TABLES; Tables_in_mysqltest_sisyfos t2 +connection master; DROP DATABASE IF EXISTS mysqltest_prometheus; DROP DATABASE IF EXISTS mysqltest_sisyfos; DROP DATABASE IF EXISTS mysqltest_bob; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_do_grant.result b/mysql-test/suite/engines/funcs/r/rpl_do_grant.result index 50d181be0ca..9eca21b38e4 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_do_grant.result +++ b/mysql-test/suite/engines/funcs/r/rpl_do_grant.result @@ -1,80 +1,331 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; delete from mysql.user where user=_binary'rpl_do_grant'; delete from mysql.db where user=_binary'rpl_do_grant'; flush privileges; +connection slave; delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; +connection master; +create user rpl_do_grant@localhost; grant select on *.* to rpl_do_grant@localhost; grant drop on test.* to rpl_do_grant@localhost; +connection slave; show grants for rpl_do_grant@localhost; Grants for rpl_do_grant@localhost GRANT SELECT ON *.* TO 'rpl_do_grant'@'localhost' GRANT DROP ON `test`.* TO 'rpl_do_grant'@'localhost' +connection master; set password for rpl_do_grant@localhost=password("does it work?"); -select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant'; -password<>_binary'' +connection slave; +select authentication_string<>_binary'' from mysql.user where user=_binary'rpl_do_grant'; +authentication_string<>_binary'' +1 +connection master; +update mysql.user set authentication_string='' where user='rpl_do_grant'; +flush privileges; +select authentication_string<>'' from mysql.user where user='rpl_do_grant'; +authentication_string<>'' +0 +set sql_mode='ANSI_QUOTES'; +set password for rpl_do_grant@localhost=password('does it work?'); +set sql_mode=''; +connection slave; +select authentication_string<>'' from mysql.user where user='rpl_do_grant'; +authentication_string<>'' 1 +connection master; delete from mysql.user where user=_binary'rpl_do_grant'; delete from mysql.db where user=_binary'rpl_do_grant'; flush privileges; +connection slave; delete from mysql.user where user=_binary'rpl_do_grant'; delete from mysql.db where user=_binary'rpl_do_grant'; flush privileges; +connection master; show grants for rpl_do_grant@localhost; ERROR 42000: There is no such grant defined for user 'rpl_do_grant' on host 'localhost' +connection slave; show grants for rpl_do_grant@localhost; ERROR 42000: There is no such grant defined for user 'rpl_do_grant' on host 'localhost' +connection master; create user rpl_do_grant@localhost; show grants for rpl_do_grant@localhost; Grants for rpl_do_grant@localhost GRANT USAGE ON *.* TO 'rpl_do_grant'@'localhost' show grants for rpl_do_grant2@localhost; ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost' +connection slave; show grants for rpl_do_grant@localhost; Grants for rpl_do_grant@localhost GRANT USAGE ON *.* TO 'rpl_do_grant'@'localhost' show grants for rpl_do_grant2@localhost; ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost' +connection master; rename user rpl_do_grant@localhost to rpl_do_grant2@localhost; show grants for rpl_do_grant2@localhost; Grants for rpl_do_grant2@localhost GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost' +connection slave; show grants for rpl_do_grant2@localhost; Grants for rpl_do_grant2@localhost GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost' +connection master; grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost; show grants for rpl_do_grant2@localhost; Grants for rpl_do_grant2@localhost GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost' GRANT INSERT, DELETE ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost' +connection slave; show grants for rpl_do_grant2@localhost; Grants for rpl_do_grant2@localhost GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost' GRANT INSERT, DELETE ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost' +connection master; revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost; show grants for rpl_do_grant2@localhost; Grants for rpl_do_grant2@localhost GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost' GRANT INSERT ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost' +connection slave; show grants for rpl_do_grant2@localhost; Grants for rpl_do_grant2@localhost GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost' GRANT INSERT ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost' +connection master; revoke all privileges, grant option from rpl_do_grant2@localhost; show grants for rpl_do_grant2@localhost; Grants for rpl_do_grant2@localhost GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost' +connection slave; show grants for rpl_do_grant2@localhost; Grants for rpl_do_grant2@localhost GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost' +connection master; drop user rpl_do_grant2@localhost; show grants for rpl_do_grant2@localhost; ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost' +connection slave; show grants for rpl_do_grant2@localhost; ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost' +connection master; +call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' error.* 1396"); +connection slave; +connection master; +DROP DATABASE IF EXISTS bug42217_db; +CREATE DATABASE bug42217_db; +GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost' + IDENTIFIED BY 'create_rout_db' WITH GRANT OPTION; +connection slave; +connection master; +connect create_rout_db_master, localhost, create_rout_db, create_rout_db, bug42217_db,$MASTER_MYPORT,; +connect create_rout_db_slave, localhost, create_rout_db, create_rout_db, bug42217_db, $SLAVE_MYPORT,; +connection create_rout_db_master; +USE bug42217_db; +CREATE FUNCTION upgrade_del_func() RETURNS CHAR(30) +BEGIN +RETURN "INSIDE upgrade_del_func()"; +END// +connection master; +USE bug42217_db; +SELECT * FROM mysql.procs_priv; +Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp +localhost bug42217_db create_rout_db upgrade_del_func FUNCTION create_rout_db@localhost Execute,Alter Routine # +SELECT upgrade_del_func(); +upgrade_del_func() +INSIDE upgrade_del_func() +connection slave; +SELECT * FROM mysql.procs_priv; +Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp +localhost bug42217_db create_rout_db upgrade_del_func FUNCTION create_rout_db@localhost Execute,Alter Routine # +SHOW GRANTS FOR 'create_rout_db'@'localhost'; +Grants for create_rout_db@localhost +GRANT USAGE ON *.* TO 'create_rout_db'@'localhost' IDENTIFIED BY PASSWORD '*08792480350CBA057BDE781B9DF183B263934601' +GRANT CREATE ROUTINE ON `bug42217_db`.* TO 'create_rout_db'@'localhost' WITH GRANT OPTION +GRANT EXECUTE, ALTER ROUTINE ON FUNCTION `bug42217_db`.`upgrade_del_func` TO 'create_rout_db'@'localhost' +USE bug42217_db; +SHOW CREATE FUNCTION upgrade_del_func; +Function sql_mode Create Function character_set_client collation_connection Database Collation +upgrade_del_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1 +BEGIN +RETURN "INSIDE upgrade_del_func()"; +END latin1 latin1_swedish_ci latin1_swedish_ci +SELECT upgrade_del_func(); +upgrade_del_func() +INSIDE upgrade_del_func() +"Check whether the definer user will be able to execute the replicated routine on slave" +connection create_rout_db_slave; +USE bug42217_db; +SHOW CREATE FUNCTION upgrade_del_func; +Function sql_mode Create Function character_set_client collation_connection Database Collation +upgrade_del_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1 +BEGIN +RETURN "INSIDE upgrade_del_func()"; +END latin1 latin1_swedish_ci latin1_swedish_ci +SELECT upgrade_del_func(); +upgrade_del_func() +INSIDE upgrade_del_func() +connection slave; +DELETE FROM mysql.procs_priv; +FLUSH PRIVILEGES; +USE bug42217_db; +"Can't execute the replicated routine on slave like before after procs privilege is deleted " +SELECT upgrade_del_func(); +ERROR 42000: execute command denied to user 'create_rout_db'@'localhost' for routine 'bug42217_db.upgrade_del_func' +"Test the user who creates a function on master doesn't exist on slave." +"Hence SQL thread ACL_GLOBAL privilege jumps in and no mysql.procs_priv is inserted" +DROP USER 'create_rout_db'@'localhost'; +connection create_rout_db_master; +CREATE FUNCTION upgrade_alter_func() RETURNS CHAR(30) +BEGIN +RETURN "INSIDE upgrade_alter_func()"; +END// +connection master; +SELECT upgrade_alter_func(); +upgrade_alter_func() +INSIDE upgrade_alter_func() +connection slave; +SHOW CREATE FUNCTION upgrade_alter_func; +Function sql_mode Create Function character_set_client collation_connection Database Collation +upgrade_alter_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_alter_func`() RETURNS char(30) CHARSET latin1 +BEGIN +RETURN "INSIDE upgrade_alter_func()"; +END latin1 latin1_swedish_ci latin1_swedish_ci +"Should no privilege record for upgrade_alter_func in mysql.procs_priv" +SELECT * FROM mysql.procs_priv; +Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp +SELECT upgrade_alter_func(); +ERROR HY000: The user specified as a definer ('create_rout_db'@'localhost') does not exist +disconnect create_rout_db_master; +disconnect create_rout_db_slave; +connection master; +USE bug42217_db; +DROP FUNCTION upgrade_del_func; +DROP FUNCTION upgrade_alter_func; +DROP DATABASE bug42217_db; +connection slave; +connection master; +SET SQL_LOG_BIN= 0; +DROP USER 'create_rout_db'@'localhost'; +SET SQL_LOG_BIN= 1; +include/rpl_reset.inc +USE test; +######## BUG#49119 ####### +### i) test case from the 'how to repeat section' +connection master; +CREATE TABLE t1(c1 INT); +CREATE PROCEDURE p1() SELECT * FROM t1 | +REVOKE EXECUTE ON PROCEDURE p1 FROM 'root'@'localhost'; +ERROR 42000: There is no such grant defined for user 'root' on host 'localhost' on routine 'p1' +connection slave; +connection master; +DROP TABLE t1; +DROP PROCEDURE p1; +connection slave; +### ii) Test case in which REVOKE partially succeeds +connection master; +include/rpl_reset.inc +connection master; +CREATE TABLE t1(c1 INT); +CREATE PROCEDURE p1() SELECT * FROM t1 | +CREATE USER 'user49119'@'localhost'; +GRANT EXECUTE ON PROCEDURE p1 TO 'user49119'@'localhost'; +############################################################## +### Showing grants for both users: root and user49119 (master) +SHOW GRANTS FOR 'user49119'@'localhost'; +Grants for user49119@localhost +GRANT USAGE ON *.* TO 'user49119'@'localhost' +GRANT EXECUTE ON PROCEDURE `test`.`p1` TO 'user49119'@'localhost' +SHOW GRANTS FOR CURRENT_USER; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +############################################################## +connection slave; +############################################################## +### Showing grants for both users: root and user49119 (master) +SHOW GRANTS FOR 'user49119'@'localhost'; +Grants for user49119@localhost +GRANT USAGE ON *.* TO 'user49119'@'localhost' +GRANT EXECUTE ON PROCEDURE `test`.`p1` TO 'user49119'@'localhost' +SHOW GRANTS FOR CURRENT_USER; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +############################################################## +connection master; +## This statement will make the revoke fail because root has no +## execute grant. However, it will still revoke the grant for +## user49119. +REVOKE EXECUTE ON PROCEDURE p1 FROM 'user49119'@'localhost', 'root'@'localhost'; +ERROR 42000: There is no such grant defined for user 'root' on host 'localhost' on routine 'p1' +############################################################## +### Showing grants for both users: root and user49119 (master) +### after revoke statement failure +SHOW GRANTS FOR 'user49119'@'localhost'; +Grants for user49119@localhost +GRANT USAGE ON *.* TO 'user49119'@'localhost' +SHOW GRANTS FOR CURRENT_USER; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +############################################################## +connection slave; +############################################################# +### Showing grants for both users: root and user49119 (slave) +### after revoke statement failure (should match +SHOW GRANTS FOR 'user49119'@'localhost'; +Grants for user49119@localhost +GRANT USAGE ON *.* TO 'user49119'@'localhost' +SHOW GRANTS FOR CURRENT_USER; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +############################################################## +connection master; +DROP TABLE t1; +DROP PROCEDURE p1; +DROP USER 'user49119'@'localhost'; +connection slave; +include/rpl_reset.inc +connection master; +grant all on *.* to foo@"1.2.3.4"; +revoke all privileges, grant option from "foo"; +ERROR HY000: Can't revoke all privileges for one or more of the requested users +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; grant all on *.* to foo@"1.2.3.4" +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; revoke all privileges, grant option from "foo" +connection slave; +include/check_slave_no_error.inc +connection master; +DROP USER foo@"1.2.3.4"; +connection slave; + +# Bug#27606 GRANT statement should be replicated with DEFINER information +include/rpl_reset.inc +connection master; +GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost; +SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; +Grantor +root@localhost +connection slave; +SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; +Grantor +root@localhost +connection master; +REVOKE SELECT ON mysql.user FROM user_bug27606@localhost; +SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; +Grantor +root@localhost +connection slave; +SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; +Grantor +root@localhost +connection master; +DROP USER user_bug27606@localhost; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_drop.result b/mysql-test/suite/engines/funcs/r/rpl_drop.result index b83594c9bb1..74514fe7f61 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_drop.result +++ b/mysql-test/suite/engines/funcs/r/rpl_drop.result @@ -1,10 +1,7 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -drop table if exists t1, t2; +include/master-slave.inc +[connection master] create table t1 (a int); drop table t1, t2; -ERROR 42S02: Unknown table 't2' +ERROR 42S02: Unknown table 'test.t2' +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_drop_db.result b/mysql-test/suite/engines/funcs/r/rpl_drop_db.result index b2d56af34bc..1b132c20afc 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_drop_db.result +++ b/mysql-test/suite/engines/funcs/r/rpl_drop_db.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; drop database if exists mysqltest1; create database mysqltest1; create table mysqltest1.t1 (n int); @@ -12,18 +9,20 @@ select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt'; create table mysqltest1.t2 (n int); create table mysqltest1.t3 (n int); drop database mysqltest1; -ERROR HY000: Error dropping database (can't rmdir './mysqltest1/', errno: 17) +ERROR HY000: Error dropping database (can't rmdir './mysqltest1', errno: 39 "Directory not empty") use mysqltest1; show tables; Tables_in_mysqltest1 drop database mysqltest1; -ERROR HY000: Error dropping database (can't rmdir './mysqltest1/', errno: 17) +ERROR HY000: Error dropping database (can't rmdir './mysqltest1', errno: 39 "Directory not empty") use mysqltest1; show tables; Tables_in_mysqltest1 use test; create table t1 (n int); insert into t1 values (1234); +connection slave; +connection slave; use mysqltest1; show tables; Tables_in_mysqltest1 @@ -31,9 +30,9 @@ use test; select * from t1; n 1234 -drop table t1; -stop slave; -drop database mysqltest1; -drop database mysqltest1; +connection master; use test; drop table t1; +drop database mysqltest1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result b/mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result index 257baa81b74..ed9060f8307 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result +++ b/mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result @@ -1,22 +1,28 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection slave; reset master; +connection master; change master to master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root"; -start slave; +include/start_slave.inc +connection slave; create table t1 (n int); +connection master; +connection master; create table t4 (n int); create table t5 (n int); create table t6 (n int); +connection slave; +connection slave; +connection master; show tables; Tables_in_test t1 t4 t5 t6 -stop slave; +include/stop_slave.inc reset slave; drop table t1,t4,t5,t6; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result b/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result deleted file mode 100644 index b5e14d3adac..00000000000 --- a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result +++ /dev/null @@ -1,12 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error -load table t1 from master; -ERROR 08S01: Error connecting to master: Master is not configured -load table t1 from master; -ERROR HY000: Error from master: 'Table 'test.t1' doesn't exist' diff --git a/mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result b/mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result index f211d5d9a2f..2017252f5d1 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result +++ b/mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result @@ -1,14 +1,12 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; create table t1 (a int primary key); create table t4 (a int primary key); insert into t1 values (1),(1); Got one of the listed errors insert into t4 values (1),(2); +connection slave; show tables like 't1'; Tables_in_test (t1) show tables like 't4'; @@ -18,25 +16,36 @@ SELECT * FROM test.t4 ORDER BY a; a 1 2 +connection master; drop table t1; +connection slave; +connection master1; select get_lock('crash_lock%20C', 10); get_lock('crash_lock%20C', 10) 1 +connection master; create table t2 (a int primary key); insert into t2 values(1); create table t3 (id int); insert into t3 values(connection_id()); update t2 set a = a + 1 + get_lock('crash_lock%20C', 10); +connection master1; select (@id := id) - id from t3; (@id := id) - id 0 kill @id; drop table t2,t3; insert into t4 values (3),(4); +connection master; +connection master1; +connection slave; SELECT * FROM test.t4 ORDER BY a; a 1 2 3 4 +connection master1; DROP TABLE test.t4; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result index 53a521aaf85..4a56880d97f 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result +++ b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result @@ -1,21 +1,14 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -stop slave; +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=MASTER_PORT; -start slave; -stop slave; +include/start_slave.inc +connection master; change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=SLAVE_PORT; -start slave; - -let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%' ; - ---source include/wait_slave_status.inc +include/start_slave.inc flush logs; SHOW SLAVE STATUS; Slave_IO_State # @@ -24,7 +17,7 @@ Master_User root Master_Port SLAVE_PORT Connect_Retry 60 Master_Log_File slave-bin.000001 -Read_Master_Log_Pos 107 +Read_Master_Log_Pos 328 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File slave-bin.000001 @@ -39,7 +32,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 107 +Exec_Master_Log_Pos 328 Relay_Log_Space # Until_Condition None Until_Log_File @@ -58,4 +51,15 @@ Last_SQL_Errno 0 Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id 2 -STOP SLAVE; +Master_SSL_Crl +Master_SSL_Crlpath +Using_Gtid No +Gtid_IO_Pos +Replicate_Do_Domain_Ids +Replicate_Ignore_Domain_Ids +Parallel_Mode conservative +SQL_Delay 0 +SQL_Remaining_Delay NULL +Slave_SQL_Running_State Slave has read all relay log; waiting for the slave I/O thread to update it +stop slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_free_items.result b/mysql-test/suite/engines/funcs/r/rpl_free_items.result index 91c1e2aa6e5..af7a267266f 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_free_items.result +++ b/mysql-test/suite/engines/funcs/r/rpl_free_items.result @@ -1,10 +1,10 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] create table t1 (a int); create table t2 (a int); +connection slave; +connection master; drop table t1; drop table t2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_get_lock.result b/mysql-test/suite/engines/funcs/r/rpl_get_lock.result index f7c9541bd9f..b852546e1bf 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_get_lock.result +++ b/mysql-test/suite/engines/funcs/r/rpl_get_lock.result @@ -1,17 +1,17 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); create table t1(n int); insert into t1 values(get_lock("lock",2)); +disconnect master; +connection master1; select get_lock("lock",2); get_lock("lock",2) 1 select release_lock("lock"); release_lock("lock") 1 +connection slave; select get_lock("lock",3); get_lock("lock",3) 1 @@ -32,4 +32,7 @@ is_free_lock("lock2") select is_free_lock(NULL); is_free_lock(NULL) NULL +connection master1; drop table t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result b/mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result index 5169cc8e888..29e6bb6d6a4 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result +++ b/mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result @@ -1,21 +1,23 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; +set sql_mode=""; delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; +connection slave; +set sql_mode=""; delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; +connection master; grant select on *.* to rpl_ignore_grant@localhost; grant drop on test.* to rpl_ignore_grant@localhost; show grants for rpl_ignore_grant@localhost; Grants for rpl_ignore_grant@localhost GRANT SELECT ON *.* TO 'rpl_ignore_grant'@'localhost' GRANT DROP ON `test`.* TO 'rpl_ignore_grant'@'localhost' +connection slave; show grants for rpl_ignore_grant@localhost; ERROR 42000: There is no such grant defined for user 'rpl_ignore_grant' on host 'localhost' select count(*) from mysql.user where user=_binary'rpl_ignore_grant'; @@ -25,13 +27,19 @@ select count(*) from mysql.db where user=_binary'rpl_ignore_grant'; count(*) 0 grant select on *.* to rpl_ignore_grant@localhost; +connection master; set password for rpl_ignore_grant@localhost=password("does it work?"); +connection slave; select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant'; password<>_binary'' 0 +connection master; delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; +connection slave; delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; +connection master; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result b/mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result index b1ccd2f0442..c86f2f4e4df 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result +++ b/mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result @@ -1,14 +1,12 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; grant select on *.* to 'user_foo'@'%' identified by 'user_foopass'; revoke select on *.* from 'user_foo'@'%'; select select_priv from mysql.user where user='user_foo' /* master:must be N */; select_priv N +connection slave; grant select on *.* to 'user_foo'@'%' identified by 'user_foopass'; revoke select on *.* from 'user_foo'@'%'; select select_priv from mysql.user where user='user_foo' /* slave:must be N */; @@ -18,13 +16,19 @@ grant select on *.* to 'user_foo'@'%' identified by 'user_foopass'; select select_priv from mysql.user where user='user_foo' /* slave:must be Y */; select_priv Y +connection master; revoke select on *.* from 'user_foo'; select select_priv from mysql.user where user='user_foo' /* master:must be N */; select_priv N +connection slave; select select_priv from mysql.user where user='user_foo' /* slave:must get Y */; select_priv Y +connection slave; revoke select on *.* FROM 'user_foo'; +connection master; delete from mysql.user where user="user_foo"; +connection slave; delete from mysql.user where user="user_foo"; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result b/mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result index a88a3c690ed..d4efa2dc42e 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result +++ b/mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result @@ -1,14 +1,12 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection slave; use test; drop table if exists mysqltest_foo; drop table if exists mysqltest_bar; create table mysqltest_foo (n int); insert into mysqltest_foo values(4); +connection master; use test; create table mysqltest_foo (n int); insert into mysqltest_foo values(5); @@ -16,8 +14,12 @@ create table mysqltest_bar (m int); insert into mysqltest_bar values(15); create table t1 (k int); insert into t1 values(55); +connection slave; select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1; n m k 4 15 55 +connection master; drop table mysqltest_foo,mysqltest_bar,t1; +connection slave; drop table mysqltest_foo,mysqltest_bar,t1; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_init_slave.result b/mysql-test/suite/engines/funcs/r/rpl_init_slave.result index 740c918976c..a90de76f139 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_init_slave.result +++ b/mysql-test/suite/engines/funcs/r/rpl_init_slave.result @@ -1,9 +1,11 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +set global max_connections=151; +connection slave; +include/stop_slave.inc +include/start_slave.inc +connection master; +connection slave; show variables like 'init_slave'; Variable_name Value init_slave set global max_connections=500 @@ -11,17 +13,21 @@ show variables like 'max_connections'; Variable_name Value max_connections 500 reset master; +connection master; show variables like 'init_slave'; Variable_name Value init_slave show variables like 'max_connections'; Variable_name Value max_connections 151 +connection slave; set @my_global_init_connect= @@global.init_connect; set global init_connect="set @c=1"; show variables like 'init_connect'; Variable_name Value init_connect set @c=1 -stop slave; +connection master; +connection slave; set global init_connect= @my_global_init_connect; set global max_connections= default; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_insert.result b/mysql-test/suite/engines/funcs/r/rpl_insert.result index b6a97926f73..1e790387e71 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_insert.result +++ b/mysql-test/suite/engines/funcs/r/rpl_insert.result @@ -1,23 +1,25 @@ # # Bug#20821: INSERT DELAYED fails to write some rows to binlog # -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] CREATE SCHEMA IF NOT EXISTS mysqlslap; USE mysqlslap; -CREATE TABLE t1 (id INT, name VARCHAR(64)); +CREATE TABLE t1 (id INT, name VARCHAR(64)) ENGINE=MyISAM; +connection slave; +connection master; SELECT COUNT(*) FROM mysqlslap.t1; COUNT(*) 5000 +connection slave; SELECT COUNT(*) FROM mysqlslap.t1; COUNT(*) 5000 # # Cleanup # +connection master; USE test; DROP SCHEMA mysqlslap; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_insert_select.result b/mysql-test/suite/engines/funcs/r/rpl_insert_select.result index 1aff39e0026..3c9b31ded56 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_insert_select.result +++ b/mysql-test/suite/engines/funcs/r/rpl_insert_select.result @@ -1,17 +1,21 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; create table t1 (n int not null primary key); insert into t1 values (1); create table t2 (n int); insert into t2 values (1); insert ignore into t1 select * from t2; +Warnings: +Warning 1062 Duplicate entry '1' for key 'PRIMARY' insert into t1 values (2); +connection slave; +connection slave; select * from t1; n 1 2 +connection master; drop table t1,t2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata2.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata2.result index 5e3923616ed..d7a9a5981dc 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_loaddata2.result +++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata2.result @@ -1,9 +1,5 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] CREATE TABLE t1 (word CHAR(20) NOT NULL); LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; SELECT * FROM t1 ORDER BY word; @@ -78,6 +74,7 @@ Aberdeen Abernathy aberrant aberration +connection slave; SELECT * FROM t1 ORDER BY word; word Aarhus @@ -150,4 +147,7 @@ Aberdeen Abernathy aberrant aberration +connection master; drop table t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result index 4639c717cea..8e2bc2f0b1c 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result +++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result @@ -1,10 +1,7 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] drop database if exists mysqltest; +connection master; USE test; CREATE TABLE t1(a INT, b INT, UNIQUE(b)); LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1; @@ -18,6 +15,7 @@ LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1; SELECT COUNT(*) FROM mysqltest.t1; COUNT(*) 2 +connection slave; SHOW DATABASES; Database information_schema @@ -36,5 +34,8 @@ t1 SELECT COUNT(*) FROM mysqltest.t1; COUNT(*) 2 +connection master; DROP DATABASE mysqltest; -DROP TABLE test.t1; +DROP TABLE IF EXISTS test.t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result index 8b2da7ff9a1..1eb37dd4899 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result +++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result @@ -1,15 +1,16 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection slave; reset master; +connection master; create table test.t1(a int, b int, unique(b)); load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; +connection slave; select count(*) from test.t1; count(*) 2 -show binlog events from 107; -Log_name Pos Event_type Server_id End_log_pos Info +include/show_binlog_events.inc +connection master; drop table test.t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result b/mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result index 4dd4289b657..f7034cb7968 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result +++ b/mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result @@ -1,31 +1,37 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] create table t1(a int); select * into outfile 'MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' from t1; truncate table t1; load data local infile 'MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1; +connection slave; select a,count(*) from t1 group by a; a count(*) 1 10000 +connection master; drop table t1; +connection slave; +connection master; create table t1(a int); insert into t1 values (1), (2), (2), (3); select * into outfile 'MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' from t1; drop table t1; create table t1(a int primary key); load data local infile 'MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1; +Warnings: +Warning 1062 Duplicate entry '2' for key 'PRIMARY' SELECT * FROM t1 ORDER BY a; a 1 2 3 +connection slave; SELECT * FROM t1 ORDER BY a; a 1 2 3 +connection master; drop table t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_loadfile.result b/mysql-test/suite/engines/funcs/r/rpl_loadfile.result index 7a5a7bc50c9..fb40cbf3220 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_loadfile.result +++ b/mysql-test/suite/engines/funcs/r/rpl_loadfile.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); @@ -119,6 +116,8 @@ Abernathy aberrant aberration +connection slave; +connection slave; SELECT * FROM test.t1 ORDER BY blob_column; a blob_column 1 abase @@ -223,5 +222,8 @@ Abernathy aberrant aberration +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP TABLE test.t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result index df4512fa0ea..7f5f34bf831 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result +++ b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result @@ -1,46 +1,37 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +create table if not exists t1 (n int); +drop table t1; +call mtr.add_suppression ("Slave I/O: Got fatal error 1236 from master when reading data from binary"); +call mtr.add_suppression ("Error in Log_event::read_log_event"); show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 107 <Binlog_Ignore_DB> -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 107 # # master-bin.000001 Yes Yes 0 0 107 # None 0 No # No 0 0 1 -stop slave; -change master to master_log_pos=107; -start slave; -stop slave; -change master to master_log_pos=107; -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 107 # # master-bin.000001 No No 0 0 107 # None 0 No # No 0 0 1 -start slave; -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 107 # # master-bin.000001 Yes Yes 0 0 107 # None 0 No # No 0 0 1 -stop slave; -change master to master_log_pos=178; +master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB> +connection slave; +include/stop_slave.inc +change master to master_log_pos=MASTER_LOG_POS; start slave; -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 178 # # master-bin.000001 No Yes 0 0 178 # None 0 No # No 1236 Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position' 0 1 +include/wait_for_slave_io_error.inc [errno=1236] +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.'' +include/stop_slave_sql.inc +connection master; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 107 <Binlog_Ignore_DB> +master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB> create table if not exists t1 (n int); drop table if exists t1; create table t1 (n int); insert into t1 values (1),(2),(3); -stop slave; -change master to master_log_pos=207; +connection slave; +change master to master_log_pos=MASTER_LOG_POS; start slave; select * from t1 ORDER BY n; n 1 2 3 +connection master; drop table t1; +connection slave; +End of 5.0 tests +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_many_optimize.result b/mysql-test/suite/engines/funcs/r/rpl_many_optimize.result index b2148892591..82b1f685ea8 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_many_optimize.result +++ b/mysql-test/suite/engines/funcs/r/rpl_many_optimize.result @@ -1,9 +1,7 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] create table t1 (a int not null auto_increment primary key, b int, key(b)); INSERT INTO t1 (a) VALUES (1),(2); drop table t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_master_pos_wait.result b/mysql-test/suite/engines/funcs/r/rpl_master_pos_wait.result deleted file mode 100644 index ab9b8cdad9d..00000000000 --- a/mysql-test/suite/engines/funcs/r/rpl_master_pos_wait.result +++ /dev/null @@ -1,18 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -select master_pos_wait('master-bin.999999',0,2); -master_pos_wait('master-bin.999999',0,2) --1 -explain extended select master_pos_wait('master-bin.999999',0,2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used -Warnings: -Note 1003 select master_pos_wait('master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)` -select master_pos_wait('master-bin.999999',0); -stop slave sql_thread; -master_pos_wait('master-bin.999999',0) -NULL diff --git a/mysql-test/suite/engines/funcs/r/rpl_misc_functions.result b/mysql-test/suite/engines/funcs/r/rpl_misc_functions.result index 5003a3e7d65..6c20623d62b 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_misc_functions.result +++ b/mysql-test/suite/engines/funcs/r/rpl_misc_functions.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +CALL mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT'); create table t1(id int, i int, r1 int, r2 int, p varchar(100)); insert into t1 values(1, connection_id(), 0, 0, ""); insert into t1 values(2, 0, rand()*1000, rand()*1000, ""); @@ -13,12 +10,50 @@ delete from t1 where id=6; set sql_log_bin=1; insert into t1 values(3, 0, 0, 0, password('does_this_work?')); insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?')); -select * into outfile '../../tmp/rpl_misc_functions.outfile' from t1; -create table t2 like t1; -load data local infile 'MYSQLTEST_VARDIR/tmp/rpl_misc_functions.outfile' into table t2; +select * into outfile 'rpl_misc_functions.outfile' from t1; +connection slave; +create temporary table t2 like t1; +load data local infile 'MYSQLD_DATADIR/test/rpl_misc_functions.outfile' into table t2; select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p); id i r1 r2 p id i r1 r2 p -stop slave; -drop table t1; -drop table t2; +connection master; drop table t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +col_a DOUBLE DEFAULT NULL); +CREATE PROCEDURE test_replication_sp1() +BEGIN +INSERT INTO t1 (col_a) VALUES (rand()), (rand()); +INSERT INTO t1 (col_a) VALUES (rand()); +END| +CREATE PROCEDURE test_replication_sp2() +BEGIN +CALL test_replication_sp1(); +CALL test_replication_sp1(); +END| +CREATE FUNCTION test_replication_sf() RETURNS DOUBLE DETERMINISTIC +BEGIN +RETURN (rand() + rand()); +END| +CALL test_replication_sp1(); +CALL test_replication_sp2(); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); +connection slave; +select * from t1 into outfile "../../tmp/t1_slave.txt"; +connection master; +create temporary table t1_slave select * from t1 where 1=0; +load data infile '../../tmp/t1_slave.txt' into table t1_slave; +select count(*) into @aux from t1 join t1_slave using (id) +where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ; +SELECT @aux; +@aux +12 +connection master; +DROP TABLE t1, t1_slave; +DROP PROCEDURE test_replication_sp1; +DROP PROCEDURE test_replication_sp2; +DROP FUNCTION test_replication_sf; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_multi_delete.result b/mysql-test/suite/engines/funcs/r/rpl_multi_delete.result index 4831502eb88..62a0d74225d 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_multi_delete.result +++ b/mysql-test/suite/engines/funcs/r/rpl_multi_delete.result @@ -1,9 +1,5 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] create table t1 (a int primary key); create table t2 (a int); insert into t1 values (1); @@ -14,9 +10,13 @@ a select * from t2; a 1 +connection slave; select * from t1; a select * from t2; a 1 +connection master; drop table t1,t2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result b/mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result index 8e6a6a3d4d0..0a316ec3452 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result +++ b/mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result @@ -1,13 +1,12 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; set sql_log_bin=0; create database mysqltest_from; set sql_log_bin=1; +connection slave; create database mysqltest_to; +connection master; use mysqltest_from; drop table if exists a; CREATE TABLE a (i INT); @@ -20,10 +19,12 @@ delete alias FROM a alias where alias.i=2; select * from a; i 3 +connection slave; use mysqltest_to; select * from a; i 3 +connection master; create table t1 (a int primary key); create table t2 (a int); insert into t1 values (1); @@ -34,11 +35,15 @@ a select * from t2; a 1 +connection slave; select * from t1; ERROR 42S02: Table 'mysqltest_to.t1' doesn't exist select * from t2; ERROR 42S02: Table 'mysqltest_to.t2' doesn't exist +connection master; set sql_log_bin=0; drop database mysqltest_from; set sql_log_bin=1; +connection slave; drop database mysqltest_to; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_multi_update4.result b/mysql-test/suite/engines/funcs/r/rpl_multi_update4.result index f6dde65a35d..256c1c503ab 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_multi_update4.result +++ b/mysql-test/suite/engines/funcs/r/rpl_multi_update4.result @@ -1,12 +1,11 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; drop database if exists d1; drop database if exists d2; +connection slave; drop database if exists d2; +connection master; create database d1; create table d1.t0 (id int); create database d2; @@ -17,9 +16,13 @@ insert into t1 values (1), (2), (3), (4), (5); insert into t2 select id + 3 from t1; update t1 join t2 using (id) set t1.id = 0; insert into d1.t0 values (0); +connection slave; use d1; select * from t0 where id=0; id 0 +connection master; drop database d1; drop database d2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_ps.result b/mysql-test/suite/engines/funcs/r/rpl_ps.result index 73c36af4862..57c2db05811 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_ps.result +++ b/mysql-test/suite/engines/funcs/r/rpl_ps.result @@ -1,9 +1,5 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] drop table if exists t1; create table t1(n char(30)); prepare stmt1 from 'insert into t1 values (?)'; @@ -19,12 +15,40 @@ set @var2= 'insert into t1 values (concat("from-var-", ?))'; prepare stmt2 from @var2; set @var1='from-master-3'; execute stmt2 using @var1; +connection slave; SELECT * FROM t1 ORDER BY n; n from-master-1 from-master-2-'', from-var-from-master-3 +connection master; drop table t1; +connection slave; stop slave; -reset master; -reset slave; +include/wait_for_slave_to_stop.inc + +######################################################################## +# +# BUG#25843: Changing default database between PREPARE and EXECUTE of +# statement breaks binlog. +# +######################################################################## +connection slave; +START SLAVE; +connection master; +CREATE DATABASE mysqltest1; +CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32)); +PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)'; +EXECUTE stmt_d_1; +use mysqltest1; +EXECUTE stmt_d_1; +connection slave; +SELECT * FROM t1; +db_name db_col_name +test latin1_swedish_ci +test latin1_swedish_ci +connection master; +DROP DATABASE mysqltest1; +use test; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result b/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result deleted file mode 100644 index 13f7fbfbdeb..00000000000 --- a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result +++ /dev/null @@ -1,55 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -**** On Master **** -CREATE TABLE t1 (a INT, b LONG); -INSERT INTO t1 VALUES (1,1), (2,2); -INSERT INTO t1 VALUES (3,UUID()), (4,UUID()); -SHOW BINLOG EVENTS; -**** On Slave **** -SHOW SLAVE STATUS; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port MASTER_PORT -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File # -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running Yes -Slave_SQL_Running Yes -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 0 -Last_Error -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error -Last_SQL_Errno 0 -Last_SQL_Error -Replicate_Ignore_Server_Ids -Master_Server_Id 1 -SHOW BINLOG EVENTS; -DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/engines/funcs/r/rpl_relayspace.result b/mysql-test/suite/engines/funcs/r/rpl_relayspace.result index 1f2a739d3e3..90bf18aaa88 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_relayspace.result +++ b/mysql-test/suite/engines/funcs/r/rpl_relayspace.result @@ -1,19 +1,18 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -stop slave; +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +connection master; create table t1 (a int); drop table t1; create table t1 (a int); drop table t1; +connection slave; reset slave; start slave io_thread; -stop slave io_thread; +include/wait_for_slave_param.inc [Slave_IO_State] +include/stop_slave_io.inc reset slave; -start slave; -select master_pos_wait('master-bin.001',200,6)=-1; -master_pos_wait('master-bin.001',200,6)=-1 -0 +include/start_slave.inc +include/assert.inc [Assert that master_pos_wait does not timeout nor it returns NULL] +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result b/mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result index 0135804c02d..1192f9860f2 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result +++ b/mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result @@ -1,9 +1,5 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] drop database if exists mysqltest1; drop database if exists mysqltest2; create database mysqltest1; @@ -11,13 +7,19 @@ create database mysqltest2; use mysqltest1; create table t1 (a int); insert into t1 values(1); +connection slave; select * from mysqltest1.t1; ERROR 42S02: Table 'mysqltest1.t1' doesn't exist +connection master; use mysqltest2; create table t1 (a int); insert into t1 values(1); +connection slave; select * from mysqltest2.t1; a 1 +connection master; drop database mysqltest1; drop database mysqltest2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_NOW.result b/mysql-test/suite/engines/funcs/r/rpl_row_NOW.result index 23f95878608..480ad34ce69 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_NOW.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_NOW.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; create database if not exists mysqltest1; DROP TABLE IF EXISTS mysqltest1.t1; CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, @@ -24,6 +21,10 @@ FOR EACH ROW BEGIN SET new.b = mysqltest1.f1(); END| INSERT INTO mysqltest1.t1 SET n = NULL, a = now(); +connection slave; +connection master; DROP TABLE IF EXISTS mysqltest1.t1; DROP FUNCTION mysqltest1.f1; DROP DATABASE mysqltest1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_USER.result b/mysql-test/suite/engines/funcs/r/rpl_row_USER.result index c4774665307..2771c674f44 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_USER.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_USER.result @@ -1,15 +1,15 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +set local sql_mode=""; +connection master; DROP DATABASE IF EXISTS mysqltest1; CREATE DATABASE mysqltest1; CREATE USER tester IDENTIFIED BY 'test'; GRANT ALL ON mysqltest1.* TO 'tester'@'%' IDENTIFIED BY 'test'; GRANT ALL ON mysqltest1.* TO ''@'localhost%'; FLUSH PRIVILEGES; +connect m_1,localhost,tester,,mysqltest1; +connection m_1; CREATE TABLE mysqltest1.t1 (a INT, users VARCHAR(255), PRIMARY KEY(a)); INSERT INTO mysqltest1.t1 VALUES(1,USER()); INSERT INTO mysqltest1.t1 VALUES(2,CURRENT_USER()); @@ -19,21 +19,26 @@ INSERT INTO mysqltest1.t1 VALUES(3,USER()); INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER()); end| CALL mysqltest1.p1(); +connection master; SELECT * FROM mysqltest1.t1 ORDER BY a; a users 1 tester@localhost 2 @localhost% 3 tester@localhost 4 @localhost% +connection slave; SELECT * FROM mysqltest1.t1 ORDER BY a; a users 1 tester@localhost 2 @localhost% 3 tester@localhost 4 @localhost% +connection master; +DROP DATABASE mysqltest1; REVOKE ALL ON mysqltest1.* FROM 'tester'@'%'; REVOKE ALL ON mysqltest1.* FROM ''@'localhost%'; -DROP DATABASE mysqltest1; -DROP USER 'tester'; +DROP USER tester@'%'; DROP USER ''@'localhost%'; FLUSH PRIVILEGES; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result index d45bbadf7df..8753764e81e 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result @@ -1,10 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -**** On Master **** +include/master-slave.inc +[connection master] +connection master; CREATE TABLE t1 (a int); CREATE TABLE t2 (a int); CREATE TEMPORARY TABLE t2 (a int, b int); @@ -12,47 +8,48 @@ SHOW TABLES; Tables_in_test t1 t2 -**** On Slave **** +connection slave; SHOW TABLES; Tables_in_test t1 t2 -**** On Master **** +connection master; DROP TABLE t2; SHOW TABLES; Tables_in_test t1 t2 -**** On Slave **** +connection slave; SHOW TABLES; Tables_in_test t1 t2 -**** On Master **** +connection master; CREATE TEMPORARY TABLE t2 (a int, b int); SHOW TABLES; Tables_in_test t1 t2 -**** On Slave **** +connection slave; SHOW TABLES; Tables_in_test t1 t2 -**** On Master **** +connection master; DROP TABLE t1,t2; -SHOW BINLOG EVENTS; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 107 Server ver: VERSION, Binlog ver: 4 -master-bin.000001 107 Query 1 193 use `test`; CREATE TABLE t1 (a int) -master-bin.000001 193 Query 1 279 use `test`; CREATE TABLE t2 (a int) -master-bin.000001 279 Query 1 403 use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */ -master-bin.000001 403 Query 1 527 use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */ -master-bin.000001 527 Query 1 631 use `test`; DROP TABLE `t1` /* generated by server */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ SHOW TABLES; Tables_in_test t2 -**** On Slave **** +connection slave; SHOW TABLES; Tables_in_test t2 +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_func001.result b/mysql-test/suite/engines/funcs/r/rpl_row_func001.result index b20f3f724d0..ae05b5cf3c0 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_func001.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_func001.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP FUNCTION test.f1; DROP TABLE IF EXISTS test.t1; create table test.t1 (a int, PRIMARY KEY(a)); @@ -22,9 +19,14 @@ select * from test.t1; a 1 2 +connection slave; +connection slave; select * from test.t1; a 1 2 +connection master; DROP FUNCTION test.f1; DROP TABLE test.t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result index aff54e01b95..e2bd199ecab 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result @@ -1,14 +1,12 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; create table t1 (a int not null primary key); insert into t1 values (1); create table t2 (a int); insert into t2 values (1); update t1, t2 set t1.a = 0 where t1.a = t2.a; +connection slave; show tables; Tables_in_test t1 @@ -16,46 +14,14 @@ select * from t1; a 0 drop table t1; +connection master; insert into t1 values (1); -show slave status; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port MASTER_MYPORT -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File # -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running Yes -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table test.t2 -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 1146 -Last_Error Error executing row event: 'Table 'test.t1' doesn't exist' -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno 0 -Last_IO_Error -Last_SQL_Errno 1146 -Last_SQL_Error Error executing row event: 'Table 'test.t1' doesn't exist' -Replicate_Ignore_Server_Ids -Master_Server_Id 1 +connection slave; +call mtr.add_suppression("Slave SQL.*Error executing row event: .Table .test.t1. doesn.t exist., error.* 1146"); +include/wait_for_slave_sql_error.inc [errno=1146] +==== Clean up ==== +include/stop_slave_io.inc +RESET SLAVE; +connection master; drop table t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result b/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result index 547dd8e1541..41d18d7f9fe 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result @@ -1,20 +1,19 @@ +include/master-slave.inc +[connection master] +connection slave; stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -stop slave; +connection master; # # Generate a big enough master's binlog to cause relay log rotations # create table t1 (a int); drop table t1; +connection slave; reset slave; # # Test 1 # -set @my_max_binlog_size= @@global.max_binlog_size; +set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size; set global max_binlog_size=8192; set global max_relay_log_size=8192-1; Warnings: @@ -23,7 +22,7 @@ select @@global.max_relay_log_size; @@global.max_relay_log_size 4096 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 2 # @@ -33,17 +32,19 @@ set global max_relay_log_size=(5*4096); select @@global.max_relay_log_size; @@global.max_relay_log_size 20480 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 3: max_relay_log_size = 0 # stop slave; reset slave; set global max_relay_log_size=0; +Warnings: +Warning 1292 Truncated incorrect max_relay_log_size value: '0' select @@global.max_relay_log_size; -@@global.max_relay_log_size 0 +@@global.max_relay_log_size 4096 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions # @@ -56,19 +57,27 @@ flush logs; reset slave; start slave; flush logs; +connection master; create table t1 (a int); -Checking that both slave threads are running. +connection slave; +include/check_slave_is_running.inc # # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated # flush logs; +connection master; drop table t1; -Checking that both slave threads are running. +connection slave; +include/check_slave_is_running.inc +connection master; flush logs; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000002 # <Binlog_Do_DB> <Binlog_Ignore_DB> +connection slave; set global max_binlog_size= @my_max_binlog_size; +set global max_relay_log_size= @my_max_relay_log_size; # # End of 4.1 tests # +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result b/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result index 5499d41bc1f..b9e98d5a97d 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result @@ -1,41 +1,58 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -Master_User root -Master_Host 127.0.0.1 +include/master-slave.inc +[connection master] +connection slave; +Master_User = 'root' +Master_Host = '127.0.0.1' include/stop_slave.inc change master to master_user='test'; -Master_User test -Master_Host 127.0.0.1 +Master_User = 'test' +Master_Host = '127.0.0.1' reset slave; -Master_User test -Master_Host 127.0.0.1 +Master_User = 'test' +Master_Host = '127.0.0.1' change master to master_user='root'; include/start_slave.inc -Master_User root -Master_Host 127.0.0.1 +Master_User = 'root' +Master_Host = '127.0.0.1' include/stop_slave.inc reset slave; include/start_slave.inc +connection master; create temporary table t1 (a int); +connection slave; include/stop_slave.inc reset slave; include/start_slave.inc show status like 'slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 +connection master; +drop temporary table if exists t1; +connection slave; include/stop_slave.inc reset slave; +include/check_slave_no_error.inc change master to master_user='impossible_user_name'; start slave; -stop slave; +include/wait_for_slave_io_error.inc [errno=1045] +include/stop_slave_sql.inc change master to master_user='root'; include/start_slave.inc +include/check_slave_no_error.inc stop slave; change master to master_user='impossible_user_name'; start slave; -stop slave; +include/wait_for_slave_io_error.inc [errno=1045] +include/stop_slave_sql.inc reset slave; +include/check_slave_no_error.inc +change master to master_user='root'; +reset slave; +include/start_slave.inc +include/stop_slave.inc +reset slave all; +start slave; +ERROR HY000: Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO +CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp001.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp001.result index 8c26c061376..d37425c43a8 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_sp001.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp001.result @@ -1,9 +1,5 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] <Begin test section 1 (non deterministic SP)> --------------------------------------------- @@ -34,12 +30,14 @@ a t 2 NEW 3 NEW 4 NEW +connection slave; SELECT * FROM t2 ORDER BY a; a t 1 NEW 2 NEW 3 NEW 4 NEW +connection master; call test.p2(1); SELECT * FROM t2 ORDER BY a; a t @@ -47,12 +45,14 @@ a t 2 Tex 3 Tex 4 Tex +connection slave; SELECT * FROM t2 ORDER BY a; a t 1 Tex 2 Tex 3 Tex 4 Tex +connection master; call test.p2(2); SELECT * FROM t2 ORDER BY a; a t @@ -60,12 +60,14 @@ a t 2 SQL 3 SQL 4 SQL +connection slave; SELECT * FROM t2 ORDER BY a; a t 1 SQL 2 SQL 3 SQL 4 SQL +connection master; call test.p2(3); SELECT * FROM t2 ORDER BY a; a t @@ -73,13 +75,17 @@ a t 2 NONE 3 NONE 4 NONE +connection slave; SELECT * FROM t2 ORDER BY a; a t 1 NONE 2 NONE 3 NONE 4 NONE +connection master; DROP PROCEDURE test.p1; DROP PROCEDURE test.p2; DROP TABLE test.t1; DROP TABLE test.t2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result index 58c53b394b2..8acc2e20202 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t2; @@ -42,9 +39,6 @@ INSERT INTO test.t1 VALUES (4,'MySQL'),(20,'ROCKS'),(11,'Texas'),(10,'kyle'); INSERT INTO test.t2 VALUES (4),(2),(1),(3); UPDATE test.t1 SET id=id+4 WHERE id=4; END| - -< ---- Master selects-- > -------------------------- CALL test.p2(); SELECT * FROM test.t1 ORDER BY id; id data @@ -58,9 +52,7 @@ id2 2 3 4 - -< ---- Slave selects-- > ------------------------- +connection slave; SELECT * FROM test.t1 ORDER BY id; id data 8 MySQL @@ -73,30 +65,28 @@ id2 2 3 4 - -< ---- Master selects-- > -------------------------- +connection master; CALL test.p1(); -Warnings: -Error 1329 No data - zero rows fetched, selected, or processed SELECT * FROM test.t3 ORDER BY id3; id3 c 1 MySQL 2 kyle 3 Texas 4 ROCKS - -< ---- Slave selects-- > ------------------------- +connection slave; SELECT * FROM test.t3 ORDER BY id3; id3 c 1 MySQL 2 kyle 3 Texas 4 ROCKS +connection master; ALTER PROCEDURE test.p1 MODIFIES SQL DATA; +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp008.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp008.result index 23197964a24..481c9b3f6cc 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_sp008.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp008.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t2; CREATE TABLE test.t1 (a INT,PRIMARY KEY(a)); @@ -14,21 +11,19 @@ BEGIN SELECT SQL_CALC_FOUND_ROWS * FROM test.t1 LIMIT 1; INSERT INTO test.t2 VALUES(FOUND_ROWS()); END| - -< ---- Master selects-- > -------------------------- CALL test.p1(); a 1 SELECT * FROM test.t2; a 2 - -< ---- Slave selects-- > ------------------------- +connection slave; SELECT * FROM test.t2; a 2 +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp009.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp009.result index 35ce0d7b420..d4bcfe9fcb6 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_sp009.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp009.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; @@ -53,25 +50,33 @@ SELECT * FROM test.t2 ORDER BY a; a 1 3 +connection slave; SELECT * FROM test.t2 ORDER BY a; a 1 3 +connection master; truncate test.t2; call test.p1('b'); select * from test.t2 ORDER BY a; a 2 4 +connection slave; SELECT * FROM test.t2 ORDER BY a; a 2 4 +connection master; truncate test.t2; SELECT * FROM test.t2 ORDER BY a; a +connection slave; SELECT * FROM test.t2 ORDER BY a; a +connection master; DROP PROCEDURE test.p1; DROP TABLE test.t1; DROP TABLE test.t2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp010.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp010.result index 02567465428..6a15298eddf 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_sp010.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp010.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p3; @@ -26,8 +23,10 @@ SELECT * FROM test.t1 ORDER BY a; a 1 2 +connection slave; show tables; Tables_in_test +connection master; CREATE PROCEDURE test.p3() BEGIN INSERT INTO test.t2 VALUES(7); @@ -44,13 +43,17 @@ SELECT * FROM test.t2 ORDER BY a; a 6 7 +connection slave; SELECT * FROM test.t2 ORDER BY a; a 6 7 +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p3; DROP PROCEDURE IF EXISTS test.p4; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp011.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp011.result index e35c9f21adb..53a9a964b53 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_sp011.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp011.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p3; @@ -58,6 +55,8 @@ ALTER TABLE test.t2 DROP COLUMN to_drop; INSERT INTO test.t2 VALUES ('gone',NULL,'STM',RAND()); END| CALL test.p1(); +connection slave; +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p3; @@ -67,3 +66,5 @@ DROP PROCEDURE IF EXISTS test.p6; DROP PROCEDURE IF EXISTS test.p7; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp012.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp012.result index 4aa16cbf6bd..65cc566256a 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_sp012.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp012.result @@ -1,12 +1,10 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p3; +create user user1@localhost; grant usage on *.* to user1@localhost; flush privileges; SELECT CURRENT_USER(); @@ -21,9 +19,10 @@ CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1(); GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost; GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost; GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost; - -<******** Master user1 p3 & p2 calls *******> ----------------------------------------------- +set sql_mode=default; +connection slave; +connect muser1,localhost,user1,,; +connection muser1; SELECT CURRENT_USER(); CURRENT_USER() user1@localhost @@ -36,9 +35,9 @@ user1@localhost user1@localhost CALL test.p2(); CURRENT_USER() USER() root@localhost user1@localhost - -<******** Slave user1 p3 & p2 calls *******> ---------------------------------------------- +connect suser1,127.0.0.1,user1,,test,$SLAVE_MYPORT,; +connection master; +connection suser1; SELECT CURRENT_USER(); CURRENT_USER() user1@localhost @@ -51,9 +50,12 @@ user1@localhost user1@localhost CALL test.p2(); CURRENT_USER() USER() root@localhost user1@localhost +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p3; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; -DROP USER 'user1'@'localhost'; +DROP USER user1@localhost; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result b/mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result index 46ca5748174..07be1bfebfe 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result @@ -1,11 +1,10 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; create table t1 (a int not null auto_increment primary key, b int, key(b)); -stop slave; +connection slave; +include/stop_slave.inc +connection master; INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); INSERT INTO t1 (a) SELECT null FROM t1; INSERT INTO t1 (a) SELECT null FROM t1; @@ -20,7 +19,9 @@ INSERT INTO t1 (a) SELECT null FROM t1; INSERT INTO t1 (a) SELECT null FROM t1; INSERT INTO t1 (a) SELECT null FROM t1; INSERT INTO t1 (a) SELECT null FROM t1; -start slave; -stop slave; +connection slave; +include/start_slave.inc +include/stop_slave.inc drop table t1; +connection master; drop table t1; diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_trig001.result b/mysql-test/suite/engines/funcs/r/rpl_row_trig001.result index 6665dc6d555..142c6c61865 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_trig001.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_trig001.result @@ -1,14 +1,10 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n)); CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n)); CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n)); INSERT INTO test.t1 VALUES (1,NOW()); -CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1;// +CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1// CREATE PROCEDURE test.p3() BEGIN INSERT INTO test.t3 (d) VALUES (NOW()); @@ -18,9 +14,15 @@ CREATE PROCEDURE test.p2() BEGIN INSERT INTO test.t2 (f,d) VALUES (RAND(),NOW()); END// +connection slave; +connection master; +connection master; +INSERT INTO test.t1 VALUES (1+1, NOW()); +connection slave; <End test section 2 (Tiggers & SP)> ----------------------------------- +connection master; DROP PROCEDURE test.p2; DROP PROCEDURE test.p3; DROP TRIGGER test.t2_ai; @@ -28,3 +30,5 @@ DROP TRIGGER test.t3_bi_t2; DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE test.t3; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_trig002.result b/mysql-test/suite/engines/funcs/r/rpl_row_trig002.result index 794104db750..8259edd56df 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_trig002.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_trig002.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP TRIGGER test.t2_ai; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; @@ -20,6 +17,7 @@ id domain 3 earthmotherwear.com 4 yahoo.com 5 example.com +connection slave; SELECT * FROM test.t1 ORDER BY id; id domain 1 example.com @@ -27,6 +25,7 @@ id domain 3 earthmotherwear.com 4 yahoo.com 5 example.com +connection master; INSERT INTO test.t3 VALUES ('Yes', 5, NULL, 'spamfilter','scan_incoming'); INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming'); INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming'); @@ -37,6 +36,7 @@ select * from test.t3; value domain_id mailaccount_id program keey No 5 NULL spamfilter scan_incoming Yes 1 NULL spamfilter scan_incoming +connection slave; select * from test.t2; value domain_id mailaccount_id program keey Yes 1 NULL spamfilter scan_incoming @@ -44,6 +44,7 @@ select * from test.t3; value domain_id mailaccount_id program keey No 5 NULL spamfilter scan_incoming Yes 1 NULL spamfilter scan_incoming +connection master; DELETE FROM test.t1 WHERE id = 1; SELECT * FROM test.t1 ORDER BY id; id domain @@ -51,19 +52,24 @@ id domain 3 earthmotherwear.com 4 yahoo.com 5 example.com +connection master; SELECT * FROM test.t1 ORDER BY id; id domain 2 mysql.com 3 earthmotherwear.com 4 yahoo.com 5 example.com +connection slave; SELECT * FROM test.t1 ORDER BY id; id domain 2 mysql.com 3 earthmotherwear.com 4 yahoo.com 5 example.com +connection master; DROP TRIGGER test.t2_ai; DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE test.t3; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result b/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result index 131af933b41..239d5917bc5 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP TRIGGER test.t1_bi; DROP TRIGGER test.t2_ai; DROP TRIGGER test.t1_bu; @@ -69,15 +66,11 @@ INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL C UPDATE test.t1 SET b1 = 0 WHERE b1 = 1; INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW()); UPDATE test.t2 SET b1 = 0 WHERE b1 = 1; -Warnings: -Error 1329 No data - zero rows fetched, selected, or processed INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW()); DELETE FROM test.t1 WHERE id = 1; -Warnings: -Error 1329 No data - zero rows fetched, selected, or processed DELETE FROM test.t2 WHERE id = 1; -Warnings: -Error 1329 No data - zero rows fetched, selected, or processed +connection slave; +connection master; DROP TRIGGER test.t1_bi; DROP TRIGGER test.t2_ai; DROP TRIGGER test.t1_bu; @@ -87,3 +80,5 @@ DROP TRIGGER test.t2_ad; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_until.result b/mysql-test/suite/engines/funcs/r/rpl_row_until.result index 457d83496bc..82268ce72eb 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_until.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_until.result @@ -6,15 +6,14 @@ INSERT INTO t1 VALUES (1),(2),(3),(4); DROP TABLE t1; CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); INSERT INTO t2 VALUES (1),(2); -connection slave; -connection master; INSERT INTO t2 VALUES (3),(4); DROP TABLE t2; connection slave; include/stop_slave.inc RESET SLAVE; +CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT; connection slave; -START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1 +START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1; include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; n @@ -23,7 +22,7 @@ n 3 4 include/check_slave_param.inc [Exec_Master_Log_Pos] -START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; +START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291; include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; n @@ -32,19 +31,12 @@ n 3 4 include/check_slave_param.inc [Exec_Master_Log_Pos] -START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2 -include/wait_for_slave_sql_to_stop.inc -SELECT * FROM t2; -n -1 -2 -include/check_slave_param.inc [Exec_Master_Log_Pos] START SLAVE; include/wait_for_slave_to_start.inc connection master; connection slave; include/stop_slave.inc -START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2 +START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2; include/wait_for_slave_param.inc [Until_Log_Pos] include/wait_for_slave_sql_to_stop.inc include/check_slave_param.inc [Exec_Master_Log_Pos] @@ -58,10 +50,25 @@ START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009'; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=MASTER_LOG_POS; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL -START SLAVE; START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; -Warnings: -Note 1254 Slave is already running include/stop_slave.inc RESET SLAVE; +include/start_slave.inc +include/rpl_reset.inc +connection master; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +connection slave; +include/stop_slave_sql.inc +connection master; +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +include/sync_slave_io_with_master.inc +start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=relay_log_pos; +include/wait_for_slave_sql_to_stop.inc +include/assert.inc [table t1 should have two rows.] +include/start_slave.inc +connection master; +DROP TABLE t1; +connection slave; include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_view01.result b/mysql-test/suite/engines/funcs/r/rpl_row_view01.result index a4b8d0a05e3..5c9944e75e0 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_row_view01.result +++ b/mysql-test/suite/engines/funcs/r/rpl_row_view01.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; create database if not exists mysqltest1; DROP VIEW IF EXISTS mysqltest1.v1; DROP VIEW IF EXISTS mysqltest1.v2; @@ -35,6 +32,7 @@ a c c2 1 Thank GOD 2 it is 3 Friday TGIF +connection slave; SELECT * FROM mysqltest1.v2; qty price value 3 50 150 @@ -45,6 +43,7 @@ a c c2 1 Thank GOD 2 it is 3 Friday TGIF +connection master; INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2; INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1; SELECT * FROM mysqltest1.t5 ORDER BY qty; @@ -57,6 +56,7 @@ a c c2 1 Thank GOD 2 it is 3 Friday TGIF +connection slave; SELECT * FROM mysqltest1.t5 ORDER BY qty; qty price total 3 50 150 @@ -67,6 +67,7 @@ a c c2 1 Thank GOD 2 it is 3 Friday TGIF +connection master; INSERT INTO mysqltest1.v4 VALUES (4,'TEST'); SELECT * FROM mysqltest1.t1 ORDER BY a; a c @@ -79,6 +80,7 @@ a c 2 it 3 Friday 4 TEST +connection slave; SELECT * FROM mysqltest1.t1 ORDER BY a; a c 1 Thank @@ -90,6 +92,7 @@ a c 2 it 3 Friday 4 TEST +connection master; DROP VIEW IF EXISTS mysqltest1.v1; DROP VIEW IF EXISTS mysqltest1.v2; DROP VIEW IF EXISTS mysqltest1.v3; @@ -99,3 +102,5 @@ DROP TABLE IF EXISTS mysqltest1.t1; DROP TABLE IF EXISTS mysqltest1.t2; DROP TABLE IF EXISTS mysqltest1.t4; DROP DATABASE mysqltest1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result index 700bc270f07..3f318a0a664 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result +++ b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result @@ -1,19 +1,19 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection slave; create table t1 (n int); reset master; -stop slave; +include/stop_slave.inc change master to master_port=SLAVE_PORT; show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id - 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 107 None 0 No NULL No 0 0 1 +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State + 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 256 None 0 No NULL No 0 0 1 No conservative 0 NULL start slave; insert into t1 values (1); -show status like "slave_running"; -Variable_name Value -Slave_running OFF +include/wait_for_slave_param.inc [Last_IO_Errno] +Last_IO_Errno = '1593' +Last_IO_Error = 'Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).' +include/stop_slave.inc +reset slave; +reset master; drop table t1; diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result index f8d24f70776..74145645920 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result +++ b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result @@ -1,21 +1,38 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection slave; create table t1 (n int); reset master; stop slave; +include/wait_for_slave_to_stop.inc change master to master_port=SLAVE_PORT; -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id - 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 107 None 0 No NULL No 0 0 1 start slave; +include/wait_for_slave_to_start.inc insert into t1 values (1); select * from t1; n 1 1 stop slave; +include/wait_for_slave_to_stop.inc +drop table t1; +connection master; +reset master; +create table t1(n int); +create table t2(n int); +connection slave; +change master to master_port=MASTER_PORT; +start slave until master_log_file='master-bin.000001', master_log_pos=UNTIL_POS; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_stop.inc +*** checking until position execution: must be only t1 in the list *** +show tables; +Tables_in_test +t1 +connection slave; +start slave sql_thread; +connection master; drop table t1; +drop table t2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_session_var.result b/mysql-test/suite/engines/funcs/r/rpl_session_var.result index b5b4b815ade..67863583f8d 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_session_var.result +++ b/mysql-test/suite/engines/funcs/r/rpl_session_var.result @@ -1,12 +1,8 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] drop table if exists t1; Warnings: -Note 1051 Unknown table 't1' +Note 1051 Unknown table 'test.t1' create table t1(a varchar(100),b int); set @@session.sql_mode=pipes_as_concat; insert into t1 values('My'||'SQL', 1); @@ -16,10 +12,12 @@ select * from t1 where b<3 order by a; a b 1 2 MySQL 1 +connection slave; select * from t1 where b<3 order by a; a b 1 2 MySQL 1 +connection master; set @@session.sql_mode=ignore_space; insert into t1 values(password ('MySQL'), 3); set @@session.sql_mode=ansi_quotes; @@ -37,7 +35,24 @@ insert into t2 select 2,a from t1 where a is null; select * from t2 order by b; b a 1 1 +connection slave; select * from t2 order by b; b a 1 1 +connection master; drop table t1,t2; +connection slave; +connection master; +CREATE TABLE t1 ( +`id` int(11) NOT NULL auto_increment, +`data` varchar(100), +PRIMARY KEY (`id`) +) ENGINE=MyISAM; +INSERT INTO t1(data) VALUES(SESSION_USER()); +connection slave; +SELECT length(data) < 100 FROM t1; +length(data) < 100 +1 +connection master; +drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_sf.result b/mysql-test/suite/engines/funcs/r/rpl_sf.result index 9cb9c9e8354..e692e31f908 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_sf.result +++ b/mysql-test/suite/engines/funcs/r/rpl_sf.result @@ -1,9 +1,5 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] set global log_bin_trust_function_creators=0; set binlog_format=STATEMENT; create function fn16456() @@ -27,3 +23,4 @@ set binlog_format=STATEMENT; select fn16456(); ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) drop function fn16456; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_skip_error.result b/mysql-test/suite/engines/funcs/r/rpl_skip_error.result index 248ce5b52c3..98c165e7db0 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_skip_error.result +++ b/mysql-test/suite/engines/funcs/r/rpl_skip_error.result @@ -1,16 +1,18 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] create table t1 (n int not null primary key); +connection slave; insert into t1 values (1); +connection master; insert into t1 values (1); insert into t1 values (2),(3); +connection slave; select * from t1 ORDER BY n; n 1 2 3 +connection master; drop table t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result index 0e438d294fd..1c81cec2577 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result +++ b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result @@ -1,63 +1,48 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; -stop slave; -change master to master_user='rpl',master_password='rpl'; -start slave; -drop table if exists t1; -create table t1 (n int); -insert into t1 values (1); -select * from t1; +include/master-slave.inc +[connection master] +==== Create new replication user ==== +connection master; +GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl'; +connection slave; +include/stop_slave.inc +set @save_relay_log_purge=@@global.relay_log_purge; +set @@global.relay_log_purge=0; +CHANGE MASTER TO master_user='rpl', master_password='rpl'; +select @@global.relay_log_purge; +@@global.relay_log_purge +0 +set @@global.relay_log_purge=1; +CHANGE MASTER TO master_user='rpl', master_password='rpl'; +select @@global.relay_log_purge; +@@global.relay_log_purge +1 +set @@global.relay_log_purge=@save_relay_log_purge; +CHANGE MASTER TO master_user='rpl', master_password='rpl'; +include/start_slave.inc +==== Do replication as new user ==== +connection master; +CREATE TABLE t1 (n INT); +INSERT INTO t1 VALUES (1); +connection slave; +SELECT * FROM t1; n 1 -drop user rpl@127.0.0.1; -flush privileges; -stop slave; -start slave; -show slave status; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User rpl -Master_Port MASTER_MYPORT -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File # -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running Connecting -Slave_SQL_Running Yes -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 0 -Last_Error -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master NULL -Master_SSL_Verify_Server_Cert No -Last_IO_Errno # -Last_IO_Error # -Last_SQL_Errno 0 -Last_SQL_Error -Replicate_Ignore_Server_Ids -Master_Server_Id 1 -drop table t1; -drop table t1; +==== Delete new replication user ==== +connection master; +DROP USER rpl@127.0.0.1; +FLUSH PRIVILEGES; +connection slave; +==== Restart slave without privileges ===== +include/stop_slave.inc +START SLAVE; +include/wait_for_slave_sql_to_start.inc +include/wait_for_slave_io_to_stop.inc +==== Verify that Slave IO thread stopped with error ==== +include/wait_for_slave_io_error.inc [errno=1045] +==== Cleanup (Note that slave IO thread is not running) ==== +include/stop_slave_sql.inc +CHANGE MASTER TO MASTER_USER = 'root', MASTER_PASSWORD = ''; +include/rpl_reset.inc +connection master; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff b/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff new file mode 100644 index 00000000000..520a1e83e41 --- /dev/null +++ b/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff @@ -0,0 +1,476 @@ +@@ -126,11 +126,14 @@ + show warnings; + Level Code Message + Error 1062 Duplicate entry '20' for key 'a' ++Warning 1196 Some non-transactional changed tables couldn't be rolled back + select * from t2; + a ++20 + connection slave; + select * from t2; + a ++20 + select * from mysql.proc where name="foo4" and db='mysqltest1'; + db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 + mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin +@@ -170,20 +173,16 @@ + insert into t2 values(fn1(21)); + select * from t1; + a +-15 + 20 + 21 +-5 + select * from t2; + a + 23 + connection slave; + select * from t1; + a +-15 + 20 + 21 +-5 + select * from t2; + a + 23 +@@ -290,13 +289,18 @@ + do fn1(100); + Warnings: + Error 1062 Duplicate entry '100' for key 'a' ++Warning 1196 Some non-transactional changed tables couldn't be rolled back + select fn1(20); + ERROR 23000: Duplicate entry '20' for key 'a' + select * from t2; + a ++20 ++100 + connection slave; + select * from t2; + a ++20 ++100 + connection con1; + create trigger trg before insert on t1 for each row set new.a= 10; + ERROR 42000: TRIGGER command denied to user 'zedjzlcsjhd'@'localhost' for table 't1' +@@ -470,13 +474,13 @@ + end + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8)) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (unix_timestamp()) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; delete from t1 +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`() + select * from mysqltest1.t1 +@@ -507,24 +511,24 @@ + end + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (15) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo4 sql security invoker + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (5) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; delete from t2 +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a) + master-bin.000001 # Gtid # # GTID #-#-# +@@ -535,6 +539,9 @@ + begin + insert into t2 values(20),(20); + end ++master-bin.000001 # Gtid # # BEGIN GTID #-#-# ++master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(20),(20) ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4 + master-bin.000001 # Gtid # # GTID #-#-# +@@ -555,10 +562,10 @@ + master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(fn1(21)) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; drop function fn1 + master-bin.000001 # Gtid # # GTID #-#-# +@@ -569,10 +576,10 @@ + end + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; delete from t1 +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(fn1()) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11) + NO SQL +@@ -587,7 +594,7 @@ + end + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; delete from t2 +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a) + master-bin.000001 # Gtid # # GTID #-#-# +@@ -599,21 +606,27 @@ + return 10; + end + master-bin.000001 # Gtid # # BEGIN GTID #-#-# ++master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100) ++master-bin.000001 # Query # # COMMIT ++master-bin.000001 # Gtid # # BEGIN GTID #-#-# ++master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20) ++master-bin.000001 # Query # # COMMIT ++master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; delete from t1 +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; delete from t1 +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; drop trigger trg + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() + READS SQL DATA +@@ -645,7 +658,7 @@ + master-bin.000001 # Query # # use `test`; create table t1 (a int) + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `test`; insert into t1 (a) values (f1()) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `test`; drop view v1 + master-bin.000001 # Gtid # # GTID #-#-# +@@ -661,7 +674,7 @@ + INSERT INTO t1 VALUES(arg) + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci')) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1 + master-bin.000001 # Gtid # # GTID #-#-# +@@ -695,7 +708,7 @@ + begin end + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest2`; insert into t values ( 1 ) +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + master-bin.000001 # Gtid # # GTID #-#-# + master-bin.000001 # Query # # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) + begin +@@ -704,7 +717,7 @@ + end + master-bin.000001 # Gtid # # BEGIN GTID #-#-# + master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`() +-master-bin.000001 # Xid # # COMMIT /* XID */ ++master-bin.000001 # Query # # COMMIT + connection slave; + set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; + connection master; +@@ -799,19 +812,25 @@ + SET TIMESTAMP=t/*!*/; + insert into t1 values ( NAME_CONST('b',8)) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + BEGIN + /*!*/; + SET TIMESTAMP=t/*!*/; + insert into t1 values (unix_timestamp()) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + BEGIN + /*!*/; + SET TIMESTAMP=t/*!*/; + delete from t1 + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`() + select * from mysqltest1.t1 +@@ -856,21 +875,27 @@ + SET TIMESTAMP=t/*!*/; + insert into t2 values(3) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + BEGIN + /*!*/; + SET TIMESTAMP=t/*!*/; + SET @@session.sql_mode=0/*!*/; + insert into t1 values (15) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + BEGIN + /*!*/; + SET TIMESTAMP=t/*!*/; + SET @@session.sql_mode=1411383296/*!*/; + insert into t2 values(3) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + SET @@session.sql_mode=0/*!*/; + alter procedure foo4 sql security invoker +@@ -881,20 +906,26 @@ + SET @@session.sql_mode=1411383296/*!*/; + insert into t2 values(3) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + BEGIN + /*!*/; + SET TIMESTAMP=t/*!*/; + insert into t1 values (5) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + BEGIN + /*!*/; + SET TIMESTAMP=t/*!*/; + SET @@session.sql_mode=0/*!*/; + delete from t2 + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + alter table t2 add unique (a) + /*!*/; +@@ -908,6 +939,14 @@ + insert into t2 values(20),(20); + end + /*!*/; ++BEGIN ++/*!*/; ++SET TIMESTAMP=t/*!*/; ++insert into t2 values(20),(20) ++/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + drop procedure foo4 + /*!*/; +@@ -941,13 +980,17 @@ + SET TIMESTAMP=t/*!*/; + SELECT `mysqltest1`.`fn1`(20) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + BEGIN + /*!*/; + SET TIMESTAMP=t/*!*/; + insert into t2 values(fn1(21)) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + drop function fn1 + /*!*/; +@@ -963,13 +1006,17 @@ + SET TIMESTAMP=t/*!*/; + delete from t1 + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + BEGIN + /*!*/; + SET TIMESTAMP=t/*!*/; + insert into t1 values(fn1()) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + SET @@session.sql_mode=1411383296/*!*/; + CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11) +@@ -991,7 +1038,9 @@ + SET TIMESTAMP=t/*!*/; + delete from t2 + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + alter table t2 add unique (a) + /*!*/; +@@ -1008,9 +1057,27 @@ + BEGIN + /*!*/; + SET TIMESTAMP=t/*!*/; ++SELECT `mysqltest1`.`fn1`(100) ++/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; ++BEGIN ++/*!*/; ++SET TIMESTAMP=t/*!*/; ++SELECT `mysqltest1`.`fn1`(20) ++/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; ++BEGIN ++/*!*/; ++SET TIMESTAMP=t/*!*/; + delete from t1 + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 + /*!*/; +@@ -1019,13 +1086,17 @@ + SET TIMESTAMP=t/*!*/; + insert into t1 values (1) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + BEGIN + /*!*/; + SET TIMESTAMP=t/*!*/; + delete from t1 + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + drop trigger trg + /*!*/; +@@ -1034,7 +1105,9 @@ + SET TIMESTAMP=t/*!*/; + insert into t1 values (1) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() + READS SQL DATA +@@ -1079,7 +1152,9 @@ + SET TIMESTAMP=t/*!*/; + insert into t1 (a) values (f1()) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + drop view v1 + /*!*/; +@@ -1104,7 +1179,9 @@ + SET TIMESTAMP=t/*!*/; + INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci')) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + DROP PROCEDURE p1 + /*!*/; +@@ -1156,7 +1233,9 @@ + SET TIMESTAMP=t/*!*/; + insert into t values ( 1 ) + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) + begin +@@ -1170,7 +1249,9 @@ + SET TIMESTAMP=t/*!*/; + SELECT `mysqltest2`.`f1`() + /*!*/; +-COMMIT/*!*/; ++SET TIMESTAMP=t/*!*/; ++COMMIT ++/*!*/; + SET TIMESTAMP=t/*!*/; + drop database mysqltest + /*!*/; diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp.result b/mysql-test/suite/engines/funcs/r/rpl_sp.result index 873ee6b03c5..e19732fe7ff 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_sp.result +++ b/mysql-test/suite/engines/funcs/r/rpl_sp.result @@ -1,14 +1,13 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +set local sql_mode=''; drop database if exists mysqltest1; create database mysqltest1; use mysqltest1; create table t1 (a varchar(100)); +connection slave; use mysqltest1; +connection master; create procedure foo() begin declare b int; @@ -29,6 +28,7 @@ set b = 8; insert into t1 values (b); insert into t1 values (unix_timestamp()); end +connection slave; select * from mysql.proc where name='foo' and db='mysqltest1'; db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin @@ -42,16 +42,19 @@ set b = 8; insert into t1 values (b); insert into t1 values (unix_timestamp()); end +connection master; set timestamp=1000000000; call foo(); select * from t1; a 8 1000000000 +connection slave; select * from t1; a 8 1000000000 +connection master; delete from t1; create procedure foo2() select * from mysqltest1.t1; @@ -70,6 +73,8 @@ grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1; SELECT 1; 1 1 +connect con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,; +connection con1; create procedure foo4() deterministic begin @@ -78,6 +83,7 @@ insert into t1 values (5); end| call foo4(); Got one of the listed errors +connection master; call foo3(); show warnings; Level Code Message @@ -96,6 +102,7 @@ a 3 3 3 +connection slave; select * from t1; a 15 @@ -105,20 +112,40 @@ a 3 3 3 +connection master; +delete from t2; +alter table t2 add unique (a); +drop procedure foo4; +create procedure foo4() +deterministic +begin +insert into t2 values(20),(20); +end| +call foo4(); +ERROR 23000: Duplicate entry '20' for key 'a' +show warnings; +Level Code Message +Error 1062 Duplicate entry '20' for key 'a' +select * from t2; +a +connection slave; +select * from t2; +a select * from mysql.proc where name="foo4" and db='mysqltest1'; db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 -mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES INVOKER begin -insert into t2 values(3); -insert into t1 values (5); -end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin -insert into t2 values(3); -insert into t1 values (5); +mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin +insert into t2 values(20),(20); +end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +insert into t2 values(20),(20); end +connection master; drop procedure foo4; select * from mysql.proc where name="foo4" and db='mysqltest1'; db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +connection slave; select * from mysql.proc where name="foo4" and db='mysqltest1'; db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +connection master; drop procedure foo; drop procedure foo2; drop procedure foo3; @@ -143,18 +170,24 @@ fn1(20) insert into t2 values(fn1(21)); select * from t1; a +15 20 21 +5 select * from t2; a 23 +connection slave; select * from t1; a +15 20 21 +5 select * from t2; a 23 +connection master; drop function fn1; create function fn1() returns int @@ -167,6 +200,7 @@ ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA delete from t1; set timestamp=1000000000; insert into t1 values(fn1()); +connection con1; create function fn2() returns int no sql @@ -174,15 +208,21 @@ begin return unix_timestamp(); end| ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) +connection master; +set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; set global log_bin_trust_function_creators=0; set global log_bin_trust_function_creators=1; +connection slave; +set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; set global log_bin_trust_function_creators=1; +connection con1; create function fn2() returns int no sql begin return unix_timestamp(); end| +connection master; create function fn3() returns int not deterministic @@ -202,7 +242,7 @@ return unix_timestamp(); end mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); -end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +end zedjzlcsjhd@localhost # # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci begin return unix_timestamp(); end mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin @@ -213,6 +253,7 @@ end select * from t1; a 1000000000 +connection slave; use mysqltest1; select * from t1; a @@ -226,7 +267,7 @@ return unix_timestamp(); end mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); -end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +end zedjzlcsjhd@localhost # # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci begin return unix_timestamp(); end mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin @@ -234,39 +275,73 @@ return 0; end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin return 0; end +connection master; +delete from t2; +alter table t2 add unique (a); +Warnings: +Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release +drop function fn1; +create function fn1(x int) +returns int +begin +insert into t2 values(x),(x); +return 10; +end| +do fn1(100); +Warnings: +Error 1062 Duplicate entry '100' for key 'a' +select fn1(20); +ERROR 23000: Duplicate entry '20' for key 'a' +select * from t2; +a +connection slave; +select * from t2; +a +connection con1; create trigger trg before insert on t1 for each row set new.a= 10; ERROR 42000: TRIGGER command denied to user 'zedjzlcsjhd'@'localhost' for table 't1' +connection master; delete from t1; create trigger trg before insert on t1 for each row set new.a= 10; insert into t1 values (1); select * from t1; a 10 +connection slave; select * from t1; a 10 +connection master; delete from t1; drop trigger trg; insert into t1 values (1); select * from t1; a 1 +connection slave; select * from t1; a 1 +connection master; create procedure foo() not deterministic reads sql data select * from t1; +connection slave; call foo(); a 1 +connection master; drop procedure foo; +connection slave; +connection master; drop function fn1; drop database mysqltest1; drop user "zedjzlcsjhd"@127.0.0.1; use test; +connection slave; use test; +connection master; drop function if exists f1; create function f1() returns int reads sql data begin @@ -285,9 +360,12 @@ a 1 drop view v1; drop function f1; +connection slave; +connection slave; select * from t1; a 1 +connection master; DROP PROCEDURE IF EXISTS p1; DROP TABLE IF EXISTS t1; CREATE TABLE t1(col VARCHAR(10)); @@ -297,21 +375,23 @@ CALL p1('test'); SELECT * FROM t1; col test +connection slave; SELECT * FROM t1; col test +connection master; DROP PROCEDURE p1; ---> Test for BUG#20438 ---> Preparing environment... ----> connection: master +connection master; DROP PROCEDURE IF EXISTS p1; DROP FUNCTION IF EXISTS f1; ---> Synchronizing slave with master... - ----> connection: master +connection slave; +connection master; ---> Creating procedure... /*!50003 CREATE PROCEDURE p1() SET @a = 1 */; @@ -328,7 +408,7 @@ f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) RETURN 0 latin1 latin1_swedish_ci latin1_swedish_ci ---> Synchronizing slave with master... ----> connection: master +connection slave; ---> Checking on slave... SHOW CREATE PROCEDURE p1; @@ -339,17 +419,17 @@ SHOW CREATE FUNCTION f1; Function sql_mode Create Function character_set_client collation_connection Database Collation f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) RETURN 0 latin1 latin1_swedish_ci latin1_swedish_ci - ----> connection: master +connection master; ---> Cleaning up... DROP PROCEDURE p1; DROP FUNCTION f1; +connection slave; +connection master; +connection master; drop table t1; -set global log_bin_trust_function_creators=0; -set global log_bin_trust_function_creators=0; -End of 5.0 tests -reset master; +connection slave; +connection master; drop database if exists mysqltest; drop database if exists mysqltest2; create database mysqltest; @@ -360,6 +440,871 @@ create procedure mysqltest.test() begin end; insert into t values ( 1 ); create procedure `\\`.test() begin end; ERROR 42000: Unknown database '\\' +connection master; +create function f1 () returns int +begin +insert into t values (1); +return 0; +end| +connection slave; +connection master; +use mysqltest; +set @a:= mysqltest2.f1(); +connection slave; +connection master; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # drop database if exists mysqltest1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # create database mysqltest1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a varchar(100)) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() +begin +declare b int; +set b = 8; +insert into t1 values (b); +insert into t1 values (unix_timestamp()); +end +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8)) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (unix_timestamp()) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; delete from t1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`() +select * from mysqltest1.t1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo2 contains sql +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE `t1` /* generated by server */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; create table t2 like t1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`() + DETERMINISTIC +insert into t1 values (15) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`() + DETERMINISTIC +begin +insert into t2 values(3); +insert into t1 values (5); +end +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (15) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo4 sql security invoker +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (5) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; delete from t2 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`() + DETERMINISTIC +begin +insert into t2 values(20),(20); +end +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo2 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo3 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11) + DETERMINISTIC +begin +insert into t1 values (x); +return x+2; +end +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; delete t1,t2 from t1,t2 +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(fn1(21)) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; drop function fn1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`() RETURNS int(11) + NO SQL +begin +return unix_timestamp(); +end +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; delete from t1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(fn1()) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11) + NO SQL +begin +return unix_timestamp(); +end +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11) + READS SQL DATA +begin +return 0; +end +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; delete from t2 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; drop function fn1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11) +begin +insert into t2 values(x),(x); +return 10; +end +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; delete from t1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; delete from t1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; drop trigger trg +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() + READS SQL DATA +select * from t1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest1`; drop function fn1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # drop database mysqltest1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # drop user "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; drop function if exists f1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) + READS SQL DATA +begin +declare var integer; +declare c cursor for select a from v1; +open c; +fetch c into var; +close c; +return var; +end +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; create table t1 (a int) +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; insert into t1 (a) values (f1()) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; drop view v1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; drop function f1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS p1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE t1(col VARCHAR(10)) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10)) +INSERT INTO t1 VALUES(arg) +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci')) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS p1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS f1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +SET @a = 1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +RETURN 0 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP FUNCTION f1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # drop database if exists mysqltest +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # drop database if exists mysqltest2 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # create database mysqltest +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # create database mysqltest2 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest2`; create table t ( t integer ) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`() +begin end +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest2`; insert into t values ( 1 ) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +begin +insert into t values (1); +return 0; +end +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`() +master-bin.000001 # Xid # # COMMIT /* XID */ +connection slave; +set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; +connection master; +set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; drop database mysqltest; drop database mysqltest2; -End of 5.1 tests +connection slave; +connection master; +use test; +/*!50001 create procedure `mysqltestbug36570_p1`() */ +begin +select 1; +end| +use mysql| +create procedure test.` mysqltestbug36570_p2`(/*!50001 a int*/)`label`: +begin +select a; +end| +/*!50001 create function test.mysqltestbug36570_f1() */ +returns int +/*!50001 deterministic */ +begin +return 3; +end| +use test| +show procedure status like '%mysqltestbug36570%'; +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test mysqltestbug36570_p2 PROCEDURE root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci +test mysqltestbug36570_p1 PROCEDURE root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci +show create procedure ` mysqltestbug36570_p2`; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation + mysqltestbug36570_p2 CREATE DEFINER=`root`@`localhost` PROCEDURE ` mysqltestbug36570_p2`( a int) +`label`: +begin +select a; +end latin1 latin1_swedish_ci latin1_swedish_ci +connection slave; +connection slave; +show procedure status like '%mysqltestbug36570%'; +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test mysqltestbug36570_p2 PROCEDURE root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci +test mysqltestbug36570_p1 PROCEDURE root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci +show create procedure ` mysqltestbug36570_p2`; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation + mysqltestbug36570_p2 CREATE DEFINER=`root`@`localhost` PROCEDURE ` mysqltestbug36570_p2`( a int) +`label`: +begin +select a; +end latin1 latin1_swedish_ci latin1_swedish_ci +call ` mysqltestbug36570_p2`(42); +a +42 +show function status like '%mysqltestbug36570%'; +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test mysqltestbug36570_f1 FUNCTION root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci +connection master; +flush logs; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET TIMESTAMP=t/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +drop database if exists mysqltest1 +/*!*/; +SET TIMESTAMP=t/*!*/; +create database mysqltest1 +/*!*/; +use `mysqltest1`/*!*/; +SET TIMESTAMP=t/*!*/; +create table t1 (a varchar(100)) +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() +begin +declare b int; +set b = 8; +insert into t1 values (b); +insert into t1 values (unix_timestamp()); +end +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values ( NAME_CONST('b',8)) +/*!*/; +COMMIT/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values (unix_timestamp()) +/*!*/; +COMMIT/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +delete from t1 +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`() +select * from mysqltest1.t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +alter procedure foo2 contains sql +/*!*/; +SET TIMESTAMP=t/*!*/; +DROP TABLE `t1` /* generated by server */ +/*!*/; +SET TIMESTAMP=t/*!*/; +create table t1 (a int) +/*!*/; +SET TIMESTAMP=t/*!*/; +create table t2 like t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`() + DETERMINISTIC +insert into t1 values (15) +/*!*/; +SET TIMESTAMP=t/*!*/; +grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1 +/*!*/; +SET TIMESTAMP=t/*!*/; +grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1 +/*!*/; +SET TIMESTAMP=t/*!*/; +grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 +/*!*/; +SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=1411383296/*!*/; +CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`() + DETERMINISTIC +begin +insert into t2 values(3); +insert into t1 values (5); +end +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t2 values(3) +/*!*/; +COMMIT/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=0/*!*/; +insert into t1 values (15) +/*!*/; +COMMIT/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=1411383296/*!*/; +insert into t2 values(3) +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=0/*!*/; +alter procedure foo4 sql security invoker +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=1411383296/*!*/; +insert into t2 values(3) +/*!*/; +COMMIT/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values (5) +/*!*/; +COMMIT/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=0/*!*/; +delete from t2 +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +alter table t2 add unique (a) +/*!*/; +SET TIMESTAMP=t/*!*/; +drop procedure foo4 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`() + DETERMINISTIC +begin +insert into t2 values(20),(20); +end +/*!*/; +SET TIMESTAMP=t/*!*/; +drop procedure foo4 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop procedure foo +/*!*/; +SET TIMESTAMP=t/*!*/; +drop procedure foo2 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop procedure foo3 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11) + DETERMINISTIC +begin +insert into t1 values (x); +return x+2; +end +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +delete t1,t2 from t1,t2 +/*!*/; +SET TIMESTAMP=t/*!*/; +COMMIT +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +SELECT `mysqltest1`.`fn1`(20) +/*!*/; +COMMIT/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t2 values(fn1(21)) +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +drop function fn1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`() RETURNS int(11) + NO SQL +begin +return unix_timestamp(); +end +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +delete from t1 +/*!*/; +COMMIT/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values(fn1()) +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=1411383296/*!*/; +CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11) + NO SQL +begin +return unix_timestamp(); +end +/*!*/; +SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=0/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11) + READS SQL DATA +begin +return 0; +end +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +delete from t2 +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +alter table t2 add unique (a) +/*!*/; +SET TIMESTAMP=t/*!*/; +drop function fn1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11) +begin +insert into t2 values(x),(x); +return 10; +end +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +delete from t1 +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values (1) +/*!*/; +COMMIT/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +delete from t1 +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +drop trigger trg +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 values (1) +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() + READS SQL DATA +select * from t1 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop procedure foo +/*!*/; +SET TIMESTAMP=t/*!*/; +drop function fn1 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop database mysqltest1 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop user "zedjzlcsjhd"@127.0.0.1 +/*!*/; +use `test`/*!*/; +SET TIMESTAMP=t/*!*/; +drop function if exists f1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) + READS SQL DATA +begin +declare var integer; +declare c cursor for select a from v1; +open c; +fetch c into var; +close c; +return var; +end +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a +/*!*/; +SET TIMESTAMP=t/*!*/; +create table t1 (a int) +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t1 (a) values (f1()) +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +drop view v1 +/*!*/; +SET TIMESTAMP=t/*!*/; +drop function f1 +/*!*/; +SET TIMESTAMP=t/*!*/; +DROP PROCEDURE IF EXISTS p1 +/*!*/; +SET TIMESTAMP=t/*!*/; +DROP TABLE IF EXISTS `t1` /* generated by server */ +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE TABLE t1(col VARCHAR(10)) +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10)) +INSERT INTO t1 VALUES(arg) +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci')) +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +DROP PROCEDURE p1 +/*!*/; +SET TIMESTAMP=t/*!*/; +DROP PROCEDURE IF EXISTS p1 +/*!*/; +SET TIMESTAMP=t/*!*/; +DROP FUNCTION IF EXISTS f1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +SET @a = 1 +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +RETURN 0 +/*!*/; +SET TIMESTAMP=t/*!*/; +DROP PROCEDURE p1 +/*!*/; +SET TIMESTAMP=t/*!*/; +DROP FUNCTION f1 +/*!*/; +SET TIMESTAMP=t/*!*/; +DROP TABLE `t1` /* generated by server */ +/*!*/; +SET TIMESTAMP=t/*!*/; +drop database if exists mysqltest +/*!*/; +SET TIMESTAMP=t/*!*/; +drop database if exists mysqltest2 +/*!*/; +SET TIMESTAMP=t/*!*/; +create database mysqltest +/*!*/; +SET TIMESTAMP=t/*!*/; +create database mysqltest2 +/*!*/; +use `mysqltest2`/*!*/; +SET TIMESTAMP=t/*!*/; +create table t ( t integer ) +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`() +begin end +/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=t/*!*/; +insert into t values ( 1 ) +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +begin +insert into t values (1); +return 0; +end +/*!*/; +BEGIN +/*!*/; +use `mysqltest`/*!*/; +SET TIMESTAMP=t/*!*/; +SELECT `mysqltest2`.`f1`() +/*!*/; +COMMIT/*!*/; +SET TIMESTAMP=t/*!*/; +drop database mysqltest +/*!*/; +SET TIMESTAMP=t/*!*/; +drop database mysqltest2 +/*!*/; +use `test`/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltestbug36570_p1`() +begin +select 1; +end +/*!*/; +use `mysql`/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` PROCEDURE `test`.` mysqltestbug36570_p2`( a int) +`label`: +begin +select a; +end +/*!*/; +SET TIMESTAMP=t/*!*/; +CREATE DEFINER=`root`@`localhost` FUNCTION `test`.`mysqltestbug36570_f1`() RETURNS int(11) + DETERMINISTIC +begin +return 3; +end +/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +use test; +drop procedure mysqltestbug36570_p1; +drop procedure ` mysqltestbug36570_p2`; +drop function mysqltestbug36570_f1; +End of 5.0 tests +# End of 5.1 tests +# +# Test Bug#30977 Concurrent statement using stored +# function and DROP FUNCTION breaks SBR. +# +# Demonstrate that stored function DDL can not go through, +# or, worse yet, make its way into the binary log, while +# the stored function is in use. +# For that, try to insert a result of a stored function +# into a table. Block the insert in the beginning, waiting +# on a table lock. While insert is blocked, attempt to +# drop the routine. Verify that this attempt +# blocks and waits for INSERT to complete. Commit and +# reap the chain of events. Master and slave must contain +# identical data. Statements in the binrary log must be +# consistent with data in the table. +# +connection default; +drop table if exists t1, t2; +drop function if exists t1; +create table t1 (a int); +create table t2 (a int) as select 1 as a; +create function f1() returns int deterministic return (select max(a) from t2); +lock table t2 write; +connection master; +# Sending 'insert into t1 (a) values (f1())'... +insert into t1 (a) values (f1()); +connection master1; +# Waitng for 'insert into t1 ...' to get blocked on table lock... +# Sending 'drop function f1'. It will wait till insert finishes. +drop function f1;; +connection default; +# Check that 'drop function f1' gets blocked. +# Now let's let 'insert' go through... +unlock tables; +connection master; +# Reaping 'insert into t1 (a) values (f1())'... +connection master1; +# Reaping 'drop function f1' +connection master; +select * from t1; +a +1 +connection slave; +connection slave; +select * from t1; +a +1 +connection master; +drop table t1, t2; +drop function f1; +ERROR 42000: FUNCTION test.f1 does not exist +# +# Bug #11918 Can't use a declared variable in LIMIT clause +# +include/rpl_reset.inc +create table t1 (c1 int); +insert into t1 (c1) values +(1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +create procedure p1(p1 integer) +delete from t1 limit p1; +set @save_binlog_format=@@session.binlog_format; +set @@session.binlog_format=STATEMENT; +call p1(NULL); +call p1(0); +call p1(1); +call p1(2); +call p1(3); +select * from t1; +c1 +7 +8 +9 +10 +connection slave; +connection slave; +select * from t1; +c1 +7 +8 +9 +10 +connection master; +call p1(-1); +select * from t1; +c1 +connection slave; +connection slave; +select * from t1; +c1 +connection master; +# Cleanup +set @@session.binlog_format=@save_binlog_format; +drop table t1; +drop procedure p1; +# End of 5.5 tests. +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp004.result b/mysql-test/suite/engines/funcs/r/rpl_sp004.result index 1c0ed3cc50a..72f0428ce0f 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_sp004.result +++ b/mysql-test/suite/engines/funcs/r/rpl_sp004.result @@ -1,9 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t2; @@ -38,6 +35,7 @@ a 2 3 8 +connection slave; SELECT * FROM test.t1 ORDER BY a; a 1 @@ -50,15 +48,18 @@ a 2 3 8 +connection master; CALL test.p2(); USE test; SHOW TABLES; Tables_in_test t3 +connection slave; USE test; SHOW TABLES; Tables_in_test t3 +connection master; CALL test.p1(); Warnings: Note 1050 Table 't3' already exists @@ -74,6 +75,7 @@ a 2 3 8 +connection slave; SELECT * FROM test.t1 ORDER BY a; a 1 @@ -86,8 +88,11 @@ a 2 3 8 +connection master; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp_effects.result b/mysql-test/suite/engines/funcs/r/rpl_sp_effects.result index 97cc0a78a23..d6890f22b02 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_sp_effects.result +++ b/mysql-test/suite/engines/funcs/r/rpl_sp_effects.result @@ -1,9 +1,7 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection master; +SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; drop procedure if exists p1; drop procedure if exists p2; drop function if exists f1; @@ -20,6 +18,8 @@ set spv=spv+1; end while; end// call p1(); +connection slave; +connection slave; SELECT * FROM t1 ORDER BY a; a 1 @@ -27,6 +27,7 @@ a 3 4 5 +connection master; SELECT * FROM t1 ORDER BY a; a 1 @@ -43,9 +44,12 @@ call p2(); SELECT * FROM t2 ORDER BY a; a 4 +connection slave; +connection slave; SELECT * FROM t2 ORDER BY a; a 4 +connection master; drop procedure p1; drop procedure p2; drop table t2; @@ -104,6 +108,8 @@ master: 7 master: 8 master: 10 master: 11 +connection slave; +connection slave; SELECT 'slave:',a FROM t1 ORDER BY a; slave: a slave: 1 @@ -120,6 +126,7 @@ slave: 7 slave: 8 slave: 10 slave: 11 +connection master; drop procedure p1; delete from t1; delete from t2; @@ -134,10 +141,13 @@ SELECT 'master:',a FROM t1 ORDER BY a; master: a master: 1 master: 2 +connection slave; +connection slave; SELECT 'slave:',a FROM t1 ORDER BY a; slave: a slave: 1 slave: 2 +connection master; drop view v1; delete from t1; prepare s1 from 'select f1(?)'; @@ -148,9 +158,12 @@ f1(?) SELECT 'master:',a FROM t1 ORDER BY a; master: a master: 123 +connection slave; +connection slave; SELECT 'slave:',a FROM t1 ORDER BY a; slave: a slave: 123 +connection master; delete from t1; create procedure p1(spv int) begin @@ -169,12 +182,15 @@ master: 6 master: 6 master: 15 master: 15 +connection slave; +connection slave; SELECT 'slave:',a FROM t1 ORDER BY a; slave: a slave: 6 slave: 6 slave: 15 slave: 15 +connection master; drop procedure p1; drop function f1; drop table t1,t2; @@ -220,6 +236,8 @@ master 100 master 101 master 101 master 102 +connection slave; +connection slave; SELECT 'slave', a FROM t1 ORDER BY a; slave a slave 10 @@ -231,7 +249,73 @@ slave 100 slave 101 slave 101 slave 102 +connection master; drop table t1; drop function f1; drop function f2; drop procedure p1; +connection slave; +connection master; +create table t2 (b BIT(7)); +create procedure sp_bug26199(bitvalue BIT(7)) +begin +insert into t2 set b = bitvalue; +end // +create function sf_bug26199(b BIT(7)) returns int +begin +insert into t2 values(b); +return 0; +end// +call sp_bug26199(b'1110'); +call sp_bug26199('\0'); +select sf_bug26199(b'1111111'); +sf_bug26199(b'1111111') +0 +SET STATEMENT sql_mode = '' FOR +select sf_bug26199(b'101111111'); +sf_bug26199(b'101111111') +0 +Warnings: +Warning 1264 Out of range value for column 'b' at row 1 +select sf_bug26199('\''); +sf_bug26199('\'') +0 +select hex(b) from t2; +hex(b) +E +0 +7F +7F +27 +connection slave; +select hex(b) from t2; +hex(b) +E +0 +7F +7F +27 +connection master; +drop table t2; +drop procedure sp_bug26199; +drop function sf_bug26199; +SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; +connection slave; +set names utf8; +CREATE FUNCTION f() RETURNS timestamp DETERMINISTIC +BEGIN RETURN '2012-12-21 12:12:12'; END | +CREATE PROCEDURE p(t timestamp) +BEGIN +SET @t = t; +PREPARE stmt FROM " + UPDATE t1 SET a = @t WHERE '2012-12-31 08:00:00' < f() "; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +END | +create table t1 (a timestamp); +call p('2012-12-31 08:00:00'); +drop table t1; +drop procedure p; +drop function f; +end of the tests +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result b/mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result index 1fcb586d1fb..48c5e548fd2 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result +++ b/mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result @@ -1,12 +1,17 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -stop slave; +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +connection master; create table t1(n int); -start slave; -stop slave io_thread; +connection slave; +include/start_slave.inc +include/stop_slave_io.inc start slave io_thread; +include/wait_for_slave_io_to_start.inc +connection master; +connection slave; +connection master; drop table t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result b/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result index 547dd8e1541..41d18d7f9fe 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result +++ b/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result @@ -1,20 +1,19 @@ +include/master-slave.inc +[connection master] +connection slave; stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -stop slave; +connection master; # # Generate a big enough master's binlog to cause relay log rotations # create table t1 (a int); drop table t1; +connection slave; reset slave; # # Test 1 # -set @my_max_binlog_size= @@global.max_binlog_size; +set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size; set global max_binlog_size=8192; set global max_relay_log_size=8192-1; Warnings: @@ -23,7 +22,7 @@ select @@global.max_relay_log_size; @@global.max_relay_log_size 4096 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 2 # @@ -33,17 +32,19 @@ set global max_relay_log_size=(5*4096); select @@global.max_relay_log_size; @@global.max_relay_log_size 20480 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 3: max_relay_log_size = 0 # stop slave; reset slave; set global max_relay_log_size=0; +Warnings: +Warning 1292 Truncated incorrect max_relay_log_size value: '0' select @@global.max_relay_log_size; -@@global.max_relay_log_size 0 +@@global.max_relay_log_size 4096 start slave; -Checking that both slave threads are running. +include/check_slave_is_running.inc # # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions # @@ -56,19 +57,27 @@ flush logs; reset slave; start slave; flush logs; +connection master; create table t1 (a int); -Checking that both slave threads are running. +connection slave; +include/check_slave_is_running.inc # # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated # flush logs; +connection master; drop table t1; -Checking that both slave threads are running. +connection slave; +include/check_slave_is_running.inc +connection master; flush logs; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000002 # <Binlog_Do_DB> <Binlog_Ignore_DB> +connection slave; set global max_binlog_size= @my_max_binlog_size; +set global max_relay_log_size= @my_max_relay_log_size; # # End of 4.1 tests # +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result b/mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result index ea34b308ec2..0d99235e45c 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result +++ b/mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result @@ -1,20 +1,20 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] create table t1(n int auto_increment primary key, s char(10)); +connection slave; insert into t1 values (2,'old'); +connection master; insert into t1 values(NULL,'new'); insert into t1 values(NULL,'new'); +connection slave; select * from t1 order by n; n s 1 new 2 old delete from t1 where n = 2; -start slave; -stop slave; +include/start_slave.inc +include/stop_slave.inc +connection master; create table t2(n int); drop table t2; insert into t1 values(NULL,'new'); @@ -22,10 +22,14 @@ set sql_log_bin=0; insert into t1 values(NULL,'new'); set sql_log_bin=1; delete from t1 where n=4; -start slave; +connection slave; +include/start_slave.inc select * from t1 order by n; n s 1 new 2 new 3 new +connection master; drop table t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result b/mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result index 5a253d61fcb..2505660f863 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result +++ b/mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result @@ -1,52 +1,71 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection slave; create database mysqltest; +connection master; drop database if exists mysqltest; Warnings: Note 1008 Can't drop database 'mysqltest'; database doesn't exist +connection slave; show tables from mysqltest; ERROR 42000: Unknown database 'mysqltest' +connection slave; create table t1 (a int); +connection master; drop table if exists t1; Warnings: -Note 1051 Unknown table 't1' +Note 1051 Unknown table 'test.t1' +connection slave; select * from t1; ERROR 42S02: Table 'test.t1' doesn't exist +connection master; create table t1 (a int, b int); +connection slave; insert into t1 values(1,1); +connection master; delete from t1; +connection slave; select * from t1; a b insert into t1 values(1,1); +connection master; insert into t1 values(2,1); update t1 set a=2; +connection slave; select * from t1; a b 2 1 2 1 +connection master; create table t2 (a int, b int); delete from t1; insert into t1 values(1,1); insert into t2 values(1,1); +connection slave; update t1 set a=2; +connection master; UPDATE t1, t2 SET t1.a = t2.a; +connection slave; select * from t1; a b 1 1 select * from t2; a b 1 1 +connection master; delete from t1; delete from t2; +connection slave; insert into t1 values(1,1); insert into t2 values(1,1); +connection master; DELETE t1.*, t2.* from t1, t2; +connection slave; select * from t1; a b select * from t2; a b +connection master; drop table t1, t2; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result b/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result index c6c2c525098..1ba2d1b624b 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result +++ b/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result @@ -1,41 +1,58 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -Master_User root -Master_Host 127.0.0.1 +include/master-slave.inc +[connection master] +connection slave; +Master_User = 'root' +Master_Host = '127.0.0.1' include/stop_slave.inc change master to master_user='test'; -Master_User test -Master_Host 127.0.0.1 +Master_User = 'test' +Master_Host = '127.0.0.1' reset slave; -Master_User test -Master_Host 127.0.0.1 +Master_User = 'test' +Master_Host = '127.0.0.1' change master to master_user='root'; include/start_slave.inc -Master_User root -Master_Host 127.0.0.1 +Master_User = 'root' +Master_Host = '127.0.0.1' include/stop_slave.inc reset slave; include/start_slave.inc +connection master; create temporary table t1 (a int); +connection slave; include/stop_slave.inc reset slave; include/start_slave.inc show status like 'slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 1 +connection master; +drop temporary table if exists t1; +connection slave; include/stop_slave.inc reset slave; +include/check_slave_no_error.inc change master to master_user='impossible_user_name'; start slave; -stop slave; +include/wait_for_slave_io_error.inc [errno=1045] +include/stop_slave_sql.inc change master to master_user='root'; include/start_slave.inc +include/check_slave_no_error.inc stop slave; change master to master_user='impossible_user_name'; start slave; -stop slave; +include/wait_for_slave_io_error.inc [errno=1045] +include/stop_slave_sql.inc reset slave; +include/check_slave_no_error.inc +change master to master_user='root'; +reset slave; +include/start_slave.inc +include/stop_slave.inc +reset slave all; +start slave; +ERROR HY000: Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO +CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result index b0d92f3ca3f..2f7f1b07cb4 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result @@ -1,15 +1,36 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -set @saved_binlog_format = @@global.binlog_format; +include/master-slave.inc +[connection master] +connection slave; +connection master; drop database if exists mysqltest1; create database mysqltest1; use mysqltest1; +set @my_binlog_format= @@global.binlog_format; +set session binlog_format=mixed; +show session variables like "binlog_format%"; +Variable_name Value +binlog_format MIXED +set session binlog_format=statement; +show session variables like "binlog_format%"; +Variable_name Value +binlog_format STATEMENT set session binlog_format=row; -set global binlog_format=row; +show session variables like "binlog_format%"; +Variable_name Value +binlog_format ROW +set global binlog_format=DEFAULT; +show global variables like "binlog_format%"; +Variable_name Value +binlog_format MIXED +set global binlog_format=MIXED; +show global variables like "binlog_format%"; +Variable_name Value +binlog_format MIXED +set global binlog_format=STATEMENT; +show global variables like "binlog_format%"; +Variable_name Value +binlog_format STATEMENT +set global binlog_format=ROW; show global variables like "binlog_format%"; Variable_name Value binlog_format ROW @@ -68,11 +89,11 @@ execute stmt1 using @string; deallocate prepare stmt1; insert into t1 values("for_10_"); insert into t1 select "yesterday_11_"; -set binlog_format=default; +set binlog_format=statement; select @@global.binlog_format, @@session.binlog_format; @@global.binlog_format @@session.binlog_format STATEMENT STATEMENT -set global binlog_format=default; +set global binlog_format=statement; select @@global.binlog_format, @@session.binlog_format; @@global.binlog_format @@session.binlog_format STATEMENT STATEMENT @@ -87,11 +108,11 @@ execute stmt1 using @string; deallocate prepare stmt1; insert into t1 values("for_15_"); insert into t1 select "yesterday_16_"; -set binlog_format=mixed; +set global binlog_format=mixed; select @@global.binlog_format, @@session.binlog_format; @@global.binlog_format @@session.binlog_format -STATEMENT MIXED -set global binlog_format=mixed; +MIXED STATEMENT +set binlog_format=default; select @@global.binlog_format, @@session.binlog_format; @@global.binlog_format @@session.binlog_format MIXED MIXED @@ -112,11 +133,15 @@ execute stmt1 using @string; deallocate prepare stmt1; insert into t1 values(concat("for_23_",UUID())); insert into t1 select "yesterday_24_"; -create table t2 select rpad(UUID(),100,' '); +create table t2 ENGINE=MyISAM select rpad(UUID(),100,' '); create table t3 select 1 union select UUID(); +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3); +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); -insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); +Warnings: +Warning 1292 Incorrect datetime value: '3' +insert ignore into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); create procedure foo() begin insert into t1 values("work_25_"); @@ -228,6 +253,14 @@ begin set NEW.data = concat(NEW.data,UUID()); end| insert into t11 values("try_560_"); +insert delayed into t2 values("delay_1_"); +insert delayed into t2 values(concat("delay_2_",UUID())); +insert delayed into t2 values("delay_6_"); +insert delayed into t2 values(rand()); +set @a=2.345; +insert delayed into t2 values(@a); +connection slave; +connection master; create table t20 select * from t1; create table t21 select * from t2; create table t22 select * from t3; @@ -244,14 +277,18 @@ end| select f("try_41_"); f("try_41_") 1 +connection slave; use mysqltest1; insert into t2 values(2,null),(3,null),(4,null); delete from t2 where a>=2; +connection master; select f("try_42_"); f("try_42_") 1 +connection slave; insert into t2 values(3,null),(4,null); delete from t2 where a>=3; +connection master; prepare stmt1 from 'select f(?)'; set @string="try_43_"; insert into t1 values(null,"try_44_"); @@ -259,6 +296,8 @@ execute stmt1 using @string; f(?) 1 deallocate prepare stmt1; +connection slave; +connection master; create table t12 select * from t1; drop table t1; create table t1 (a int, b varchar(100), key(a)); @@ -284,12 +323,16 @@ end| select f1("try_46_"),f2("try_47_"); f1("try_46_") f2("try_47_") 1 1 +connection slave; insert into t2 values(2,null),(3,null),(4,null); delete from t2 where a>=2; +connection master; select f1("try_48_"),f2("try_49_"); f1("try_48_") f2("try_49_") 1 1 insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_"))); +connection slave; +connection master; drop function f2; create function f2 (x varchar(100)) returns int deterministic begin @@ -301,6 +344,8 @@ end| select f1("try_53_"),f2("try_54_"); f1("try_53_") f2("try_54_") 1 3 +connection slave; +connection master; drop function f2; create trigger t1_bi before insert on t1 for each row begin @@ -309,12 +354,16 @@ end| insert into t1 values(null,"try_56_"); alter table t1 modify a int, drop primary key; insert into t1 values(null,"try_57_"); +connection slave; +connection master; CREATE TEMPORARY TABLE t15 SELECT UUID(); create table t16 like t15; INSERT INTO t16 SELECT * FROM t15; insert into t16 values("try_65_"); drop table t15; insert into t16 values("try_66_"); +connection slave; +connection master; select count(*) from t1; count(*) 7 @@ -338,7 +387,7 @@ count(*) 66 select count(*) from t21; count(*) -14 +19 select count(*) from t22; count(*) 2 @@ -354,6 +403,8 @@ count(*) select count(*) from t16; count(*) 3 +connection slave; +connection master; DROP TABLE IF EXISTS t11; SET SESSION BINLOG_FORMAT=STATEMENT; CREATE TABLE t11 (song VARCHAR(255)); @@ -366,17 +417,44 @@ UNLOCK TABLES; SELECT * FROM t11; song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict song Careful With That Axe, Eugene +connection slave; USE mysqltest1; SELECT * FROM t11; song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict song Careful With That Axe, Eugene +connection master; DROP TABLE IF EXISTS t12; SET SESSION BINLOG_FORMAT=MIXED; CREATE TABLE t12 (data LONG); LOCK TABLES t12 WRITE; INSERT INTO t12 VALUES(UUID()); UNLOCK TABLES; -show binlog events; -show binlog events; +connection slave; +connection master; +CREATE FUNCTION my_user() +RETURNS CHAR(64) +BEGIN +DECLARE user CHAR(64); +SELECT USER() INTO user; +RETURN user; +END $$ +CREATE FUNCTION my_current_user() +RETURNS CHAR(64) +BEGIN +DECLARE user CHAR(64); +SELECT CURRENT_USER() INTO user; +RETURN user; +END $$ +DROP TABLE IF EXISTS t13; +CREATE TABLE t13 (data CHAR(64)); +INSERT INTO t13 VALUES (USER()); +INSERT INTO t13 VALUES (my_user()); +INSERT INTO t13 VALUES (CURRENT_USER()); +INSERT INTO t13 VALUES (my_current_user()); +connection slave; +connection master; drop database mysqltest1; -set global binlog_format= @saved_binlog_format; +connection slave; +connection master; +set global binlog_format =@my_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_temp_table.result b/mysql-test/suite/engines/funcs/r/rpl_temp_table.result index e4ca31d8908..ff3e52f77b5 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_temp_table.result +++ b/mysql-test/suite/engines/funcs/r/rpl_temp_table.result @@ -1,9 +1,5 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] create table t2 (n int, PRIMARY KEY(n)); create temporary table t1 (n int); create temporary table t3 (n int not null); @@ -15,10 +11,16 @@ insert into t3 values (1010); insert into t2 select * from t3; drop table if exists t3; insert into t2 values (1012); +connection master1; create temporary table t1 (n int); insert into t1 values (4),(5); insert into t2 select * from t1; +disconnect master; +connection slave; +connection master1; insert into t2 values(61); +disconnect master1; +connection slave; select * from t2; n 1 @@ -43,6 +45,19 @@ sum(n) show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 +*** MDEV-8016: Replication aborts on DROP /*!40005 TEMPORARY */ TABLE IF EXISTS *** +connect master2,localhost,root,,; +INSERT INTO t2 VALUES (2000), (2001); +CREATE FUNCTION f() RETURNS INTEGER RETURN 1; +CREATE TEMPORARY TABLE t3 AS SELECT f() AS col FROM t2; +disconnect master2; +connection default; +connection slave; +connect master2,localhost,root,,; +connection master2; drop table if exists t1,t2; Warnings: -Note 1051 Unknown table 't1' +Note 1051 Unknown table 'test.t1' +drop function f; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_temporary.result b/mysql-test/suite/engines/funcs/r/rpl_temporary.result index 27def773a30..e2999cdd225 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_temporary.result +++ b/mysql-test/suite/engines/funcs/r/rpl_temporary.result @@ -1,11 +1,43 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +SET sql_log_bin = 0; +SET sql_log_bin = 1; +include/master-slave.inc +[connection master] +connection slave; reset master; -CREATE USER ''@localhost; +connection master; +DROP TABLE IF EXISTS t1; +CREATE TEMPORARY TABLE t1 (a char(1)); +INSERT INTO t1 VALUES ('a'); +connection slave; +include/stop_slave.inc +include/start_slave.inc +connection master; +INSERT INTO t1 VALUES ('b'); +connection slave; +connection master; +DROP TABLE IF EXISTS t1; +CREATE TEMPORARY TABLE `t1`(`a` tinyint,`b` char(1))engine=myisam; +INSERT IGNORE INTO `t1` set `a`=128,`b`='128'; +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1265 Data truncated for column 'b' at row 1 +connection slave; +include/stop_slave.inc +include/start_slave.inc +connection master; +INSERT IGNORE INTO `t1` set `a`=128,`b`='128'; +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1265 Data truncated for column 'b' at row 1 +connection slave; +connection master; +DROP TABLE t1; +connection slave; +connection master; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connect con3,localhost,zedjzlcsjhd,,; +connection con3; SET @save_select_limit=@@session.sql_select_limit; SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100; ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation @@ -17,20 +49,33 @@ ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) fo SELECT @@session.sql_select_limit = @save_select_limit; @@session.sql_select_limit = @save_select_limit 1 +connection con2; +SET @save_conn_id= connection_id(); SET @@session.pseudo_thread_id=100; SET @@session.pseudo_thread_id=connection_id(); +SET @@session.pseudo_thread_id=@save_conn_id; SET @@session.sql_log_bin=0; SET @@session.sql_log_bin=1; +connection con3; drop table if exists t1,t2; create table t1(f int); create table t2(f int); insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +SELECT COUNT(*) FROM t1; +COUNT(*) +10 +connection con1; create temporary table t3(f int); insert into t3 select * from t1 where f<6; +connection con2; create temporary table t3(f int); +connection con1; insert into t2 select count(*) from t3; +connection con2; insert into t3 select * from t1 where f>=4; +connection con1; drop temporary table t3; +connection con2; insert into t2 select count(*) from t3; drop temporary table t3; select * from t2 ORDER BY f; @@ -75,15 +120,22 @@ f 7 drop table t1,t2; create temporary table t3 (f int); +connection slave; +connection master; create temporary table t4 (f int); create table t5 (f int); -select id from information_schema.processlist where command='Binlog Dump' into @id; -kill @id; +connection slave; +stop slave; +connection master; insert into t5 select * from t4; +connection slave; +start slave; select * from t5 /* must be 1 after reconnection */; f +connection master; drop temporary table t4; drop table t5; +connection con1; set @@session.pseudo_thread_id=100; create temporary table t101 (id int); create temporary table t102 (id int); @@ -95,14 +147,99 @@ set @@session.pseudo_thread_id=300; create temporary table t301 (id int); create temporary table t302 (id int); create temporary table `#sql_not_user_table303` (id int); -DROP USER ''@localhost; +disconnect con1; +connection master; create table t1(f int); insert into t1 values (1); +connection slave; select * from t1 /* must be 1 */; f 1 +connection master; drop table t1; +connection slave; select * from t1; a 1 +connection master; drop table t1; +connection slave; +include/stop_slave.inc +connection master; +include/rpl_reset.inc +-- Bug#43748 +-- make a user on the slave that can list but not kill system threads. +connection slave; +FLUSH PRIVILEGES; +GRANT USAGE ON *.* TO user43748@127.0.0.1 IDENTIFIED BY 'meow'; +GRANT PROCESS ON *.* TO user43748@127.0.0.1; +-- try to KILL system-thread as that non-privileged user (on slave). +connect cont43748,127.0.0.1,user43748,meow,test,$SLAVE_MYPORT,; +connection cont43748; +SELECT id INTO @id FROM information_schema.processlist WHERE user='system user' LIMIT 1; +KILL @id; +Got one of the listed errors +disconnect cont43748; +-- throw out test-user on slave. +connection slave; +DROP USER user43748@127.0.0.1; +# +# MDEV-10216: Assertion `strcmp(share->unique_file_name,filename) || +# share->last_version' failed in myisam/mi_open.c:67: test_if_reopen +# +connection master; +CREATE TEMPORARY TABLE t1(i INT PRIMARY KEY) ENGINE=MYISAM; +INSERT INTO t1 VALUES(1); +SELECT COUNT(*)=1 FROM t1; +COUNT(*)=1 +1 +ALTER TABLE t1 RENAME t2; +SELECT COUNT(*)=1 FROM t2; +COUNT(*)=1 +1 +ALTER TABLE t2 RENAME t1; +ALTER TABLE t1 DISABLE KEYS; +ALTER TABLE t1 ENABLE KEYS; +LOCK TABLES t1 WRITE; +ALTER TABLE t1 RENAME t2; +SELECT COUNT(*)=1 FROM t2; +COUNT(*)=1 +1 +ALTER TABLE t2 RENAME t1; +ALTER TABLE t1 DISABLE KEYS; +ALTER TABLE t1 ENABLE KEYS; +UNLOCK TABLES; +LOCK TABLES t1 READ; +ALTER TABLE t1 RENAME t2; +SELECT COUNT(*)=1 FROM t2; +COUNT(*)=1 +1 +ALTER TABLE t2 RENAME t1; +ALTER TABLE t1 DISABLE KEYS; +ALTER TABLE t1 ENABLE KEYS; +UNLOCK TABLES; +FLUSH TABLES WITH READ LOCK; +ALTER TABLE t1 RENAME t2; +SELECT COUNT(*)=1 FROM t2; +COUNT(*)=1 +1 +ALTER TABLE t2 RENAME t1; +ALTER TABLE t1 DISABLE KEYS; +ALTER TABLE t1 ENABLE KEYS; +UNLOCK TABLES; +ALTER TABLE t1 RENAME t2, LOCK SHARED; +ALTER TABLE t2 RENAME t1, LOCK EXCLUSIVE; +DROP TABLE t1; +# +# MDEV-10320: NO-OP ALTER TABLE on temporary tables getting logged +# under row binlog format +# +connection master; +CREATE TEMPORARY TABLE t1(i INT PRIMARY KEY) ENGINE=MYISAM; +ALTER TABLE t1; +ALTER TABLE t1 ADD COLUMN IF NOT EXISTS I INT; +Warnings: +Note 1060 Duplicate column name 'I' +DROP TABLE t1; +End of 5.1 tests +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_trigger.result b/mysql-test/suite/engines/funcs/r/rpl_trigger.result index 7c7cda1f581..b5b88670fc6 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_trigger.result +++ b/mysql-test/suite/engines/funcs/r/rpl_trigger.result @@ -1,12 +1,6 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -DROP TABLE IF EXISTS t3; +include/master-slave.inc +[connection master] +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); create table t1 (a int auto_increment, primary key (a), b int, rand_value double not null); create table t2 (a int auto_increment, primary key (a), b int); create table t3 (a int auto_increment, primary key (a), name varchar(64) not null, old_a int, old_b int, rand_value double not null); @@ -22,8 +16,10 @@ insert into t3 values(100,"log",0,0,0); SET @@RAND_SEED1=658490765, @@RAND_SEED2=635893186; insert into t1 values(1,1,rand()),(NULL,2,rand()); insert into t2 (b) values(last_insert_id()); -insert into t2 values(3,0),(NULL,0); -insert into t2 values(NULL,0),(500,0); +insert into t2 values(3,0); +insert into t2 values(NULL,0); +insert into t2 values(NULL,0); +insert into t2 values(500,0); select a,b, truncate(rand_value,4) from t1; a b truncate(rand_value,4) 1 1 0.4320 @@ -39,14 +35,13 @@ select a,name, old_a, old_b, truncate(rand_value,4) from t3; a name old_a old_b truncate(rand_value,4) 100 log 0 0 0.0000 101 t1 1 1 0.3203 -102 t1 0 2 0.5666 +102 t1 NULL 2 0.5666 103 t2 1 2 0.9164 104 t2 3 0 0.8826 105 t2 4 0 0.6635 106 t2 5 0 0.6699 107 t2 500 0 0.3593 - ---- On slave -- +connection slave; select a,b, truncate(rand_value,4) from t1; a b truncate(rand_value,4) 1 1 0.4320 @@ -62,16 +57,20 @@ select a,name, old_a, old_b, truncate(rand_value,4) from t3; a name old_a old_b truncate(rand_value,4) 100 log 0 0 0.0000 101 t1 1 1 0.3203 -102 t1 0 2 0.5666 +102 t1 NULL 2 0.5666 103 t2 1 2 0.9164 104 t2 3 0 0.8826 105 t2 4 0 0.6635 106 t2 5 0 0.6699 107 t2 500 0 0.3593 +connection master; drop table t1,t2,t3; +connect con2,localhost,root,,; +connection con2; select get_lock("bug12480",2); get_lock("bug12480",2) 1 +connection default; create table t1 (a datetime,b datetime, c datetime); drop function if exists bug12480; create function bug12480() returns datetime @@ -91,40 +90,33 @@ select a=b && a=c from t1; a=b && a=c 1 SELECT routine_name, definer -FROM information_schema.routines; +FROM information_schema.routines +WHERE routine_name = 'bug12480'; routine_name definer -add_suppression root@localhost -check_testcase root@localhost -check_warnings root@localhost -force_restart root@localhost bug12480 root@localhost SELECT trigger_name, definer -FROM information_schema.triggers; +FROM information_schema.triggers +WHERE trigger_name = 't1_first'; trigger_name definer -gs_insert root@localhost -ts_insert root@localhost t1_first root@localhost - ---- On slave -- +connection slave; SELECT routine_name, definer -FROM information_schema.routines; +FROM information_schema.routines +WHERE routine_name = 'bug12480'; routine_name definer -add_suppression root@localhost -check_testcase root@localhost -check_warnings root@localhost -force_restart root@localhost bug12480 root@localhost SELECT trigger_name, definer -FROM information_schema.triggers; +FROM information_schema.triggers +WHERE trigger_name = 't1_first'; trigger_name definer -gs_insert root@localhost -ts_insert root@localhost t1_first root@localhost select a=b && a=c from t1; a=b && a=c 1 test 1 +connection master; +disconnect con2; truncate table t1; drop trigger t1_first; insert into t1 values ("2003-03-03","2003-03-03","2003-03-03"),(bug12480(),bug12480(),bug12480()),(now(),now(),now()); @@ -144,6 +136,8 @@ end| create database other; use other; insert into test.t1 values (1); +connection slave; +connection master; use test; drop table t1,t2; drop database other; @@ -151,14 +145,18 @@ test case for BUG#13227 ------------------- 10 ------------------- +connection master; drop table if exists t110; +connection slave; drop table if exists t210,t310; +connection master; create table t110 (f1 int) /* 2 replicate */; insert into t110 values (-5); insert into t110 values (-4); insert into t110 values (-3); insert into t110 values (-2); insert into t110 values (-1); +connection slave; select * from t110; f1 -5 @@ -198,11 +196,13 @@ f1 SELECT * from t310 /* must be f3 5*100 */; f3 500 +connection master; UPDATE t110 SET f1=5 where f1=-5; UPDATE t110 SET f1=4 where f1=-4; UPDATE t110 SET f1=3 where f1=-3; UPDATE t110 SET f1=2 where f1=-2; UPDATE t110 SET f1=1 where f1=-1; +connection slave; SELECT * from t110 /* must be f1 5 ... 1 */; f1 5 @@ -219,18 +219,25 @@ f3 100 drop trigger trg110; drop table t210,t310; +connection master; drop table t110; +connection slave; +connection master; ------------------- 9 ------------------- +connection master; drop table if exists t19; +connection slave; drop table if exists t29,t39; +connection master; create table t19 (f1 int) /* 2 replicate */; insert into t19 values (-5); insert into t19 values (-4); insert into t19 values (-3); insert into t19 values (-2); insert into t19 values (-1); +connection slave; select * from t19; f1 -5 @@ -270,11 +277,13 @@ f1 SELECT * from t39 /* must be f3 5*100 */; f3 500 +connection master; UPDATE t19 SET f1=5 where f1=-5; UPDATE t19 SET f1=4 where f1=-4; UPDATE t19 SET f1=3 where f1=-3; UPDATE t19 SET f1=2 where f1=-2; UPDATE t19 SET f1=1 where f1=-1; +connection slave; SELECT * from t19 /* must be f1 5 ... 1 */; f1 5 @@ -291,18 +300,25 @@ f3 100 drop trigger trg19; drop table t29,t39; +connection master; drop table t19; +connection slave; +connection master; ------------------- 8 ------------------- +connection master; drop table if exists t18; +connection slave; drop table if exists t28,t38; +connection master; create table t18 (f1 int) /* 2 replicate */; insert into t18 values (-5); insert into t18 values (-4); insert into t18 values (-3); insert into t18 values (-2); insert into t18 values (-1); +connection slave; select * from t18; f1 -5 @@ -342,11 +358,13 @@ f1 SELECT * from t38 /* must be f3 5*100 */; f3 500 +connection master; UPDATE t18 SET f1=5 where f1=-5; UPDATE t18 SET f1=4 where f1=-4; UPDATE t18 SET f1=3 where f1=-3; UPDATE t18 SET f1=2 where f1=-2; UPDATE t18 SET f1=1 where f1=-1; +connection slave; SELECT * from t18 /* must be f1 5 ... 1 */; f1 5 @@ -363,18 +381,25 @@ f3 100 drop trigger trg18; drop table t28,t38; +connection master; drop table t18; +connection slave; +connection master; ------------------- 7 ------------------- +connection master; drop table if exists t17; +connection slave; drop table if exists t27,t37; +connection master; create table t17 (f1 int) /* 2 replicate */; insert into t17 values (-5); insert into t17 values (-4); insert into t17 values (-3); insert into t17 values (-2); insert into t17 values (-1); +connection slave; select * from t17; f1 -5 @@ -414,11 +439,13 @@ f1 SELECT * from t37 /* must be f3 5*100 */; f3 500 +connection master; UPDATE t17 SET f1=5 where f1=-5; UPDATE t17 SET f1=4 where f1=-4; UPDATE t17 SET f1=3 where f1=-3; UPDATE t17 SET f1=2 where f1=-2; UPDATE t17 SET f1=1 where f1=-1; +connection slave; SELECT * from t17 /* must be f1 5 ... 1 */; f1 5 @@ -435,18 +462,25 @@ f3 100 drop trigger trg17; drop table t27,t37; +connection master; drop table t17; +connection slave; +connection master; ------------------- 6 ------------------- +connection master; drop table if exists t16; +connection slave; drop table if exists t26,t36; +connection master; create table t16 (f1 int) /* 2 replicate */; insert into t16 values (-5); insert into t16 values (-4); insert into t16 values (-3); insert into t16 values (-2); insert into t16 values (-1); +connection slave; select * from t16; f1 -5 @@ -486,11 +520,13 @@ f1 SELECT * from t36 /* must be f3 5*100 */; f3 500 +connection master; UPDATE t16 SET f1=5 where f1=-5; UPDATE t16 SET f1=4 where f1=-4; UPDATE t16 SET f1=3 where f1=-3; UPDATE t16 SET f1=2 where f1=-2; UPDATE t16 SET f1=1 where f1=-1; +connection slave; SELECT * from t16 /* must be f1 5 ... 1 */; f1 5 @@ -507,18 +543,25 @@ f3 100 drop trigger trg16; drop table t26,t36; +connection master; drop table t16; +connection slave; +connection master; ------------------- 5 ------------------- +connection master; drop table if exists t15; +connection slave; drop table if exists t25,t35; +connection master; create table t15 (f1 int) /* 2 replicate */; insert into t15 values (-5); insert into t15 values (-4); insert into t15 values (-3); insert into t15 values (-2); insert into t15 values (-1); +connection slave; select * from t15; f1 -5 @@ -558,11 +601,13 @@ f1 SELECT * from t35 /* must be f3 5*100 */; f3 500 +connection master; UPDATE t15 SET f1=5 where f1=-5; UPDATE t15 SET f1=4 where f1=-4; UPDATE t15 SET f1=3 where f1=-3; UPDATE t15 SET f1=2 where f1=-2; UPDATE t15 SET f1=1 where f1=-1; +connection slave; SELECT * from t15 /* must be f1 5 ... 1 */; f1 5 @@ -579,18 +624,25 @@ f3 100 drop trigger trg15; drop table t25,t35; +connection master; drop table t15; +connection slave; +connection master; ------------------- 4 ------------------- +connection master; drop table if exists t14; +connection slave; drop table if exists t24,t34; +connection master; create table t14 (f1 int) /* 2 replicate */; insert into t14 values (-5); insert into t14 values (-4); insert into t14 values (-3); insert into t14 values (-2); insert into t14 values (-1); +connection slave; select * from t14; f1 -5 @@ -630,11 +682,13 @@ f1 SELECT * from t34 /* must be f3 5*100 */; f3 500 +connection master; UPDATE t14 SET f1=5 where f1=-5; UPDATE t14 SET f1=4 where f1=-4; UPDATE t14 SET f1=3 where f1=-3; UPDATE t14 SET f1=2 where f1=-2; UPDATE t14 SET f1=1 where f1=-1; +connection slave; SELECT * from t14 /* must be f1 5 ... 1 */; f1 5 @@ -651,18 +705,25 @@ f3 100 drop trigger trg14; drop table t24,t34; +connection master; drop table t14; +connection slave; +connection master; ------------------- 3 ------------------- +connection master; drop table if exists t13; +connection slave; drop table if exists t23,t33; +connection master; create table t13 (f1 int) /* 2 replicate */; insert into t13 values (-5); insert into t13 values (-4); insert into t13 values (-3); insert into t13 values (-2); insert into t13 values (-1); +connection slave; select * from t13; f1 -5 @@ -702,11 +763,13 @@ f1 SELECT * from t33 /* must be f3 5*100 */; f3 500 +connection master; UPDATE t13 SET f1=5 where f1=-5; UPDATE t13 SET f1=4 where f1=-4; UPDATE t13 SET f1=3 where f1=-3; UPDATE t13 SET f1=2 where f1=-2; UPDATE t13 SET f1=1 where f1=-1; +connection slave; SELECT * from t13 /* must be f1 5 ... 1 */; f1 5 @@ -723,18 +786,25 @@ f3 100 drop trigger trg13; drop table t23,t33; +connection master; drop table t13; +connection slave; +connection master; ------------------- 2 ------------------- +connection master; drop table if exists t12; +connection slave; drop table if exists t22,t32; +connection master; create table t12 (f1 int) /* 2 replicate */; insert into t12 values (-5); insert into t12 values (-4); insert into t12 values (-3); insert into t12 values (-2); insert into t12 values (-1); +connection slave; select * from t12; f1 -5 @@ -774,11 +844,13 @@ f1 SELECT * from t32 /* must be f3 5*100 */; f3 500 +connection master; UPDATE t12 SET f1=5 where f1=-5; UPDATE t12 SET f1=4 where f1=-4; UPDATE t12 SET f1=3 where f1=-3; UPDATE t12 SET f1=2 where f1=-2; UPDATE t12 SET f1=1 where f1=-1; +connection slave; SELECT * from t12 /* must be f1 5 ... 1 */; f1 5 @@ -795,18 +867,25 @@ f3 100 drop trigger trg12; drop table t22,t32; +connection master; drop table t12; +connection slave; +connection master; ------------------- 1 ------------------- +connection master; drop table if exists t11; +connection slave; drop table if exists t21,t31; +connection master; create table t11 (f1 int) /* 2 replicate */; insert into t11 values (-5); insert into t11 values (-4); insert into t11 values (-3); insert into t11 values (-2); insert into t11 values (-1); +connection slave; select * from t11; f1 -5 @@ -846,11 +925,13 @@ f1 SELECT * from t31 /* must be f3 5*100 */; f3 500 +connection master; UPDATE t11 SET f1=5 where f1=-5; UPDATE t11 SET f1=4 where f1=-4; UPDATE t11 SET f1=3 where f1=-3; UPDATE t11 SET f1=2 where f1=-2; UPDATE t11 SET f1=1 where f1=-1; +connection slave; SELECT * from t11 /* must be f1 5 ... 1 */; f1 5 @@ -867,11 +948,20 @@ f3 100 drop trigger trg11; drop table t21,t31; +connection master; drop table t11; -STOP SLAVE; +connection slave; +connection master; +connection slave; +include/stop_slave.inc +connection master; FLUSH LOGS; +include/rpl_stop_server.inc [server_number=1] +include/rpl_start_server.inc [server_number=1] +--> Master binlog: Server ver: 5.0.16-debug-log, Binlog ver: 4 +connection slave; RESET SLAVE; -START SLAVE; +include/start_slave.inc SELECT MASTER_POS_WAIT('master-bin.000001', 513) >= 0; MASTER_POS_WAIT('master-bin.000001', 513) >= 0 1 @@ -881,7 +971,7 @@ t1 t2 SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation -trg1 INSERT t1 INSERT INTO t2 VALUES(CURRENT_USER()) AFTER NULL latin1 latin1_swedish_ci latin1_swedish_ci +trg1 INSERT t1 INSERT INTO t2 VALUES(CURRENT_USER()) AFTER # latin1 latin1_swedish_ci latin1_swedish_ci SELECT * FROM t1; c 1 @@ -900,25 +990,28 @@ root@localhost DROP TRIGGER trg1; DROP TABLE t1; DROP TABLE t2; -STOP SLAVE; +include/stop_slave.inc RESET SLAVE; +connection master; SHOW TABLES LIKE 't_'; Tables_in_test (t_) SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation RESET MASTER; -START SLAVE; +connection slave; +include/start_slave.inc ---> Test for BUG#20438 ---> Preparing environment... ----> connection: master +connection master; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; ---> Synchronizing slave with master... +connection slave; ----> connection: master +connection master; ---> Creating objects... CREATE TABLE t1(c INT); @@ -939,7 +1032,7 @@ c 10 ---> Synchronizing slave with master... ----> connection: master +connection slave; ---> Checking on slave... SELECT * FROM t1; @@ -949,11 +1042,14 @@ SELECT * FROM t2; c 10 ----> connection: master +connection master; ---> Cleaning up... DROP TABLE t1; DROP TABLE t2; +connection slave; +connection master; +connection master; drop table if exists t1; create table t1(a int, b varchar(50)); drop trigger not_a_trigger; @@ -975,11 +1071,15 @@ a b 1 In trigger t1_bi 2 b 3 c +connection slave; select * from t1; a b 1 In trigger t1_bi 2 b 3 c +connection master; drop table if exists t1,t11; Warnings: -Note 1051 Unknown table 't11' +Note 1051 Unknown table 'test.t11' +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result b/mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result index 44624a38875..35cd91d795b 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result +++ b/mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result @@ -1,22 +1,26 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] create temporary table t1 (n int); insert into t1 values(1); +connection slave; show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 1 +connection master; delete from t1; +connection slave; show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 1 +connection master; truncate t1; +connection slave; show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 1 +disconnect master; +connection slave; show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_user_variables.result b/mysql-test/suite/engines/funcs/r/rpl_user_variables.result index ed0d2782394..0efdbff5522 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_user_variables.result +++ b/mysql-test/suite/engines/funcs/r/rpl_user_variables.result @@ -1,10 +1,8 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] +connection slave; reset master; +connection master; create table t1(n char(30)); set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1; set @s1:='This is a test', @r1:=12.5, @r2:=-12.5; @@ -23,6 +21,7 @@ set @a:=5; insert into t1 values (@a),(@a); select * from t1 where n = '<nonexistant>'; n +connection master1; insert into t1 values (@a),(@a),(@a*5); SELECT * FROM t1 ORDER BY n; n @@ -51,6 +50,7 @@ abcn1 abcn1n2 abc\def This is a test +connection slave; SELECT * FROM t1 ORDER BY n; n NULL @@ -78,6 +78,235 @@ abcn1 abcn1n2 abc\def This is a test +connection master; insert into t1 select * FROM (select @var1 union select @var2) AS t2; drop table t1; -stop slave; +End of 4.1 tests. +DROP TABLE IF EXISTS t20; +DROP TABLE IF EXISTS t21; +DROP PROCEDURE IF EXISTS test.insert; +CREATE TABLE t20 (a VARCHAR(20)); +CREATE TABLE t21 (a VARCHAR(20)); +CREATE PROCEDURE test.insert() +BEGIN +IF (@VAR) +THEN +INSERT INTO test.t20 VALUES ('SP_TRUE'); +ELSE +INSERT INTO test.t20 VALUES ('SP_FALSE'); +END IF; +END| +CREATE TRIGGER test.insert_bi BEFORE INSERT +ON test.t20 FOR EACH ROW +BEGIN +IF (@VAR) +THEN +INSERT INTO test.t21 VALUES ('TRIG_TRUE'); +ELSE +INSERT INTO test.t21 VALUES ('TRIG_FALSE'); +END IF; +END| +connection slave; +connection master; +SET @VAR=0; +CALL test.insert(); +SET @VAR=1; +CALL test.insert(); +Check the tables for correct data +SELECT * FROM t20; +a +SP_FALSE +SP_TRUE +SELECT * FROM t21; +a +TRIG_FALSE +TRIG_TRUE +connection slave; +Check the tables for correct data and it matches master +SELECT * FROM t20; +a +SP_FALSE +SP_TRUE +SELECT * FROM t21; +a +TRIG_FALSE +TRIG_TRUE +connection master; +DROP TABLE t20; +DROP TABLE t21; +DROP PROCEDURE test.insert; +DROP TABLE IF EXISTS t1; +DROP FUNCTION IF EXISTS test.square; +CREATE TABLE t1 (i INT); +CREATE FUNCTION test.square() RETURNS INTEGER DETERMINISTIC RETURN +(@var * @var); +SET @var = 1; +INSERT INTO t1 VALUES (square()); +SET @var = 2; +INSERT INTO t1 VALUES (square()); +SET @var = 3; +INSERT INTO t1 VALUES (square()); +SET @var = 4; +INSERT INTO t1 VALUES (square()); +SET @var = 5; +INSERT INTO t1 VALUES (square()); +Retrieve the values from the table +SELECT * FROM t1; +i +1 +4 +9 +16 +25 +connection slave; +Retrieve the values from the table and verify they are the same as on master +SELECT * FROM t1; +i +1 +4 +9 +16 +25 +connection master; +DROP TABLE t1; +DROP FUNCTION test.square; +DROP TABLE IF EXISTS t1; +DROP FUNCTION IF EXISTS f1; +DROP FUNCTION IF EXISTS f2; +CREATE TABLE t1(a int); +CREATE FUNCTION f1() returns int deterministic BEGIN +return @a; +END | +CREATE FUNCTION f2() returns int deterministic BEGIN +IF (@b > 0) then +SET @c = (@a + @b); +else +SET @c = (@a - 1); +END if; +return @c; +END | +connection slave; +connection master; +SET @a=500; +INSERT INTO t1 values(f1()); +SET @b = 125; +SET @c = 1; +INSERT INTO t1 values(f2()); +Retrieve the values from the table +connection slave; +connection master; +SELECT * from t1; +a +500 +625 +connection slave; +Check the tables for correct data and it matches master +SELECT * from t1; +a +500 +625 +connection master; +DROP TABLE t1; +DROP FUNCTION f1; +DROP FUNCTION f2; +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +CREATE TABLE t1 (i int); +CREATE TABLE t2 (k int); +CREATE trigger t1_bi before INSERT on t1 for each row BEGIN +INSERT INTO t2 values (@a); +SET @a:=42; +INSERT INTO t2 values (@a); +END | +connection slave; +connection master; +SET @a:=100; +INSERT INTO t1 values (5); +Check to see that data was inserted correctly in both tables +SELECT * from t1; +i +5 +SELECT * from t2; +k +100 +42 +connection slave; +Check the tables for correct data and it matches master +SELECT * from t1; +i +5 +SELECT * from t2; +k +100 +42 +connection master; +drop table t1, t2; +connection master; +create table t1(a int, b int); +prepare s1 from 'insert into t1 values (@x:=@x+1, ?)'; +set @x=1; +execute s1 using @x; +select * from t1; +a b +2 1 +connection slave; +connection slave; +select * from t1; +a b +2 1 +connection master; +drop table t1; +connection master; +create table t1(a int); +insert into t1 values (1),(2); +prepare s1 from 'insert into t1 select a from t1 limit ?'; +set @x='1.1'; +execute s1 using @x; +select * from t1; +a +1 +2 +1 +connection slave; +connection slave; +select * from t1; +a +1 +2 +1 +connection master; +drop table t1; +End of 5.0 tests. +DROP FUNCTION IF EXISTS f1; +DROP FUNCTION IF EXISTS f2; +CREATE TABLE t1 (i INT); +CREATE FUNCTION f1() RETURNS INT RETURN @a; +CREATE +FUNCTION f2() RETURNS INT BEGIN +INSERT INTO t1 VALUES (10 + @a); +RETURN 0; +END| +connection slave; +connection master; +SET @a:=123; +SELECT f1(), f2(); +f1() f2() +123 0 +Check to see that data was inserted correctly +INSERT INTO t1 VALUES(f1()); +SELECT * FROM t1; +i +133 +123 +connection slave; +Check the table for correct data and it matches master +SELECT * FROM t1; +i +133 +123 +connection master; +DROP FUNCTION f1; +DROP FUNCTION f2; +DROP TABLE t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_variables.result b/mysql-test/suite/engines/funcs/r/rpl_variables.result index 6a9af27179e..547c324fdf8 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_variables.result +++ b/mysql-test/suite/engines/funcs/r/rpl_variables.result @@ -1,9 +1,5 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] set @my_slave_net_timeout =@@global.slave_net_timeout; set @my_sql_slave_skip_counter =@@global.sql_slave_skip_counter; set global slave_net_timeout=100; @@ -19,3 +15,4 @@ Variable_name Value slave_skip_errors 3,100,137,643,1752 set global slave_net_timeout=@my_slave_net_timeout; set global sql_slave_skip_counter=@my_sql_slave_skip_counter; +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/r/rpl_view.result b/mysql-test/suite/engines/funcs/r/rpl_view.result index 00d9bfbf380..68a149720b0 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_view.result +++ b/mysql-test/suite/engines/funcs/r/rpl_view.result @@ -1,12 +1,10 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +include/master-slave.inc +[connection master] drop table if exists t1,v1; drop view if exists t1,v1; +connection slave; reset master; +connection master; create table t1 (a int); insert into t1 values (1); create view v1 as select a from t1; @@ -15,45 +13,57 @@ select * from v1 order by a; a 1 2 +connection slave; select * from v1 order by a; a 1 2 +connection master; update v1 set a=3 where a=1; select * from v1 order by a; a 2 3 +connection slave; select * from v1 order by a; a 2 3 +connection master; delete from v1 where a=2; select * from v1 order by a; a 3 +connection slave; select * from v1 order by a; a 3 +connection master; alter view v1 as select a as b from t1; +connection slave; select * from v1 order by 1; b 3 +connection master; drop view v1; +connection slave; select * from v1 order by a; ERROR 42S02: Table 'test.v1' doesn't exist +connection master; drop table t1; +connection slave; ---> Test for BUG#20438 ---> Preparing environment... ----> connection: master +connection master; DROP TABLE IF EXISTS t1; DROP VIEW IF EXISTS v1; ---> Synchronizing slave with master... +connection slave; ----> connection: master +connection master; ---> Creating objects... CREATE TABLE t1(c INT); @@ -68,21 +78,22 @@ c 1 ---> Synchronizing slave with master... ----> connection: master - ----> Checking on slave... +connection slave; SELECT * FROM t1; c 1 - ----> connection: master +connection master; ---> Cleaning up... DROP VIEW v1; DROP TABLE t1; +connection slave; +connection master; +connection master; create table t1(a int, b int); insert into t1 values (1, 1), (1, 2), (1, 3); create view v1(a, b) as select a, sum(b) from t1 group by a; +connection slave; explain v1; Field Type Null Key Default Extra a int(11) YES NULL @@ -93,6 +104,35 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI select * from v1; a b 1 6 +connection master; drop table t1; drop view v1; +connection slave; +connection master; +CREATE TABLE t1(a INT); +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE VIEW v1 AS SELECT * FROM t1; +ERROR 42S01: Table 'v1' already exists +DROP VIEW v1; +DROP TABLE t1; +connection slave; +connection master; +CREATE TABLE t1 (a INT); +# create view as output from mysqldump 10.11 (5.0.62) +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) */ +/*!50002 WITH CASCADED CHECK OPTION */; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3 WITH CASCADED CHECK OPTION latin1 latin1_swedish_ci +connection slave; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3 WITH CASCADED CHECK OPTION latin1 latin1_swedish_ci +connection master; +DROP VIEW v1; +DROP TABLE t1; +connection slave; End of 5.0 tests +include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl000010-slave.opt b/mysql-test/suite/engines/funcs/t/rpl000010-slave.opt deleted file mode 100644 index 0dbfb311e33..00000000000 --- a/mysql-test/suite/engines/funcs/t/rpl000010-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---disconnect-slave-event-count=2 diff --git a/mysql-test/suite/engines/funcs/t/rpl000010.test b/mysql-test/suite/engines/funcs/t/rpl000010.test deleted file mode 100644 index 261b9148774..00000000000 --- a/mysql-test/suite/engines/funcs/t/rpl000010.test +++ /dev/null @@ -1,19 +0,0 @@ -# This tests the offset off by 22 mystery bug -# Must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1 - -source include/master-slave.inc; - -create table t1 (n int not null auto_increment primary key); -insert into t1 values(NULL); -insert into t1 values(2); -save_master_pos; -connection slave; -sync_with_master; -select n from t1; -connection master; -drop table t1; -save_master_pos; -connection slave; -sync_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl000011.test b/mysql-test/suite/engines/funcs/t/rpl000011.test deleted file mode 100644 index 32f6227f7c5..00000000000 --- a/mysql-test/suite/engines/funcs/t/rpl000011.test +++ /dev/null @@ -1,17 +0,0 @@ -source include/master-slave.inc; - -create table t1 (n int); -insert into t1 values(1); -sync_slave_with_master; -stop slave; -start slave; -connection master; -insert into t1 values(2); -#let slave catch up -sync_slave_with_master; -select * from t1; -connection master; -drop table t1; -sync_slave_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl000013.test b/mysql-test/suite/engines/funcs/t/rpl000013.test deleted file mode 100644 index 2c727107563..00000000000 --- a/mysql-test/suite/engines/funcs/t/rpl000013.test +++ /dev/null @@ -1,61 +0,0 @@ -# This test is to verify that DROP TEMPORARY TABLE -# is automatically binlogged and sent to slave -# when a temp table is dropped by disconnection -# of a master's conection. -# So it does not apply to row-based, where we neither need -# nor do this automatic binlogging. And if we run this test -# in row-based, it hangs waiting for an offset which is never -# reached (the "sync_with_master 1"), logically. - ---source include/have_binlog_format_mixed_or_statement.inc -source include/master-slave.inc; -save_master_pos; -connection slave; -sync_with_master; -connection master; - ---disable_query_log -CALL mtr.add_suppression(" Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); ---enable_query_log - -create table t2(n int); -create temporary table t1 (n int); -insert into t1 values(1),(2),(3); ---disable_warnings -insert into t2 select * from t1; ---enable_warnings -connection master1; -create temporary table t1 (n int); -insert into t1 values (4),(5); ---disable_warnings -insert into t2 select * from t1 as t10; ---enable_warnings -save_master_pos; -disconnect master; -connection slave; -#add 1 to catch drop table -sync_with_master 1; -connection master1; -insert into t2 values(6); -save_master_pos; -disconnect master1; -connection slave; -# same trick to go one more event -sync_with_master 1; -select * from t2; -show status like 'Slave_open_temp_tables'; -# -# Clean up -# -connect (master2,localhost,root,,); -connection master2; - -# We will get a warning for t1 as this is a temporary table that doesn't -# exist in this connection. - -drop table if exists t1,t2; -save_master_pos; -connection slave; -sync_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl000017-slave.opt b/mysql-test/suite/engines/funcs/t/rpl000017-slave.opt deleted file mode 100644 index 58a964c90d0..00000000000 --- a/mysql-test/suite/engines/funcs/t/rpl000017-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---skip-slave-start diff --git a/mysql-test/suite/engines/funcs/t/rpl_000010.test b/mysql-test/suite/engines/funcs/t/rpl_000010.test new file mode 100644 index 00000000000..155b54572e3 --- /dev/null +++ b/mysql-test/suite/engines/funcs/t/rpl_000010.test @@ -0,0 +1,2 @@ +--source suite/rpl/t/rpl_000010.test + diff --git a/mysql-test/suite/engines/funcs/t/rpl_000011.test b/mysql-test/suite/engines/funcs/t/rpl_000011.test new file mode 100644 index 00000000000..f7fc0f4a310 --- /dev/null +++ b/mysql-test/suite/engines/funcs/t/rpl_000011.test @@ -0,0 +1,18 @@ +--source include/master-slave.inc + +create table t1 (n int); +insert into t1 values(1); +--sync_slave_with_master +--source include/stop_slave.inc +--source include/start_slave.inc +connection master; +insert into t1 values(2); +#let slave catch up +--sync_slave_with_master +select * from t1; +connection master; +drop table t1; +--sync_slave_with_master + +# End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_000013.test b/mysql-test/suite/engines/funcs/t/rpl_000013.test new file mode 100644 index 00000000000..c2f6c114ad6 --- /dev/null +++ b/mysql-test/suite/engines/funcs/t/rpl_000013.test @@ -0,0 +1,2 @@ +--source suite/rpl/t/rpl_000013.test + diff --git a/mysql-test/suite/engines/funcs/t/rpl_000015.test b/mysql-test/suite/engines/funcs/t/rpl_000015.test index 817ed6f407c..8d76fc674e5 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_000015.test +++ b/mysql-test/suite/engines/funcs/t/rpl_000015.test @@ -3,13 +3,13 @@ # Change Date: 2006-01-17 # Change: added order by in select ##################### -source include/master-slave.inc; +--source include/master-slave.inc reset master; show master status; save_master_pos; connection slave; -stop slave; +--source include/stop_slave.inc reset slave; --vertical_results --replace_result $MASTER_MYPORT MASTER_PORT @@ -29,7 +29,7 @@ eval change master to master_host='127.0.0.1',master_user='root', --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 5 # 8 # 9 # 23 # 33 # show slave status; -start slave; +--source include/start_slave.inc sync_with_master; --vertical_results --replace_result $MASTER_MYPORT MASTER_PORT @@ -42,10 +42,11 @@ drop table if exists t1; --enable_warnings create table t1 (n int, PRIMARY KEY(n)); insert into t1 values (10),(45),(90); -sync_slave_with_master; +--sync_slave_with_master connection slave; SELECT * FROM t1 ORDER BY n; connection master; SELECT * FROM t1 ORDER BY n; drop table t1; -sync_slave_with_master; +--sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_000017.test b/mysql-test/suite/engines/funcs/t/rpl_000017.test new file mode 100644 index 00000000000..f498ce10a58 --- /dev/null +++ b/mysql-test/suite/engines/funcs/t/rpl_000017.test @@ -0,0 +1,2 @@ +--source suite/rpl/t/rpl_000017.test + diff --git a/mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test b/mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test index ae647ed6648..e896d62a0ab 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test +++ b/mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test @@ -1,38 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/18/2005 # -############################################################################# -# TEST: To test the LOAD DATA INFILE in rbr # -############################################################################# - -# Includes --- source include/master-slave.inc - -# Begin clean up test section ---disable_warnings -connection master; -DROP TABLE IF EXISTS test.t1; ---enable_warnings - -# Section 1 test -CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a)); -LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; -DELETE FROM test.t1 WHERE a = 'abashed'; -DELETE FROM test.t1; -LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1; - - -SELECT * FROM test.t1 ORDER BY a DESC; -save_master_pos; -sync_slave_with_master; -connection slave; -SELECT * FROM test.t1 ORDER BY a DESC; - -# Cleanup -#show binlog events; -connection master; -DROP TABLE test.t1; -sync_slave_with_master; - -# End of 5.0 test case +--source suite/rpl/t/rpl_LD_INFILE.test diff --git a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test b/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test deleted file mode 100644 index 078d1048794..00000000000 --- a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test +++ /dev/null @@ -1,47 +0,0 @@ -# -# Test of automatic redirection of queries to master/slave. -# - -source include/master-slave.inc; -# We disable this for now as PS doesn't handle redirection ---disable_ps_protocol - -#first, make sure the slave has had enough time to register -save_master_pos; -connection slave; -sync_with_master; - -#discover slaves -connection master; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 8 # 9 # 16 # 23 # 33 # -SHOW SLAVE STATUS; ---replace_result $SLAVE_MYPORT SLAVE_PORT -SHOW SLAVE HOSTS; -rpl_probe; - -#turn on master/slave query direction auto-magic -enable_rpl_parse; -create table t1 ( n int); -insert into t1 values (1),(2),(3),(4); -disable_rpl_parse; -save_master_pos; -connection slave; -sync_with_master; -insert into t1 values(5); -connection master; -enable_rpl_parse; -# The first of the queries will be sent to the slave, the second to the master. -SELECT * FROM t1 ORDER BY n; -SELECT * FROM t1 ORDER BY n; -disable_rpl_parse; -SELECT * FROM t1 ORDER BY n; -connection slave; -SELECT * FROM t1 ORDER BY n; - -# Cleanup -connection master; -drop table t1; -sync_slave_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_alter.test b/mysql-test/suite/engines/funcs/t/rpl_alter.test index 576376a0264..12360f5a3e8 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_alter.test +++ b/mysql-test/suite/engines/funcs/t/rpl_alter.test @@ -1,24 +1,2 @@ -source include/master-slave.inc; ---disable_warnings -drop database if exists mysqltest; ---enable_warnings -create database mysqltest; +--source suite/rpl/t/rpl_alter.test -create table mysqltest.t1 ( n int); -alter table mysqltest.t1 add m int; -insert into mysqltest.t1 values (1,2); -create table mysqltest.t2 (n int); -insert into mysqltest.t2 values (45); -rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2; -save_master_pos; -connection slave; -sync_with_master; -select * from mysqltest.t2; -select * from mysqltest.t3; -connection master; -drop database mysqltest; -save_master_pos; -connection slave; -sync_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_alter_db.test b/mysql-test/suite/engines/funcs/t/rpl_alter_db.test index 17ba06ce063..097eaf9071b 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_alter_db.test +++ b/mysql-test/suite/engines/funcs/t/rpl_alter_db.test @@ -1,12 +1,2 @@ -source include/master-slave.inc; -connection master; -use mysql; # to be different from initial `test' db of mysqltest client -alter database collate latin1_bin; -save_master_pos; +--source suite/rpl/t/rpl_alter_db.test -connection slave; -sync_with_master; - -# Restoring to the original state -connection master; -alter database collate latin1_swedish_ci; diff --git a/mysql-test/suite/engines/funcs/t/rpl_bit.test b/mysql-test/suite/engines/funcs/t/rpl_bit.test index 7f85313ae4c..822fae57f68 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_bit.test +++ b/mysql-test/suite/engines/funcs/t/rpl_bit.test @@ -1,93 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Sept/15/2005 # -############################################################################# -# Test: To test the replication of the bit field # -############################################################################# -# Change Author: JBM -# Change Date: 2006-01-16 -########## +--source suite/rpl/t/rpl_bit.test --- source include/master-slave.inc - - -# Begin clean up test section -connection master; ---disable_warnings -DROP TABLE IF EXISTS test.t1; ---enable_warnings -# End of cleanup - -# Begin test section 1 - -CREATE TABLE test.t1 ( - dummyKey INTEGER NOT NULL, - f01 TINYINT, - f10 TINYINT, - f12 TINYINT, - f15 TINYINT, - f16 TINYINT, - f7 TINYINT, - f9 TINYINT, - f29 TINYINT, - f0 TINYINT, - fA1 TINYINT, - C32 TINYINT, - A42 TINYINT, - CA3 TINYINT, - A044 TINYINT, - f001 TINYINT, - A3002 TINYINT, - fC003 TINYINT, - CA300 TINYINT, - A305 TINYINT, - CA321 TINYINT, - r001 TINYINT, - bit1 BIT(6), - bit2 BIT(6), - bit3 BIT(6), - State1 TINYINT, - State2 TINYINT, - State3 TINYINT, - State4 TINYINT, - SubState TINYINT, - gState TINYINT, - oSupp TINYINT, - tSupp TINYINT, - sSuppD TINYINT, - mSuppf TINYINT, - GSuppDf TINYINT, - VNotSupp TINYINT, - x034 TINYINT, -PRIMARY KEY USING HASH (dummyKey) ); - -LOCK TABLES test.t1 WRITE; -INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); -UNLOCK TABLES; - - -SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1; -SELECT hex(bit1) FROM test.t1 ORDER BY bit1; -SELECT hex(bit2) from test.t1 ORDER BY bit2; -SELECT hex(bit3) from test.t1 ORDER BY bit3; -save_master_pos; - -connection slave; -sync_with_master; -SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1; -SELECT hex(bit1) FROM test.t1 ORDER BY bit1; -SELECT hex(bit2) from test.t1 ORDER BY bit2; -SELECT hex(bit3) from test.t1 ORDER BY bit3; - -connection master; -DROP TABLE IF EXISTS test.t1; -sync_slave_with_master; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_bit_npk.test b/mysql-test/suite/engines/funcs/t/rpl_bit_npk.test index 12b587919f9..d2214ada074 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_bit_npk.test +++ b/mysql-test/suite/engines/funcs/t/rpl_bit_npk.test @@ -1,116 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Sept/15/2005 # -############################################################################# -# Test: To test the replication of the bit field # -############################################################################# +--source suite/rpl/t/rpl_bit_npk.test --- source include/master-slave.inc - - -# Begin clean up test section -connection master; ---disable_warnings -DROP TABLE IF EXISTS test.t1; ---enable_warnings -# End of cleanup - -# Begin test section 1 - -CREATE TABLE test.t1 ( - dummyKey INTEGER NOT NULL, - f01 TINYINT, - f10 TINYINT, - f12 TINYINT, - f15 TINYINT, - f16 TINYINT, - f7 TINYINT, - f9 TINYINT, - f29 TINYINT, - f0 TINYINT, - fA1 TINYINT, - C32 TINYINT, - A42 TINYINT, - CA3 TINYINT, - A044 TINYINT, - f001 TINYINT, - A3002 TINYINT, - fC003 TINYINT, - CA300 TINYINT, - A305 TINYINT, - CA321 TINYINT, - r001 TINYINT, - bit1 BIT(6), - bit2 BIT(6), - bit3 BIT(6), - State1 TINYINT, - State2 TINYINT, - State3 TINYINT, - State4 TINYINT, - SubState TINYINT, - gState TINYINT, - oSupp TINYINT, - tSupp TINYINT, - sSuppD TINYINT, - mSuppf TINYINT, - GSuppDf TINYINT, - VNotSupp TINYINT, - x034 TINYINT); - -LOCK TABLES test.t1 WRITE; -INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,NULL,1); -INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'0',1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); -INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1); -UNLOCK TABLES; - -UPDATE test.t1 set x034 = 50 where bit3 = b'000000'; -UPDATE test.t1 set VNotSupp = 33 where bit1 = b'0'; -SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 - FROM test.t1 - ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034; -SELECT hex(bit1) from test.t1 ORDER BY bit1; -SELECT hex(bit2) from test.t1 ORDER BY bit2; -SELECT hex(bit3) from test.t1 ORDER BY bit3; -save_master_pos; - -connection slave; -sync_with_master; -SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 - FROM test.t1 - ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034; -SELECT hex(bit1) from test.t1 ORDER BY bit1; -SELECT hex(bit2) from test.t1 ORDER BY bit2; -SELECT hex(bit3) from test.t1 ORDER BY bit3; - -connection master; -CREATE TABLE test.t2 (a INT, b BIT(1)); -INSERT INTO test.t2 VALUES (1, b'0'); -INSERT INTO test.t2 VALUES (1, b'1'); -UPDATE test.t2 SET a = 2 WHERE b = b'1'; - -CREATE TABLE test.t3 (a INT, b INT); -INSERT INTO test.t3 VALUES (1, NULL); -INSERT INTO test.t3 VALUES (1, 0); -UPDATE test.t3 SET a = 2 WHERE b = 0; - -SELECT a, hex(b) FROM test.t2 ORDER BY a,b; -SELECT * FROM test.t3 ORDER BY a,b; -save_master_pos; - -connection slave; -sync_with_master; -SELECT a, hex(b) FROM test.t2 ORDER BY a,b; -SELECT * FROM test.t3 ORDER BY a,b; - -connection master; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t3; -sync_slave_with_master; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_change_master.test b/mysql-test/suite/engines/funcs/t/rpl_change_master.test index c031464c95e..e7e70bd2ac6 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_change_master.test +++ b/mysql-test/suite/engines/funcs/t/rpl_change_master.test @@ -1,37 +1,2 @@ -# Verify that after CHANGE MASTER, replication (I/O thread and SQL -# thread) restart from where SQL thread left, not from where -# I/O thread left (some old bug fixed in 4.0.17) +--source suite/rpl/t/rpl_change_master.test -source include/master-slave.inc; - -connection master; -# Make SQL slave thread advance a bit -create table t1(n int); -sync_slave_with_master; -select * from t1; -# Now stop it and make I/O slave thread be ahead -stop slave sql_thread; -connection master; -insert into t1 values(1); -insert into t1 values(2); -save_master_pos; -connection slave; ---real_sleep 3 # wait for I/O thread to have read updates -stop slave; ---replace_result $MASTER_MYPORT MASTER_MYPORT ---replace_column 1 # 7 # 8 # 9 # 23 # 33 # -show slave status; -change master to master_user='root'; ---replace_result $MASTER_MYPORT MASTER_MYPORT ---replace_column 1 # 7 # 8 # 9 # 23 # 33 # -show slave status; -start slave; -sync_with_master; -select * from t1; -connection master; -drop table t1; -save_master_pos; -connection slave; -sync_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_create_database.test b/mysql-test/suite/engines/funcs/t/rpl_create_database.test index 70cff8daca2..8690de2a604 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_create_database.test +++ b/mysql-test/suite/engines/funcs/t/rpl_create_database.test @@ -1,72 +1,2 @@ -# -# Tests for replication of statements that manipulate databases. -# -# For this test file, we have a number of databases. All databases -# with "greek" names will be replicated on the slave, while other names -# (e.g., american) will not be replicated. -# +--source suite/rpl/t/rpl_create_database.test -source include/master-slave.inc; - -# Bug#6391 (binlog-do-db rules ignored) -# In this case, 'mysqltest_bob' should not be replicated to the slave. ---disable_warnings -DROP DATABASE IF EXISTS mysqltest_prometheus; -DROP DATABASE IF EXISTS mysqltest_sisyfos; -DROP DATABASE IF EXISTS mysqltest_bob; -sync_slave_with_master; -# This database is not replicated -DROP DATABASE IF EXISTS mysqltest_bob; ---enable_warnings - -connection master; -CREATE DATABASE mysqltest_prometheus; -CREATE DATABASE mysqltest_sisyfos; -CREATE DATABASE mysqltest_bob; - -USE mysqltest_sisyfos; -# These should be replicated -CREATE TABLE t1 (b int); -INSERT INTO t1 VALUES(1); - -USE mysqltest_bob; -# These should *not* be replicated -CREATE TABLE t2 (b int); -INSERT INTO t2 VALUES(2); - -# Current database is now 'mysqltest_bob' -# The following should be replicated -ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1; - -USE mysqltest_sisyfos; -# The following should *not* be replicated -ALTER DATABASE mysqltest_bob CHARACTER SET latin1; - -SHOW DATABASES; -sync_slave_with_master; -SHOW DATABASES; - -connection master; -DROP DATABASE IF EXISTS mysqltest_sisyfos; -USE mysqltest_prometheus; -CREATE TABLE t1 (a INT); -INSERT INTO t1 VALUES (1); -CREATE DATABASE mysqltest_sisyfos; -USE mysqltest_sisyfos; -CREATE TABLE t2 (a INT); -let $VERSION=`select version()`; -SHOW DATABASES; -sync_slave_with_master; -SHOW DATABASES; -USE mysqltest_prometheus; -SHOW TABLES; -USE mysqltest_sisyfos; -SHOW TABLES; - -connection master; -DROP DATABASE IF EXISTS mysqltest_prometheus; -DROP DATABASE IF EXISTS mysqltest_sisyfos; -DROP DATABASE IF EXISTS mysqltest_bob; -sync_slave_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_do_grant.test b/mysql-test/suite/engines/funcs/t/rpl_do_grant.test index 4e398114269..95e90ce1bc3 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_do_grant.test +++ b/mysql-test/suite/engines/funcs/t/rpl_do_grant.test @@ -1,98 +1,2 @@ -# Works in statement-based and row-based binlogging. -# Test that GRANT and other user management commands are replicated to the slave +--source suite/rpl/t/rpl_do_grant.test --- source include/master-slave.inc - -# do not be influenced by other tests. -connection master; -delete from mysql.user where user=_binary'rpl_do_grant'; -delete from mysql.db where user=_binary'rpl_do_grant'; -flush privileges; -save_master_pos; -connection slave; -sync_with_master; -# if these DELETE did nothing on the master, we need to do them manually on the -# slave. -delete from mysql.user where user=_binary'rpl_ignore_grant'; -delete from mysql.db where user=_binary'rpl_ignore_grant'; -flush privileges; - -# test replication of GRANT -connection master; -grant select on *.* to rpl_do_grant@localhost; -grant drop on test.* to rpl_do_grant@localhost; -save_master_pos; -connection slave; -sync_with_master; -show grants for rpl_do_grant@localhost; - -# test replication of SET PASSWORD -connection master; -set password for rpl_do_grant@localhost=password("does it work?"); -save_master_pos; -connection slave; -sync_with_master; -select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant'; - -# clear what we have done, to not influence other tests. -connection master; -delete from mysql.user where user=_binary'rpl_do_grant'; -delete from mysql.db where user=_binary'rpl_do_grant'; -flush privileges; -sync_slave_with_master; -# The mysql database is not replicated, so we have to do the deletes -# manually on the slave as well. -delete from mysql.user where user=_binary'rpl_do_grant'; -delete from mysql.db where user=_binary'rpl_do_grant'; -flush privileges; - -# End of 4.1 tests - -connection master; ---error 1141 -show grants for rpl_do_grant@localhost; -connection slave; ---error 1141 -show grants for rpl_do_grant@localhost; - -connection master; -create user rpl_do_grant@localhost; -show grants for rpl_do_grant@localhost; ---error 1141 -show grants for rpl_do_grant2@localhost; -sync_slave_with_master; -show grants for rpl_do_grant@localhost; ---error 1141 -show grants for rpl_do_grant2@localhost; - -connection master; -rename user rpl_do_grant@localhost to rpl_do_grant2@localhost; -show grants for rpl_do_grant2@localhost; -sync_slave_with_master; -show grants for rpl_do_grant2@localhost; - -connection master; -grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost; -show grants for rpl_do_grant2@localhost; -sync_slave_with_master; -show grants for rpl_do_grant2@localhost; - -connection master; -revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost; -show grants for rpl_do_grant2@localhost; -sync_slave_with_master; -show grants for rpl_do_grant2@localhost; - -connection master; -revoke all privileges, grant option from rpl_do_grant2@localhost; -show grants for rpl_do_grant2@localhost; -sync_slave_with_master; -show grants for rpl_do_grant2@localhost; - -connection master; -drop user rpl_do_grant2@localhost; ---error 1141 -show grants for rpl_do_grant2@localhost; -sync_slave_with_master; ---error 1141 -show grants for rpl_do_grant2@localhost; diff --git a/mysql-test/suite/engines/funcs/t/rpl_drop.test b/mysql-test/suite/engines/funcs/t/rpl_drop.test index b38007a755f..7dda6987502 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_drop.test +++ b/mysql-test/suite/engines/funcs/t/rpl_drop.test @@ -1,16 +1,2 @@ -# Testcase for BUG#4552 (DROP on two tables, one of which does not -# exist, must be binlogged with a non-zero error code) -source include/master-slave.inc; ---disable_warnings -drop table if exists t1, t2; ---enable_warnings -create table t1 (a int); ---error 1051 -drop table t1, t2; -save_master_pos; -connection slave; -sync_with_master; - -# End of 4.1 tests - +--source suite/rpl/t/rpl_drop.test diff --git a/mysql-test/suite/engines/funcs/t/rpl_drop_db.test b/mysql-test/suite/engines/funcs/t/rpl_drop_db.test index fb26cc20f8a..54d5300be14 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_drop_db.test +++ b/mysql-test/suite/engines/funcs/t/rpl_drop_db.test @@ -1,61 +1,2 @@ -# test case for BUG#4680 -- if there are extra files in the db directory -# dropping the db on the master causes replication problems +--source suite/rpl/t/rpl_drop_db.test --- source include/master-slave.inc -connection master; - ---disable_warnings -drop database if exists mysqltest1; ---enable_warnings -create database mysqltest1; -create table mysqltest1.t1 (n int); -insert into mysqltest1.t1 values (1); -select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt'; -create table mysqltest1.t2 (n int); -create table mysqltest1.t3 (n int); ---replace_result \\ / ---error 1010 -drop database mysqltest1; -use mysqltest1; -show tables; - -# test the branch of the code that deals with the query buffer overflow - ---disable_query_log -let $1=50; -while ($1) -{ - eval create table mysqltest1.mysqltest_long_table_name$1 (n int); - dec $1; -} ---enable_query_log - ---replace_result \\ / ---error 1010 -drop database mysqltest1; -use mysqltest1; -show tables; -use test; -create table t1 (n int); -insert into t1 values (1234); -sync_slave_with_master; - -connection slave; -use mysqltest1; -show tables; -use test; -select * from t1; -drop table t1; - -#cleanup -connection slave; -stop slave; -drop database mysqltest1; - -connection master; -# Remove the "extra" file created above ---remove_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest1/f1.txt -drop database mysqltest1; - -use test; -drop table t1; diff --git a/mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test b/mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test index 518fa9df885..bf5e84152bc 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test +++ b/mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test @@ -6,7 +6,7 @@ # of their server id). # It also will test BUG#13861. -source include/master-slave.inc; +--source include/master-slave.inc # set up "dual head" @@ -18,7 +18,7 @@ connection master; --replace_result $SLAVE_MYPORT SLAVE_PORT eval change master to master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root"; -start slave; +--source include/start_slave.inc # now we test it @@ -68,7 +68,7 @@ sync_with_master; # show tables; -# start slave; +# --source include/start_slave.inc # BUG#13023 is that Exec_master_log_pos may stay too low "forever": @@ -78,9 +78,7 @@ create table t4 (n int); # create 3 ignored events create table t5 (n int); create table t6 (n int); -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master connection slave; @@ -97,12 +95,11 @@ show tables; # cleanup -stop slave; +--source include/stop_slave.inc reset slave; drop table t1,t4,t5,t6; # add t2 and t3 later -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test b/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test deleted file mode 100644 index 707d1eca8c2..00000000000 --- a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test +++ /dev/null @@ -1,15 +0,0 @@ -source include/master-slave.inc; - ---replace_column 1 # 8 # 9 # 16 # 23 # 33 # -show slave status; - -# -# Load table should not succeed on the master as this is not a slave -# ---error 1218 -load table t1 from master; -connection slave; ---error 1188 -load table t1 from master; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test b/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test index adf1526a657..1459b24799e 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test +++ b/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test @@ -1,68 +1,2 @@ -# Test for -# Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave -# still checks that it has the same error as on the master. -########################################################################## +--source suite/rpl/t/rpl_err_ignoredtable.test --- source include/master-slave.inc - ---disable_query_log -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); ---enable_query_log - -connection master; -create table t1 (a int primary key); -create table t4 (a int primary key); -# generate an error that goes to the binlog ---error 1022, 1062, 1582 -insert into t1 values (1),(1); -insert into t4 values (1),(2); -save_master_pos; -connection slave; -# as the t1 table is ignored on the slave, the slave should be able to sync -sync_with_master; -# check that the table has been ignored, because otherwise the test is nonsense -show tables like 't1'; -show tables like 't4'; -SELECT * FROM test.t4 ORDER BY a; -connection master; -drop table t1; -save_master_pos; -connection slave; -sync_with_master; - -# Now test that even critical errors (connection killed) -# are ignored if rules allow it. -# The "kill" idea was copied from rpl000001.test. - -connection master1; -select get_lock('crash_lock%20C', 10); - -connection master; -create table t2 (a int primary key); -insert into t2 values(1); -create table t3 (id int); -insert into t3 values(connection_id()); -send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10); - -connection master1; -real_sleep 2; -select (@id := id) - id from t3; -kill @id; -drop table t2,t3; -insert into t4 values (3),(4); -connection master; ---error 0,1053,2013,1317 -reap; -connection master1; -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM test.t4 ORDER BY a; - -connection master1; -DROP TABLE test.t4; -save_master_pos; -connection slave; -sync_with_master; -# End of 4.1 tests -# Adding comment for force manual merge 5.0 -> wl1012. delete me if needed diff --git a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test index 2e481f5e5e7..93207dfddf7 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test +++ b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test @@ -6,31 +6,22 @@ # Start replication master -> slave # connection slave; ---disable_warnings -stop slave; ---enable_warnings + +--source include/stop_slave.inc + --replace_result $MASTER_MYPORT MASTER_PORT eval change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=$MASTER_MYPORT; -start slave; - +--source include/start_slave.inc # # Start replication slave -> master # connection master; ---disable_warnings -stop slave; ---enable_warnings + --replace_result $SLAVE_MYPORT SLAVE_PORT eval change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=$SLAVE_MYPORT; -start slave; - -# -# Wait for start of slave IO and SQL threads -# -let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%'; --- source $MYSQL_TEST_DIR/suite/engines/funcs/t/wait_slave_status.inc +--source include/start_slave.inc # # Flush logs of slave @@ -45,4 +36,5 @@ sleep 5; --replace_column 1 # 8 # 9 # 16 # 23 # 33 # --vertical_results SHOW SLAVE STATUS; -STOP SLAVE; +stop slave; +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_free_items.test b/mysql-test/suite/engines/funcs/t/rpl_free_items.test index 043e84160b8..31d65396d36 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_free_items.test +++ b/mysql-test/suite/engines/funcs/t/rpl_free_items.test @@ -1,22 +1,2 @@ -source include/master-slave.inc; -create table t1 (a int); -create table t2 (a int); -disable_query_log; -SET @query="INSERT INTO t2 SELECT * FROM t1 WHERE a REGEXP \"0\""; -let $1 = 2000; -while ($1) -{ - eval SET @query=concat(@query, " OR a REGEXP '$1'"); - dec $1; -} -let $1=`select @query`; -eval $1; -enable_query_log; -# I have seen the slave crash either now or at shutdown -sync_slave_with_master; -connection master; -drop table t1; -drop table t2; -sync_slave_with_master; +--source suite/rpl/t/rpl_free_items.test -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_get_lock.test b/mysql-test/suite/engines/funcs/t/rpl_get_lock.test index c57e9313899..a9265c7f864 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_get_lock.test +++ b/mysql-test/suite/engines/funcs/t/rpl_get_lock.test @@ -1,49 +1,2 @@ -source include/master-slave.inc; +--source suite/rpl/t/rpl_get_lock.test ---disable_query_log -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); ---enable_query_log - -create table t1(n int); ---disable_warnings -insert into t1 values(get_lock("lock",2)); ---enable_warnings -dirty_close master; -connection master1; -select get_lock("lock",2); - -select release_lock("lock"); -#ignore -disable_query_log; -let $1=2000; -while ($1) -{ - do get_lock("lock",2); - do release_lock("lock"); - dec $1; -} -enable_query_log; -save_master_pos; -connection slave; -sync_with_master; -select get_lock("lock",3); -select * from t1; -# There is no point in testing REPLICATIION of the IS_*_LOCK -# functions; slave does not run with the same concurrency context as -# master (generally in slave we can't know that on master this lock -# was already held by another connection and so that the the -# get_lock() we're replicating timed out on master hence returned 0, -# or that the is_free_lock() we're playing returned 0 etc. -# But here all we do is test these functions outside of replication. -select is_free_lock("lock"), is_used_lock("lock") = connection_id(); -explain extended select is_free_lock("lock"), is_used_lock("lock"); -# Check lock functions -select is_free_lock("lock2"); -select is_free_lock(NULL); -connection master1; -drop table t1; -save_master_pos; -connection slave; -sync_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test b/mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test index 2e6e2ce9a31..234fec3361e 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test +++ b/mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test @@ -1,59 +1,2 @@ -# Test that GRANT is not replicated to the slave -# when --replicate-wild-ignore-table=mysql.% -# In BUG#980, this test would _randomly_ fail. +--source suite/rpl/t/rpl_ignore_grant.test -source include/master-slave.inc; - -# do not be influenced by other tests. -connection master; -delete from mysql.user where user=_binary'rpl_ignore_grant'; -delete from mysql.db where user=_binary'rpl_ignore_grant'; -flush privileges; -save_master_pos; -connection slave; -sync_with_master; -# as these DELETE were not replicated, we need to do them manually on the -# slave. -delete from mysql.user where user=_binary'rpl_ignore_grant'; -delete from mysql.db where user=_binary'rpl_ignore_grant'; -flush privileges; - -# test non-replication of GRANT -connection master; -grant select on *.* to rpl_ignore_grant@localhost; -grant drop on test.* to rpl_ignore_grant@localhost; -show grants for rpl_ignore_grant@localhost; -save_master_pos; -connection slave; -sync_with_master; ---error 1141 #("no such grant for user") -show grants for rpl_ignore_grant@localhost; -# check it another way -select count(*) from mysql.user where user=_binary'rpl_ignore_grant'; -select count(*) from mysql.db where user=_binary'rpl_ignore_grant'; - -# test non-replication of SET PASSWORD -# first force creation of the user on slave (because as the user does not exist -# on slave, the SET PASSWORD may be replicated but silently do nothing; this is -# not what we want; we want it to be not-replicated). -grant select on *.* to rpl_ignore_grant@localhost; -connection master; -set password for rpl_ignore_grant@localhost=password("does it work?"); -save_master_pos; -connection slave; -sync_with_master; -select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant'; - -# clear what we have done, to not influence other tests. -connection master; -delete from mysql.user where user=_binary'rpl_ignore_grant'; -delete from mysql.db where user=_binary'rpl_ignore_grant'; -flush privileges; -save_master_pos; -connection slave; -sync_with_master; -delete from mysql.user where user=_binary'rpl_ignore_grant'; -delete from mysql.db where user=_binary'rpl_ignore_grant'; -flush privileges; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test b/mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test index 00171605a92..1a981652645 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test +++ b/mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test @@ -1,51 +1,2 @@ -# test verifies that REVOKE must not be replicated when -# slave server starts with --replicate-wild-ignore-table=mysql.% -# the option is set in rpl_ignore_revoke-slave.opt -# The first part of BUG#9483 for GRANT is checked by -# existed specific rpl_ignore_grant test case (BUG#980) +--source suite/rpl/t/rpl_ignore_revoke.test - -source include/master-slave.inc; - -### CLEAN-UP: create an account and manually duplicate it on the slave - -connection master; -grant select on *.* to 'user_foo'@'%' identified by 'user_foopass'; -revoke select on *.* from 'user_foo'@'%'; -select select_priv from mysql.user where user='user_foo' /* master:must be N */; - -sync_slave_with_master; -#connection slave; -grant select on *.* to 'user_foo'@'%' identified by 'user_foopass'; -revoke select on *.* from 'user_foo'@'%'; -select select_priv from mysql.user where user='user_foo' /* slave:must be N */; - - -### TEST - -#connection slave; -grant select on *.* to 'user_foo'@'%' identified by 'user_foopass'; -select select_priv from mysql.user where user='user_foo' /* slave:must be Y */; - -connection master; -revoke select on *.* from 'user_foo'; -select select_priv from mysql.user where user='user_foo' /* master:must be N */; - -sync_slave_with_master; -#connection slave; -select select_priv from mysql.user where user='user_foo' /* slave:must get Y */; - -### CLEAN-UP - -connection slave; ---disable_abort_on_error -revoke select on *.* FROM 'user_foo'; ---enable_abort_on_error - -connection master; -delete from mysql.user where user="user_foo"; -sync_slave_with_master; - -# Since changes to mysql.* are ignored, the revoke need to -# be done on slave as well -delete from mysql.user where user="user_foo"; diff --git a/mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test b/mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test index fe030f90411..9ace16dd247 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test +++ b/mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test @@ -1,38 +1,2 @@ -# This one assumes we are ignoring updates on table mysqltest_foo, but doing -# the ones on all other tables +--source suite/rpl/t/rpl_ignore_table_update.test -source include/master-slave.inc; -connection slave; - -# -# For this test we must be in the test database -# -use test; - ---disable_warnings -drop table if exists mysqltest_foo; -drop table if exists mysqltest_bar; ---enable_warnings - -create table mysqltest_foo (n int); -insert into mysqltest_foo values(4); -connection master; -use test; -create table mysqltest_foo (n int); -insert into mysqltest_foo values(5); -create table mysqltest_bar (m int); -insert into mysqltest_bar values(15); -create table t1 (k int); -insert into t1 values(55); -save_master_pos; -connection slave; -sync_with_master; -select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1; -connection master; -drop table mysqltest_foo,mysqltest_bar,t1; -save_master_pos; -connection slave; -sync_with_master; -drop table mysqltest_foo,mysqltest_bar,t1; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_init_slave.test b/mysql-test/suite/engines/funcs/t/rpl_init_slave.test index 139b4902e12..85869ffbb99 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_init_slave.test +++ b/mysql-test/suite/engines/funcs/t/rpl_init_slave.test @@ -1,34 +1,2 @@ -source include/master-slave.inc; +--source suite/rpl/t/rpl_init_slave.test -# -# Test of init_slave variable -# - -save_master_pos; -connection slave; -sleep 1; -show variables like 'init_slave'; -show variables like 'max_connections'; -sync_with_master; -reset master; -connection master; -show variables like 'init_slave'; -show variables like 'max_connections'; -save_master_pos; -connection slave; -sync_with_master; -# Save variable value -set @my_global_init_connect= @@global.init_connect; -set global init_connect="set @c=1"; -show variables like 'init_connect'; -connection master; -save_master_pos; -connection slave; -sync_with_master; -stop slave; - -# Restore changed global variable -set global init_connect= @my_global_init_connect; -set global max_connections= default; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_insert.test b/mysql-test/suite/engines/funcs/t/rpl_insert.test index f57a6e226d1..1a5d5ecba54 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_insert.test +++ b/mysql-test/suite/engines/funcs/t/rpl_insert.test @@ -1,44 +1,2 @@ ---echo # ---echo # Bug#20821: INSERT DELAYED fails to write some rows to binlog ---echo # +--source suite/rpl/t/rpl_insert.test ---source include/not_embedded.inc ---source include/not_windows.inc ---source include/master-slave.inc - ---disable_warnings -CREATE SCHEMA IF NOT EXISTS mysqlslap; -USE mysqlslap; ---enable_warnings - -CREATE TABLE t1 (id INT, name VARCHAR(64)); - -let $query = "INSERT INTO t1 VALUES (1, 'Dr. No'), (2, 'From Russia With Love'), (3, 'Goldfinger'), (4, 'Thunderball'), (5, 'You Only Live Twice')"; ---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=200 --query=$query --delimiter=";" - -# Wait until all the 5000 inserts has been inserted into the table ---disable_query_log -let $counter= 300; # Max 30 seconds wait -while (`select count(*)!=5000 from mysqlslap.t1`) -{ - sleep 0.1; - dec $counter; - if (!$counter) - { - Number of records in t1 didnt reach 5000; - } -} ---enable_query_log - -SELECT COUNT(*) FROM mysqlslap.t1; -sync_slave_with_master; -SELECT COUNT(*) FROM mysqlslap.t1; - ---echo # ---echo # Cleanup ---echo # - -connection master; -USE test; -DROP SCHEMA mysqlslap; -sync_slave_with_master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_insert_select.test b/mysql-test/suite/engines/funcs/t/rpl_insert_select.test index 677be526982..bc9ec9da636 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_insert_select.test +++ b/mysql-test/suite/engines/funcs/t/rpl_insert_select.test @@ -1,6 +1,6 @@ # Testcase for BUG#10456 - INSERT INTO ... SELECT violating a primary key # breaks replication - +-- source include/have_binlog_format_mixed_or_row.inc -- source include/master-slave.inc connection master; @@ -10,10 +10,11 @@ create table t2 (n int); insert into t2 values (1); insert ignore into t1 select * from t2; insert into t1 values (2); -sync_slave_with_master; +--sync_slave_with_master connection slave; select * from t1; connection master; drop table t1,t2; -sync_slave_with_master; +--sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata2.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata2.test index 439c2b48ca5..b357054b4db 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_loaddata2.test +++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata2.test @@ -3,7 +3,7 @@ CREATE TABLE t1 (word CHAR(20) NOT NULL); LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; SELECT * FROM t1 ORDER BY word; -sync_slave_with_master; +--sync_slave_with_master # Check SELECT * FROM t1 ORDER BY word; @@ -11,4 +11,5 @@ SELECT * FROM t1 ORDER BY word; # Cleanup connection master; drop table t1; -sync_slave_with_master; +--sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test index 42c3ad99f33..901c40b5079 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test +++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test @@ -1,52 +1,2 @@ -# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules -# exist. -# This is for BUG#1100 (LOAD DATA INFILE was half-logged). -###################################################### -# Change Author: JBM -# Change Date: 2005-12-22 -# Change: Test rewritten to remove show binlog events -# and to test the option better + Cleanup -###################################################### --- source include/master-slave.inc +--source suite/rpl/t/rpl_loaddata_m.test ---disable_warnings -drop database if exists mysqltest; ---enable_warnings - -connection master; -# 'test' database should be ignored by the slave -USE test; -CREATE TABLE t1(a INT, b INT, UNIQUE(b)); -LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1; -SELECT COUNT(*) FROM test.t1; - -# 'mysqltest' database should NOT be ignored by the slave -CREATE DATABASE mysqltest; -USE mysqltest; -CREATE TABLE t1(a INT, b INT, UNIQUE(b)); -LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1; -SELECT COUNT(*) FROM mysqltest.t1; - -# Now lets check the slave to see what we have :-) -save_master_pos; -connection slave; -sync_with_master; - -SHOW DATABASES; - -USE test; -SHOW TABLES; - -USE mysqltest; -SHOW TABLES; -SELECT COUNT(*) FROM mysqltest.t1; - -#show binlog events; - -# Cleanup -connection master; -DROP DATABASE mysqltest; -DROP TABLE test.t1; -sync_slave_with_master; - -# End of test diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test index a06df3bbfc9..7521f62403e 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test +++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test @@ -1,30 +1,2 @@ -# See if the slave logs (in its own binlog, with --log-slave-updates) a -# replicated LOAD DATA INFILE correctly when it has binlog_*_db rules. -# This is for BUG#1100 (LOAD DATA INFILE was half-logged). +--source suite/rpl/t/rpl_loaddata_s.test --- source include/have_binlog_format_mixed_or_statement.inc --- source include/master-slave.inc - -connection slave; -# Not sure why we connect to slave and then try to reset master, but I will leave it [JBM] -reset master; - -connection master; -# 'test' is the current database -create table test.t1(a int, b int, unique(b)); -load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; - -# Test logging on slave; - -save_master_pos; -connection slave; -sync_with_master; -select count(*) from test.t1; # check that LOAD was replicated ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events from 107; # should be nothing - -# Cleanup -connection master; -drop table test.t1; -sync_slave_with_master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test b/mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test index e272be3c13b..36e863c4573 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test +++ b/mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test @@ -6,7 +6,7 @@ # only the first 4KB, 8KB or 16KB usually. # - the loaded file's first line was not written entirely to the # master's binlog (1st char was absent) -source include/master-slave.inc; +--source include/master-slave.inc create table t1(a int); let $1=10000; @@ -26,15 +26,11 @@ truncate table t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1; remove_file $MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile; -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master select a,count(*) from t1 group by a; connection master; drop table t1; -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master # End of 4.1 tests @@ -54,12 +50,9 @@ create table t1(a int primary key); eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1; remove_file $MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile; SELECT * FROM t1 ORDER BY a; -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master SELECT * FROM t1 ORDER BY a; connection master; drop table t1; -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_loadfile.test b/mysql-test/suite/engines/funcs/t/rpl_loadfile.test index 26235d89016..26829b265f1 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_loadfile.test +++ b/mysql-test/suite/engines/funcs/t/rpl_loadfile.test @@ -41,7 +41,7 @@ CALL test.p1(); --enable_warnings SELECT * FROM test.t1 ORDER BY blob_column; save_master_pos; -sync_slave_with_master; +--sync_slave_with_master connection slave; SELECT * FROM test.t1 ORDER BY blob_column; @@ -49,6 +49,6 @@ SELECT * FROM test.t1 ORDER BY blob_column; connection master; DROP PROCEDURE IF EXISTS test.p1; DROP TABLE test.t1; -sync_slave_with_master; - +--sync_slave_with_master +--source include/rpl_end.inc # End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test index 22deee6b5f3..53b38d9a2de 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test +++ b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test @@ -1,58 +1,2 @@ -########## -# Change Author: JBM -# Change Date: 2006-01-16 -########## +--source suite/rpl/t/rpl_log_pos.test -# -# Testing of setting slave to wrong log position with master_log_pos -# - -# Passes with rbr no problem, removed statement include [jbm] - -source include/master-slave.inc; ---replace_column 3 <Binlog_Ignore_DB> -show master status; -sync_slave_with_master; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 8 # 9 # 23 # 33 # -show slave status; -stop slave; -change master to master_log_pos=107; -start slave; -sleep 5; -stop slave; -change master to master_log_pos=107; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 8 # 9 # 23 # 33 # -show slave status; -start slave; -sleep 5; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 8 # 9 # 23 # 33 # -show slave status; -stop slave; -change master to master_log_pos=178; -start slave; -sleep 2; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 8 # 9 # 23 # 33 # -show slave status; -connection master; ---replace_column 3 <Binlog_Ignore_DB> -show master status; -create table if not exists t1 (n int); -drop table if exists t1; -create table t1 (n int); -insert into t1 values (1),(2),(3); -save_master_pos; -connection slave; -stop slave; -change master to master_log_pos=207; -start slave; -sync_with_master; -select * from t1 ORDER BY n; -connection master; -drop table t1; -sync_slave_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_many_optimize.test b/mysql-test/suite/engines/funcs/t/rpl_many_optimize.test index 91fab0b27a8..337cc1b36be 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_many_optimize.test +++ b/mysql-test/suite/engines/funcs/t/rpl_many_optimize.test @@ -1,22 +1,2 @@ -# Test for BUG#7658 "optimize crashes slave thread (1 in 1000)]" +--source suite/rpl/t/rpl_many_optimize.test -source include/master-slave.inc; - -create table t1 (a int not null auto_increment primary key, b int, key(b)); -INSERT INTO t1 (a) VALUES (1),(2); -# Now many OPTIMIZE to test if we crash (BUG#7658) -let $1=300; -disable_query_log; -disable_result_log; -while ($1) -{ - eval OPTIMIZE TABLE t1; - dec $1; -} -enable_result_log; -enable_query_log; -drop table t1; -# Bug was that slave segfaulted after ~ a hundred of OPTIMIZE (or ANALYZE) -sync_slave_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_master_pos_wait.test b/mysql-test/suite/engines/funcs/t/rpl_master_pos_wait.test deleted file mode 100644 index 893c8746efc..00000000000 --- a/mysql-test/suite/engines/funcs/t/rpl_master_pos_wait.test +++ /dev/null @@ -1,18 +0,0 @@ -# See if master_pos_wait(,,timeout) -# Terminates with "timeout expired" (-1) -source include/master-slave.inc; -save_master_pos; -connection slave; -sync_with_master; -# Ask for a master log that has certainly not been reached yet -# timeout= 2 seconds -select master_pos_wait('master-bin.999999',0,2); -explain extended select master_pos_wait('master-bin.999999',0,2); -# Testcase for bug 651 (master_pos_wait() hangs if slave idle and STOP SLAVE). -send select master_pos_wait('master-bin.999999',0); -connection slave1; -stop slave sql_thread; -connection slave; -reap; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test b/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test index 6e4bedf7371..2f0786a9271 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test +++ b/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test @@ -1,46 +1,2 @@ -# -# Test of replicating some difficult functions -# -source include/master-slave.inc; +--source suite/rpl/t/rpl_misc_functions.test ---disable_query_log -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); ---enable_query_log - -create table t1(id int, i int, r1 int, r2 int, p varchar(100)); -insert into t1 values(1, connection_id(), 0, 0, ""); -# don't put rand and password in the same query, to see if they replicate -# independently -# Pure rand test ---disable_warnings -insert into t1 values(2, 0, rand()*1000, rand()*1000, ""); ---enable_warnings -# change the rand suite on the master (we do this because otherwise password() -# benefits from the fact that the above rand() is well replicated : -# it picks the same sequence element, which hides a possible bug in password() replication. -set sql_log_bin=0; -insert into t1 values(6, 0, rand(), rand(), ""); -delete from t1 where id=6; -set sql_log_bin=1; -# Pure password test -insert into t1 values(3, 0, 0, 0, password('does_this_work?')); -# "altogether now" ---disable_warnings -insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?')); ---enable_warnings -select * into outfile '../../tmp/rpl_misc_functions.outfile' from t1; -sync_slave_with_master; -create table t2 like t1; -# read the values from the master table ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_misc_functions.outfile' into table t2; -# compare them with the replica; the SELECT below should return no row -select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p); -stop slave; -drop table t1; -drop table t2; - -connection master; -drop table t1; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_multi_delete.test b/mysql-test/suite/engines/funcs/t/rpl_multi_delete.test index a251cbf8833..53347fbf127 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_multi_delete.test +++ b/mysql-test/suite/engines/funcs/t/rpl_multi_delete.test @@ -1,26 +1,2 @@ -source include/master-slave.inc; -create table t1 (a int primary key); -create table t2 (a int); +--source suite/rpl/t/rpl_multi_delete.test -insert into t1 values (1); -insert into t2 values (1); - - -delete t1.* from t1, t2 where t1.a = t2.a; - -save_master_pos; -select * from t1; -select * from t2; - -connection slave; -sync_with_master; -select * from t1; -select * from t2; - -connection master; -drop table t1,t2; -save_master_pos; -connection slave; -sync_with_master; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test b/mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test index e91fad1872a..17df048f930 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test +++ b/mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test @@ -1,68 +1,2 @@ -#multi delete replication bugs - - -source include/master-slave.inc; - -#BUG#11139 - improper wild-table and table rules -#checking for multi deletes with an alias - -connection master; -set sql_log_bin=0; -create database mysqltest_from; -set sql_log_bin=1; - -connection slave; -create database mysqltest_to; - - -connection master; -use mysqltest_from; ---disable_warnings -drop table if exists a; ---enable_warnings -CREATE TABLE a (i INT); -INSERT INTO a VALUES(1); -DELETE alias FROM a alias WHERE alias.i=1; -SELECT * FROM a; -insert into a values(2),(3); -delete alias FROM a alias where alias.i=2; -select * from a; -save_master_pos; -connection slave; - -use mysqltest_to; -sync_with_master; -select * from a; - -# BUG#3461 -connection master; -create table t1 (a int primary key); -create table t2 (a int); - -insert into t1 values (1); -insert into t2 values (1); - -delete t1.* from t1, t2 where t1.a = t2.a; - -save_master_pos; -select * from t1; -select * from t2; - -connection slave; -# BUG#3461 would cause sync to fail -sync_with_master; -error 1146; -select * from t1; -error 1146; -select * from t2; - -# cleanup -connection master; -set sql_log_bin=0; -drop database mysqltest_from; -set sql_log_bin=1; -connection slave; -drop database mysqltest_to; - -# End of 4.1 tests +--source suite/rpl/t/rpl_multi_delete2.test diff --git a/mysql-test/suite/engines/funcs/t/rpl_multi_update4.test b/mysql-test/suite/engines/funcs/t/rpl_multi_update4.test index 4991a385f6f..5538e6cba77 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_multi_update4.test +++ b/mysql-test/suite/engines/funcs/t/rpl_multi_update4.test @@ -1,45 +1,2 @@ -# Let's verify that multi-update is not always skipped by slave if -# some replicate-* rules exist. -# (BUG#15699) +--source suite/rpl/t/rpl_multi_update4.test -source include/master-slave.inc; - -### Clean-up - -connection master; ---disable_warnings -drop database if exists d1; -drop database if exists d2; - -connection slave; -drop database if exists d2; ---enable_warnings - -### Do on master - -connection master; -create database d1; # accepted by slave -create table d1.t0 (id int); -create database d2; # ignored by slave -use d2; -create table t1 (id int); -create table t2 (id int); -insert into t1 values (1), (2), (3), (4), (5); -insert into t2 select id + 3 from t1; -# a problematic query which must be filter out by slave -update t1 join t2 using (id) set t1.id = 0; -insert into d1.t0 values (0); # replication works - -### Check on slave - -sync_slave_with_master; -use d1; -select * from t0 where id=0; # must find - -### Clean-up -connection master; -drop database d1; -drop database d2; -sync_slave_with_master; - -# End of test diff --git a/mysql-test/suite/engines/funcs/t/rpl_ps.test b/mysql-test/suite/engines/funcs/t/rpl_ps.test index 09c7b779f65..d40c5737912 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_ps.test +++ b/mysql-test/suite/engines/funcs/t/rpl_ps.test @@ -1,49 +1,2 @@ -# -# Test of replicating user variables -# -########################################################### -source include/master-slave.inc; +--source suite/rpl/t/rpl_ps.test -#save_master_pos; -#connection slave; -#sync_with_master; -#reset master; -#connection master; - ---disable_warnings -drop table if exists t1; ---enable_warnings - -create table t1(n char(30)); - -prepare stmt1 from 'insert into t1 values (?)'; -set @var1= "from-master-1"; -execute stmt1 using @var1; -set @var1= "from-master-2-'',"; -execute stmt1 using @var1; -SELECT * FROM t1 ORDER BY n; - -set @var2= 'insert into t1 values (concat("from-var-", ?))'; -prepare stmt2 from @var2; -set @var1='from-master-3'; -execute stmt2 using @var1; - -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM t1 ORDER BY n; - -connection master; - -drop table t1; - -save_master_pos; -connection slave; -sync_with_master; -stop slave; - -# End of 4.1 tests - -reset master; -reset slave; -disconnect master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test deleted file mode 100644 index f4e6239c679..00000000000 --- a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test +++ /dev/null @@ -1,47 +0,0 @@ --- source include/have_binlog_format_mixed.inc --- source include/master-slave.inc - -# Test that the slave temporarily switches to ROW when seeing row -# events when it is in MIXED mode - ---echo **** On Master **** -CREATE TABLE t1 (a INT, b LONG); -INSERT INTO t1 VALUES (1,1), (2,2); -INSERT INTO t1 VALUES (3,UUID()), (4,UUID()); -let $VERSION=`select version()`; ---replace_result $VERSION VERSION ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -# Different number of binlog events are generated by different engines ---disable_result_log -SHOW BINLOG EVENTS; ---enable_result_log -sync_slave_with_master; ---echo **** On Slave **** ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # ---query_vertical SHOW SLAVE STATUS ---replace_result $VERSION VERSION ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -# Different number of binlog events are generated by different engines ---disable_result_log -SHOW BINLOG EVENTS; ---enable_result_log ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql - -connection master; -DROP TABLE IF EXISTS t1; - -# Let's compare. Note: If they match test will pass, if they do not match -# the test will show that the diff statement failed and not reject file -# will be created. You will need to go to the mysql-test dir and diff -# the files your self to see what is not matching - -diff_files $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql; - -# If all is good, we can remove the files - -remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql; -remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql; diff --git a/mysql-test/suite/engines/funcs/t/rpl_relayspace.test b/mysql-test/suite/engines/funcs/t/rpl_relayspace.test index 70315c14f34..5c60f57b496 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_relayspace.test +++ b/mysql-test/suite/engines/funcs/t/rpl_relayspace.test @@ -1,34 +1,2 @@ -# The slave is started with relay_log_space_limit=10 bytes, -# to force the deadlock after one event. +--source suite/rpl/t/rpl_relayspace.test -source include/master-slave.inc; -connection slave; -stop slave; -connection master; -# This will generate a master's binlog > 10 bytes -create table t1 (a int); -drop table t1; -create table t1 (a int); -drop table t1; -connection slave; -reset slave; -start slave io_thread; -# Give the I/O thread time to block. -sleep 2; -# A bug caused the I/O thread to refuse stopping. -stop slave io_thread; -reset slave; -start slave; -# The I/O thread stops filling the relay log when -# it's >10b. And the SQL thread cannot purge this relay log -# as purge is done only when the SQL thread switches to another -# relay log, which does not exist here. -# So we should have a deadlock. -# if it is not resolved automatically we'll detect -# it with master_pos_wait that waits for farther than 1Ob; -# it will timeout after 10 seconds; -# also the slave will probably not cooperate to shutdown -# (as 2 threads are locked) -select master_pos_wait('master-bin.001',200,6)=-1; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test b/mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test index bcfef919fad..edadb14a3ee 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test +++ b/mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test @@ -1,30 +1,2 @@ -# see if --replicate-ignore-db works +--source suite/rpl/t/rpl_replicate_ignore_db.test ---source include/master-slave.inc - ---disable_warnings -drop database if exists mysqltest1; -drop database if exists mysqltest2; ---enable_warnings -create database mysqltest1; -create database mysqltest2; - -use mysqltest1; -create table t1 (a int); -insert into t1 values(1); -sync_slave_with_master; ---error 1146 -select * from mysqltest1.t1; - -connection master; -use mysqltest2; -create table t1 (a int); -insert into t1 values(1); -sync_slave_with_master; -select * from mysqltest2.t1; - -# cleanup -connection master; -drop database mysqltest1; -drop database mysqltest2; -sync_slave_with_master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_NOW.test b/mysql-test/suite/engines/funcs/t/rpl_row_NOW.test index bf9576ae11b..b909062b8cc 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_NOW.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_NOW.test @@ -1,74 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/18/2005 # -# Updated 08/30/2005 Added dumps and diff # -############################################################################# -#TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12480 # -############################################################################# +--source suite/rpl/t/rpl_row_NOW.test -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - - -# Begin clean up test section -connection master; ---disable_warnings -create database if not exists mysqltest1; -DROP TABLE IF EXISTS mysqltest1.t1; ---enable_warnings - - -# Begin test section 1 -CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, - a TIMESTAMP DEFAULT '2005-05-05 01:01:01', - b TIMESTAMP DEFAULT '2005-05-05 01:01:01', - PRIMARY KEY(n)); -delimiter |; -CREATE FUNCTION mysqltest1.f1() RETURNS TIMESTAMP -BEGIN - DECLARE v1 INT DEFAULT 300; - WHILE v1 > 0 DO - SET v1 = v1 - 1; - END WHILE; - RETURN NOW(); -END| -delimiter ;| - -INSERT INTO mysqltest1.t1 VALUES(NULL,NOW(),mysqltest1.f1()); - -delimiter |; -CREATE TRIGGER mysqltest1.trig1 BEFORE INSERT ON mysqltest1.t1 -FOR EACH ROW BEGIN - SET new.b = mysqltest1.f1(); -END| -delimiter ;| - -INSERT INTO mysqltest1.t1 SET n = NULL, a = now(); - -sync_slave_with_master; - -connection master; - ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_slave.sql - -# lets cleanup -DROP TABLE IF EXISTS mysqltest1.t1; -DROP FUNCTION mysqltest1.f1; - -# Lets compare. Note: If they match test will pass, if they do not match -# the test will show that the diff statement failed and not reject file -# will be created. You will need to go to the mysql-test dir and diff -# the files your self to see what is not matching :-) The failed dump -# files will be located in $MYSQLTEST_VARDIR/tmp - -diff_files $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave.sql; - -# If all is good, when can cleanup our dump files. -remove_file $MYSQLTEST_VARDIR/tmp/NOW_master.sql; -remove_file $MYSQLTEST_VARDIR/tmp/NOW_slave.sql; - -DROP DATABASE mysqltest1; -sync_slave_with_master; -# End of 5.1 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_USER.test b/mysql-test/suite/engines/funcs/t/rpl_row_USER.test index c3639d05c48..e48b25293fa 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_USER.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_USER.test @@ -1,57 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/18/2005 # -############################################################################# -# TEST: To test the UUID() in rbr # -############################################################################# -# Change Author: JBM -# Change Date: 2006-01-16 -########## +--source suite/rpl/t/rpl_row_USER.test -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - -# Begin clean up test section -connection master; ---disable_warnings -DROP DATABASE IF EXISTS mysqltest1; -CREATE DATABASE mysqltest1; ---enable_warnings - -# Section 1 test -CREATE USER tester IDENTIFIED BY 'test'; -GRANT ALL ON mysqltest1.* TO 'tester'@'%' IDENTIFIED BY 'test'; -GRANT ALL ON mysqltest1.* TO ''@'localhost%'; -FLUSH PRIVILEGES; -connect (m_1,localhost,tester,,mysqltest1); - -connection m_1; -CREATE TABLE mysqltest1.t1 (a INT, users VARCHAR(255), PRIMARY KEY(a)); -INSERT INTO mysqltest1.t1 VALUES(1,USER()); -INSERT INTO mysqltest1.t1 VALUES(2,CURRENT_USER()); -delimiter |; -create procedure mysqltest1.p1() -begin - INSERT INTO mysqltest1.t1 VALUES(3,USER()); - INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER()); -end| -delimiter ;| - -CALL mysqltest1.p1(); -connection master; -SELECT * FROM mysqltest1.t1 ORDER BY a; -sync_slave_with_master; -SELECT * FROM mysqltest1.t1 ORDER BY a; - -connection master; -# Lets cleanup - -REVOKE ALL ON mysqltest1.* FROM 'tester'@'%'; -REVOKE ALL ON mysqltest1.* FROM ''@'localhost%'; -DROP DATABASE mysqltest1; -DROP USER 'tester'; -DROP USER ''@'localhost%'; -FLUSH PRIVILEGES; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test index 20c217a7c3a..35090d7f32f 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test @@ -1,48 +1,2 @@ --- source include/have_binlog_format_row.inc --- source include/master-slave.inc +--source suite/rpl/t/rpl_row_drop.test -# Bug#12415: DROP of temporary table on master stops slave -connection master; ---echo **** On Master **** -CREATE TABLE t1 (a int); -CREATE TABLE t2 (a int); -CREATE TEMPORARY TABLE t2 (a int, b int); -SHOW TABLES; -sync_slave_with_master; ---echo **** On Slave **** -SHOW TABLES; -connection master; ---echo **** On Master **** -DROP TABLE t2; # Dropping the temporary table -SHOW TABLES; -sync_slave_with_master; ---echo **** On Slave **** -SHOW TABLES; # There should be two tables on the slave - -connection master; ---echo **** On Master **** -CREATE TEMPORARY TABLE t2 (a int, b int); -SHOW TABLES; -sync_slave_with_master; ---echo **** On Slave **** -SHOW TABLES; -connection master; ---echo **** On Master **** -# Should drop the non-temporary table t1 and the temporary table t2 -DROP TABLE t1,t2; -let $VERSION=`select version()`; ---replace_result $VERSION VERSION ---replace_regex /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS; -SHOW TABLES; -sync_slave_with_master; ---echo **** On Slave **** -SHOW TABLES; - ---disable_query_log ---disable_warnings -connection master; -DROP TABLE IF EXISTS t2; -sync_slave_with_master; ---enable_warnings ---enable_query_log diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_func001.test b/mysql-test/suite/engines/funcs/t/rpl_row_func001.test index 53fb55118e6..7671d9947c1 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_func001.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_func001.test @@ -1,57 +1,2 @@ -############################################################################# -# This test is being created to test out the non deterministic items with # -# row based replication. # -# Original Author: JBM # -# Original Date: Aug/10/2005 # -# Update: 08/29/2005 change name to initails # -############################################################################# +--source suite/rpl/t/rpl_row_func001.test -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - - -# Begin clean up test section -connection master; ---disable_warnings ---error 0,1305 -DROP FUNCTION test.f1; -DROP TABLE IF EXISTS test.t1; - - ---enable_warnings - -# Section 1 test from bug #12487 Uses stored function to insert rows to see what is replicated. - -create table test.t1 (a int, PRIMARY KEY(a)); - -delimiter //; -create function test.f1(i int) returns int -begin -insert into test.t1 values(i); -return 0; -end// -delimiter ;// - -select test.f1(1); -select test.f1(2); -select * from test.t1; - -save_master_pos; -sync_slave_with_master; -connection slave; -#show create table test.t1; -select * from test.t1; - -connection master; - -#Used for debugging -#show binlog events; - -# Cleanup - -DROP FUNCTION test.f1; -DROP TABLE test.t1; -sync_slave_with_master; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test index 736071a8ece..793b94e63a6 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test @@ -2,7 +2,7 @@ # not have --source include/have_binlog_format_row.inc -source include/master-slave.inc; +--source include/master-slave.inc connection master; create table t1 (a int not null primary key); @@ -11,7 +11,7 @@ create table t2 (a int); insert into t2 values (1); update t1, t2 set t1.a = 0 where t1.a = t2.a; -sync_slave_with_master; +--sync_slave_with_master # t2 should not have been replicated # t1 should have been properly updated show tables; @@ -23,13 +23,16 @@ insert into t1 values (1); connection slave; # slave should have stopped because can't find table t1 -wait_for_slave_to_stop; -# see if we have a good error message: ---replace_result $MASTER_MYPORT MASTER_MYPORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # ---vertical_results -show slave status; +# 1146 = ER_NO_SUCH_TABLE +call mtr.add_suppression("Slave SQL.*Error executing row event: .Table .test.t1. doesn.t exist., error.* 1146"); +--let $slave_sql_errno= 1146 +--source include/wait_for_slave_sql_error.inc + +--echo ==== Clean up ==== +--source include/stop_slave_io.inc +RESET SLAVE; -# cleanup connection master; drop table t1, t2; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test b/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test index 3e057d48ec9..b1c01954293 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test @@ -4,6 +4,6 @@ # Test of manual relay log rotation with FLUSH LOGS. # Requires statement logging -source include/have_binlog_format_row.inc; +--source include/have_binlog_format_row.inc -source extra/rpl_tests/rpl_max_relay_size.test; +--source extra/rpl_tests/rpl_max_relay_size.test diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp001.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp001.test index ae6116bea4e..0610ef0274a 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_sp001.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp001.test @@ -1,146 +1,2 @@ -############################################################################# -# This test is being created to test out the non deterministic items with # -# row based replication. # -# Original Author: JBM # -# Original Date: Aug/09/2005 # -# Updated: Aug/29/2005 -############################################################################# -# Test: Includes two stored procedure tests. First test uses SP to insert # -# values from RAND() and NOW() into a table. # -# The second test uses SP with CASE structure to decide what to text # -# to update a given table with. # -############################################################################ +--source suite/rpl/t/rpl_row_sp001.test -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - --- disable_query_log --- disable_result_log - -# Begin clean up test section -connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; - --- enable_query_log --- enable_result_log - -# Begin test section 1 for non deterministic SP -let $message=<Begin test section 1 (non deterministic SP)>; ---source include/show_msg.inc - -create table test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n)); - -delimiter //; -create procedure test.p1() -begin - INSERT INTO test.t1 (f,d) VALUES (RAND(),NOW()); -end// -delimiter ;// - -# show binlog events; - --- disable_query_log --- disable_result_log -let $1=10; -while ($1) -{ - call test.p1(); - sleep 1; - dec $1; -} --- enable_result_log --- enable_query_log - -## Used for debugging -#show binlog events; -#select * from test.t1; -#sync_slave_with_master; -#select * from test.t1; -#connection master; - -let $message=<End test section 1 (non deterministic SP)>; ---source include/show_msg.inc - - -CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t CHAR(4), PRIMARY KEY(a)); - -delimiter //; -CREATE PROCEDURE test.p2(n int) -begin -CASE n -WHEN 1 THEN - UPDATE test.t2 set t ='Tex'; -WHEN 2 THEN - UPDATE test.t2 set t ='SQL'; -ELSE - UPDATE test.t2 set t ='NONE'; -END CASE; -end// -delimiter ;// - -INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'); - -SELECT * FROM t2 ORDER BY a; -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM t2 ORDER BY a; - -connection master; -call test.p2(1); -SELECT * FROM t2 ORDER BY a; -sync_slave_with_master; -SELECT * FROM t2 ORDER BY a; - - -connection master; -call test.p2(2); -SELECT * FROM t2 ORDER BY a; -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM t2 ORDER BY a; - -connection master; -call test.p2(3); -SELECT * FROM t2 ORDER BY a; -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM t2 ORDER BY a; - -##Used for debugging -#show binlog events; - -# time to dump the databases and so we can see if they match - ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_slave.sql - -# First lets cleanup - -connection master; -DROP PROCEDURE test.p1; -DROP PROCEDURE test.p2; -DROP TABLE test.t1; -DROP TABLE test.t2; -sync_slave_with_master; - -# Lets compare. Note: If they match test will pass, if they do not match -# the test will show that the diff statement failed and not reject file -# will be created. You will need to go to the mysql-test dir and diff -# the files your self to see what is not matching :-) Failed dump files -# will be located in $MYSQLTEST_VARDIR/tmp - -diff_files $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_slave.sql; - -# If all is good, when can cleanup our dump files. -remove_file $MYSQLTEST_VARDIR/tmp/sp001_master.sql; -remove_file $MYSQLTEST_VARDIR/tmp/sp001_slave.sql; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test index d8a5aacc5e6..a304dbe009b 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test @@ -1,108 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/15/2005 # -# Updated: Aug/29/2005: Removed sleeps # -############################################################################# -# Test: Tests SPs with cursors, flow logic, and alter sp. In addition the # -# tests SPs with insert and update operations. # -############################################################################# +--source suite/rpl/t/rpl_row_sp005.test -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - - -# Begin clean up test section -connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t3; ---enable_warnings -# End of cleanup - -# Begin test section 1 -CREATE TABLE IF NOT EXISTS test.t1(id INT, data CHAR(16),PRIMARY KEY(id)); -CREATE TABLE IF NOT EXISTS test.t2(id2 INT,PRIMARY KEY(id2)); -CREATE TABLE IF NOT EXISTS test.t3(id3 INT,PRIMARY KEY(id3), c CHAR(16)); - -delimiter |; -CREATE PROCEDURE test.p1() -BEGIN -DECLARE done INT DEFAULT 0; - DECLARE spa CHAR(16); - DECLARE spb,spc INT; - DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1 ORDER BY id; - DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2 ORDER BY id2; - DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; - - OPEN cur1; - OPEN cur2; - - REPEAT - FETCH cur1 INTO spb, spa; - FETCH cur2 INTO spc; - IF NOT done THEN - IF spb < spc THEN - INSERT INTO test.t3 VALUES (spb,spa); - ELSE - INSERT INTO test.t3 VALUES (spc,spa); - END IF; - END IF; - UNTIL done END REPEAT; - - CLOSE cur1; - CLOSE cur2; -END| -CREATE PROCEDURE test.p2() -BEGIN - INSERT INTO test.t1 VALUES (4,'MySQL'),(20,'ROCKS'),(11,'Texas'),(10,'kyle'); - INSERT INTO test.t2 VALUES (4),(2),(1),(3); - UPDATE test.t1 SET id=id+4 WHERE id=4; -END| -delimiter ;| - -let $message=< ---- Master selects-- >; ---source include/show_msg.inc -CALL test.p2(); -SELECT * FROM test.t1 ORDER BY id; -SELECT * FROM test.t2 ORDER BY id2; - -let $message=< ---- Slave selects-- >; ---source include/show_msg.inc -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM test.t1 ORDER BY id; -SELECT * FROM test.t2 ORDER BY id2; - -let $message=< ---- Master selects-- >; ---source include/show_msg.inc -connection master; -CALL test.p1(); -sleep 6; -SELECT * FROM test.t3 ORDER BY id3; - -let $message=< ---- Slave selects-- >; ---source include/show_msg.inc -connection slave; -SELECT * FROM test.t3 ORDER BY id3; - -connection master; - -ALTER PROCEDURE test.p1 MODIFIES SQL DATA; -#show binlog events; - -# Cleanup - -connection master; -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t3; -sync_slave_with_master; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp008.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp008.test index b1295820c99..3cc0ed26ea2 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_sp008.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp008.test @@ -1,57 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/15/2005 # -# Update: 08/29/2005 Remove sleep # -############################################################################# -# TEST: Use SQL_CALC_FOUND_ROWS and insert results into a table inside a sp # -############################################################################# +--source suite/rpl/t/rpl_row_sp008.test - -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - -# Begin clean up test section -connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test.p1; -DROP TABLE IF EXISTS test.t2; ---enable_warnings -# End of cleanup - - - -# Begin test section 1 -CREATE TABLE test.t1 (a INT,PRIMARY KEY(a)); -CREATE TABLE test.t2 (a INT,PRIMARY KEY(a)); -INSERT INTO test.t1 VALUES(1),(2); - -delimiter |; -CREATE PROCEDURE test.p1() -BEGIN - SELECT SQL_CALC_FOUND_ROWS * FROM test.t1 LIMIT 1; - INSERT INTO test.t2 VALUES(FOUND_ROWS()); -END| -delimiter ;| - -let $message=< ---- Master selects-- >; ---source include/show_msg.inc -CALL test.p1(); -SELECT * FROM test.t2; - -let $message=< ---- Slave selects-- >; ---source include/show_msg.inc -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM test.t2; - -# Cleanup - -connection master; -DROP PROCEDURE IF EXISTS test.p1; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -sync_slave_with_master; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test index 505ed582ba9..56b42a0953d 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test @@ -1,102 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/18/2005 # -# Updated: 08/29/2005 removed sleeps and added master pos save and snyc # -############################################################################# -#TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12168 # -############################################################################# +--source suite/rpl/t/rpl_row_sp009.test -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - - -# Begin clean up test section -connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test.p1; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; - - -# Begin test section 1 -CREATE TABLE test.t1 (a INT, PRIMARY KEY(a)); -INSERT INTO test.t1 VALUES (1),(2),(3),(4); -CREATE TABLE test.t2 (a INT, PRIMARY KEY(a)); - -delimiter |; -CREATE PROCEDURE test.p1 (arg1 CHAR(1)) -BEGIN - DECLARE b, c INT; - IF arg1 = 'a' THEN - BEGIN - DECLARE cur1 CURSOR FOR SELECT A FROM test.t1 WHERE a % 2; - DECLARE continue handler for not found set b = 1; - SET b = 0; - OPEN cur1; - c1_repeat: REPEAT - FETCH cur1 INTO c; - IF (b = 1) THEN - LEAVE c1_repeat; - END IF; - - INSERT INTO test.t2 VALUES (c); - UNTIL b = 1 - END REPEAT; - CLOSE cur1; - END; - END IF; - IF arg1 = 'b' THEN - BEGIN - DECLARE cur2 CURSOR FOR SELECT a FROM test.t1 WHERE NOT a % 2; - DECLARE continue handler for not found set b = 1; - SET b = 0; - OPEN cur2; - c2_repeat: REPEAT - FETCH cur2 INTO c; - IF (b = 1) THEN - LEAVE c2_repeat; - END IF; - - INSERT INTO test.t2 VALUES (c); - UNTIL b = 1 - END REPEAT; - CLOSE cur2; - END; - END IF; -END| -delimiter ;| - -CALL test.p1('a'); -SELECT * FROM test.t2 ORDER BY a; -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM test.t2 ORDER BY a; -connection master; -truncate test.t2; - -# this next call fails, but should not -call test.p1('b'); -select * from test.t2 ORDER BY a; -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM test.t2 ORDER BY a; - -connection master; -truncate test.t2; -SELECT * FROM test.t2 ORDER BY a; -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM test.t2 ORDER BY a; - -# Cleanup -connection master; -DROP PROCEDURE test.p1; -DROP TABLE test.t1; -DROP TABLE test.t2; -sync_slave_with_master; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp010.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp010.test index 28b82217517..a52fc311315 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_sp010.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp010.test @@ -1,80 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/18/2005 # -# Update: 08/29/2005 remove sleep added master pos save and sync # -############################################################################# -#TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=11126 # -############################################################################# +--source suite/rpl/t/rpl_row_sp010.test -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - - -# Begin clean up test section -connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP PROCEDURE IF EXISTS test.p3; -DROP PROCEDURE IF EXISTS test.p4; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; - - -# Begin test section 1 -delimiter |; -CREATE PROCEDURE test.p1() -BEGIN - INSERT INTO test.t1 VALUES(2); -END| -CREATE PROCEDURE test.p2() -BEGIN - DROP TEMPORARY TABLE IF EXISTS test.t1; - CREATE TEMPORARY TABLE test.t1 (a int, PRIMARY KEY(a)); - INSERT INTO test.t1 VALUES(1); - CALL test.p1(); -END| -delimiter ;| -CALL test.p2(); -SELECT * FROM test.t1 ORDER BY a; - -save_master_pos; -connection slave; -sync_with_master; -show tables; - -connection master; -delimiter |; -CREATE PROCEDURE test.p3() -BEGIN - INSERT INTO test.t2 VALUES(7); -END| -CREATE PROCEDURE test.p4() -BEGIN - DROP TABLE IF EXISTS test.t2; - CREATE TABLE test.t2 (a int, PRIMARY KEY(a)); - INSERT INTO test.t2 VALUES(6); - CALL test.p3(); -END| -delimiter ;| -CALL test.p4(); -SELECT * FROM test.t2 ORDER BY a; - -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM test.t2 ORDER BY a; - -# Cleanup -connection master; -#show binlog events; -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP PROCEDURE IF EXISTS test.p3; -DROP PROCEDURE IF EXISTS test.p4; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -sync_slave_with_master; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp011.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp011.test index 1c24904dd5a..c24282c8f16 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_sp011.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp011.test @@ -1,111 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/18/2005 # -# Updated: 08/29/2005 turned on diff and commented out debug SQL statements# -############################################################################# -#TEST: SP to test alter table and nested SP calls # -############################################################################# +--source suite/rpl/t/rpl_row_sp011.test -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - - -# Begin clean up test section -connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP PROCEDURE IF EXISTS test.p3; -DROP PROCEDURE IF EXISTS test.p4; -DROP PROCEDURE IF EXISTS test.p5; -DROP PROCEDURE IF EXISTS test.p6; -DROP PROCEDURE IF EXISTS test.p7; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; - - -# Begin test section 1 -CREATE TABLE test.t1 (a int, PRIMARY KEY(a)); -INSERT INTO test.t1 VALUES (1); - -delimiter |; -CREATE PROCEDURE test.p1() -BEGIN - ALTER TABLE test.t1 ADD COLUMN b CHAR(4) AFTER a; - UPDATE test.t1 SET b = 'rbr' WHERE a = 1; - CALL test.p2(); -END| -CREATE PROCEDURE test.p2() -BEGIN - ALTER TABLE test.t1 ADD COLUMN f FLOAT AFTER b; - UPDATE test.t1 SET f = RAND() WHERE a = 1; - CALL test.p3(); -END| -CREATE PROCEDURE test.p3() -BEGIN - ALTER TABLE test.t1 RENAME test.t2; - CALL test.p4(); -END| -CREATE PROCEDURE test.p4() -BEGIN - ALTER TABLE test.t2 ADD INDEX (f); - ALTER TABLE test.t2 CHANGE a a INT UNSIGNED NOT NULL AUTO_INCREMENT; - INSERT INTO test.t2 VALUES (NULL,'TEST',RAND()); - CALL test.p5(); -END| -CREATE PROCEDURE test.p5() -BEGIN - ALTER TABLE test.t2 ORDER BY f; - INSERT INTO test.t2 VALUES (NULL,'STM',RAND()); - CALL test.p6(); -END| -CREATE PROCEDURE test.p6() -BEGIN - ALTER TABLE test.t2 ADD COLUMN b2 CHAR(4) FIRST; - ALTER TABLE test.t2 ADD COLUMN to_drop BIT(8) AFTER b2; - INSERT INTO test.t2 VALUES ('new',1,NULL,'STM',RAND()); - CALL test.p7(); -END| -CREATE PROCEDURE test.p7() -BEGIN - ALTER TABLE test.t2 DROP COLUMN to_drop; - INSERT INTO test.t2 VALUES ('gone',NULL,'STM',RAND()); -END| -delimiter ;| -CALL test.p1(); - -#SELECT * FROM test.t2; -sync_slave_with_master; -#SELECT * FROM test.t2; - ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_slave.sql - -# Cleanup -connection master; -#show binlog events; -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP PROCEDURE IF EXISTS test.p3; -DROP PROCEDURE IF EXISTS test.p4; -DROP PROCEDURE IF EXISTS test.p5; -DROP PROCEDURE IF EXISTS test.p6; -DROP PROCEDURE IF EXISTS test.p7; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -sync_slave_with_master; - -# Lets compare. Note: If they match test will pass, if they do not match -# the test will show that the diff statement failed and not reject file -# will be created. You will need to go to the mysql-test dir and diff -# the files your self to see what is not matching :-) Failed test -# Will leave dump files in $MYSQLTEST_VARDIR/tmp - -diff_files $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_slave.sql; - -# If all is good, when can cleanup our dump files. -remove_file $MYSQLTEST_VARDIR/tmp/sp011_master.sql; -remove_file $MYSQLTEST_VARDIR/tmp/sp011_slave.sql; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp012.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp012.test index f3963c7537a..f23e5c905a6 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_sp012.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp012.test @@ -1,75 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/22/2005 # -# Update: 08/29/2005 Added save pos and sync # -############################################################################# -#TEST: SP to test security and current_user and user # -############################################################################# - - -# Includes --- source include/have_binlog_format_row.inc --- source include/not_embedded.inc --- source include/master-slave.inc - - -# Begin clean up test section -connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP PROCEDURE IF EXISTS test.p3; - - -# Begin test section 1 -# Create user user1 with no particular access rights -grant usage on *.* to user1@localhost; -flush privileges; - -SELECT CURRENT_USER(); -SELECT USER(); -CREATE PROCEDURE test.p1 () SQL SECURITY INVOKER SELECT CURRENT_USER(), USER(); -CREATE PROCEDURE test.p2 () SQL SECURITY DEFINER CALL test.p1(); -CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1(); -GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost; -GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost; -GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost; - -# Need to wait for the rights to be applied at the slave -sync_slave_with_master; - -let $message=<******** Master user1 p3 & p2 calls *******>; ---source include/show_msg.inc -connect (muser1,localhost,user1,,); -connection muser1; -SELECT CURRENT_USER(); -SELECT USER(); -CALL test.p3(); -CALL test.p2(); - -let $message=<******** Slave user1 p3 & p2 calls *******>; ---source include/show_msg.inc -connect (suser1,127.0.0.1,user1,,test,$SLAVE_MYPORT,); - -connection master; -save_master_pos; -connection suser1; -sync_with_master; - -SELECT CURRENT_USER(); -SELECT USER(); -CALL test.p3(); -CALL test.p2(); - -# Cleanup -connection master; -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p3; -DROP PROCEDURE IF EXISTS test.p2; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -DROP USER 'user1'@'localhost'; -sync_slave_with_master; - -# End of 5.0 test case +--source suite/rpl/t/rpl_row_sp012.test diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test b/mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test index da363736100..397bc9a1d61 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test @@ -9,8 +9,8 @@ connection master; create table t1 (a int not null auto_increment primary key, b int, key(b)); -sync_slave_with_master; -stop slave; +--sync_slave_with_master +--source include/stop_slave.inc connection master; INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); INSERT INTO t1 (a) SELECT null FROM t1; @@ -28,13 +28,13 @@ INSERT INTO t1 (a) SELECT null FROM t1; INSERT INTO t1 (a) SELECT null FROM t1; connection slave; -start slave; +--source include/start_slave.inc # hope one second is not enough for slave to reach the last # Rows_log_event, so that test actually tests something. real_sleep 1; -stop slave; +--source include/stop_slave.inc # see if slave hangs on DROP TABLE diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_trig001.test b/mysql-test/suite/engines/funcs/t/rpl_row_trig001.test index 7b1fca2d6a1..77fd9fbf90e 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_trig001.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_trig001.test @@ -1,100 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/09/2005 # -############################################################################# -# TEST: Use after insert and before inset triggers and stored procdures to # -# Update and insert data # -############################################################################# +--source suite/rpl/t/rpl_row_trig001.test -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - --- disable_query_log --- disable_result_log - -# Begin clean up test section -connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test.p2; -DROP PROCEDURE IF EXISTS test.p3; ---error 0,1360 -DROP TRIGGER test.t2_ai; ---error 0,1360 -DROP TRIGGER test.t3_bi_t2; ---error 0,1360 -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t3; - - -# test section 1, lets add a trigger to the mix. Taken from bug #12280 -let $message=<Begin test section 1 (Tiggers & SP)>; ---source include/show_msg.inc - -CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n)); -CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n)); -CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n)); - -INSERT INTO test.t1 VALUES (1,NOW()); - -delimiter //; -CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1;// -CREATE PROCEDURE test.p3() -BEGIN - INSERT INTO test.t3 (d) VALUES (NOW()); -END// -CREATE TRIGGER test.t3_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW CALL test.p3()// -CREATE PROCEDURE test.p2() -BEGIN - INSERT INTO test.t2 (f,d) VALUES (RAND(),NOW()); -END// -delimiter ;// - --- disable_query_log --- disable_result_log -let $1=10; -while ($1) -{ - CALL test.p2(); - sleep 1; - dec $1; -} --- enable_result_log --- enable_query_log - -#show binlog events; -#select * from test.t2; -#select * from test.t3; -#connection slave; -#select * from test.t2; -#select * from test.t3; - -let $message=<End test section 2 (Tiggers & SP)>; ---source include/show_msg.inc - -# time to dump the databases and so we can see if they match - ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trig001_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trig001_slave.sql - -# Cleanup -connection master; -DROP PROCEDURE test.p2; -DROP PROCEDURE test.p3; -DROP TRIGGER test.t2_ai; -DROP TRIGGER test.t3_bi_t2; -DROP TABLE test.t1; -DROP TABLE test.t2; -DROP TABLE test.t3; -sync_slave_with_master; - -# Lets compare. Note: If they match test will pass, if they do not match -# the test will show that the diff statement failed and not reject file -# will be created. You will need to go to the mysql-test dir and diff -# the files your self to see what is not matching :-) Failed tests -# will leave dump files in $MYSQLTEST_VARDIR/tmp - -diff_files $MYSQLTEST_VARDIR/tmp/trig001_master.sql $MYSQLTEST_VARDIR/tmp/trig001_slave.sql; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_trig002.test b/mysql-test/suite/engines/funcs/t/rpl_row_trig002.test index 44b7d8b1dc2..8b7342c32a1 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_trig002.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_trig002.test @@ -1,82 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/14/2005 # -# Updated: 08/29/2005 added save master pos and sync with master # -############################################################################# -# TEST: Taken and modified from BUG#12048 After Insert updates replication # -############################################################################# +--source suite/rpl/t/rpl_row_trig002.test -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - -#-- disable_query_log -#-- disable_result_log - -# Begin clean up test section -connection master; ---disable_warnings ---error 0,1360 -DROP TRIGGER test.t2_ai; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t3; ---enable_warnings - -# test section 1, Taken from bug #12408 - -CREATE TABLE test.t2 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id)); - -CREATE TABLE test.t3 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id)); - -CREATE TABLE test.t1 (id INT,domain CHAR(30),PRIMARY KEY(id)); - -delimiter |; -CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t3 ms, test.t1 d SET ms.value='No' WHERE ms.domain_id = (SELECT max(id) FROM test.t1 WHERE domain='example.com') AND ms.mailaccount_id IS NULL AND ms.program='spamfilter' AND ms.keey='scan_incoming'| -delimiter ;| - -INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com'); - -SELECT * FROM test.t1 ORDER BY id; -#show binlog events; -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM test.t1 ORDER BY id; -connection master; - -INSERT INTO test.t3 VALUES ('Yes', 5, NULL, 'spamfilter','scan_incoming'); -INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming'); -INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming'); - -select * from test.t2; ---sorted_result -select * from test.t3; -save_master_pos; -connection slave; -sync_with_master; -select * from test.t2; ---sorted_result -select * from test.t3; -connection master; - -DELETE FROM test.t1 WHERE id = 1; - -SELECT * FROM test.t1 ORDER BY id; -connection master; -SELECT * FROM test.t1 ORDER BY id; -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM test.t1 ORDER BY id; - -# Cleanup -connection master; -#show binlog events; -DROP TRIGGER test.t2_ai; -DROP TABLE test.t1; -DROP TABLE test.t2; -DROP TABLE test.t3; -sync_slave_with_master; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_trig003.test b/mysql-test/suite/engines/funcs/t/rpl_row_trig003.test index 4a1bbc5ca89..2bb581995d0 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_trig003.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_trig003.test @@ -1,152 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/16/2005 # -# Updated: 8/29/2005 Remove sleep calls add dump and diff # -############################################################################# -# TEST: This test includes all trigger types. BEFORE/AFTER INSERT, UPDATE & # -# DELETE. In addition, includes cursor, bit, varchar, flow control, # -# looping, ROUND(), NOW(), YEAR(), TIMESTAMP # -############################################################################# +--source suite/rpl/t/rpl_row_trig003.test -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - -#-- disable_query_log -#-- disable_result_log - -# Begin clean up test section -connection master; ---disable_warnings ---error 0,1360 -DROP TRIGGER test.t1_bi; ---error 0,1360 -DROP TRIGGER test.t2_ai; ---error 0,1360 -DROP TRIGGER test.t1_bu; ---error 0,1360 -DROP TRIGGER test.t2_au; ---error 0,1360 -DROP TRIGGER test.t1_bd; ---error 0,1360 -DROP TRIGGER test.t2_ad; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t3; ---enable_warnings - -# test section 1 - -CREATE TABLE test.t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id)); -CREATE TABLE test.t2 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id)); -CREATE TABLE test.t3 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id)); - -# Note Most of these cause the slave to core or do not produce desired results. Currently commenting out the ones not working until they are fixed. - -delimiter |; -CREATE TRIGGER test.t1_bi BEFORE INSERT ON test.t1 FOR EACH ROW UPDATE test.t3 SET b1=1 and y=YEAR(NOW())| -CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW BEGIN - INSERT INTO test.t3 VALUES(NULL,0,'MySQL Replication team rocks!', 'Dark beer in prague is #1',12345.34,12.51,0,1965,NOW()); - UPDATE test.t3 SET f = ROUND(f); -END| -CREATE TRIGGER test.t1_bu BEFORE UPDATE on test.t1 FOR EACH ROW BEGIN - UPDATE test.t3 SET y = '2000'; - INSERT INTO test.t3 VALUES(NULL,1,'Testing MySQL databases before update ', 'Insert should work',621.43, 0105.21,0,1974,NOW()); -END| -CREATE TRIGGER test.t2_au AFTER UPDATE on test.t2 FOR EACH ROW BEGIN - DECLARE done INT DEFAULT 0; - DECLARE a DECIMAL(10,4); - DECLARE b FLOAT; - DECLARE num MEDIUMINT; - DECLARE cur1 CURSOR FOR SELECT t2.id, t2.d, t2.f FROM test.t2; - DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; - - OPEN cur1; - - REPEAT - FETCH cur1 INTO num, a, b; - IF NOT done THEN - UPDATE test.t3 SET total =(a*b) WHERE ID = num; - END IF; - UNTIL done END REPEAT; - CLOSE cur1; -END| -CREATE TRIGGER test.t1_bd BEFORE DELETE on test.t1 FOR EACH ROW BEGIN - DECLARE done INT DEFAULT 0; - DECLARE a BIT(8); - DECLARE b VARCHAR(255); - DECLARE c CHAR(255); - DECLARE d DECIMAL(10,4); - DECLARE e FLOAT; - DECLARE f BIGINT UNSIGNED; - DECLARE g YEAR; - DECLARE h TIMESTAMP; - DECLARE cur1 CURSOR FOR SELECT t1.b1, t1.vc, t1.bc, t1.d, t1.f, t1.total, t1.y, t1.t FROM test.t1; - DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; - - OPEN cur1; - - REPEAT - FETCH cur1 INTO a, b, c, d, e, f, g, h; - IF NOT done THEN - INSERT INTO test.t3 VALUES(NULL, a, b, c, d, e, f, g, h); - END IF; - UNTIL done END REPEAT; - CLOSE cur1; -END| -CREATE TRIGGER test.t2_ad AFTER DELETE ON test.t2 FOR EACH ROW - DELETE FROM test.t1| -delimiter ;| - -INSERT INTO test.t1 VALUES(NULL,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,NOW()); -INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL Customers ROCK!',654321.4321,1.24521,0,YEAR(NOW()),NOW()); - -UPDATE test.t1 SET b1 = 0 WHERE b1 = 1; - -INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW()); -UPDATE test.t2 SET b1 = 0 WHERE b1 = 1; - -INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW()); - -# To make sure BUG#14698 is gone, we sleep 2 seconds before calling trigger -# (with the bug in, that caused differences in TIMESTAMP columns). -# We just need to let the machine's clock advance, it's not -# to do synchronization, so real_sleep is good. -real_sleep 2; - -DELETE FROM test.t1 WHERE id = 1; - -DELETE FROM test.t2 WHERE id = 1; - -save_master_pos; -connection slave; -sync_with_master; -connection master; - -# time to dump the databases and so we can see if they match - ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trg003_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trg003_slave.sql - -# cleanup ---disable_warnings ---error 0,1360 -DROP TRIGGER test.t1_bi; ---error 0,1360 -DROP TRIGGER test.t2_ai; ---error 0,1360 -DROP TRIGGER test.t1_bu; ---error 0,1360 -DROP TRIGGER test.t2_au; ---error 0,1360 -DROP TRIGGER test.t1_bd; ---error 0,1360 -DROP TRIGGER test.t2_ad; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t3; ---enable_warnings - -diff_files $MYSQLTEST_VARDIR/tmp/trg003_master.sql $MYSQLTEST_VARDIR/tmp/trg003_slave.sql; - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_until.test b/mysql-test/suite/engines/funcs/t/rpl_row_until.test index 7f8b0000042..d919bf7773b 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_until.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_until.test @@ -1,126 +1,2 @@ --- source include/have_binlog_format_row.inc --- source include/master-slave.inc +--source suite/rpl/t/rpl_row_until.test -# Note: The test is dependent on binlog positions - -# Create some events on master -connection master; -CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); -INSERT INTO t1 VALUES (1),(2),(3),(4); -DROP TABLE t1; -# Save master log position for query DROP TABLE t1 -save_master_pos; -let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 11); -let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 11); - -CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); -# Save master log position for query CREATE TABLE t2 -save_master_pos; -let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 12); - -INSERT INTO t2 VALUES (1),(2); -save_master_pos; -# Save master log position for query INSERT INTO t2 VALUES (1),(2); -let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 19); -sync_slave_with_master; - -# Save relay log position for query INSERT INTO t2 VALUES (1),(2); -let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1); - -connection master; -INSERT INTO t2 VALUES (3),(4); -DROP TABLE t2; -# Save master log position for query DROP TABLE t2; -let $master_pos_drop_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 26); -sync_slave_with_master; - ---source include/stop_slave.inc -# Reset slave. -RESET SLAVE; ---disable_query_log -eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT; ---enable_query_log - -# Try to replicate all queries until drop of t1 -connection slave; -echo START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_drop_t1; ---disable_query_log -eval START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_drop_t1; ---enable_query_log ---source include/wait_for_slave_sql_to_stop.inc - -# Here table should be still not deleted -SELECT * FROM t1; ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_pos_drop_t1 ---source include/check_slave_param.inc - -# This should fail right after start ---replace_result 291 MASTER_LOG_POS -START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291; ---source include/wait_for_slave_sql_to_stop.inc -# again this table should be still not deleted -SELECT * FROM t1; - ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_pos_drop_t1 ---source include/check_slave_param.inc - -# Try replicate all up to and not including the second insert to t2; -echo START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2; ---disable_query_log -eval START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=$relay_pos_insert1_t2; ---enable_query_log ---source include/wait_for_slave_sql_to_stop.inc -SELECT * FROM t2; - ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_pos_insert1_t2 ---source include/check_slave_param.inc - -# clean up -START SLAVE; ---source include/wait_for_slave_to_start.inc -connection master; -sync_slave_with_master; ---source include/stop_slave.inc - -# This should stop immediately as we are already there -echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_create_t2; ---disable_query_log -eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_create_t2; ---enable_query_log -let $slave_param= Until_Log_Pos; -let $slave_param_value= $master_pos_create_t2; ---source include/wait_for_slave_param.inc ---source include/wait_for_slave_sql_to_stop.inc -# here the sql slave thread should be stopped ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_pos_drop_t2 ---source include/check_slave_param.inc - -#testing various error conditions ---replace_result 561 MASTER_LOG_POS ---error 1277 -START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561; ---replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS ---error 1277 -START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12; ---error 1277 -START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001'; ---error 1277 -START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009'; ---replace_result 561 MASTER_LOG_POS ---error 1277 -START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561; -# Warning should be given for second command -START SLAVE; ---replace_result 740 MASTER_LOG_POS -START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740; - ---source include/stop_slave.inc -# Clear slave IO error. -RESET SLAVE; - ---let $rpl_only_running_threads= 1 ---source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_view01.test b/mysql-test/suite/engines/funcs/t/rpl_row_view01.test index 1ccfcb4eb27..6d58666f883 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_view01.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_view01.test @@ -1,82 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/19/2005 # -# Updated: 08/29/2005 Remove sleeps # -############################################################################# -#TEST: row based replication of views # -############################################################################# -# Includes --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - -# Begin clean up test section -connection master; ---disable_warnings -create database if not exists mysqltest1; -DROP VIEW IF EXISTS mysqltest1.v1; -DROP VIEW IF EXISTS mysqltest1.v2; -DROP VIEW IF EXISTS mysqltest1.v3; -DROP VIEW IF EXISTS mysqltest1.v4; -DROP TABLE IF EXISTS mysqltest1.t3; -DROP TABLE IF EXISTS mysqltest1.t1; -DROP TABLE IF EXISTS mysqltest1.t2; -DROP TABLE IF EXISTS mysqltest1.t4; - -# Begin test section 1 -CREATE TABLE mysqltest1.t1 (a INT, c CHAR(6),PRIMARY KEY(a)); -CREATE TABLE mysqltest1.t2 (a INT, c CHAR(6),PRIMARY KEY(a)); -CREATE TABLE mysqltest1.t3 (a INT, c CHAR(6), c2 CHAR(6), PRIMARY KEY(a)); -CREATE TABLE mysqltest1.t4 (a INT, qty INT, price INT,PRIMARY KEY(a)); -CREATE TABLE mysqltest1.t5 (qty INT, price INT, total INT, PRIMARY KEY(qty)); -INSERT INTO mysqltest1.t1 VALUES (1,'Thank'),(2,'it'),(3,'Friday'); -INSERT INTO mysqltest1.t2 VALUES (1,'GOD'),(2,'is'),(3,'TGIF'); -INSERT INTO mysqltest1.t4 VALUES(1, 3, 50),(2, 18, 3),(4, 4, 4); - - -CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4 ORDER BY qty; -CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a ORDER BY a; -CREATE VIEW mysqltest1.v3 AS SELECT * FROM mysqltest1.t1; -CREATE VIEW mysqltest1.v4 AS SELECT * FROM mysqltest1.v3 WHERE a > 1 WITH LOCAL CHECK OPTION; - - -SELECT * FROM mysqltest1.v2; -SELECT * FROM mysqltest1.v1; -sync_slave_with_master; -SELECT * FROM mysqltest1.v2; -SELECT * FROM mysqltest1.v1; -connection master; - -INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2; -INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1; - -SELECT * FROM mysqltest1.t5 ORDER BY qty; -SELECT * FROM mysqltest1.t3 ORDER BY a; -sync_slave_with_master; -SELECT * FROM mysqltest1.t5 ORDER BY qty; -SELECT * FROM mysqltest1.t3 ORDER BY a; -connection master; - -INSERT INTO mysqltest1.v4 VALUES (4,'TEST'); - -SELECT * FROM mysqltest1.t1 ORDER BY a; -SELECT * FROM mysqltest1.v4 ORDER BY a; -sync_slave_with_master; -SELECT * FROM mysqltest1.t1 ORDER BY a; -SELECT * FROM mysqltest1.v4 ORDER BY a; - -connection master; - -# lets cleanup -DROP VIEW IF EXISTS mysqltest1.v1; -DROP VIEW IF EXISTS mysqltest1.v2; -DROP VIEW IF EXISTS mysqltest1.v3; -DROP VIEW IF EXISTS mysqltest1.v4; -DROP TABLE IF EXISTS mysqltest1.t3; -DROP TABLE IF EXISTS mysqltest1.t1; -DROP TABLE IF EXISTS mysqltest1.t2; -DROP TABLE IF EXISTS mysqltest1.t4; -DROP DATABASE mysqltest1; -sync_slave_with_master; - -# End of 5.1 test case +--source suite/rpl/t/rpl_row_view01.test diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test index 71310750b60..a1425531b2c 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test +++ b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test @@ -4,12 +4,12 @@ # ignored, which has caught our customers), unless # --replicate-same-server-id. -source include/master-slave.inc; +--source include/master-slave.inc connection slave; create table t1 (n int); reset master; # replicate ourselves -stop slave; +--source include/stop_slave.inc --replace_result $SLAVE_MYPORT SLAVE_PORT eval change master to master_port=$SLAVE_MYPORT; --replace_result $SLAVE_MYPORT SLAVE_PORT @@ -17,10 +17,16 @@ eval change master to master_port=$SLAVE_MYPORT; show slave status; start slave; insert into t1 values (1); -# can't MASTER_POS_WAIT(), it does not work in this weird setup -# (when slave is its own master without --replicate-same-server-id) -sleep 2; # enough time for the event to be replicated (it should not) -show status like "slave_running"; -drop table t1; -# End of 4.1 tests +--let $slave_param=Last_IO_Errno +--let $slave_param_value=1593 +--source include/wait_for_slave_param.inc + +--let $slave_field_result_replace= / at [0-9]*/ at XXX/ +--let $status_items= Last_IO_Errno, Last_IO_Error +--source include/show_slave_status.inc + +--source include/stop_slave.inc +reset slave; +reset master; +drop table t1; diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test index 0f2eb560d18..8d48746ba5e 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test +++ b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test @@ -1,26 +1,2 @@ -# This test checks that a slave DOES execute queries originating -# from itself, if running with --replicate-same-server-id. +--source suite/rpl/t/rpl_server_id2.test -source include/master-slave.inc; -connection slave; -create table t1 (n int); -reset master; -# replicate ourselves -stop slave; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval change master to master_port=$SLAVE_MYPORT; ---replace_result $SLAVE_MYPORT SLAVE_PORT ---replace_column 18 # -show slave status; -start slave; -insert into t1 values (1); -save_master_pos; -sync_with_master; -select * from t1; # check that indeed 2 were inserted -# We stop the slave before cleaning up otherwise we'll get -# 'drop table t1' executed twice, so an error in the slave.err -# (not critical). -stop slave; -drop table t1; - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_session_var.test b/mysql-test/suite/engines/funcs/t/rpl_session_var.test index a6f4b496a23..f1686e107b6 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_session_var.test +++ b/mysql-test/suite/engines/funcs/t/rpl_session_var.test @@ -1,42 +1,2 @@ -# Replication of session variables. -# FOREIGN_KEY_CHECKS is tested in rpl_insert_id.test +--source suite/rpl/t/rpl_session_var.test -source include/master-slave.inc; -drop table if exists t1; -create table t1(a varchar(100),b int); -set @@session.sql_mode=pipes_as_concat; -insert into t1 values('My'||'SQL', 1); -set @@session.sql_mode=default; -insert into t1 values('1'||'2', 2); -select * from t1 where b<3 order by a; -save_master_pos; -connection slave; -sync_with_master; -select * from t1 where b<3 order by a; -connection master; -# if the slave does the next sync_with_master fine, then it means it accepts the -# two lines of ANSI syntax below, which is what we want to check. -set @@session.sql_mode=ignore_space; -insert into t1 values(password ('MySQL'), 3); -set @@session.sql_mode=ansi_quotes; -create table "t2" ("a" int); -drop table t1, t2; -set @@session.sql_mode=default; -create table t1(a int auto_increment primary key); -create table t2(b int, a int); -set @@session.sql_auto_is_null=1; -insert into t1 values(null); -insert into t2 select 1,a from t1 where a is null; -set @@session.sql_auto_is_null=0; -insert into t1 values(null); -insert into t2 select 2,a from t1 where a is null; -select * from t2 order by b; -save_master_pos; -connection slave; -sync_with_master; -select * from t2 order by b; -connection master; -drop table t1,t2; -save_master_pos; -connection slave; -sync_with_master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_sf.test b/mysql-test/suite/engines/funcs/t/rpl_sf.test index 6a741d80172..7ce6dc002ae 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_sf.test +++ b/mysql-test/suite/engines/funcs/t/rpl_sf.test @@ -1,5 +1,5 @@ # Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR -source include/master-slave.inc; +--source include/master-slave.inc # save status let $oblf=`select @@SESSION.BINLOG_FORMAT`; @@ -66,3 +66,4 @@ drop function fn16456; eval set binlog_format=$oblf; eval set global log_bin_trust_function_creators=$otfc; --enable_query_log +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_skip_error.test b/mysql-test/suite/engines/funcs/t/rpl_skip_error.test index ff81e2f010e..083dfaa2075 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_skip_error.test +++ b/mysql-test/suite/engines/funcs/t/rpl_skip_error.test @@ -2,12 +2,10 @@ # 2006-02-07 By JBM: Added order by ######################################### # Note that errors are ignored by opt file. -source include/master-slave.inc; +--source include/master-slave.inc create table t1 (n int not null primary key); -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master insert into t1 values (1); connection master; # Here we expect (ignored) error, since 1 is already in slave table @@ -16,14 +14,13 @@ insert into t1 values (1); # These should work fine insert into t1 values (2),(3); -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master select * from t1 ORDER BY n; # Cleanup connection master; drop table t1; -sync_slave_with_master; +--sync_slave_with_master # End of 4.1 tests +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test index b3d6e49e215..677d95117fc 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test +++ b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test @@ -1,58 +1,2 @@ ---source include/master-slave.inc +--source suite/rpl/t/rpl_slave_status.test -############################################################################ -# Test case for BUG#10780 -# -# REQUIREMENT -# A slave without replication privileges should have Slave_IO_Running = No - -# 1. Create new replication user -connection master; -grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; - -connection slave; -stop slave; -change master to master_user='rpl',master_password='rpl'; -start slave; - -# 2. Do replication as new user -connection master; ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1 (n int); -insert into t1 values (1); -save_master_pos; -connection slave; -sync_with_master; -select * from t1; - -# 3. Delete new replication user -connection master; -drop user rpl@127.0.0.1; -sleep 1; -flush privileges; -connection slave; - -# 4. Restart slave without privileges -# (slave.err will contain access denied error for this START SLAVE command) -stop slave; -start slave; - -# 5. Make sure Slave_IO_Running = No ---replace_result $MASTER_MYPORT MASTER_MYPORT -# Column 1 is replaced, since the output can be either -# "Connecting to master" or "Waiting for master update" ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 # ---vertical_results -show slave status; - -# Cleanup (Note that slave IO thread is not running) -connection slave; -drop table t1; -connection master; -drop table t1; - -# end of test case for BUG#10780 - -# end of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_sp.test b/mysql-test/suite/engines/funcs/t/rpl_sp.test index ad2cc29375b..773062275c9 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_sp.test +++ b/mysql-test/suite/engines/funcs/t/rpl_sp.test @@ -1,496 +1,2 @@ -# row-based and statement have expected binlog difference in result files - -# Test of replication of stored procedures (WL#2146 for MySQL 5.0) -# Modified by WL#2971. - -source include/have_binlog_format_mixed.inc; -source include/master-slave.inc; - -# we need a db != test, where we don't have automatic grants ---disable_warnings -drop database if exists mysqltest1; ---enable_warnings -create database mysqltest1; -use mysqltest1; -create table t1 (a varchar(100)); -sync_slave_with_master; -use mysqltest1; - -# ********************** PART 1 : STORED PROCEDURES *************** - -# Does the same proc as on master get inserted into mysql.proc ? -# (same definer, same properties...) - -connection master; - -delimiter |; - -# Stored procedures don't have the limitations that functions have -# regarding binlogging: it's ok to create a procedure as not -# deterministic and updating data, while it's not ok to create such a -# function. We test this. - -create procedure foo() -begin - declare b int; - set b = 8; - insert into t1 values (b); - insert into t1 values (unix_timestamp()); -end| -delimiter ;| - -# we replace columns having times -# (even with fixed timestamp displayed time may changed based on TZ) ---replace_result localhost.localdomain localhost 127.0.0.1 localhost ---replace_column 13 # 14 # -select * from mysql.proc where name='foo' and db='mysqltest1'; -sync_slave_with_master; -# You will notice in the result that the definer does not match what -# it is on master, it is a known bug on which Alik is working ---replace_result localhost.localdomain localhost 127.0.0.1 localhost ---replace_column 13 # 14 # -select * from mysql.proc where name='foo' and db='mysqltest1'; - -connection master; -# see if timestamp used in SP on slave is same as on master -set timestamp=1000000000; -call foo(); -select * from t1; -sync_slave_with_master; -select * from t1; - -# Now a SP which is not updating tables - -connection master; -delete from t1; -create procedure foo2() - select * from mysqltest1.t1; -call foo2(); - -# check that this is allowed (it's not for functions): -alter procedure foo2 contains sql; - -# SP with definer's right - -drop table t1; -create table t1 (a int); -create table t2 like t1; - -create procedure foo3() - deterministic - insert into t1 values (15); - -# let's create a non-privileged user -grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1; -grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1; -grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1; - -# ToDo: BUG#14931: There is a race between the last grant binlogging, and -# the binlogging in the new connection made below, causing sporadic test -# failures due to switched statement order in binlog. To fix this we do -# SELECT 1 in the first connection before starting the second, ensuring -# that binlogging is done in the expected order. -# Please remove this SELECT 1 when BUG#14931 is fixed. -SELECT 1; - -connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,); -connection con1; - -# this routine will fail in the second INSERT because of privileges -delimiter |; -create procedure foo4() - deterministic - begin - insert into t2 values(3); - insert into t1 values (5); - end| - -delimiter ;| - -# I add ,0 so that it does not print the error in the test output, -# because this error is hostname-dependent ---error 1142,0 -call foo4(); # invoker has no INSERT grant on table t1 => failure - -connection master; -call foo3(); # success (definer == root) -show warnings; - ---error 1142,0 -call foo4(); # definer's rights => failure - -# we test replication of ALTER PROCEDURE -alter procedure foo4 sql security invoker; -call foo4(); # invoker's rights => success -show warnings; - -# Note that half-failed procedure calls are ok with binlogging; -# if we compare t2 on master and slave we see they are identical: - -select * from t1; -select * from t2; -sync_slave_with_master; -select * from t1; -select * from t2; - -# Test of DROP PROCEDURE - ---replace_result localhost.localdomain localhost 127.0.0.1 localhost ---replace_column 13 # 14 # -select * from mysql.proc where name="foo4" and db='mysqltest1'; -connection master; -drop procedure foo4; -select * from mysql.proc where name="foo4" and db='mysqltest1'; -sync_slave_with_master; -select * from mysql.proc where name="foo4" and db='mysqltest1'; - -# ********************** PART 2 : FUNCTIONS *************** - -connection master; -drop procedure foo; -drop procedure foo2; -drop procedure foo3; - -delimiter |; -# check that needs "deterministic" ---error 1418 -create function fn1(x int) - returns int -begin - insert into t1 values (x); - return x+2; -end| -create function fn1(x int) - returns int - deterministic -begin - insert into t1 values (x); - return x+2; -end| - -delimiter ;| -delete t1,t2 from t1,t2; -select fn1(20); -insert into t2 values(fn1(21)); ---sorted_result -select * from t1; -select * from t2; -sync_slave_with_master; ---sorted_result -select * from t1; -select * from t2; - -connection master; -delimiter |; - -drop function fn1; - -create function fn1() - returns int - no sql -begin - return unix_timestamp(); -end| - -delimiter ;| -# check that needs "deterministic" ---error 1418 -alter function fn1 contains sql; - -delete from t1; -set timestamp=1000000000; -insert into t1 values(fn1()); - -connection con1; - -delimiter |; ---error 1419 # only full-global-privs user can create a function -create function fn2() - returns int - no sql -begin - return unix_timestamp(); -end| -delimiter ;| -connection master; -set global log_bin_trust_function_creators=0; -set global log_bin_trust_function_creators=1; -# slave needs it too otherwise will not execute what master allowed: -connection slave; -set global log_bin_trust_function_creators=1; - -connection con1; - -delimiter |; -create function fn2() - returns int - no sql -begin - return unix_timestamp(); -end| -delimiter ;| - -connection master; - -# Now a function which is supposed to not update tables -# as it's "reads sql data", so should not give error even if -# non-deterministic. - -delimiter |; -create function fn3() - returns int - not deterministic - reads sql data -begin - return 0; -end| -delimiter ;| - -select fn3(); ---replace_result localhost.localdomain localhost 127.0.0.1 localhost ---replace_column 13 # 14 # -select * from mysql.proc where db='mysqltest1'; -select * from t1; - -sync_slave_with_master; -use mysqltest1; -select * from t1; ---replace_result localhost.localdomain localhost 127.0.0.1 localhost ---replace_column 13 # 14 # -select * from mysql.proc where db='mysqltest1'; - -# ********************** PART 3 : TRIGGERS *************** - -connection con1; -# now fails due to missing trigger grant (err 1142 i/o 1227) due to new -# check in sql_trigger.cc (v1.44) by anozdrin on 2006/02/01 --azundris ---error ER_TABLEACCESS_DENIED_ERROR -create trigger trg before insert on t1 for each row set new.a= 10; - -connection master; -delete from t1; -# TODO: when triggers can contain an update, test that this update -# does not go into binlog. -# I'm not setting user vars in the trigger, because replication of user vars -# would take care of propagating the user var's value to slave, so even if -# the trigger was not executed on slave it would not be discovered. -create trigger trg before insert on t1 for each row set new.a= 10; -insert into t1 values (1); -select * from t1; -sync_slave_with_master; -select * from t1; - -connection master; -delete from t1; -drop trigger trg; -insert into t1 values (1); -select * from t1; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -#show binlog events in 'master-bin.000001' from 106; -sync_slave_with_master; -select * from t1; - - -# -# Test for bug #13969 "Routines which are replicated from master can't be -# executed on slave". -# -connection master; -create procedure foo() - not deterministic - reads sql data - select * from t1; -sync_slave_with_master; -# This should not fail -call foo(); -connection master; -drop procedure foo; -sync_slave_with_master; - - -# Clean up -connection master; -drop function fn1; -drop database mysqltest1; -drop user "zedjzlcsjhd"@127.0.0.1; -use test; -sync_slave_with_master; -use test; - -# -# Bug#14077 "Failure to replicate a stored function with a cursor": -# verify that stored routines with cursors work on slave. -# -connection master; ---disable_warnings -drop function if exists f1; ---enable_warnings -delimiter |; -create function f1() returns int reads sql data -begin - declare var integer; - declare c cursor for select a from v1; - open c; - fetch c into var; - close c; - return var; -end| -delimiter ;| -create view v1 as select 1 as a; -create table t1 (a int); -insert into t1 (a) values (f1()); -select * from t1; -drop view v1; -drop function f1; -sync_slave_with_master; -connection slave; -select * from t1; - -# -# Bug#16621 "INSERTs in Stored Procedures causes data corruption in the Binary -# Log for 5.0.18" -# - -# Prepare environment. - -connection master; - ---disable_warnings -DROP PROCEDURE IF EXISTS p1; -DROP TABLE IF EXISTS t1; ---enable_warnings - -# Test case. - -CREATE TABLE t1(col VARCHAR(10)); - -CREATE PROCEDURE p1(arg VARCHAR(10)) - INSERT INTO t1 VALUES(arg); - -CALL p1('test'); - -SELECT * FROM t1; - -sync_slave_with_master; -SELECT * FROM t1; - -# Cleanup -connection master; -DROP PROCEDURE p1; - - -# -# BUG#20438: CREATE statements for views, stored routines and triggers can be -# not replicable. -# - ---echo ---echo ---> Test for BUG#20438 - -# Prepare environment. - ---echo ---echo ---> Preparing environment... ---echo ---> connection: master ---connection master - ---disable_warnings -DROP PROCEDURE IF EXISTS p1; -DROP FUNCTION IF EXISTS f1; ---enable_warnings - ---echo ---echo ---> Synchronizing slave with master... - ---save_master_pos ---connection slave ---sync_with_master - ---echo ---echo ---> connection: master ---connection master - -# Test. - ---echo ---echo ---> Creating procedure... - -/*!50003 CREATE PROCEDURE p1() SET @a = 1 */; - -/*!50003 CREATE FUNCTION f1() RETURNS INT RETURN 0 */; - ---echo ---echo ---> Checking on master... - -SHOW CREATE PROCEDURE p1; -SHOW CREATE FUNCTION f1; - ---echo ---echo ---> Synchronizing slave with master... - ---save_master_pos ---connection slave ---sync_with_master - ---echo ---> connection: master - ---echo ---echo ---> Checking on slave... - -SHOW CREATE PROCEDURE p1; -SHOW CREATE FUNCTION f1; - -# Cleanup. - ---echo ---echo ---> connection: master ---connection master - ---echo ---echo ---> Cleaning up... - -DROP PROCEDURE p1; -DROP FUNCTION f1; - ---save_master_pos ---connection slave ---sync_with_master ---connection master - - -# cleanup -connection master; -drop table t1; -sync_slave_with_master; - -# Restore log_bin_trust_function_creators to original value -set global log_bin_trust_function_creators=0; -connection master; -set global log_bin_trust_function_creators=0; ---echo End of 5.0 tests - -# -# Bug22043: MySQL don't add "USE <DATABASE>" before "DROP PROCEDURE IF EXISTS" -# -connection master; -reset master; ---disable_warnings -drop database if exists mysqltest; -drop database if exists mysqltest2; ---enable_warnings -create database mysqltest; -create database mysqltest2; -use mysqltest2; -create table t ( t integer ); -create procedure mysqltest.test() begin end; -insert into t values ( 1 ); -#show binlog events in 'master-bin.000001' from 106; ---error ER_BAD_DB_ERROR -create procedure `\\`.test() begin end; -# Clean up -drop database mysqltest; -drop database mysqltest2; - ---echo End of 5.1 tests +--source suite/rpl/t/rpl_sp.test diff --git a/mysql-test/suite/engines/funcs/t/rpl_sp004.test b/mysql-test/suite/engines/funcs/t/rpl_sp004.test index 967e7007c15..ca5c802b279 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_sp004.test +++ b/mysql-test/suite/engines/funcs/t/rpl_sp004.test @@ -1,97 +1,2 @@ -############################################################################# -# Original Author: JBM # -# Original Date: Aug/14/2005 # -############################################################################# -# Test: This test contains two sp that create and drop tables, insert and # -# updated data and uses the NOW() function. # -############################################################################# +--source suite/rpl/t/rpl_sp004.test - -# Includes --- source include/master-slave.inc - - -# Begin clean up test section -connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t3; ---enable_warnings -# End of cleanup - -# Begin test section 1 - -delimiter |; -CREATE PROCEDURE test.p1() -BEGIN - CREATE TABLE IF NOT EXISTS test.t1(a INT,PRIMARY KEY(a)); - CREATE TABLE IF NOT EXISTS test.t2(a INT,PRIMARY KEY(a)); - INSERT INTO test.t1 VALUES (4),(2),(1),(3); - UPDATE test.t1 SET a=a+4 WHERE a=4; - INSERT INTO test.t2 (a) SELECT t1.a FROM test.t1; - UPDATE test.t1 SET a=a+4 WHERE a=8; - CREATE TABLE IF NOT EXISTS test.t3(n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n)); -END| -CREATE PROCEDURE test.p2() -BEGIN - DROP TABLE IF EXISTS test.t1; - DROP TABLE IF EXISTS test.t2; - INSERT INTO test.t3 VALUES(NULL,11111111.233333,NOW()); -END| -delimiter ;| - -CALL test.p1(); -SELECT * FROM test.t1 ORDER BY a; -SELECT * FROM test.t2 ORDER BY a; -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM test.t1 ORDER BY a; -SELECT * FROM test.t2 ORDER BY a; - -connection master; -CALL test.p2(); -USE test; -SHOW TABLES; -#SELECT * FROM test.t3; -save_master_pos; -connection slave; -sync_with_master; -USE test; -SHOW TABLES; -#SELECT * FROM test.t3; - -connection master; -CALL test.p1(); -SELECT * FROM test.t1 ORDER BY a; -SELECT * FROM test.t2 ORDER BY a; -#SELECT * FROM test.t3; -save_master_pos; -connection slave; -sync_with_master; -SELECT * FROM test.t1 ORDER BY a; -SELECT * FROM test.t2 ORDER BY a; -#SELECT * FROM test.t3; - ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_slave.sql - -# Cleanup -connection master; -#show binlog events; -DROP PROCEDURE IF EXISTS test.p1; -DROP PROCEDURE IF EXISTS test.p2; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t3; -sync_slave_with_master; - -# If the test fails, you will need to diff the dumps to see why. - -diff_files $MYSQLTEST_VARDIR/tmp/sp004_master.sql $MYSQLTEST_VARDIR/tmp/sp004_slave.sql; - - -# End of 5.0 test case diff --git a/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test b/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test index 94ce539291d..29b27c728e4 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test +++ b/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test @@ -1,208 +1,2 @@ -########################################## -# Change Author: JBM -# Change Date: 2006-05-02 -########################################## +--source suite/rpl/t/rpl_sp_effects.test -# Test of replication of stored procedures (WL#2146 for MySQL 5.0) --- source include/master-slave.inc - -# **************************************************************** -connection master; - -# cleanup ---disable_warnings -drop procedure if exists p1; -drop procedure if exists p2; -drop function if exists f1; -drop table if exists t1,t2; -drop view if exists v1; ---enable_warnings -create table t1 (a int); - -SET GLOBAL log_bin_trust_function_creators = 1; - -# 1. Test simple variables use. -delimiter //; -create procedure p1() -begin - declare spv int default 0; - while spv < 5 do - insert into t1 values(spv+1); - set spv=spv+1; - end while; -end// -delimiter ;// - -call p1(); - -sync_slave_with_master; -connection slave; -SELECT * FROM t1 ORDER BY a; -connection master; -SELECT * FROM t1 ORDER BY a; - -# 2. Test SP variable name -delimiter //; -create procedure p2() -begin - declare a int default 4; - create table t2 as select a; -end// -delimiter ;// - -call p2(); -SELECT * FROM t2 ORDER BY a; -sync_slave_with_master; -connection slave; -SELECT * FROM t2 ORDER BY a; - -connection master; -drop procedure p1; -drop procedure p2; -drop table t2; - -# 3. Test FUNCTIONs in various places - -delimiter //; -create function f1(x int) returns int -begin - insert into t1 values(x); - return x+1; -end// - -create procedure p1(a int, b int) -begin - declare v int default f1(5); - if (f1(6)) then - select 'yes'; - end if; - set v = f1(7); - while f1(8) < 1 do - select 'this cant be'; - end while; - -end// -delimiter ;// - -call p1(f1(1), f1(2)); -SELECT * FROM t1 ORDER BY a; - -create table t2(a int); -insert into t2 values (10),(11); -SELECT a,f1(a) FROM t2 ORDER BY a; - -# This shouldn't put separate 'call f1(3)' into binlog: -insert into t2 select f1(3); -SELECT 'master:',a FROM t1 ORDER BY a; - -sync_slave_with_master; -connection slave; -SELECT 'slave:',a FROM t1 ORDER BY a; - -connection master; -drop procedure p1; -delete from t1; -delete from t2; - -# 4. VIEWs -delete from t1; -insert into t2 values(1),(2); -create view v1 as select f1(a) as f from t2; -select * from v1 order by f; -SELECT 'master:',a FROM t1 ORDER BY a; - -sync_slave_with_master; -connection slave; -SELECT 'slave:',a FROM t1 ORDER BY a; - -connection master; -drop view v1; -delete from t1; - -# 5. Prepared statements. -prepare s1 from 'select f1(?)'; -set @xx=123; -execute s1 using @xx; -SELECT 'master:',a FROM t1 ORDER BY a; - -sync_slave_with_master; -connection slave; -SELECT 'slave:',a FROM t1 ORDER BY a; - -connection master; -delete from t1; - -# 5. Cursors. -# t2 has (1),(2); -delimiter //; -create procedure p1(spv int) -begin - declare c cursor for select f1(spv) from t2; - while (spv > 2) do - open c; - fetch c into spv; - close c; - set spv= spv - 10; - end while; -end// -delimiter ;// -call p1(15); -SELECT 'master:',a FROM t1 ORDER BY a; -sync_slave_with_master; -connection slave; -SELECT 'slave:',a FROM t1 ORDER BY a; - -connection master; -drop procedure p1; -drop function f1; -drop table t1,t2; - -# BUG#12637: User variables + SPs replication -create table t1 (a int); -delimiter //; -create procedure p1() -begin - insert into t1 values(@x); - set @x=@x+1; - insert into t1 values(@x); - if (f2()) then - insert into t1 values(1243); - end if; -end// - -create function f2() returns int -begin - insert into t1 values(@z); - set @z=@z+1; - insert into t1 values(@z); - return 0; -end// - -create function f1() returns int -begin - insert into t1 values(@y); - call p1(); - return 0; -end// - -delimiter ;// - -set @x=10; -set @y=20; -set @z=100; -select f1(); - -set @x=30; -call p1(); - -SELECT 'master', a FROM t1 ORDER BY a; -sync_slave_with_master; -connection slave; -SELECT 'slave', a FROM t1 ORDER BY a; - -connection master; -drop table t1; -drop function f1; -drop function f2; -drop procedure p1; -sync_slave_with_master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test b/mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test index 19988cf902a..632a1a0232c 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test +++ b/mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test @@ -1,10 +1,10 @@ -source include/master-slave.inc; +--source include/master-slave.inc # # Bug#6148 () # connection slave; -stop slave; +--source include/stop_slave.inc # Let the master do lots of insertions connection master; @@ -17,20 +17,19 @@ while ($1) dec $1; } enable_query_log; -save_master_pos; connection slave; -start slave; -sleep 1; -stop slave io_thread; +--source include/start_slave.inc +--source include/stop_slave_io.inc start slave io_thread; -sync_with_master; +--source include/wait_for_slave_io_to_start.inc connection master; -drop table t1; -save_master_pos; +--sync_slave_with_master -connection slave; -sync_with_master; +connection master; +drop table t1; +--sync_slave_with_master -# End of 4.1 tests +# End of test +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test b/mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test index 017593fdfba..ca1b14201d3 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test +++ b/mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test @@ -20,7 +20,7 @@ # first, cause a duplicate key problem on the slave create table t1(n int auto_increment primary key, s char(10)); -sync_slave_with_master; +--sync_slave_with_master insert into t1 values (2,'old'); connection master; insert into t1 values(NULL,'new'); @@ -31,13 +31,13 @@ connection slave; wait_for_slave_to_stop; select * from t1 order by n; delete from t1 where n = 2; ---disable_warnings -start slave; ---enable_warnings + +--source include/start_slave.inc + sync_with_master; #now the buggy slave would be confused on the offset but it can replicate #in order to make it break, we need to stop/start the slave one more time -stop slave; +--source include/stop_slave.inc connection master; # to be able to really confuse the slave, we need some non-auto-increment # events in the log @@ -51,9 +51,9 @@ set sql_log_bin=1; delete from t1 where n=4; save_master_pos; connection slave; ---disable_warnings -start slave; ---enable_warnings + +--source include/start_slave.inc + #now the truth comes out - if the slave is buggy, it will never sync because #the slave thread is not able to read events sync_with_master; @@ -61,6 +61,6 @@ select * from t1 order by n; #clean up connection master; drop table t1; -sync_slave_with_master; - +--sync_slave_with_master +--source include/rpl_end.inc # End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test b/mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test index 66dc89bd712..e1f920b0928 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test +++ b/mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test @@ -1,93 +1,2 @@ -# It's true only in statement-based replication that a statement which -# updates no rows (UPDATE/DELETE) is binlogged; in row-based -# replication, as we log modified rows, nothing is binlogged in this -# case. So this test is meaningul only in statement-based (and if it was -# enabled in row-based, it would fail as expected). +--source suite/rpl/t/rpl_stm_no_op.test --- source include/have_binlog_format_mixed_or_statement.inc - -source include/master-slave.inc; - -# see if DROP DATABASE is binlogged even if no effect -connection slave; -create database mysqltest; -connection master; -drop database if exists mysqltest; -sync_slave_with_master; -# can't read dir ---replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X" \\ / ---error 1049 -show tables from mysqltest; - -# see if DROP TABLE is binlogged even if no effect -connection slave; -create table t1 (a int); -connection master; -drop table if exists t1; -sync_slave_with_master; -# table does not exist ---error 1146 -select * from t1; - -# see if single-table DELETE is binlogged even if no effect -connection master; -create table t1 (a int, b int); -sync_slave_with_master; -insert into t1 values(1,1); -connection master; -delete from t1; -sync_slave_with_master; -select * from t1; - -# see if single-table UPDATE is binlogged even if no effect -insert into t1 values(1,1); -connection master; -insert into t1 values(2,1); -update t1 set a=2; -sync_slave_with_master; -select * from t1; - -# End of 4.1 tests - -# see if multi-table UPDATE is binlogged even if no effect (BUG#13348) - -connection master; -create table t2 (a int, b int); -delete from t1; -insert into t1 values(1,1); -insert into t2 values(1,1); - -sync_slave_with_master; -# force a difference to see if master's multi-UPDATE will correct it -update t1 set a=2; - -connection master; -UPDATE t1, t2 SET t1.a = t2.a; - -sync_slave_with_master; -select * from t1; -select * from t2; - -# See if multi-table DELETE is binlogged even if no effect - -connection master; -delete from t1; -delete from t2; - -sync_slave_with_master; -# force a difference to see if master's multi-DELETE will correct it -insert into t1 values(1,1); -insert into t2 values(1,1); - -connection master; -DELETE t1.*, t2.* from t1, t2; - -sync_slave_with_master; -select * from t1; -select * from t2; - - -# cleanup -connection master; -drop table t1, t2; -sync_slave_with_master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test index 396ba4073e4..cd826c6be1e 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test @@ -1,564 +1 @@ --- source include/master-slave.inc - -connection default; -set @saved_binlog_format = @@global.binlog_format; - -# Since this test generates row-based events in the binary log, the -# slave SQL thread cannot be in STATEMENT mode to execute this test, -# so we only execute it for MIXED and ROW as default value of -# BINLOG_FORMAT. - -connection slave; --- source include/have_binlog_format_mixed_or_row.inc - -connection master; ---disable_warnings -drop database if exists mysqltest1; -create database mysqltest1; ---enable_warnings -use mysqltest1; -set session binlog_format=row; -set global binlog_format=row; - -show global variables like "binlog_format%"; -show session variables like "binlog_format%"; -select @@global.binlog_format, @@session.binlog_format; - -CREATE TABLE t1 (a varchar(100)); - -prepare stmt1 from 'insert into t1 select concat(UUID(),?)'; -set @string="emergency_1_"; -insert into t1 values("work_2_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values(concat(UUID(),"work_3_")); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values(concat("for_4_",UUID())); -insert into t1 select "yesterday_5_"; - -# verify that temp tables prevent a switch to SBR -create temporary table tmp(a char(100)); -insert into tmp values("see_6_"); ---error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR -set binlog_format=statement; -insert into t1 select * from tmp; -drop temporary table tmp; - -# Now we go to SBR -set binlog_format=statement; -show global variables like "binlog_format%"; -show session variables like "binlog_format%"; -select @@global.binlog_format, @@session.binlog_format; -set global binlog_format=statement; -show global variables like "binlog_format%"; -show session variables like "binlog_format%"; -select @@global.binlog_format, @@session.binlog_format; - -prepare stmt1 from 'insert into t1 select ?'; -set @string="emergency_7_"; -insert into t1 values("work_8_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values("work_9_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values("for_10_"); -insert into t1 select "yesterday_11_"; - -# test SET DEFAULT (=statement at this point of test) -set binlog_format=default; -select @@global.binlog_format, @@session.binlog_format; -# due to cluster it's hard to set back to default -#--error ER_NO_DEFAULT -set global binlog_format=default; -select @@global.binlog_format, @@session.binlog_format; - -prepare stmt1 from 'insert into t1 select ?'; -set @string="emergency_12_"; -insert into t1 values("work_13_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values("work_14_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values("for_15_"); -insert into t1 select "yesterday_16_"; - -# and now the mixed mode - -set binlog_format=mixed; -select @@global.binlog_format, @@session.binlog_format; -set global binlog_format=mixed; -select @@global.binlog_format, @@session.binlog_format; - -prepare stmt1 from 'insert into t1 select concat(UUID(),?)'; -set @string="emergency_17_"; -insert into t1 values("work_18_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values(concat(UUID(),"work_19_")); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values(concat("for_20_",UUID())); -insert into t1 select "yesterday_21_"; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values(concat(UUID(),"work_22_")); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values(concat("for_23_",UUID())); -insert into t1 select "yesterday_24_"; - -# Test of CREATE TABLE SELECT - -create table t2 select rpad(UUID(),100,' '); -create table t3 select 1 union select UUID(); -create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3); -create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); -# what if UUID() is first: ---disable_warnings -insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); ---enable_warnings - -# inside a stored procedure - -delimiter |; -create procedure foo() -begin -insert into t1 values("work_25_"); -insert into t1 values(concat("for_26_",UUID())); -insert into t1 select "yesterday_27_"; -end| -create procedure foo2() -begin -insert into t1 values(concat("emergency_28_",UUID())); -insert into t1 values("work_29_"); -insert into t1 values(concat("for_30_",UUID())); -set session binlog_format=row; # accepted for stored procs -insert into t1 values("more work_31_"); -set session binlog_format=mixed; -end| -create function foo3() returns bigint unsigned -begin - set session binlog_format=row; # rejected for stored funcs - insert into t1 values("alarm"); - return 100; -end| -create procedure foo4(x varchar(100)) -begin -insert into t1 values(concat("work_250_",x)); -insert into t1 select "yesterday_270_"; -end| -delimiter ;| -call foo(); -call foo2(); -call foo4("hello"); -call foo4(UUID()); -call foo4("world"); - -# test that can't SET in a stored function ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT -select foo3(); -select * from t1 where a="alarm"; - -# Tests of stored functions/triggers/views for BUG#20930 "Mixed -# binlogging mode does not work with stored functions, triggers, -# views" - -# Function which calls procedure -drop function foo3; -delimiter |; -create function foo3() returns bigint unsigned -begin - insert into t1 values("foo3_32_"); - call foo(); - return 100; -end| -delimiter ;| -insert into t2 select foo3(); - -prepare stmt1 from 'insert into t2 select foo3()'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# Test if stored function calls stored function which calls procedure -# which requires row-based. - -delimiter |; -create function foo4() returns bigint unsigned -begin - insert into t2 select foo3(); - return 100; -end| -delimiter ;| -select foo4(); - -prepare stmt1 from 'select foo4()'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# A simple stored function -delimiter |; -create function foo5() returns bigint unsigned -begin - insert into t2 select UUID(); - return 100; -end| -delimiter ;| -select foo5(); - -prepare stmt1 from 'select foo5()'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# A simple stored function where UUID() is in the argument -delimiter |; -create function foo6(x varchar(100)) returns bigint unsigned -begin - insert into t2 select x; - return 100; -end| -delimiter ;| -select foo6("foo6_1_"); -select foo6(concat("foo6_2_",UUID())); - -prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - - -# Test of views using UUID() - -create view v1 as select uuid(); -create table t11 (data varchar(255)); -insert into t11 select * from v1; -# Test of querying INFORMATION_SCHEMA which parses the view's body, -# to verify that it binlogs statement-based (is not polluted by -# the parsing of the view's body). -insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11'); -prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')"; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# Test of triggers with UUID() -delimiter |; -create trigger t11_bi before insert on t11 for each row -begin - set NEW.data = concat(NEW.data,UUID()); -end| -delimiter ;| -insert into t11 values("try_560_"); - -# DELAYED option not supported by table created -# using innodb. -# Test that INSERT DELAYED works in mixed mode (BUG#20649) -#insert delayed into t2 values("delay_1_"); -#insert delayed into t2 values(concat("delay_2_",UUID())); -#insert delayed into t2 values("delay_6_"); - -# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not -# replicate fine in statement-based ; we test that in mixed mode it -# works). -#insert delayed into t2 values(rand()); -#set @a=2.345; -#insert delayed into t2 values(@a); - -sleep 4; # time for the delayed inserts to reach disk - -# If you want to do manual testing of the mixed mode regarding UDFs (not -# testable automatically as quite platform- and compiler-dependent), -# you just need to set the variable below to 1, and to -# "make udf_example.so" in sql/, and to copy sql/udf_example.so to -# MYSQL_TEST_DIR/lib/mysql. -let $you_want_to_test_UDF=0; -if ($you_want_to_test_UDF) -{ - CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so'; - prepare stmt1 from 'insert into t1 select metaphon(?)'; - set @string="emergency_133_"; - insert into t1 values("work_134_"); - execute stmt1 using @string; - deallocate prepare stmt1; - prepare stmt1 from 'insert into t1 select ?'; - insert into t1 values(metaphon("work_135_")); - execute stmt1 using @string; - deallocate prepare stmt1; - insert into t1 values(metaphon("for_136_")); - insert into t1 select "yesterday_137_"; - create table t6 select metaphon("for_138_"); - create table t7 select 1 union select metaphon("for_139_"); - create table t8 select * from t1 where 3 in (select 1 union select 2 union select metaphon("for_140_") union select 3); - create table t9 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); -} - -create table t20 select * from t1; # save for comparing later -create table t21 select * from t2; -create table t22 select * from t3; -drop table t1,t2,t3; - -# This tests the fix to -# BUG#19630 stored function inserting into two auto_increment breaks statement-based binlog -# We verify that under the mixed binlog mode, a stored function -# modifying at least two tables having an auto_increment column, -# is binlogged row-based. Indeed in statement-based binlogging, -# only the auto_increment value generated for the first table -# is recorded in the binlog, the value generated for the 2nd table -# lacking. - -create table t1 (a int primary key auto_increment, b varchar(100)); -create table t2 (a int primary key auto_increment, b varchar(100)); -create table t3 (b varchar(100)); -delimiter |; -create function f (x varchar(100)) returns int deterministic -begin - insert into t1 values(null,x); - insert into t2 values(null,x); - return 1; -end| -delimiter ;| -select f("try_41_"); -# Two operations which compensate each other except that their net -# effect is that they advance the auto_increment counter of t2 on slave: -sync_slave_with_master; -use mysqltest1; -insert into t2 values(2,null),(3,null),(4,null); -delete from t2 where a>=2; - -connection master; -# this is the call which didn't replicate well -select f("try_42_"); -sync_slave_with_master; - -# now use prepared statement and test again, just to see that the RBB -# mode isn't set at PREPARE but at EXECUTE. - -insert into t2 values(3,null),(4,null); -delete from t2 where a>=3; - -connection master; -prepare stmt1 from 'select f(?)'; -set @string="try_43_"; -insert into t1 values(null,"try_44_"); # should be SBB -execute stmt1 using @string; # should be RBB -deallocate prepare stmt1; -sync_slave_with_master; - -# verify that if only one table has auto_inc, it does not trigger RBB -# (we'll check in binlog further below) - -connection master; -create table t12 select * from t1; # save for comparing later -drop table t1; -create table t1 (a int, b varchar(100), key(a)); -select f("try_45_"); - -# restore table's key -create table t13 select * from t1; -drop table t1; -create table t1 (a int primary key auto_increment, b varchar(100)); - -# now test if it's two functions, each of them inserts in one table - -drop function f; -# we need a unique key to have sorting of rows by mysqldump -create table t14 (unique (a)) select * from t2; -truncate table t2; -delimiter |; -create function f1 (x varchar(100)) returns int deterministic -begin - insert into t1 values(null,x); - return 1; -end| -create function f2 (x varchar(100)) returns int deterministic -begin - insert into t2 values(null,x); - return 1; -end| -delimiter ;| -select f1("try_46_"),f2("try_47_"); - -sync_slave_with_master; -insert into t2 values(2,null),(3,null),(4,null); -delete from t2 where a>=2; - -connection master; -# Test with SELECT and INSERT -select f1("try_48_"),f2("try_49_"); -insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_"))); -sync_slave_with_master; - -# verify that if f2 does only read on an auto_inc table, this does not -# switch to RBB -connection master; -drop function f2; -delimiter |; -create function f2 (x varchar(100)) returns int deterministic -begin - declare y int; - insert into t1 values(null,x); - set y = (select count(*) from t2); - return y; -end| -delimiter ;| -select f1("try_53_"),f2("try_54_"); -sync_slave_with_master; - -# And now, a normal statement with a trigger (no stored functions) - -connection master; -drop function f2; -delimiter |; -create trigger t1_bi before insert on t1 for each row -begin - insert into t2 values(null,"try_55_"); -end| -delimiter ;| -insert into t1 values(null,"try_56_"); -# and now remove one auto_increment and verify SBB -alter table t1 modify a int, drop primary key; -insert into t1 values(null,"try_57_"); -sync_slave_with_master; - -# Test for BUG#20499 "mixed mode with temporary table breaks binlog" -# Slave used to have only 2 rows instead of 3. -connection master; -CREATE TEMPORARY TABLE t15 SELECT UUID(); -create table t16 like t15; -INSERT INTO t16 SELECT * FROM t15; -# we'll verify that this one is done RBB -insert into t16 values("try_65_"); -drop table t15; -# we'll verify that this one is done SBB -insert into t16 values("try_66_"); -sync_slave_with_master; - -# and now compare: - -connection master; - -# first check that data on master is sensible -select count(*) from t1; -select count(*) from t2; -select count(*) from t3; -select count(*) from t4; -select count(*) from t5; -select count(*) from t11; -select count(*) from t20; -select count(*) from t21; -select count(*) from t22; -select count(*) from t12; -select count(*) from t13; -select count(*) from t14; -select count(*) from t16; -if ($you_want_to_test_UDF) -{ - select count(*) from t6; - select count(*) from t7; - select count(*) from t8; - select count(*) from t9; -} - -sync_slave_with_master; - -# -# Bug#20863 If binlog format is changed between update and unlock of -# tables, wrong binlog -# - -connection master; -DROP TABLE IF EXISTS t11; -SET SESSION BINLOG_FORMAT=STATEMENT; -CREATE TABLE t11 (song VARCHAR(255)); -LOCK TABLES t11 WRITE; -SET SESSION BINLOG_FORMAT=ROW; -INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict'); -SET SESSION BINLOG_FORMAT=STATEMENT; -INSERT INTO t11 VALUES('Careful With That Axe, Eugene'); -UNLOCK TABLES; - ---query_vertical SELECT * FROM t11 -sync_slave_with_master; -USE mysqltest1; ---query_vertical SELECT * FROM t11 - -connection master; -DROP TABLE IF EXISTS t12; -SET SESSION BINLOG_FORMAT=MIXED; -CREATE TABLE t12 (data LONG); -LOCK TABLES t12 WRITE; -INSERT INTO t12 VALUES(UUID()); -UNLOCK TABLES; - ---disable_result_log ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events; ---enable_result_log -sync_slave_with_master; - -# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql - -# Let's compare. Note: If they match test will pass, if they do not match -# the test will show that the diff statement failed and not reject file -# will be created. You will need to go to the mysql-test dir and diff -# the files your self to see what is not matching - -diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; - -connection master; ---disable_result_log ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events; ---enable_result_log - -# Now test that mysqlbinlog works fine on a binlog generated by the -# mixed mode - -# BUG#11312 "DELIMITER is not written to the binary log that causes -# syntax error" makes that mysqlbinlog will fail if we pass it the -# text of queries; this forces us to use --base64-output here. - -# BUG#20929 "BINLOG command causes invalid free plus assertion -# failure" makes mysqld segfault when receiving --base64-output - -# So I can't enable this piece of test -# SIGH - -if ($enable_when_11312_or_20929_fixed) -{ ---exec $MYSQL_BINLOG --base64-output $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql -drop database mysqltest1; ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql -# the old mysqldump output on slave is the same as what it was on -# master before restoring on master. -diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; -} - -drop database mysqltest1; -sync_slave_with_master; - -connection default; -set global binlog_format= @saved_binlog_format; +--source extra/rpl_tests/rpl_switch_stm_row_mixed.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_temp_table.test b/mysql-test/suite/engines/funcs/t/rpl_temp_table.test index c13470f20b6..43b5ce49129 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_temp_table.test +++ b/mysql-test/suite/engines/funcs/t/rpl_temp_table.test @@ -1,69 +1,2 @@ -# drop table t1 t2 t3 are included int master-slave.inc -# meaningful only in statement-based: +--source suite/rpl/t/rpl_temp_table.test --- source include/have_binlog_format_mixed_or_statement.inc --- source include/master-slave.inc - ---disable_query_log -CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); ---enable_query_log - - -create table t2 (n int, PRIMARY KEY(n)); -create temporary table t1 (n int); -create temporary table t3 (n int not null); - -insert into t1 values(1),(2),(3),(100),(25),(26),(200),(300); ---disable_warnings -insert into t2 select * from t1; ---enable_warnings -alter table t3 add primary key(n); - -flush logs; -insert into t3 values (1010); ---disable_warnings -insert into t2 select * from t3; ---enable_warnings - -drop table if exists t3; -insert into t2 values (1012); - -connection master1; -create temporary table t1 (n int); -insert into t1 values (4),(5); ---disable_warnings -insert into t2 select * from t1; ---enable_warnings - -save_master_pos; -disconnect master; - -connection slave; -#add 1 to the saved position, so we will catch drop table on disconnect -#for sure -sync_with_master 1; - -connection master1; -insert into t2 values(61); - -save_master_pos; -disconnect master1; - -connection slave; -#same trick - make sure we catch drop of temporary table on disconnect -sync_with_master 1; - -select * from t2; -select count(*) from t2; -select sum(n) from t2; -show status like 'Slave_open_temp_tables'; - -# -# Clean up -# -connect (master2,localhost,root,,); -connection master2; -drop table if exists t1,t2; -save_master_pos; -connection slave; -sync_with_master; diff --git a/mysql-test/suite/engines/funcs/t/rpl_temporary.test b/mysql-test/suite/engines/funcs/t/rpl_temporary.test index aa90a5153bf..460ea55a675 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_temporary.test +++ b/mysql-test/suite/engines/funcs/t/rpl_temporary.test @@ -1,235 +1,2 @@ +--source suite/rpl/t/rpl_temporary.test --- source include/master-slave.inc - -# Clean up old slave's binlogs. -# The slave is started with --log-slave-updates -# and this test does SHOW BINLOG EVENTS on the slave's -# binlog. But previous tests can influence the current test's -# binlog (e.g. a temporary table in the previous test has not -# been explicitly deleted, or it has but the slave hasn't had -# enough time to catch it before STOP SLAVE, -# and at the beginning of the current -# test the slave immediately writes DROP TEMPORARY TABLE this_old_table). -# We wait for the slave to have written all he wants to the binlog -# (otherwise RESET MASTER may come too early). -save_master_pos; -connection slave; -sync_with_master; -reset master; -connection master; - ---disable_query_log -CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); ---enable_query_log - -connect (con1,localhost,root,,); - -#added on 2007/5/18 -connection con1; -CREATE USER ''@localhost; - -connect (con2,localhost,root,,); -# We want to connect as an unprivileged user. But if we use user="" then this -# will pick the Unix login, which will cause problems if you're running the test -# as root. -connect (con3,localhost,zedjzlcsjhd,,); - -# We are going to use SET PSEUDO_THREAD_ID in this test; -# check that it requires the SUPER privilege. - -connection con3; -SET @save_select_limit=@@session.sql_select_limit; ---error 1227 -SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100; -SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed -# While we are here we also test that SQL_LOG_BIN can't be set ---error 1227 -SET @@session.sql_select_limit=10, @@session.sql_log_bin=0; -SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed -# Now as root, to be sure it works -connection con2; -SET @@session.pseudo_thread_id=100; -SET @@session.pseudo_thread_id=connection_id(); -SET @@session.sql_log_bin=0; -SET @@session.sql_log_bin=1; - -connection con3; -let $VERSION=`select version()`; - ---disable_warnings -drop table if exists t1,t2; ---enable_warnings - -create table t1(f int); -create table t2(f int); -insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); - -connection con1; -create temporary table t3(f int); ---disable_warnings -insert into t3 select * from t1 where f<6; ---enable_warnings -sleep 1; - -connection con2; -create temporary table t3(f int); -sleep 1; - -connection con1; ---disable_warnings -insert into t2 select count(*) from t3; ---enable_warnings -sleep 1; - -connection con2; ---disable_warnings -insert into t3 select * from t1 where f>=4; ---enable_warnings -sleep 1; - -connection con1; -drop temporary table t3; -sleep 1; - -connection con2; ---disable_warnings -insert into t2 select count(*) from t3; ---enable_warnings -drop temporary table t3; - -select * from t2 ORDER BY f; - -# Commented out 8/30/2005 to make compatable with both sbr and rbr -#--replace_result $VERSION VERSION -#--replace_column 2 # 5 # -#show binlog events; - -drop table t1, t2; - -use test; -SET TIMESTAMP=1040323920; -create table t1(f int); -SET TIMESTAMP=1040323931; -create table t2(f int); -SET TIMESTAMP=1040323938; -insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); - -SET TIMESTAMP=1040323945; -SET @@session.pseudo_thread_id=1; -create temporary table t3(f int); -SET TIMESTAMP=1040323952; -SET @@session.pseudo_thread_id=1; ---disable_warnings -insert into t3 select * from t1 where f<6; ---enable_warnings -SET TIMESTAMP=1040324145; -SET @@session.pseudo_thread_id=2; -create temporary table t3(f int); -SET TIMESTAMP=1040324186; -SET @@session.pseudo_thread_id=1; ---disable_warnings -insert into t2 select count(*) from t3; ---enable_warnings -SET TIMESTAMP=1040324200; -SET @@session.pseudo_thread_id=2; ---disable_warnings -insert into t3 select * from t1 where f>=4; ---enable_warnings -SET TIMESTAMP=1040324211; -SET @@session.pseudo_thread_id=1; -drop temporary table t3; -SET TIMESTAMP=1040324219; -SET @@session.pseudo_thread_id=2; ---disable_warnings -insert into t2 select count(*) from t3; ---enable_warnings -SET TIMESTAMP=1040324224; -SET @@session.pseudo_thread_id=2; -drop temporary table t3; - -select * from t2 ORDER BY f; -drop table t1,t2; - -# Create last a temporary table that is not dropped at end to ensure that we -# don't get any memory leaks for this - -create temporary table t3 (f int); -#sync_with_master; - -# The server will now close done - -# -# Bug#17284 erroneous temp table cleanup on slave -# - -connection master; -create temporary table t4 (f int); -create table t5 (f int); -#sync_with_master; -# find dumper's $id -select id from information_schema.processlist where command='Binlog Dump' into @id; -kill @id; # to stimulate reconnection by slave w/o timeout ---disable_warnings -insert into t5 select * from t4; ---enable_warnings -save_master_pos; - -connection slave; -sync_with_master; -select * from t5 /* must be 1 after reconnection */; - -connection master; -drop temporary table t4; -drop table t5; - -# -# BUG#17263 incorrect generation DROP temp tables -# Temporary tables of connection are dropped in batches -# where a batch correspond to pseudo_thread_id -# value was set up at the moment of temp table creation -# -connection con1; -set @@session.pseudo_thread_id=100; -create temporary table t101 (id int); -create temporary table t102 (id int); -set @@session.pseudo_thread_id=200; -create temporary table t201 (id int); -create temporary table `t``201` (id int); -# emulate internal temp table not to come to binlog -create temporary table `#sql_not_user_table202` (id int); -set @@session.pseudo_thread_id=300; -create temporary table t301 (id int); -create temporary table t302 (id int); -create temporary table `#sql_not_user_table303` (id int); - - -#Added on 2007/5/18 -DROP USER ''@localhost; - -disconnect con1; - -#now do something to show that slave is ok after DROP temp tables -connection master; -create table t1(f int); -insert into t1 values (1); - -sync_slave_with_master; -#connection slave; -select * from t1 /* must be 1 */; - -connection master; -drop table t1; - -# -#14157: utf8 encoding in binlog without set character_set_client -# -exec $MYSQL --character-sets-dir=../sql/share/charsets/ --default-character-set=latin1 test -e "create table t1 (a int); set names latin1; create temporary table äöüÄÖÜ (a int); insert into äöüÄÖÜ values (1); insert into t1 select * from äöüÄÖÜ"; - -sync_slave_with_master; -#connection slave; -select * from t1; - -connection master; -drop table t1; - -# End of 5.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_trigger.test b/mysql-test/suite/engines/funcs/t/rpl_trigger.test index 77cc7a3b2c0..4f61e738200 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_trigger.test +++ b/mysql-test/suite/engines/funcs/t/rpl_trigger.test @@ -5,16 +5,7 @@ --source include/have_binlog_format_mixed_or_statement.inc --source include/master-slave.inc -disable_query_log; call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -enable_query_log; - ---disable_warnings -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -DROP TABLE IF EXISTS t3; - ---enable_warnings # # #12482: Triggers has side effects with auto_increment values @@ -45,19 +36,16 @@ SET @@RAND_SEED1=658490765, @@RAND_SEED2=635893186; --disable_warnings insert into t1 values(1,1,rand()),(NULL,2,rand()); insert into t2 (b) values(last_insert_id()); -insert into t2 values(3,0),(NULL,0); -insert into t2 values(NULL,0),(500,0); +insert into t2 values(3,0); +insert into t2 values(NULL,0); +insert into t2 values(NULL,0); +insert into t2 values(500,0); --enable_warnings select a,b, truncate(rand_value,4) from t1; select * from t2; select a,name, old_a, old_b, truncate(rand_value,4) from t3; -save_master_pos; -connection slave; -sync_with_master; ---disable_query_log -select "--- On slave --" as ""; ---enable_query_log +--sync_slave_with_master select a,b, truncate(rand_value,4) from t1; select * from t2; select a,name, old_a, old_b, truncate(rand_value,4) from t3; @@ -109,17 +97,14 @@ let $time=`select a from t1`; # - dump definers on the slave; SELECT routine_name, definer -FROM information_schema.routines; +FROM information_schema.routines +WHERE routine_name = 'bug12480'; SELECT trigger_name, definer -FROM information_schema.triggers; +FROM information_schema.triggers +WHERE trigger_name = 't1_first'; -save_master_pos; -connection slave; -sync_with_master; ---disable_query_log -select "--- On slave --" as ""; ---enable_query_log +--sync_slave_with_master # XXX: Definers of stored procedures and functions are not replicated. WL#2897 # (Complete definer support in the stored routines) addresses this issue. So, @@ -127,10 +112,12 @@ select "--- On slave --" as ""; # item. SELECT routine_name, definer -FROM information_schema.routines; +FROM information_schema.routines +WHERE routine_name = 'bug12480'; SELECT trigger_name, definer -FROM information_schema.triggers; +FROM information_schema.triggers +WHERE trigger_name = 't1_first'; select a=b && a=c from t1; --disable_query_log @@ -170,9 +157,7 @@ create database other; use other; insert into test.t1 values (1); -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master connection master; use test; @@ -219,7 +204,7 @@ while ($rnd) dec $i; } - sync_slave_with_master; + --sync_slave_with_master #connection slave; eval select * from t1$rnd; delimiter |; @@ -258,7 +243,7 @@ while ($rnd) dec $i; } - sync_slave_with_master; + --sync_slave_with_master #connection slave; eval SELECT * from t1$rnd /* must be f1 $max_rows ... 1 */; eval SELECT * from t3$rnd /* must be f3 $max_rows * 100 ... 100 */; @@ -270,6 +255,8 @@ while ($rnd) connection master; eval drop table t1$rnd; + --sync_slave_with_master + connection master; dec $rnd; } @@ -300,26 +287,42 @@ while ($rnd) # Stop the slave. connection slave; -STOP SLAVE; +--source include/stop_slave.inc # Replace master's binlog. connection master; +let $MYSQLD_DATADIR= `select @@datadir`; FLUSH LOGS; -let $DATADIR = `select @@datadir`; -remove_file $DATADIR/master-bin.000001; -copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $DATADIR/master-bin.000001; + +# Stop master server +--let $rpl_server_number= 1 +--source include/rpl_stop_server.inc + +# Replace binlog +remove_file $MYSQLD_DATADIR/master-bin.000001; +copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLD_DATADIR/master-bin.000001; + +--let $rpl_server_number= 1 +--source include/rpl_start_server.inc + +let $binlog_version= query_get_value(SHOW BINLOG EVENTS, Info, 1); + + +# Make the slave to replay the new binlog. +--echo --> Master binlog: $binlog_version # Make the slave to replay the new binlog. connection slave; RESET SLAVE; -START SLAVE; +--source include/start_slave.inc SELECT MASTER_POS_WAIT('master-bin.000001', 513) >= 0; # Check that the replication succeeded. SHOW TABLES LIKE 't_'; +--replace_column 6 # SHOW TRIGGERS; SELECT * FROM t1; SELECT * FROM t2; @@ -338,7 +341,7 @@ DROP TRIGGER trg1; DROP TABLE t1; DROP TABLE t2; -STOP SLAVE; +--source include/stop_slave.inc RESET SLAVE; # The master should be clean. @@ -352,7 +355,7 @@ RESET MASTER; # Restart slave. connection slave; -START SLAVE; +--source include/start_slave.inc # @@ -367,7 +370,6 @@ START SLAVE; --echo --echo ---> Preparing environment... ---echo ---> connection: master --connection master --disable_warnings @@ -378,12 +380,9 @@ DROP TABLE IF EXISTS t2; --echo --echo ---> Synchronizing slave with master... ---save_master_pos ---connection slave ---sync_with_master +--sync_slave_with_master --echo ---echo ---> connection: master --connection master # Test. @@ -412,11 +411,7 @@ SELECT * FROM t2; --echo --echo ---> Synchronizing slave with master... ---save_master_pos ---connection slave ---sync_with_master - ---echo ---> connection: master +--sync_slave_with_master --echo --echo ---> Checking on slave... @@ -427,7 +422,6 @@ SELECT * FROM t2; # Cleanup. --echo ---echo ---> connection: master --connection master --echo @@ -436,9 +430,7 @@ SELECT * FROM t2; DROP TABLE t1; DROP TABLE t2; ---save_master_pos ---connection slave ---sync_with_master +--sync_slave_with_master --connection master # @@ -469,9 +461,7 @@ insert into t1 values (3, "c"); select * from t1; -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master select * from t1; @@ -481,6 +471,5 @@ drop table if exists t1,t11; # # End of tests # -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test b/mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test index 28bcb0c06c3..fa072022824 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test +++ b/mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test @@ -1,35 +1,2 @@ -# Requires statement logging --- source include/have_binlog_format_mixed_or_statement.inc +--source suite/rpl/t/rpl_trunc_temp.test -source include/master-slave.inc; - -# -# Bug#17137 Running "truncate table" on temporary table -# leaves the table open on a slave -# - -create temporary table t1 (n int); -insert into t1 values(1); -sync_slave_with_master; -show status like 'Slave_open_temp_tables'; - -# Perform a delete from temp table -connection master; -delete from t1; -sync_slave_with_master; -show status like 'Slave_open_temp_tables'; - -# Perform truncate on temp table -connection master; -truncate t1; -sync_slave_with_master; -show status like 'Slave_open_temp_tables'; - -# Disconnect the master, temp table on slave should dissapear -disconnect master; ---real_sleep 3 # time for DROP to be read by slave -connection slave; -show status like 'Slave_open_temp_tables'; - - -# End of 4.1 tests diff --git a/mysql-test/suite/engines/funcs/t/rpl_user_variables.test b/mysql-test/suite/engines/funcs/t/rpl_user_variables.test index 530cda3d87a..1b78f2b5fb5 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_user_variables.test +++ b/mysql-test/suite/engines/funcs/t/rpl_user_variables.test @@ -1,57 +1,2 @@ -################################### -# -# Test of replicating user variables -# -################################### +--source suite/rpl/t/rpl_user_variables.test --- source include/master-slave.inc -# Disable PS as the log positions differs ---disable_ps_protocol - - -# Clean up old slave's binlogs. -# The slave is started with --log-slave-updates -# and this test does SHOW BINLOG EVENTS on the slave's -# binlog. But previous tests can influence the current test's -# binlog (e.g. a temporary table in the previous test has not -# been explicitly deleted, or it has but the slave hasn't had -# enough time to catch it before STOP SLAVE, -# and at the beginning of the current -# test the slave immediately writes DROP TEMPORARY TABLE this_old_table). -# We wait for the slave to have written all he wants to the binlog -# (otherwise RESET MASTER may come too early). -save_master_pos; -connection slave; -sync_with_master; -reset master; -connection master; - -create table t1(n char(30)); -set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1; -set @s1:='This is a test', @r1:=12.5, @r2:=-12.5; -set @n1:=null; -set @s2:='', @s3:='abc\'def', @s4:= 'abc\\def', @s5:= 'abc''def'; -insert into t1 values (@i1), (@i2), (@i3), (@i4); -insert into t1 values (@r1), (@r2); -insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5); -insert into t1 values (@n1); -insert into t1 values (@n2); # not explicitly set before -insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1); -insert into t1 values (@a+(@b:=@a+1)); -set @q:='abc'; -insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2')); -set @a:=5; -insert into t1 values (@a),(@a); -# To flush the pending event, we add the following statement. RBR can -# concatenate the result of several statements, which SBR cannot. -select * from t1 where n = '<nonexistant>'; -connection master1; # see if variable is reset in binlog when thread changes -insert into t1 values (@a),(@a),(@a*5); -SELECT * FROM t1 ORDER BY n; -sync_slave_with_master; -SELECT * FROM t1 ORDER BY n; -connection master; -insert into t1 select * FROM (select @var1 union select @var2) AS t2; -drop table t1; -sync_slave_with_master; -stop slave; diff --git a/mysql-test/suite/engines/funcs/t/rpl_variables.test b/mysql-test/suite/engines/funcs/t/rpl_variables.test index 031131a3f2b..ca612a5593b 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_variables.test +++ b/mysql-test/suite/engines/funcs/t/rpl_variables.test @@ -1,4 +1,4 @@ -source include/master-slave.inc; +--source include/master-slave.inc # Init for restoration of variable values set @my_slave_net_timeout =@@global.slave_net_timeout; @@ -19,3 +19,4 @@ show variables like 'slave_skip_errors'; # Cleanup set global slave_net_timeout=@my_slave_net_timeout; set global sql_slave_skip_counter=@my_sql_slave_skip_counter; +--source include/rpl_end.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_view-slave.opt b/mysql-test/suite/engines/funcs/t/rpl_view-slave.opt deleted file mode 100644 index 79b3bf6174b..00000000000 --- a/mysql-test/suite/engines/funcs/t/rpl_view-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---replicate-ignore-table=test.foo diff --git a/mysql-test/suite/engines/funcs/t/rpl_view.test b/mysql-test/suite/engines/funcs/t/rpl_view.test index 3eff8f7550a..b81b22ece4e 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_view.test +++ b/mysql-test/suite/engines/funcs/t/rpl_view.test @@ -1,155 +1,2 @@ -# NYI - row-based cannot use CREATE ... SELECT +--source suite/rpl/t/rpl_view.test -source include/master-slave.inc; ---disable_warnings -drop table if exists t1,v1; -drop view if exists t1,v1; -sync_slave_with_master; -reset master; ---enable_warnings - -# -# Check that creation drop of view is replicated, also check replication of -# updating of view -# -connection master; -create table t1 (a int); -insert into t1 values (1); -create view v1 as select a from t1; -insert into v1 values (2); -select * from v1 order by a; -sync_slave_with_master; -# view already have to be on slave -select * from v1 order by a; -connection master; -update v1 set a=3 where a=1; -select * from v1 order by a; -sync_slave_with_master; -select * from v1 order by a; -connection master; -delete from v1 where a=2; -select * from v1 order by a; -sync_slave_with_master; -select * from v1 order by a; -connection master; -# 'alter view' internally maped to creation, but still check that it works -alter view v1 as select a as b from t1; -sync_slave_with_master; -select * from v1 order by 1; -connection master; -drop view v1; -sync_slave_with_master; -#error, because view have to be removed from slave --- error 1146 -select * from v1 order by a; -connection master; -drop table t1; -sync_slave_with_master; -# Change Author: JBM -# Change Date: 2005-12-22 -# Change: Commented out binlog events to work with SBR and RBR -#--replace_column 2 # 5 # -# show binlog events limit 1,100; - -# -# BUG#20438: CREATE statements for views, stored routines and triggers can be -# not replicable. -# - ---echo ---echo ---> Test for BUG#20438 - -# Prepare environment. - ---echo ---echo ---> Preparing environment... ---echo ---> connection: master ---connection master - ---disable_warnings -DROP TABLE IF EXISTS t1; -DROP VIEW IF EXISTS v1; ---enable_warnings - ---echo ---echo ---> Synchronizing slave with master... - ---save_master_pos ---connection slave ---sync_with_master - ---echo ---echo ---> connection: master ---connection master - -# Test. - ---echo ---echo ---> Creating objects... - -CREATE TABLE t1(c INT); - -/*!50003 CREATE VIEW v1 AS SELECT * FROM t1 */; - ---echo ---echo ---> Inserting value... - -INSERT INTO t1 VALUES(1); - ---echo ---echo ---> Checking on master... - -SELECT * FROM t1; - ---echo ---echo ---> Synchronizing slave with master... - ---save_master_pos ---connection slave ---sync_with_master - ---echo ---> connection: master - ---echo ---echo ---> Checking on slave... - -SELECT * FROM t1; - -# Cleanup. - ---echo ---echo ---> connection: master ---connection master - ---echo ---echo ---> Cleaning up... - -DROP VIEW v1; -DROP TABLE t1; - ---save_master_pos ---connection slave ---sync_with_master ---connection master - -# -# BUG#19419: "VIEW: View that the column name is different -# by master and slave is made". -# -connection master; -create table t1(a int, b int); -insert into t1 values (1, 1), (1, 2), (1, 3); -create view v1(a, b) as select a, sum(b) from t1 group by a; - -sync_slave_with_master; -explain v1; -show create table v1; -select * from v1; - -connection master; -drop table t1; -drop view v1; - -sync_slave_with_master; - ---echo End of 5.0 tests diff --git a/mysql-test/suite/engines/iuds/r/insert_decimal.result b/mysql-test/suite/engines/iuds/r/insert_decimal.result index c0f3224e26f..4a6ad168a1d 100644 --- a/mysql-test/suite/engines/iuds/r/insert_decimal.result +++ b/mysql-test/suite/engines/iuds/r/insert_decimal.result @@ -110,15 +110,12 @@ Warnings: Warning 1264 Out of range value for column 'c1' at row 1 Warning 1264 Out of range value for column 'c2' at row 1 Warning 1264 Out of range value for column 'c3' at row 1 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c1` at row 2 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c2` at row 2 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c3` at row 2 +Warning 1264 Out of range value for column 'c1' at row 2 +Warning 1264 Out of range value for column 'c2' at row 2 +Warning 1264 Out of range value for column 'c3' at row 2 Note 1265 Data truncated for column 'c1' at row 3 Note 1265 Data truncated for column 'c2' at row 3 Note 1265 Data truncated for column 'c3' at row 3 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c1` at row 4 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c2` at row 4 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c3` at row 4 SELECT * FROM t1; c1 c2 c3 c4 0.00000 -0.10000 0 13 @@ -142,7 +139,6 @@ c1 c2 c3 c4 0 0 0 15 0 0 0 26 0 0 0 29 -0 0 0 31 0 0 0 32 0 0 0 33 0 0 0 7 @@ -160,6 +156,7 @@ c1 c2 c3 c4 9999999999 9999999999 9999999999 25 9999999999 9999999999 9999999999 28 9999999999 9999999999 9999999999 30 +9999999999 9999999999 9999999999 31 SELECT count(*) as total_rows, min(c1) as min_value, max(c1) as max_value, sum(c1) as sum, avg(c1) as avg FROM t1; total_rows min_value max_value sum avg 7 0.00000 99999.99999 212446.04999 30349.435712857 @@ -171,13 +168,13 @@ total_rows min_value max_value sum avg 7 0 111111111 111211212 18535202.0000 SELECT count(*) as total_rows, min(c1) as min_value, max(c1) as max_value, sum(c1) as sum, avg(c1) as avg FROM t2; total_rows min_value max_value sum avg -30 -9999999999 9999999999 21322222222 710740740.7333 +30 -9999999999 9999999999 31322222221 1044074074.0333 SELECT count(*) as total_rows, min(c2) as min_value, max(c2) as max_value, sum(c2) as sum, avg(c2) as avg FROM t2; total_rows min_value max_value sum avg -30 0 9999999999 33444444445 1114814814.8333 +30 0 9999999999 43444444444 1448148148.1333 SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c3) as sum, avg(c3) as avg FROM t2; total_rows min_value max_value sum avg -30 -9999999999 9999999999 43322222220 1444074074.0000 +30 -9999999999 9999999999 53322222219 1777407407.3000 SELECT * FROM t1; c1 c2 c3 c4 0.00000 -0.10000 0 13 diff --git a/mysql-test/suite/federated/federatedx.result b/mysql-test/suite/federated/federatedx.result index 84dcb0d0a8c..af01bb3d90f 100644 --- a/mysql-test/suite/federated/federatedx.result +++ b/mysql-test/suite/federated/federatedx.result @@ -2283,6 +2283,32 @@ connection default; connection master; CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:SLAVE_PORT/federated/t1'; ERROR HY000: Can't create federated table. Foreign data src error: database: 'federated' username: '' hostname: '127.0.0.1' +# +# MDEV-17573 Assertion in federatedx on multi-update +# +create table t1 ( +x int, +d datetime); +create table t1f engine=FEDERATED connection='mysql://root@127.0.0.1:MASTER_MYPORT/test/t1'; +create table t2 ( +x int, y int, +d datetime); +create table t2f engine=FEDERATED connection='mysql://root@127.0.0.1:MASTER_MYPORT/test/t2'; +create table t3 ( +x int, y int, z int, +d datetime); +create table t3f engine=FEDERATED connection='mysql://root@127.0.0.1:MASTER_MYPORT/test/t3'; +insert into t1 values (1, "1990-01-01 00:00"); +insert into t1 values (1, "1991-01-01 11:11"); +insert into t2 values (2, 2, "1992-02-02 22:22"); +insert into t3 values (3, 3, 3, "1993-03-03 23:33"); +update t1f, t2f, t3f set t1f.x= 11, t2f.y= 22, t3f.z= 33; +drop table t1f; +drop table t2f; +drop table t3f; +drop table t1; +drop table t2; +drop table t3; connection master; DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/suite/federated/federatedx.test b/mysql-test/suite/federated/federatedx.test index 29d1eaddc26..bd03f744639 100644 --- a/mysql-test/suite/federated/federatedx.test +++ b/mysql-test/suite/federated/federatedx.test @@ -2010,4 +2010,33 @@ connection master; --error ER_CANT_CREATE_FEDERATED_TABLE eval CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:$SLAVE_MYPORT/federated/t1'; +--echo # +--echo # MDEV-17573 Assertion in federatedx on multi-update +--echo # +create table t1 ( + x int, + d datetime); +--replace_result $MASTER_MYPORT MASTER_MYPORT +eval create table t1f engine=FEDERATED connection='mysql://root@127.0.0.1:$MASTER_MYPORT/test/t1'; + +create table t2 ( + x int, y int, + d datetime); +--replace_result $MASTER_MYPORT MASTER_MYPORT +eval create table t2f engine=FEDERATED connection='mysql://root@127.0.0.1:$MASTER_MYPORT/test/t2'; + +create table t3 ( + x int, y int, z int, + d datetime); +--replace_result $MASTER_MYPORT MASTER_MYPORT +eval create table t3f engine=FEDERATED connection='mysql://root@127.0.0.1:$MASTER_MYPORT/test/t3'; + +insert into t1 values (1, "1990-01-01 00:00"); +insert into t1 values (1, "1991-01-01 11:11"); +insert into t2 values (2, 2, "1992-02-02 22:22"); +insert into t3 values (3, 3, 3, "1993-03-03 23:33"); +update t1f, t2f, t3f set t1f.x= 11, t2f.y= 22, t3f.z= 33; + +drop table t1f; drop table t2f; drop table t3f; drop table t1; drop table t2; drop table t3; + source include/federated_cleanup.inc; diff --git a/mysql-test/suite/funcs_1/r/is_check_constraints.result b/mysql-test/suite/funcs_1/r/is_check_constraints.result index 4d7c7b446e6..fa2bf2d9201 100644 --- a/mysql-test/suite/funcs_1/r/is_check_constraints.result +++ b/mysql-test/suite/funcs_1/r/is_check_constraints.result @@ -90,7 +90,9 @@ CREATE TABLE t3 ( a int, b int check (b>0), # field constraint named 'b' -CONSTRAINT b check (b>10) # table constraint +CONSTRAINT b check (b>10), # table constraint +# `CHECK_CLAUSE` should allow more then `var(64)` constraints +CONSTRAINT b1 check (b<123456789012345678901234567890123456789012345678901234567890123456789) ) ENGINE=InnoDB; SELECT * from information_schema.check_constraints; CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE @@ -104,6 +106,7 @@ def foo t2 CHK_dates `start_date` is null def foo t2 name char_length(`name`) > 2 def foo t3 b `b` > 0 def foo t3 b `b` > 10 +def foo t3 b1 `b` < 123456789012345678901234567890123456789012345678901234567890123456789 disconnect con1; CONNECT con2, localhost, boo2,, test; SELECT * from information_schema.check_constraints; diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index a34668daff3..672c8e0810a 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -24,7 +24,7 @@ def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 '' NO varchar 32 96 N def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select NEVER NULL def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) select NEVER NULL def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL -def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL +def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select NEVER NULL def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select NEVER NULL def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL @@ -563,7 +563,7 @@ NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint( 3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema CHECK_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE varchar 64 192 utf8 utf8_general_ci varchar(64) +1.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext 3.0000 information_schema CLIENT_STATISTICS CLIENT varchar 64 192 utf8 utf8_general_ci varchar(64) NULL information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index ac3130d58b0..85026160b41 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -24,7 +24,7 @@ def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 '' NO varchar 32 96 N def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) NEVER NULL def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) NEVER NULL def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL -def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL +def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext NEVER NULL def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) NEVER NULL def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL @@ -563,7 +563,7 @@ NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint( 3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema CHECK_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE varchar 64 192 utf8 utf8_general_ci varchar(64) +1.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext 3.0000 information_schema CLIENT_STATISTICS CLIENT varchar 64 192 utf8 utf8_general_ci varchar(64) NULL information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) diff --git a/mysql-test/suite/funcs_1/r/is_tables_is.result b/mysql-test/suite/funcs_1/r/is_tables_is.result index 9022e057ae5..502b165cde3 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_is.result +++ b/mysql-test/suite/funcs_1/r/is_tables_is.result @@ -85,9 +85,9 @@ TABLE_CATALOG def TABLE_SCHEMA information_schema TABLE_NAME CHECK_CONSTRAINTS TABLE_TYPE SYSTEM VIEW -ENGINE MEMORY +ENGINE MYISAM_OR_MARIA VERSION 11 -ROW_FORMAT Fixed +ROW_FORMAT DYNAMIC_OR_PAGE TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# @@ -1044,9 +1044,9 @@ TABLE_CATALOG def TABLE_SCHEMA information_schema TABLE_NAME CHECK_CONSTRAINTS TABLE_TYPE SYSTEM VIEW -ENGINE MEMORY +ENGINE MYISAM_OR_MARIA VERSION 11 -ROW_FORMAT Fixed +ROW_FORMAT DYNAMIC_OR_PAGE TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# diff --git a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result index 9022e057ae5..502b165cde3 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result @@ -85,9 +85,9 @@ TABLE_CATALOG def TABLE_SCHEMA information_schema TABLE_NAME CHECK_CONSTRAINTS TABLE_TYPE SYSTEM VIEW -ENGINE MEMORY +ENGINE MYISAM_OR_MARIA VERSION 11 -ROW_FORMAT Fixed +ROW_FORMAT DYNAMIC_OR_PAGE TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# @@ -1044,9 +1044,9 @@ TABLE_CATALOG def TABLE_SCHEMA information_schema TABLE_NAME CHECK_CONSTRAINTS TABLE_TYPE SYSTEM VIEW -ENGINE MEMORY +ENGINE MYISAM_OR_MARIA VERSION 11 -ROW_FORMAT Fixed +ROW_FORMAT DYNAMIC_OR_PAGE TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# diff --git a/mysql-test/suite/funcs_1/t/is_check_constraints.test b/mysql-test/suite/funcs_1/t/is_check_constraints.test index eadfd817832..f66ba875024 100644 --- a/mysql-test/suite/funcs_1/t/is_check_constraints.test +++ b/mysql-test/suite/funcs_1/t/is_check_constraints.test @@ -68,7 +68,9 @@ CREATE TABLE t3 ( a int, b int check (b>0), # field constraint named 'b' -CONSTRAINT b check (b>10) # table constraint +CONSTRAINT b check (b>10), # table constraint +# `CHECK_CLAUSE` should allow more then `var(64)` constraints +CONSTRAINT b1 check (b<123456789012345678901234567890123456789012345678901234567890123456789) ) ENGINE=InnoDB; --sorted_result SELECT * from information_schema.check_constraints; diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 4d911c60a5e..a72c84564f0 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -10,20 +10,23 @@ # ############################################################################## -MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill MW-328A : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002 MW-328B : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002 MW-329 : MDEV-19962 Galera test failure on MW-329 -galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event() galera_binlog_stmt_autoinc : MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc +galera_concurrent_ctas : MDEV-24842 Galera test failure on galera_concurrent_ctas galera_gcache_recover_manytrx : MDEV-18834 Galera test failure +galera_mdl_race : MDEV-21524: galera.galera_mdl_race MTR failed: query 'reap' succeeded - should have failed with errno 1213 galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails +galera_partition : MDEV-21806: galera.galera_partition MTR failed: failed to recover from DONOR state galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim -galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key galera_var_node_address : MDEV-20485 Galera test failure galera_wan : MDEV-17259 Test failure on galera.galera_wan partition : MDEV-19958 Galera test failure on galera.partition query_cache: MDEV-15805 Test failure on galera.query_cache sql_log_bin : MDEV-21491 galera.sql_log_bin +versioning_trx_id: MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch +galera_wsrep_provider_unset_set: wsrep_provider is read-only for security reasons +pxc-421: wsrep_provider is read-only for security reasons 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_st_disconnect_slave.inc b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc index 4674fc7867f..830a170d50b 100644 --- a/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc +++ b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc @@ -21,7 +21,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; ---source suite/galera/include/galera_unload_provider.inc +--source suite/galera/include/galera_stop_replication.inc --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' @@ -53,7 +53,7 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); --connection node_2 ---source suite/galera/include/galera_load_provider.inc +--source suite/galera/include/galera_start_replication.inc --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_load_provider.inc b/mysql-test/suite/galera/include/galera_start_replication.inc index aeab7e6ea19..e6ce6411193 100644 --- a/mysql-test/suite/galera/include/galera_load_provider.inc +++ b/mysql-test/suite/galera/include/galera_start_replication.inc @@ -1,7 +1,6 @@ --echo Loading wsrep provider ... --disable_query_log ---eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig'; --eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; --enable_query_log diff --git a/mysql-test/suite/galera/include/galera_unload_provider.inc b/mysql-test/suite/galera/include/galera_stop_replication.inc index edc7eb31e0e..83438a947f0 100644 --- a/mysql-test/suite/galera/include/galera_unload_provider.inc +++ b/mysql-test/suite/galera/include/galera_stop_replication.inc @@ -1,7 +1,6 @@ --echo Unloading wsrep provider ... --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` -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; diff --git a/mysql-test/suite/galera/r/MDEV-24327.result b/mysql-test/suite/galera/r/MDEV-24327.result new file mode 100644 index 00000000000..e7cd9d08f4b --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-24327.result @@ -0,0 +1,33 @@ +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); +INSERT INTO t1 VALUES (1, 'f'); +INSERT INTO t1 VALUES (2, 'g'); +connection node_1; +SET AUTOCOMMIT=ON; +START TRANSACTION; +UPDATE t1 SET f2 = '1' WHERE f1 = 1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET SESSION wsrep_sync_wait=0; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync'; +connection node_1; +COMMIT; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_2; +UPDATE t1 SET f2 = '2' WHERE f1 = 2; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_1; +SELECT * FROM t1; +f1 f2 +1 1 +2 2 +"node 1 is complete now" +connection node_2; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera#500.result b/mysql-test/suite/galera/r/galera#500.result index 7ba02c56053..2e3f659bd79 100644 --- a/mysql-test/suite/galera/r/galera#500.result +++ b/mysql-test/suite/galera/r/galera#500.result @@ -1,3 +1,5 @@ +connection node_1; +connection node_2; connection node_2; SET SESSION wsrep_sync_wait = 0; SET GLOBAL wsrep_provider_options="gmcast.isolate=2"; diff --git a/mysql-test/suite/galera/r/galera_UK_conflict.result b/mysql-test/suite/galera/r/galera_UK_conflict.result new file mode 100644 index 00000000000..76649f1b268 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_UK_conflict.result @@ -0,0 +1,89 @@ +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 int, unique key keyj (f2)); +INSERT INTO t1 VALUES (1, 1, 0); +INSERT INTO t1 VALUES (3, 3, 0); +INSERT INTO t1 VALUES (10, 10, 0); +SET GLOBAL wsrep_slave_threads = 3; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; +connection node_1; +SET SESSION wsrep_sync_wait=0; +START TRANSACTION; +DELETE FROM t1 WHERE f2 = 3; +INSERT INTO t1 VALUES (3, 3, 1); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SET SESSION wsrep_sync_wait=0; +connection node_2; +INSERT INTO t1 VALUES (5, 5, 2); +connection node_1a; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +INSERT INTO t1 VALUES (4, 4, 2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync'; +connection node_1; +COMMIT; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +SET GLOBAL debug_dbug = NULL; +SET debug_sync='RESET'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +SET GLOBAL debug_dbug = NULL; +SET debug_sync='RESET'; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_1; +SELECT * FROM t1; +f1 f2 f3 +1 1 0 +3 3 1 +4 4 2 +5 5 2 +10 10 0 +wsrep_local_replays +1 +SET GLOBAL wsrep_slave_threads = DEFAULT; +connection node_2; +SELECT * FROM t1; +f1 f2 f3 +1 1 0 +3 3 1 +4 4 2 +5 5 2 +10 10 0 +INSERT INTO t1 VALUES (7,7,7); +INSERT INTO t1 VALUES (8,8,8); +SELECT * FROM t1; +f1 f2 f3 +1 1 0 +3 3 1 +4 4 2 +5 5 2 +7 7 7 +8 8 8 +10 10 0 +connection node_1; +SELECT * FROM t1; +f1 f2 f3 +1 1 0 +3 3 1 +4 4 2 +5 5 2 +7 7 7 +10 10 0 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_as_slave_replay.result b/mysql-test/suite/galera/r/galera_as_slave_replay.result new file mode 100644 index 00000000000..760617be5f7 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_as_slave_replay.result @@ -0,0 +1,95 @@ +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +connection node_1; +RESET MASTER; +connection node_2a; +START SLAVE; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (3, 'a'); +set binlog_format=STATEMENT; +SET AUTOCOMMIT=ON; +START TRANSACTION; +SELECT * FROM t1 FOR UPDATE; +f1 f2 +1 a +3 a +UPDATE t1 SET f2 = 'c' WHERE f1 > 1; +connection node_2a; +SET SESSION wsrep_sync_wait = 0; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_3; +SET SESSION wsrep_sync_wait = 0; +connection node_2a; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync'; +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; +connection node_3; +INSERT INTO test.t1 VALUES (2, 'b'); +connection node_1; +COMMIT; +connection node_2a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL debug_dbug = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +connection node_2a; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync'; +connection node_1; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; +COUNT(*) = 1 +1 +SELECT * FROM t1; +f1 f2 +1 a +3 c +connection node_2a; +set session wsrep_sync_wait=15; +set session wsrep_sync_wait=0; +wsrep_local_replays +1 +SELECT * FROM t1; +f1 f2 +1 a +2 b +3 c +SET DEBUG_SYNC = "RESET"; +# +# test phase with real abort +# +connection node_1; +set binlog_format=ROW; +insert into t1 values (4, 'd'); +SET AUTOCOMMIT=ON; +START TRANSACTION; +UPDATE t1 SET f2 = 'd' WHERE f1 = 3; +connection node_2a; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync'; +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; +connection node_3; +UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3; +connection node_1; +COMMIT; +connection node_2a; +SET GLOBAL debug_dbug = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +connection node_2a; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync'; +SET DEBUG_SYNC = "RESET"; +connection node_2a; +set session wsrep_sync_wait=15; +SELECT COUNT(*) = 1 FROM test.t1 WHERE f2 = 'e'; +COUNT(*) = 1 +1 +set session wsrep_sync_wait=0; +STOP SLAVE; +RESET SLAVE; +DROP TABLE t1; +connection node_1; +DROP TABLE t1; +RESET MASTER; diff --git a/mysql-test/suite/galera/r/galera_bf_kill.result b/mysql-test/suite/galera/r/galera_bf_kill.result new file mode 100644 index 00000000000..2c2e72db1e4 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_bf_kill.result @@ -0,0 +1,50 @@ +connection node_2; +CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB; +insert into t1 values (NULL,1); +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +begin; +update t1 set a = 5; +connection node_2; +select * from t1; +a b +2 1 +disconnect node_2a; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +begin; +update t1 set a =5; +connection node_2; +select * from t1; +a b +2 1 +disconnect node_2a; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +begin; +update t1 set a =5, b=2; +connection node_2; +ALTER TABLE t1 ADD UNIQUE KEY b1(b); +ALTER TABLE t1 DROP KEY b1; +select * from t1; +a b +2 1 +disconnect node_2a; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +begin; +update t1 set a =5, b=2; +connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2b; +begin; +update t1 set a =6, b=7; +connection node_2; +ALTER TABLE t1 ADD UNIQUE KEY b2(b); +ALTER TABLE t1 DROP KEY b2; +select * from t1; +a b +2 1 +disconnect node_2a; +disconnect node_2b; +connection node_1; +drop table t1; diff --git a/mysql-test/suite/galera/r/galera_fk_cascade_delete.result b/mysql-test/suite/galera/r/galera_fk_cascade_delete.result index a6c6504dc39..ba5feadb1ff 100644 --- a/mysql-test/suite/galera/r/galera_fk_cascade_delete.result +++ b/mysql-test/suite/galera/r/galera_fk_cascade_delete.result @@ -2,7 +2,6 @@ # test phase with cascading foreign key through 3 tables # connection node_1; -set wsrep_sync_wait=0; CREATE TABLE grandparent ( id INT NOT NULL PRIMARY KEY ) ENGINE=InnoDB; @@ -24,15 +23,26 @@ INSERT INTO grandparent VALUES (1),(2); INSERT INTO parent VALUES (1,1), (2,2); INSERT INTO child VALUES (1,1), (2,2); connection node_2; -set wsrep_sync_wait=0; DELETE FROM grandparent WHERE id = 1; +SELECT * FROM grandparent; +id +2 +SELECT * FROM parent; +id grandparent_id +2 2 +SELECT * FROM child; +id parent_id +2 2 connection node_1; -SELECT COUNT(*), COUNT(*) = 0 FROM parent WHERE grandparent_id = 1; -COUNT(*) COUNT(*) = 0 -0 1 -SELECT COUNT(*), COUNT(*) = 0 FROM child WHERE parent_id = 1; -COUNT(*) COUNT(*) = 0 -0 1 +SELECT * FROM grandparent; +id +2 +SELECT * FROM parent; +id grandparent_id +2 2 +SELECT * FROM child; +id parent_id +2 2 DROP TABLE child; DROP TABLE parent; DROP TABLE grandparent; diff --git a/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result b/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result index 89613b2856a..e2879c30a98 100644 --- a/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result +++ b/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result @@ -18,12 +18,10 @@ INSERT INTO child VALUES (1,'row one'), (2,'row two'); connection node_2; DELETE FROM parent; connection node_1; -SELECT COUNT(*), COUNT(*) = 0 FROM parent; -COUNT(*) COUNT(*) = 0 -0 1 -SELECT COUNT(*), COUNT(*) = 0 FROM child; -COUNT(*) COUNT(*) = 0 -0 1 +SELECT * FROM parent; +id +SELECT * FROM child; +id parent_id DROP TABLE child; DROP TABLE parent; # @@ -44,6 +42,7 @@ ON DELETE CASCADE ) ENGINE=InnoDB; INSERT INTO parent VALUES (1); INSERT INTO child VALUES (1,0,1); +connection node_2; connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; connection node_2; @@ -57,11 +56,9 @@ SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "RESET"; connection node_1; -SELECT COUNT(*), COUNT(*) = 0 FROM parent; -COUNT(*) COUNT(*) = 0 -0 1 -SELECT COUNT(*), COUNT(*) = 0 FROM child; -COUNT(*) COUNT(*) = 0 -0 1 +SELECT * FROM parent; +id +SELECT * FROM child; +id j parent_id DROP TABLE child; DROP TABLE parent; diff --git a/mysql-test/suite/galera/r/galera_fulltext.result b/mysql-test/suite/galera/r/galera_fulltext.result index 18e3bff40fc..af017083b4e 100644 --- a/mysql-test/suite/galera/r/galera_fulltext.result +++ b/mysql-test/suite/galera/r/galera_fulltext.result @@ -34,3 +34,31 @@ COUNT(f1) = 1000 1 DROP TABLE t1; DROP TABLE ten; +connection node_1; +SET @value=REPEAT (1,5001); +CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb; +INSERT IGNORE INTO t VALUES(@value); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT COUNT(*) FROM t; +COUNT(*) +1 +connection node_2; +SELECT COUNT(*) FROM t; +COUNT(*) +1 +connection node_1; +DROP TABLE t; +CREATE TABLE t (a VARCHAR(5000)) engine=innodb; +INSERT IGNORE INTO t VALUES(@value); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT COUNT(*) FROM t; +COUNT(*) +1 +connection node_2; +SELECT COUNT(*) FROM t; +COUNT(*) +1 +connection node_1; +DROP TABLE t; diff --git a/mysql-test/suite/galera/r/galera_ist_mariabackup.result b/mysql-test/suite/galera/r/galera_ist_mariabackup.result index 8a7c02ab1b6..80a28d349ba 100644 --- a/mysql-test/suite/galera/r/galera_ist_mariabackup.result +++ b/mysql-test/suite/galera/r/galera_ist_mariabackup.result @@ -21,7 +21,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; diff --git a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result index d38d664b6fa..e58d04b30b3 100644 --- a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result +++ b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result @@ -3,8 +3,9 @@ connection node_2; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a'); connection node_2; +SET SESSION wsrep_sync_wait=0; Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; connection node_1; UPDATE t1 SET f2 = 'b' WHERE f1 > 1; UPDATE t1 SET f2 = 'c' WHERE f1 > 2; diff --git a/mysql-test/suite/galera/r/galera_ist_rsync.result b/mysql-test/suite/galera/r/galera_ist_rsync.result index 8a7c02ab1b6..80a28d349ba 100644 --- a/mysql-test/suite/galera/r/galera_ist_rsync.result +++ b/mysql-test/suite/galera/r/galera_ist_rsync.result @@ -21,7 +21,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; diff --git a/mysql-test/suite/galera/r/galera_log_bin_opt.result b/mysql-test/suite/galera/r/galera_log_bin_opt.result new file mode 100644 index 00000000000..eb009a620e0 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_log_bin_opt.result @@ -0,0 +1,73 @@ +connection node_1; +reset master; +connection node_2; +reset master; +CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (id INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1); +INSERT INTO t2 VALUES (1); +connection node_2; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 2 FROM t2; +COUNT(*) = 2 +1 +connection node_1; +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-bin.000001 # Gtid # # GTID #-#-# +mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB +mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-# +mysqld-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1) +mysqld-bin.000001 # Table_map # # table_id: # (test.t1) +mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Xid # # COMMIT /* XID */ +mysqld-bin.000001 # Gtid # # GTID #-#-# +mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB +mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-# +mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1) +mysqld-bin.000001 # Table_map # # table_id: # (test.t2) +mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Xid # # COMMIT /* XID */ +mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-# +mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1) +mysqld-bin.000001 # Table_map # # table_id: # (test.t2) +mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Xid # # COMMIT /* XID */ +mysqld-bin.000001 # Gtid # # GTID #-#-# +mysqld-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER +connection node_2; +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +COUNT(*) = 2 +1 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-bin.000001 # Gtid # # GTID #-#-# +mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB +mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-# +mysqld-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1) +mysqld-bin.000001 # Table_map # # table_id: # (test.t1) +mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Xid # # COMMIT /* XID */ +mysqld-bin.000001 # Gtid # # GTID #-#-# +mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB +mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-# +mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1) +mysqld-bin.000001 # Table_map # # table_id: # (test.t2) +mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Xid # # COMMIT /* XID */ +mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-# +mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1) +mysqld-bin.000001 # Table_map # # table_id: # (test.t2) +mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +mysqld-bin.000001 # Xid # # COMMIT /* XID */ +mysqld-bin.000001 # Gtid # # GTID #-#-# +mysqld-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER +DROP TABLE t1; +DROP TABLE t2; +#cleanup +connection node_1; +RESET MASTER; diff --git a/mysql-test/suite/galera/r/galera_ssl_upgrade.result b/mysql-test/suite/galera/r/galera_ssl_upgrade.result index b24671d120d..8aab135c6a2 100644 --- a/mysql-test/suite/galera/r/galera_ssl_upgrade.result +++ b/mysql-test/suite/galera/r/galera_ssl_upgrade.result @@ -1,15 +1,25 @@ +call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown"); SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; VARIABLE_VALUE = 'Synced' 1 SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 +connection node_1; +call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*"); +connection node_2; +call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*"); +connection node_1; +connection node_2; +connection node_1; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 +connection node_2; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 +connection node_1; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result index 5c530c32ce6..6bdc933a9fc 100644 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump.result +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result @@ -30,7 +30,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; diff --git a/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result b/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result index 8a86dfd11e2..68b67977550 100644 --- a/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result +++ b/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result @@ -1,5 +1,5 @@ connection node_1; -CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; INSERT INTO t1 (f2) SELECT 1 FROM ten; diff --git a/mysql-test/suite/galera/r/galera_trigger.result b/mysql-test/suite/galera/r/galera_trigger.result index 112d3f39aa0..059f8ef13f9 100644 --- a/mysql-test/suite/galera/r/galera_trigger.result +++ b/mysql-test/suite/galera/r/galera_trigger.result @@ -30,3 +30,47 @@ id 200 DROP TRIGGER tr1; DROP TABLE t1; +connection node_1; +CREATE TABLE t1(id int not null auto_increment, value int not null, primary key (id)) engine=innodb; +CREATE TABLE t2(id int not null auto_increment, tbl varchar(64) not null, action varchar(64) not null, primary key (id)); +create trigger log_insert after insert on t1 +for each row begin +insert into t2(tbl, action) values ('t1', 'INSERT'); +end| +insert into t1(value) values (1); +insert into t1(value) values (2); +connection node_2; +set session wsrep_sync_wait=15; +insert into t1(value) values (3); +insert into t1(value) values (4); +select tbl, action from t2; +tbl action +t1 INSERT +t1 INSERT +t1 INSERT +t1 INSERT +connection node_1; +drop trigger if exists log_insert; +insert into t1(value) values (5); +select tbl, action from t2; +tbl action +t1 INSERT +t1 INSERT +t1 INSERT +t1 INSERT +connection node_2; +insert into t1(value) values (6); +select tbl, action from t2; +tbl action +t1 INSERT +t1 INSERT +t1 INSERT +t1 INSERT +connection node_1; +select tbl, action from t2; +tbl action +t1 INSERT +t1 INSERT +t1 INSERT +t1 INSERT +drop table t1, t2; diff --git a/mysql-test/suite/galera/r/galera_var_sst_auth.result b/mysql-test/suite/galera/r/galera_var_sst_auth.result index 1db83197870..89a27dce4f6 100644 --- a/mysql-test/suite/galera/r/galera_var_sst_auth.result +++ b/mysql-test/suite/galera/r/galera_var_sst_auth.result @@ -1,6 +1,3 @@ -# -# MDEV-10492: Assertion failure on shutdown when wsrep_sst_auth set in config -# SELECT @@global.wsrep_sst_auth; @@global.wsrep_sst_auth ******** @@ -8,5 +5,14 @@ SET @@global.wsrep_sst_auth='foo:bar'; SELECT @@global.wsrep_sst_auth; @@global.wsrep_sst_auth ******** -disconnect node_2; -disconnect node_1; +connection node_2; +SET @@global.wsrep_sst_auth= 'abcdefghijklmnopqrstuvwxyz'; +SELECT @@global.wsrep_sst_auth; +@@global.wsrep_sst_auth +******** +Shutdown node_2 +connection node_1; +connection node_2; +SELECT @@global.wsrep_sst_auth; +@@global.wsrep_sst_auth +******** diff --git a/mysql-test/suite/galera/r/galera_virtual_blob.result b/mysql-test/suite/galera/r/galera_virtual_blob.result new file mode 100644 index 00000000000..91952b1d52d --- /dev/null +++ b/mysql-test/suite/galera/r/galera_virtual_blob.result @@ -0,0 +1,19 @@ +CREATE TABLE t (f INT GENERATED ALWAYS AS (a+b)VIRTUAL,a INT,b INT,h BLOB); +INSERT INTO t (a,b)VALUES(0,0), (0,0), (0,0), (0,0), (0,0); +SELECT * from t; +f a b h +0 0 0 NULL +0 0 0 NULL +0 0 0 NULL +0 0 0 NULL +0 0 0 NULL +connection node_2; +SELECT * from t; +f a b h +0 0 0 NULL +0 0 0 NULL +0 0 0 NULL +0 0 0 NULL +0 0 0 NULL +connection node_1; +DROP TABLE t; diff --git a/mysql-test/suite/galera/r/lp1376747-4.result b/mysql-test/suite/galera/r/lp1376747-4.result index f1d32aa8f69..3370e1d3d8e 100644 --- a/mysql-test/suite/galera/r/lp1376747-4.result +++ b/mysql-test/suite/galera/r/lp1376747-4.result @@ -3,26 +3,23 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); connection node_2; SET session wsrep_sync_wait=0; -SET session wsrep_causal_reads=OFF; -Warnings: -Warning 1287 '@@wsrep_causal_reads' is deprecated and will be removed in a future release. Please use '@@wsrep_sync_wait=1' instead -FLUSH TABLE WITH READ LOCK; +FLUSH TABLES WITH READ LOCK; connection node_1; ALTER TABLE t1 ADD COLUMN f2 INTEGER; INSERT INTO t1 VALUES (2,3); connection node_2a; SET session wsrep_sync_wait=0; -SET session wsrep_causal_reads=OFF; -Warnings: -Warning 1287 '@@wsrep_causal_reads' is deprecated and will be removed in a future release. Please use '@@wsrep_sync_wait=1' instead SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SET debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked2 WAIT_FOR go2'; FLUSH TABLES t1 WITH READ LOCK;; connection node_2; +SET debug_sync='now WAIT_FOR parked2'; +SET debug_sync='now SIGNAL go2'; UNLOCK TABLES; SHOW CREATE TABLE t1; Table Create Table @@ -30,8 +27,10 @@ t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 +set debug_sync= 'RESET'; connection node_2a; UNLOCK TABLES; +SET SESSION wsrep_sync_wait = DEFAULT; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result index 6a5251204b9..4cc49c0cf07 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#33.result +++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result @@ -30,7 +30,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; diff --git a/mysql-test/suite/galera/t/MDEV-24327.cnf b/mysql-test/suite/galera/t/MDEV-24327.cnf new file mode 100644 index 00000000000..390a9aab0f4 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-24327.cnf @@ -0,0 +1,6 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +log-bin=mariadb-bin +log-slave-updates=OFF + diff --git a/mysql-test/suite/galera/t/MDEV-24327.test b/mysql-test/suite/galera/t/MDEV-24327.test new file mode 100644 index 00000000000..fe3dbbe2870 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-24327.test @@ -0,0 +1,87 @@ +# +# MDEV-24327 wsrep XID checkpointing order violation with log_slave_updates=OFF +# +# Here we have configure two node cluster with --log-bin=ON and --log-slave_-updates=OFF +# +# a transaction in node executes so far that it has replicated and reached +# commit phase, We have sync point before entering commit order monitor and +# the transaction is parked there +# +# Then another transaction is executed in node 2, it replicates and commits in node 2 +# and is received and applied in node 1. After applying it will remain waiting for +# commit order monitor, as it has later seqno than the first transaction in node 1. +# +# control connection in node 1 waits to see the +# +# With the buggy version of MDEV-24327, the applier has however, already synced the +# wsrep XID checkpoint +# +# +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); +INSERT INTO t1 VALUES (1, 'f'); +INSERT INTO t1 VALUES (2, 'g'); + +--connection node_1 +SET AUTOCOMMIT=ON; +START TRANSACTION; + +UPDATE t1 SET f2 = '1' WHERE f1 = 1; + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET SESSION wsrep_sync_wait=0; +--connection node_1a +--let $expected_wsrep_received = `SELECT VARIABLE_VALUE+1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_received'` +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +# Block the commit, send the COMMIT and wait until it gets blocked + +--let $galera_sync_point = commit_monitor_enter_sync +--source include/galera_set_sync_point.inc + +--connection node_1 +--send COMMIT + +--connection node_1a + +# wait for the commit to block in sync point + +--let $galera_sync_point = commit_monitor_enter_sync +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +# +# replicate non conflicting transaction from node 2 +# it will get later seqno and should sync XID checkpoint after transaction in node 1 +# +--connection node_2 +UPDATE t1 SET f2 = '2' WHERE f1 = 2; + +# +# wait until update from node 2 has been committed +# if XID checkpointing order was violated, node 1 would crash for assert +# + +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = $expected_wsrep_received FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_received' +--source include/wait_condition.inc + +--let $galera_sync_point = commit_monitor_enter_sync +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc + +--connection node_1 +--reap +SELECT * FROM t1; +--echo "node 1 is complete now" + + +--connection node_2 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera#500.test b/mysql-test/suite/galera/t/galera#500.test index 3c8490b6907..471620b32c1 100644 --- a/mysql-test/suite/galera/t/galera#500.test +++ b/mysql-test/suite/galera/t/galera#500.test @@ -8,6 +8,11 @@ --source include/galera_cluster.inc --source include/galera_have_debug_sync.inc +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + # Force node_2 gcomm background thread to terminate via exception. --connection node_2 --let $wsrep_cluster_address = `SELECT @@wsrep_cluster_address` @@ -36,3 +41,5 @@ SET SESSION wsrep_on=0; --connection node_2 CALL mtr.add_suppression("WSREP: exception from gcomm, backend must be restarted: Gcomm backend termination was requested by setting gmcast.isolate=2."); + +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_UK_conflict.test b/mysql-test/suite/galera/t/galera_UK_conflict.test new file mode 100644 index 00000000000..57bafbf8ae0 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_UK_conflict.test @@ -0,0 +1,148 @@ +# +# This test tests the operation of transaction replay with a scenario +# where two subsequent write sets in applying conflict with local transaction +# in commit phase. The conflict is "false positive" confict on GAP lock in +# secondary unique index. +# The first applier will cause BF abort for the local committer, which +# starts replaying because of positive certification. +# In buggy version, scenatio continues so that ehile the local transaction +# is replaying, the latter applier experiences similar UK GAP lock conflict +# and forces the replayer to abort second time. +# In fixed version, this latter BF abort should not happen. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 int, unique key keyj (f2)); +INSERT INTO t1 VALUES (1, 1, 0); +INSERT INTO t1 VALUES (3, 3, 0); +INSERT INTO t1 VALUES (10, 10, 0); + +# we will need 2 appliers threads for applyin two write sets in parallel in node1 +# and 1 applier thread for handling replaying +SET GLOBAL wsrep_slave_threads = 3; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; + +--connection node_1 +# starting a transaction, which deletes and inserts the middle row in test table +# this will be victim of false positive conflict with appliers +SET SESSION wsrep_sync_wait=0; +START TRANSACTION; + +DELETE FROM t1 WHERE f2 = 3; +INSERT INTO t1 VALUES (3, 3, 1); + +# Control connection to manage sync points for appliers +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait=0; + +# send from node 2 first INSERT transaction, which will conflict on GAP lock in node 1 +--connection node_2 +INSERT INTO t1 VALUES (5, 5, 2); + +--connection node_1a +# wait to see the INSERT in apply_cb sync point +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; + +# first applier seen in wait point, set sync point for the second INSERT +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_set_sync_point.inc + +--connection node_2 +# send second insert into same GAP in test table +INSERT INTO t1 VALUES (4, 4, 2); + +--connection node_1a +# wait for the second insert to arrive in his sync point +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +# both appliers are now waiting in separate sync points + +# Block the local commit, send the COMMIT and wait until it gets blocked +--let $galera_sync_point = commit_monitor_enter_sync +--source include/galera_set_sync_point.inc + +--connection node_1 +--send COMMIT + +--connection node_1a +# wait for the local commit to enter in commit monitor wait state +--let $galera_sync_point = apply_monitor_slave_enter_sync commit_monitor_enter_sync +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +# release the local transaction to continue with commit +--let $galera_sync_point = commit_monitor_enter_sync +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc + +# and now release the first applier, it should force local trx to abort +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +SET GLOBAL debug_dbug = NULL; +SET debug_sync='RESET'; + +# set another sync point for second applier +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; + +# letting the second appier to move forward +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_signal_sync_point.inc + +# waiting until second applier is in wait +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; + +# stopping second applier before commit +--let $galera_sync_point = commit_monitor_enter_sync +--source include/galera_set_sync_point.inc +--source include/galera_clear_sync_point.inc + +# releasing the second insert, with buggy version it will conflict with +# replayer +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +SET GLOBAL debug_dbug = NULL; +SET debug_sync='RESET'; + +# with fixed version, second applier has reached commit monitor, and we can +# release it to complete +--let $galera_sync_point = commit_monitor_enter_sync +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc + +# local commit should succeed +--connection node_1 +--reap + +SELECT * FROM t1; + +# wsrep_local_replays has increased by 1 +--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` +--disable_query_log +--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays; +--enable_query_log + +# returning original slave thread count +SET GLOBAL wsrep_slave_threads = DEFAULT; + +--connection node_2 +SELECT * FROM t1; + +# replicate some transactions, so that wsrep slave thread count can reach +# original state in node 1 +INSERT INTO t1 VALUES (7,7,7); +INSERT INTO t1 VALUES (8,8,8); +SELECT * FROM t1; + +--connection node_1 +SELECT * FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_as_slave_replay.cnf b/mysql-test/suite/galera/t/galera_as_slave_replay.cnf new file mode 100644 index 00000000000..b1f9d7e9cbd --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_replay.cnf @@ -0,0 +1,11 @@ +!include ../galera_2nodes_as_slave.cnf + +[mysqld] +binlog-format=row + +[mysqld.1] +wsrep_restart_slave=1 + +[mysqld.2] +wsrep_restart_slave=1 + diff --git a/mysql-test/suite/galera/t/galera_as_slave_replay.test b/mysql-test/suite/galera/t/galera_as_slave_replay.test new file mode 100644 index 00000000000..93f95349e6d --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_replay.test @@ -0,0 +1,200 @@ +# +# This test tests the operation of transaction replay for async replication slave. +# If a potentially conflicting galera transaction arrives at +# just the right time during the commit and has lock conflict with async replication transaction +# applied by slave SQL thread, then the async replication transaction should either abort +# or rollback and replay (depending on the nature of lock conflict). +# + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 + +--connection node_2a +--source include/galera_cluster.inc +#--source suite/galera/include/galera_have_debug_sync.inc + +# +# node 1 is native MariaDB server operating as async replication master +# +--connection node_1 +RESET MASTER; + +--connection node_2a +# +# count the number of wsrep replay's done in the node +# +--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` + + +# +# nodes 2 and 3 form a galera cluster, node 2 operates as slave for native MariaDB naster in node 1 +# +--disable_query_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1; +--enable_query_log +START SLAVE; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (3, 'a'); + +# +# use statement format replication to cause a false positive conflict with async replication transaction +# and galera replication. The conflict will be on GAP lock, and slave SQL thread should rollback +# and replay +# +set binlog_format=STATEMENT; + +SET AUTOCOMMIT=ON; +START TRANSACTION; + +SELECT * FROM t1 FOR UPDATE; +UPDATE t1 SET f2 = 'c' WHERE f1 > 1; + +--connection node_2a +# wait for create table and inserts to be replicated from master +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1; +--source include/wait_condition.inc + +# wait for create table and inserts to be replicated in cluster +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1; +--source include/wait_condition.inc + +--connection node_2a +# Block the future commit of async replication +--let $galera_sync_point = commit_monitor_enter_sync +--source include/galera_set_sync_point.inc + +# block also the applier before applying begins +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; + +# +# now inject a conflicting insert from node 3, it will replicate with +# earlier seqno (than async transaction) and pause before applying in node 2 +# +--connection node_3 +INSERT INTO test.t1 VALUES (2, 'b'); + +# +# send the update from master, this will succeed here, beceuase of async replication. +# async replication will apply this in node 2 and pause before commit phase, +--connection node_1 +--error 0 +COMMIT; + +# Wait until async slave commit is blocked in node_2 +--connection node_2a +--source include/galera_wait_sync_point.inc + +# +# release the applier +# note: have to clear wsrep_apply_cb sync point first, as async replication will go for replay +# and as this sync point, after BF applier is released to progress +# +SET GLOBAL debug_dbug = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; + +# Unblock the async slave commit +--connection node_2a +--source include/galera_clear_sync_point.inc +--source include/galera_signal_sync_point.inc + +--connection node_1 + +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a'; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; +SELECT * FROM t1; + +--connection node_2a + +# wsrep_local_replays has increased by 1 +set session wsrep_sync_wait=15; +--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` +set session wsrep_sync_wait=0; + +--disable_query_log +--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays; +--enable_query_log + +# +# replaying of async transaction should be effective, and row 3 having 'c' in f2 +# +SELECT * FROM t1; +SET DEBUG_SYNC = "RESET"; + +#******************************************************************************** +# test phase 2 +#******************************************************************************** + +--echo # +--echo # test phase with real abort +--echo # + +--connection node_1 + +set binlog_format=ROW; + +insert into t1 values (4, 'd'); + +SET AUTOCOMMIT=ON; +START TRANSACTION; + +UPDATE t1 SET f2 = 'd' WHERE f1 = 3; + +--connection node_2a +# wait for the last insert to be replicated from master +--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1; +--source include/wait_condition.inc + +# Block the commit +--let $galera_sync_point = commit_monitor_enter_sync +--source include/galera_set_sync_point.inc + +# block applier +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; + +# Inject a conflicting update from node 3 +--connection node_3 +UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3; + +# send the update from master +--connection node_1 +--error 0 +COMMIT; + +--connection node_2a + +# release the applier +SET GLOBAL debug_dbug = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; + + +# Unblock the async slave commit +--connection node_2a +--source include/galera_clear_sync_point.inc +--source include/galera_signal_sync_point.inc +SET DEBUG_SYNC = "RESET"; + +--connection node_2a + +set session wsrep_sync_wait=15; +SELECT COUNT(*) = 1 FROM test.t1 WHERE f2 = 'e'; +set session wsrep_sync_wait=0; + +STOP SLAVE; +RESET SLAVE; + +DROP TABLE t1; + +--connection node_1 +DROP TABLE t1; +RESET MASTER; diff --git a/mysql-test/suite/galera/t/galera_bf_kill.test b/mysql-test/suite/galera/t/galera_bf_kill.test new file mode 100644 index 00000000000..f563554b787 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_bf_kill.test @@ -0,0 +1,74 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +# +# Test case 1: Start a transaction on node_2a and kill it +# from other connection on same node +# +--connection node_2 +CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB; +insert into t1 values (NULL,1); +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +begin; +update t1 set a = 5; +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1 +--source include/wait_condition.inc +--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1` +--disable_query_log +--eval KILL $k_thread +--enable_query_log +select * from t1; +--disconnect node_2a +# +# Test case 2: Start a transaction on node_2a and use +# kill query from other connection on same node +# +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +begin; +update t1 set a =5; +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1 +--source include/wait_condition.inc +--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1` +--disable_query_log +--eval KILL QUERY $k_thread +--enable_query_log +select * from t1; +--disconnect node_2a +# +# Test case 3: Start a transaction on node_2a and start a DDL on other transaction +# that will then abort node_2a transaction +# +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +begin; +update t1 set a =5, b=2; +--connection node_2 +ALTER TABLE t1 ADD UNIQUE KEY b1(b); +ALTER TABLE t1 DROP KEY b1; +select * from t1; +--disconnect node_2a +# +# Test case 4: Start a transaction on node_2a and conflicting transaction on node_2b +# and start a DDL on other transaction that will then abort node_2a and node_2b +# transactions +# +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +begin; +update t1 set a =5, b=2; +--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2b +begin; +send update t1 set a =6, b=7; +--connection node_2 +ALTER TABLE t1 ADD UNIQUE KEY b2(b); +ALTER TABLE t1 DROP KEY b2; +select * from t1; +--disconnect node_2a +--disconnect node_2b + +--connection node_1 +drop table t1; diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test index 3d4a7da7b54..a9e10de0176 100644 --- a/mysql-test/suite/galera/t/galera_defaults.test +++ b/mysql-test/suite/galera/t/galera_defaults.test @@ -13,7 +13,7 @@ # Make sure that the test is operating on the right version of galera library. --disable_query_log ---let $galera_version=25.3.20 +--let $galera_version=25.3.31 source ../wsrep/include/check_galera_version.inc; --enable_query_log diff --git a/mysql-test/suite/galera/t/galera_fk_cascade_delete.test b/mysql-test/suite/galera/t/galera_fk_cascade_delete.test index 6f0de0a1f4a..49b54f0f7f0 100644 --- a/mysql-test/suite/galera/t/galera_fk_cascade_delete.test +++ b/mysql-test/suite/galera/t/galera_fk_cascade_delete.test @@ -9,7 +9,6 @@ --echo # --connection node_1 -set wsrep_sync_wait=0; CREATE TABLE grandparent ( id INT NOT NULL PRIMARY KEY @@ -36,17 +35,35 @@ INSERT INTO parent VALUES (1,1), (2,2); INSERT INTO child VALUES (1,1), (2,2); --connection node_2 -set wsrep_sync_wait=0; - +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'grandparent' +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'parent' +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'child' +--source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 2 FROM child; --source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 2 FROM parent; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 2 FROM grandparent; +--source include/wait_condition.inc DELETE FROM grandparent WHERE id = 1; +SELECT * FROM grandparent; +SELECT * FROM parent; +SELECT * FROM child; + --connection node_1 --let $wait_condition = SELECT COUNT(*) = 1 FROM child; --source include/wait_condition.inc -SELECT COUNT(*), COUNT(*) = 0 FROM parent WHERE grandparent_id = 1; -SELECT COUNT(*), COUNT(*) = 0 FROM child WHERE parent_id = 1; +--let $wait_condition = SELECT COUNT(*) = 1 FROM parent; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1 FROM grandparent; +--source include/wait_condition.inc + +SELECT * FROM grandparent; +SELECT * FROM parent; +SELECT * FROM child; DROP TABLE child; DROP TABLE parent; diff --git a/mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test b/mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test index f38c028b7d6..d902783ed64 100644 --- a/mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test +++ b/mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test @@ -25,16 +25,25 @@ INSERT INTO parent VALUES ('row one'), ('row two'); INSERT INTO child VALUES (1,'row one'), (2,'row two'); --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'parent' +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'child' +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 2 FROM parent; +--source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 2 FROM child; --source include/wait_condition.inc + DELETE FROM parent; --connection node_1 +--let $wait_condition = SELECT COUNT(*) = 0 FROM parent; +--source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 0 FROM child; --source include/wait_condition.inc -SELECT COUNT(*), COUNT(*) = 0 FROM parent; -SELECT COUNT(*), COUNT(*) = 0 FROM child; +SELECT * FROM parent; +SELECT * FROM child; DROP TABLE child; DROP TABLE parent; @@ -61,20 +70,27 @@ CREATE TABLE child ( INSERT INTO parent VALUES (1); INSERT INTO child VALUES (1,0,1); +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'parent' +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'child' +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1 FROM parent; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1 FROM child; +--source include/wait_condition.inc + # block applier before applying --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; --connection node_2 ---let $wait_condition = SELECT COUNT(*) = 1 FROM child; ---source include/wait_condition.inc DELETE FROM parent; --connection node_1a # wait until applier has reached the sync point SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; - --connection node_1 # issue conflicting write to child table, it should fail in certification --error ER_LOCK_DEADLOCK @@ -88,11 +104,13 @@ SET DEBUG_SYNC = "RESET"; --connection node_1 --reap - +--let $wait_condition = SELECT COUNT(*) = 0 FROM parent; +--source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 0 FROM child; --source include/wait_condition.inc -SELECT COUNT(*), COUNT(*) = 0 FROM parent; -SELECT COUNT(*), COUNT(*) = 0 FROM child; + +SELECT * FROM parent; +SELECT * FROM child; DROP TABLE child; DROP TABLE parent; diff --git a/mysql-test/suite/galera/t/galera_fulltext.test b/mysql-test/suite/galera/t/galera_fulltext.test index a90cab1aa1a..19aa4f7a0a0 100644 --- a/mysql-test/suite/galera/t/galera_fulltext.test +++ b/mysql-test/suite/galera/t/galera_fulltext.test @@ -60,3 +60,26 @@ SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk'); DROP TABLE t1; DROP TABLE ten; +# +# MDEV-24978 : SIGABRT in __libc_message +# +--connection node_1 +SET @value=REPEAT (1,5001); +CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb; +INSERT IGNORE INTO t VALUES(@value); +SELECT COUNT(*) FROM t; + +--connection node_2 +SELECT COUNT(*) FROM t; + +--connection node_1 +DROP TABLE t; +CREATE TABLE t (a VARCHAR(5000)) engine=innodb; +INSERT IGNORE INTO t VALUES(@value); +SELECT COUNT(*) FROM t; + +--connection node_2 +SELECT COUNT(*) FROM t; + +--connection node_1 +DROP TABLE t; diff --git a/mysql-test/suite/galera/t/galera_gcache_recover.cnf b/mysql-test/suite/galera/t/galera_gcache_recover.cnf index c7b59b6a27e..34c757de77e 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover.cnf +++ b/mysql-test/suite/galera/t/galera_gcache_recover.cnf @@ -4,4 +4,4 @@ wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.recover=yes;pc.ignore_sb=true' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes;pc.ignore_sb=true' +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes' diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test index 633318629a6..15b47a328fc 100644 --- a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test +++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test @@ -21,7 +21,8 @@ INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a'); # Disconnect node #2 --connection node_2 ---source suite/galera/include/galera_unload_provider.inc +SET SESSION wsrep_sync_wait=0; +--source suite/galera/include/galera_stop_replication.inc --connection node_1 UPDATE t1 SET f2 = 'b' WHERE f1 > 1; @@ -45,7 +46,6 @@ UPDATE t1 SET f2 = 'c' WHERE f1 > 2; --disable_query_log # base_port setting is lost for some reason when unloading provider, so we need to restore it --eval SET GLOBAL wsrep_provider_options= 'base_port=$NODE_GALERAPORT_2'; ---eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig'; # Make sure IST will block ... --let $galera_sync_point = recv_IST_after_apply_trx --source include/galera_set_sync_point.inc diff --git a/mysql-test/suite/galera/t/galera_log_bin.inc b/mysql-test/suite/galera/t/galera_log_bin.inc new file mode 100644 index 00000000000..f1d2a12b9de --- /dev/null +++ b/mysql-test/suite/galera/t/galera_log_bin.inc @@ -0,0 +1,42 @@ +--source include/galera_cluster.inc +--source include/force_restart.inc + +--connection node_1 +reset master; +--connection node_2 +reset master; + +# +# Test Galera with --log-bin --log-slave-updates . +# This way the actual MySQL binary log is used, +# rather than Galera's own implementation +# + +CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +CREATE TABLE t2 (id INT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1); +INSERT INTO t2 VALUES (1); + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) = 2 FROM t2; + +--connection node_1 +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +--let $MASTER_MYPORT=$NODE_MYPORT_1 +--source include/show_binlog_events.inc + +--connection node_2 +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +--let $MASTER_MYPORT=$NODE_MYPORT_2 +--source include/show_binlog_events.inc + +DROP TABLE t1; +DROP TABLE t2; + +--echo #cleanup +--connection node_1 +RESET MASTER; + diff --git a/mysql-test/suite/galera/t/galera_log_bin.test b/mysql-test/suite/galera/t/galera_log_bin.test index f1d2a12b9de..923bd623a8a 100644 --- a/mysql-test/suite/galera/t/galera_log_bin.test +++ b/mysql-test/suite/galera/t/galera_log_bin.test @@ -1,42 +1 @@ ---source include/galera_cluster.inc ---source include/force_restart.inc - ---connection node_1 -reset master; ---connection node_2 -reset master; - -# -# Test Galera with --log-bin --log-slave-updates . -# This way the actual MySQL binary log is used, -# rather than Galera's own implementation -# - -CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1); - -CREATE TABLE t2 (id INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1); -INSERT INTO t2 VALUES (1); - ---connection node_2 -SELECT COUNT(*) = 1 FROM t1; -SELECT COUNT(*) = 2 FROM t2; - ---connection node_1 -ALTER TABLE t1 ADD COLUMN f2 INTEGER; ---let $MASTER_MYPORT=$NODE_MYPORT_1 ---source include/show_binlog_events.inc - ---connection node_2 -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ---let $MASTER_MYPORT=$NODE_MYPORT_2 ---source include/show_binlog_events.inc - -DROP TABLE t1; -DROP TABLE t2; - ---echo #cleanup ---connection node_1 -RESET MASTER; - +--source galera_log_bin.inc diff --git a/mysql-test/suite/galera/t/galera_log_bin_opt-master.opt b/mysql-test/suite/galera/t/galera_log_bin_opt-master.opt new file mode 100644 index 00000000000..03fcb5d040d --- /dev/null +++ b/mysql-test/suite/galera/t/galera_log_bin_opt-master.opt @@ -0,0 +1 @@ +--log-slave-updates --log-bin diff --git a/mysql-test/suite/galera/t/galera_log_bin_opt.cnf b/mysql-test/suite/galera/t/galera_log_bin_opt.cnf new file mode 100644 index 00000000000..a09efd2e011 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_log_bin_opt.cnf @@ -0,0 +1,15 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=mariabackup +wsrep_sst_auth="root:" + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' + +[sst] +transferfmt=@ENV.MTR_GALERA_TFMT +streamfmt=xbstream diff --git a/mysql-test/suite/galera/t/galera_log_bin_opt.test b/mysql-test/suite/galera/t/galera_log_bin_opt.test new file mode 100644 index 00000000000..f3d0afbc8bc --- /dev/null +++ b/mysql-test/suite/galera/t/galera_log_bin_opt.test @@ -0,0 +1,2 @@ +--source include/have_mariabackup.inc +--source galera_log_bin.inc diff --git a/mysql-test/suite/galera/t/galera_rsu_error.test b/mysql-test/suite/galera/t/galera_rsu_error.test index cad8154ac76..6de7607b6ec 100644 --- a/mysql-test/suite/galera/t/galera_rsu_error.test +++ b/mysql-test/suite/galera/t/galera_rsu_error.test @@ -9,6 +9,9 @@ CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; INSERT INTO t1 VALUES (1), (1); --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; +--source include/wait_condition.inc + SET SESSION wsrep_OSU_method = "RSU"; --error ER_DUP_ENTRY ALTER TABLE t1 ADD PRIMARY KEY (f1); diff --git a/mysql-test/suite/galera/t/galera_rsu_simple.test b/mysql-test/suite/galera/t/galera_rsu_simple.test index 5841dbd8006..aa6f25b6db6 100644 --- a/mysql-test/suite/galera/t/galera_rsu_simple.test +++ b/mysql-test/suite/galera/t/galera_rsu_simple.test @@ -8,6 +8,9 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1' +--source include/wait_condition.inc + SET SESSION wsrep_OSU_method = "RSU"; ALTER TABLE t1 ADD COLUMN f2 INTEGER; SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf index 3fd1c650c05..2954ae0f4cb 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem' +wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem' +wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.test b/mysql-test/suite/galera/t/galera_ssl_upgrade.test index eb5f79c12b4..33c5a43df9d 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.test +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.test @@ -6,15 +6,33 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_ssl_communication.inc + +call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown"); SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--connection node_1 +call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*"); +--connection node_2 +call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*"); + +# Setup galera ports +--connection node_1 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT + +--connection node_2 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT + # 2. Restart node #1 with a socket.ssl_ca that includes both the new and the old certificate --connection node_1 --source include/shutdown_mysqld.inc ---let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/cakey.pem +--let $restart_noprint = 1 +--let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-key.pem --source include/start_mysqld.inc --source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test index d1c30656139..e8dcbd849d8 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test @@ -10,7 +10,7 @@ --connection node_2 #--connection node_2 -#--source suite/galera/include/galera_unload_provider.inc +#--source suite/galera/include/galera_stop_replication.inc --echo Shutting down server ... --source include/shutdown_mysqld.inc diff --git a/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test b/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test index 641d2101c80..793e87cb53e 100644 --- a/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test +++ b/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test @@ -7,7 +7,7 @@ --source include/have_innodb.inc --connection node_1 -CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; @@ -83,6 +83,8 @@ SET GLOBAL auto_increment_offset = 1; CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; --connection node_2a +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1' +--source include/wait_condition.inc ALTER TABLE t1 AUTO_INCREMENT=100; diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test b/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test index 51eae7005df..89a1af845c9 100644 --- a/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test +++ b/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test @@ -9,6 +9,9 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; +--source include/wait_condition.inc + ALTER TABLE t1 ADD COLUMN f2 INTEGER; INSERT INTO t1 VALUES (2, 3); diff --git a/mysql-test/suite/galera/t/galera_toi_lock_shared.test b/mysql-test/suite/galera/t/galera_toi_lock_shared.test index 6857a0e08ca..6b7feec6031 100644 --- a/mysql-test/suite/galera/t/galera_toi_lock_shared.test +++ b/mysql-test/suite/galera/t/galera_toi_lock_shared.test @@ -10,6 +10,9 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; +--source include/wait_condition.inc + ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=SHARED; --connection node_1 diff --git a/mysql-test/suite/galera/t/galera_trigger.test b/mysql-test/suite/galera/t/galera_trigger.test index 54508583f4b..3c66b941e32 100644 --- a/mysql-test/suite/galera/t/galera_trigger.test +++ b/mysql-test/suite/galera/t/galera_trigger.test @@ -33,4 +33,40 @@ SELECT * FROM t1; DROP TRIGGER tr1; DROP TABLE t1; +# +# MDEV-23638 : DROP TRIGGER in Galera Cluster not replicating +# +--connection node_1 +CREATE TABLE t1(id int not null auto_increment, value int not null, primary key (id)) engine=innodb; + +CREATE TABLE t2(id int not null auto_increment, tbl varchar(64) not null, action varchar(64) not null, primary key (id)); + +--delimiter | +create trigger log_insert after insert on t1 +for each row begin + insert into t2(tbl, action) values ('t1', 'INSERT'); +end| +--delimiter ; + +insert into t1(value) values (1); +insert into t1(value) values (2); + +--connection node_2 +set session wsrep_sync_wait=15; +insert into t1(value) values (3); +insert into t1(value) values (4); +select tbl, action from t2; + +--connection node_1 +drop trigger if exists log_insert; +insert into t1(value) values (5); +select tbl, action from t2; + +--connection node_2 +insert into t1(value) values (6); +select tbl, action from t2; + +--connection node_1 +select tbl, action from t2; +drop table t1, t2; diff --git a/mysql-test/suite/galera/t/galera_truncate.test b/mysql-test/suite/galera/t/galera_truncate.test index 79f9bad1f1b..f490943db7c 100644 --- a/mysql-test/suite/galera/t/galera_truncate.test +++ b/mysql-test/suite/galera/t/galera_truncate.test @@ -14,6 +14,9 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; INSERT INTO t1 VALUES (1); --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; +--source include/wait_condition.inc + TRUNCATE TABLE t1; SELECT COUNT(*) = 0 FROM t1; @@ -29,6 +32,9 @@ CREATE TABLE t2 (f1 VARCHAR(255)) Engine=InnoDB; INSERT INTO t2 VALUES ('abc'); --connection node_1 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t2'; +--source include/wait_condition.inc + TRUNCATE TABLE t2; --connection node_2 diff --git a/mysql-test/suite/galera/t/galera_truncate_temporary.test b/mysql-test/suite/galera/t/galera_truncate_temporary.test index 3ad94eb9930..ea20911bd5d 100644 --- a/mysql-test/suite/galera/t/galera_truncate_temporary.test +++ b/mysql-test/suite/galera/t/galera_truncate_temporary.test @@ -67,6 +67,9 @@ CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (2); --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; +--source include/wait_condition.inc + TRUNCATE TABLE t1; SELECT COUNT(*) = 0 FROM t1; diff --git a/mysql-test/suite/galera/t/galera_var_sst_auth.test b/mysql-test/suite/galera/t/galera_var_sst_auth.test index 5c9b3f5a61e..ad7f46620ad 100644 --- a/mysql-test/suite/galera/t/galera_var_sst_auth.test +++ b/mysql-test/suite/galera/t/galera_var_sst_auth.test @@ -1,12 +1,33 @@ --source include/galera_cluster.inc --source include/have_innodb.inc ---echo # ---echo # MDEV-10492: Assertion failure on shutdown when wsrep_sst_auth set in config ---echo # +# +# MDEV-10492: Assertion failure on shutdown when wsrep_sst_auth set in config +# SELECT @@global.wsrep_sst_auth; SET @@global.wsrep_sst_auth='foo:bar'; SELECT @@global.wsrep_sst_auth; ---source include/galera_end.inc +# +# MDEV-24509 Warning: Memory not freed: 56 on SET @@global.wsrep_sst_auth +# +--connection node_2 +SET @@global.wsrep_sst_auth= 'abcdefghijklmnopqrstuvwxyz'; +SELECT @@global.wsrep_sst_auth; +--echo Shutdown node_2 +--source include/shutdown_mysqld.inc + +# On node_1, verify that the node has left the cluster. +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Restart node_2 +--connection node_2 +--source include/start_mysqld.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +SELECT @@global.wsrep_sst_auth; + + diff --git a/mysql-test/suite/galera/t/galera_virtual_blob.test b/mysql-test/suite/galera/t/galera_virtual_blob.test new file mode 100644 index 00000000000..a10e3025668 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_virtual_blob.test @@ -0,0 +1,10 @@ +--source include/galera_cluster.inc + +CREATE TABLE t (f INT GENERATED ALWAYS AS (a+b)VIRTUAL,a INT,b INT,h BLOB); +INSERT INTO t (a,b)VALUES(0,0), (0,0), (0,0), (0,0), (0,0); +SELECT * from t; + +--connection node_2 +SELECT * from t; +--connection node_1 +DROP TABLE t; diff --git a/mysql-test/suite/galera/t/lp1376747-4.test b/mysql-test/suite/galera/t/lp1376747-4.test index 6ae89fe9df4..d19ff422ab0 100644 --- a/mysql-test/suite/galera/t/lp1376747-4.test +++ b/mysql-test/suite/galera/t/lp1376747-4.test @@ -5,7 +5,8 @@ # after provider is unpaused # --source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc --let $galera_connection_name = node_2a --let $galera_server_number = 2 @@ -17,8 +18,7 @@ INSERT INTO t1 VALUES (1); --connection node_2 SET session wsrep_sync_wait=0; -SET session wsrep_causal_reads=OFF; -FLUSH TABLE WITH READ LOCK; +FLUSH TABLES WITH READ LOCK; --connection node_1 ALTER TABLE t1 ADD COLUMN f2 INTEGER; @@ -26,25 +26,33 @@ INSERT INTO t1 VALUES (2,3); --connection node_2a SET session wsrep_sync_wait=0; -SET session wsrep_causal_reads=OFF; - SHOW CREATE TABLE t1; +SET debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked2 WAIT_FOR go2'; --send FLUSH TABLES t1 WITH READ LOCK; --connection node_2 ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%'; ---source include/wait_condition.inc - +SET debug_sync='now WAIT_FOR parked2'; + +# let the flush table wait in pause state before we unlock +# table otherwise there is window where-in flush table is +# yet to wait in pause and unlock allows alter table to proceed. +# this is because send is asynchronous. +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE Info LIKE 'FLUSH TABLES t1 WITH READ LOCK'; +--let $wait_condition_on_error_output = SHOW PROCESSLIST +--source include/wait_condition_with_debug.inc + +SET debug_sync='now SIGNAL go2'; +# this will release existing lock but will not resume +# the cluster as there is new FTRL that is still pausing it. UNLOCK TABLES; SHOW CREATE TABLE t1; +set debug_sync= 'RESET'; --connection node_2a --reap UNLOCK TABLES; ---let $wait_condition = SELECT COUNT(*) = 2 FROM t1; ---source include/wait_condition.inc - +SET SESSION wsrep_sync_wait = DEFAULT; SHOW CREATE TABLE t1; SELECT * from t1; diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index 0e2706f2dc3..87eca207d5a 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -10,7 +10,16 @@ # ############################################################################## +GAL-501 : MDEV-24645 galera_3nodes.GAL-501 MTR failed: failed to open gcomm backend connection: 110 galera_gtid_2_cluster : MDEV-23775 Galera test failure on galera_3nodes.galera_gtid_2_cluster +galera_ipv6_mariabackup : MDEV-24440: galera_3nodes.galera_ipv6_mariabackup MTR fails sporadically: Failed to read from: wsrep_sst_mariabackup --role 'donor' --address '[::1]:16028/xtrabackup_sst//1' +galera_ipv6_mariabackup_section : MDEV-22195: galera_3nodes.galera_ipv6_mariabackup_section MTR failed: assert_grep.inc failed +galera_ipv6_mysqldump : MDEV-24036: galera_3nodes.galera_ipv6_mysqldump: rare random crashes during shutdown +galera_ipv6_rsync_section : MDEV-23580: galera_3nodes.galera_ipv6_rsync_section MTR failed: WSREP_SST: [ERROR] rsync daemon port '16008' has been taken galera_ist_gcache_rollover : MDEV-23578 WSREP: exception caused by message: {v=0,t=1,ut=255,o=4,s=0,sr=0,as=1,f=6,src=50524cfe,srcvid=view_id(REG,50524cfe,4),insvid=view_id(UNKNOWN,00000000,0),ru=00000000,r=[-1,-1],fs=75,nl=(} -galera_slave_options_do :MDEV-8798 +galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to MySQL server during query +galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to MySQL server during query +galera_pc_bootstrap : MDEV-24650 galera_pc_bootstrap MTR failed: Could not execute 'check-testcase' before testcase +galera_safe_to_bootstrap : MDEV-24097 galera_3nodes.galera_safe_to_bootstrap MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed +galera_slave_options_do : MDEV-8798 galera_slave_options_ignore : MDEV-8798 diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test index 4904a49c73b..79551aa185d 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test @@ -37,7 +37,7 @@ SET GLOBAL wsrep_sst_method = 'mysqldump'; # #--connection node_2 -#--source suite/galera/include/galera_unload_provider.inc +#--source suite/galera/include/galera_stop_replication.inc --echo Shutting down server ... --source include/shutdown_mysqld.inc @@ -62,7 +62,7 @@ INSERT INTO t1 VALUES (1); --let $start_mysqld_params = --wsrep_sst_auth=sst: --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=[::1].1:$NODE_MYPORT_2 --source include/start_mysqld.inc -#--source suite/galera/include/galera_load_provider.inc +#--source suite/galera/include/galera_start_replication.inc --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test index ebc756d60b1..0032f8d6ee1 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test +++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test @@ -29,10 +29,10 @@ INSERT INTO t1 VALUES (01), (02), (03), (04), (05); # Disconnect nodes #2 and #3 --connection node_2 ---source suite/galera/include/galera_unload_provider.inc +--source suite/galera/include/galera_stop_replication.inc --connection node_3 ---source suite/galera/include/galera_unload_provider.inc +--source suite/galera/include/galera_stop_replication.inc --connection node_1 --source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc index 28c854c44f4..f4350d25ae9 100644 --- a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc +++ b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc @@ -343,11 +343,12 @@ DELETE FROM t1 WHERE c=1; DROP TABLE t1; } ---error ER_PARSE_ERROR CREATE TABLE t1 (c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar")); +SHOW CREATE TABLE t1; +DROP TABLE t1; CREATE TABLE t1 (i INT); ---error ER_PARSE_ERROR ALTER TABLE t1 ADD COLUMN c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar"); +SHOW CREATE TABLE t1; DROP TABLE t1; --error ER_PARSE_ERROR CREATE TABLE t1 (i INT COLLATE utf8_bin, c INT COLLATE utf8_bin GENERATED ALWAYS AS (10)); diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result index ee80e5f605a..48c4613f6ca 100644 --- a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result @@ -426,10 +426,20 @@ INSERT INTO t1(a) VALUES(0); DELETE FROM t1 WHERE c=1; DROP TABLE t1; CREATE TABLE t1 (c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar")); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GENERATED ALWAYS AS ("foo bar"))' at line 1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ('foo bar') VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; CREATE TABLE t1 (i INT); ALTER TABLE t1 ADD COLUMN c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar"); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GENERATED ALWAYS AS ("foo bar")' at line 1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + `c` char(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ('foo bar') VIRTUAL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (i INT COLLATE utf8_bin, c INT COLLATE utf8_bin GENERATED ALWAYS AS (10)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GENERATED ALWAYS AS (10))' at line 1 diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result index 09e5b617af1..b7ae6488c95 100644 --- a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result @@ -426,10 +426,20 @@ INSERT INTO t1(a) VALUES(0); DELETE FROM t1 WHERE c=1; DROP TABLE t1; CREATE TABLE t1 (c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar")); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GENERATED ALWAYS AS ("foo bar"))' at line 1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ('foo bar') VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; CREATE TABLE t1 (i INT); ALTER TABLE t1 ADD COLUMN c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar"); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GENERATED ALWAYS AS ("foo bar")' at line 1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + `c` char(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ('foo bar') VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (i INT COLLATE utf8_bin, c INT COLLATE utf8_bin GENERATED ALWAYS AS (10)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GENERATED ALWAYS AS (10))' at line 1 diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk.result b/mysql-test/suite/gcol/r/innodb_virtual_fk.result index 50685e04a69..252274f3e0a 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_fk.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_fk.result @@ -790,3 +790,36 @@ t1 CREATE TABLE `t1` ( ALTER TABLE t1 DROP INDEX f1; ALTER TABLE t1 DROP f3; DROP TABLE t1; +# +# MDEV-24041 Generated column DELETE with FOREIGN KEY crash InnoDB +# +SET FOREIGN_KEY_CHECKS=1; +CREATE DATABASE `a-b`; +USE `a-b`; +CREATE TABLE emails ( +id int, +PRIMARY KEY (id) +) ENGINE=InnoDB; +CREATE TABLE email_stats ( +id int, +email_id int, +date_sent char(4), +generated_email_id int as (email_id), +#generated_sent_date DATE GENERATED ALWAYS AS (date_sent), +PRIMARY KEY (id), +KEY mautic_generated_sent_date_email_id (generated_email_id), +FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE SET NULL +) ENGINE=InnoDB; +CREATE TABLE emails_metadata ( +email_id int, +PRIMARY KEY (email_id), +CONSTRAINT FK FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE CASCADE +) ENGINE=InnoDB; +INSERT INTO emails VALUES (1); +INSERT INTO email_stats (id, email_id, date_sent) VALUES (1,1,'Jan'); +INSERT INTO emails_metadata VALUES (1); +DELETE FROM emails; +DROP TABLE email_stats; +DROP TABLE emails_metadata; +DROP TABLE emails; +DROP DATABASE `a-b`; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_fk.test b/mysql-test/suite/gcol/t/innodb_virtual_fk.test index 23d3ee97290..24b6a4631e6 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_fk.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_fk.test @@ -649,3 +649,44 @@ SHOW CREATE TABLE t1; ALTER TABLE t1 DROP INDEX f1; ALTER TABLE t1 DROP f3; DROP TABLE t1; + +--echo # +--echo # MDEV-24041 Generated column DELETE with FOREIGN KEY crash InnoDB +--echo # +SET FOREIGN_KEY_CHECKS=1; +CREATE DATABASE `a-b`; +USE `a-b`; +CREATE TABLE emails ( + id int, + PRIMARY KEY (id) +) ENGINE=InnoDB; + +CREATE TABLE email_stats ( + id int, + email_id int, + date_sent char(4), + generated_email_id int as (email_id), + #generated_sent_date DATE GENERATED ALWAYS AS (date_sent), + PRIMARY KEY (id), + KEY mautic_generated_sent_date_email_id (generated_email_id), + FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE SET NULL +) ENGINE=InnoDB; + + +CREATE TABLE emails_metadata ( + email_id int, + PRIMARY KEY (email_id), + CONSTRAINT FK FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE CASCADE +) ENGINE=InnoDB; + + +INSERT INTO emails VALUES (1); +INSERT INTO email_stats (id, email_id, date_sent) VALUES (1,1,'Jan'); +INSERT INTO emails_metadata VALUES (1); + +DELETE FROM emails; + +DROP TABLE email_stats; +DROP TABLE emails_metadata; +DROP TABLE emails; +DROP DATABASE `a-b`; diff --git a/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc b/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc deleted file mode 100644 index d9c0294faf5..00000000000 --- a/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc +++ /dev/null @@ -1,152 +0,0 @@ ---echo # ---echo # Testing robustness against random compression failures ---echo # - ---source include/not_embedded.inc ---source include/have_innodb.inc - ---let $simulate_comp_failures_save = `SELECT @@innodb_simulate_comp_failures` - ---disable_query_log -call mtr.add_suppression("InnoDB: Simulating a compression failure for table `test`\\.`t1`"); ---enable_query_log - -# create the table with compressed pages of size 8K. -CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(msg)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; - -SHOW CREATE TABLE t1; - -# percentage of compressions that will be forced to fail -SET GLOBAL innodb_simulate_comp_failures = 25; - ---disable_query_log ---disable_result_log - -let $num_inserts_ind = $num_inserts; -let $commit_iterations=50; - -while ($num_inserts_ind) -{ - let $repeat = `select floor(rand() * 10)`; - eval INSERT INTO t1(id, msg) - VALUES ($num_inserts_ind, REPEAT('abcdefghijklmnopqrstuvwxyz', $repeat)); - dec $num_inserts_ind; -} - ---enable_query_log ---enable_result_log - -COMMIT; -SELECT COUNT(id) FROM t1; - ---disable_query_log ---disable_result_log - -# do random ops, making sure that some pages will get fragmented and reorganized. -let $num_ops_ind = $num_ops; -let $commit_count= $commit_iterations; - -BEGIN; - -while($num_ops_ind) -{ - let $idx = `select floor(rand()*$num_inserts)`; - let $insert_or_update = `select floor(rand()*3)`; - - let $repeat = `select floor(rand() * 9) + 1`; - - let $msg = query_get_value(`select repeat('abcdefghijklmnopqrstuvwxyz', $repeat) as x`, x, 1); - - let $single_or_multi = `select floor(rand()*10)`; - - if ($insert_or_update) - { - let $cnt = query_get_value(SELECT COUNT(*) cnt FROM t1 WHERE id=$idx, cnt, 1); - - if ($cnt) - { - let $update = `select floor(rand()*2)`; - - if ($update) - { - if ($single_or_multi) - { - eval UPDATE t1 SET msg=\"$msg\" WHERE id=$idx; - } - - if (!$single_or_multi) - { - eval UPDATE t1 SET msg=\"$msg\" WHERE id >= $idx - 100 AND id <= $idx + 100; - } - - } - - if (!$update) - { - if ($single_or_multi) - { - eval INSERT INTO t1(msg, id) VALUES (\"$msg\", $idx) ON DUPLICATE KEY UPDATE msg=VALUES(msg), id = VALUES(id); - } - - if (!$single_or_multi) - { - let $diff = 200; - - while ($diff) - { - eval INSERT INTO t1(msg, id) VALUES (\"$msg\", $idx + 100 - $diff) ON DUPLICATE KEY UPDATE msg=VALUES(msg), id=VALUES(id); - - dec $diff; - } - } - } - } - - if (!$cnt) - { - let $null_msg = `select floor(rand()*2)`; - - if ($null_msg) - { - eval INSERT INTO t1(id,msg) VALUES ($idx, NULL); - } - - if (!$null_msg) - { - eval INSERT INTO t1(id, msg) VALUES ($idx, \"$msg\"); - } - } - } - - if (!$insert_or_update) - { - if ($single_or_multi) - { - eval DELETE from t1 WHERE id=$idx; - } - - if (!$single_or_multi) - { - eval DELETE from t1 WHERE id >= $idx - 100 AND id <= $idx + 100; - } - } - - dec $commit_count; - if (!$commit_count) - { - let $commit_count= $commit_iterations; - COMMIT; - BEGIN; - } - - dec $num_ops_ind; -} - -COMMIT; - -# final cleanup -DROP TABLE t1; - -eval SET GLOBAL innodb_simulate_comp_failures = $simulate_comp_failures_save; - ---enable_query_log diff --git a/mysql-test/suite/innodb/r/alter_large_dml.result b/mysql-test/suite/innodb/r/alter_large_dml.result index 056e8fdd768..41f497a5591 100644 --- a/mysql-test/suite/innodb/r/alter_large_dml.result +++ b/mysql-test/suite/innodb/r/alter_large_dml.result @@ -14,16 +14,10 @@ SET DEBUG_SYNC = 'now SIGNAL dml_pause'; SET DEBUG_SYNC = 'now WAIT_FOR dml_restart'; ROLLBACK; BEGIN; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; +INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_81920; ROLLBACK; BEGIN; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_114688; ROLLBACK; SET DEBUG_SYNC = 'now SIGNAL dml_done'; connect con2, localhost,root,,test; diff --git a/mysql-test/suite/innodb/r/alter_mdl_timeout.result b/mysql-test/suite/innodb/r/alter_mdl_timeout.result new file mode 100644 index 00000000000..7af1362c69e --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_mdl_timeout.result @@ -0,0 +1,23 @@ +create table t1(f1 char(10), f2 char(10) not null, f3 int not null, +f4 int not null, primary key(f3))engine=innodb; +insert into t1 values('a','a', 1, 1), ('b','b', 2, 2), ('c', 'c', 3, 3), ('d', 'd', 4, 4); +SET DEBUG_SYNC="row_merge_after_scan SIGNAL con1_start WAIT_FOR con1_insert"; +SET DEBUG_SYNC="innodb_commit_inplace_alter_table_wait SIGNAL con1_wait WAIT_FOR con1_update"; +ALTER TABLE t1 ADD UNIQUE INDEX(f1(3), f4), ADD UNIQUE INDEX(f2), ALGORITHM=INPLACE; +connect con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR con1_start"; +begin; +INSERT INTO t1 VALUES('e','e',5, 5); +SET DEBUG_SYNC="now SIGNAL con1_insert"; +SET DEBUG_SYNC="now WAIT_FOR con1_wait"; +SET DEBUG_SYNC="before_row_upd_sec_new_index_entry SIGNAL con1_update WAIT_FOR alter_rollback"; +UPDATE t1 set f4 = 10 order by f1 desc limit 2; +connection default; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET DEBUG_SYNC="now SIGNAL alter_rollback"; +connection con1; +commit; +connection default; +disconnect con1; +DROP TABLE t1; +SET DEBUG_SYNC="RESET"; diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result index fc08f29e515..46162c167da 100644 --- a/mysql-test/suite/innodb/r/alter_table.result +++ b/mysql-test/suite/innodb/r/alter_table.result @@ -70,3 +70,19 @@ ERROR HY000: Tablespace has been discarded for table `t` ALTER TABLE t FORCE; ERROR HY000: Tablespace has been discarded for table `t` DROP TABLE t; +# +# MDEV-24763 ALTER TABLE fails to rename a column in SYS_FIELDS +# +CREATE TABLE t1 (a INT, b TEXT, c INT, PRIMARY KEY(b(9)), INDEX(c,a)) +ENGINE=InnoDB; +ALTER TABLE t1 CHANGE COLUMN a u INT; +SELECT sf.* FROM information_schema.innodb_sys_fields sf +INNER JOIN information_schema.innodb_sys_indexes si ON sf.index_id=si.index_id +INNER JOIN information_schema.innodb_sys_tables st ON si.table_id=st.table_id +WHERE st.name='test/t1' ORDER BY sf.index_id,sf.pos; +INDEX_ID NAME POS +ID b 0 +ID c 0 +ID u 1 +DROP TABLE t1; +# End of 10.2 tests diff --git a/mysql-test/suite/innodb/r/alter_varchar_change.result b/mysql-test/suite/innodb/r/alter_varchar_change.result index 8ffc6e5cfe2..e7793863ff8 100644 --- a/mysql-test/suite/innodb/r/alter_varchar_change.result +++ b/mysql-test/suite/innodb/r/alter_varchar_change.result @@ -460,11 +460,18 @@ DROP TABLE t1; DROP PROCEDURE get_index_id; DROP PROCEDURE get_table_id; create table t (a varchar(100)) engine=innodb; -select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a'; +select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len +from information_schema.innodb_sys_columns sc +inner join information_schema.innodb_sys_tables st +on sc.table_id=st.table_id where st.name='test/t' and sc.name='a'; name pos mtype prtype len a 0 1 524303 100 alter table t modify a varchar(110), algorithm=inplace; -select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a'; +select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len +from information_schema.innodb_sys_columns sc +inner join information_schema.innodb_sys_tables st +on sc.table_id=st.table_id where st.name='test/t' and sc.name='a'; name pos mtype prtype len a 0 1 524303 110 drop table t; +# End of 10.2 tests diff --git a/mysql-test/suite/innodb/r/file_format_defaults.result b/mysql-test/suite/innodb/r/file_format_defaults.result index 5ea34ceb7b5..2be4e375eb2 100644 --- a/mysql-test/suite/innodb/r/file_format_defaults.result +++ b/mysql-test/suite/innodb/r/file_format_defaults.result @@ -12,7 +12,7 @@ Warning 131 Using innodb_large_prefix is deprecated and the parameter may be rem SET SQL_MODE=strict_all_tables; CREATE TABLE tab0 (c1 VARCHAR(65530), KEY(c1(3073))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes SHOW CREATE TABLE tab0; Table Create Table tab0 CREATE TABLE `tab0` ( diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result index 8101ae6bea2..ca27595ffa0 100644 --- a/mysql-test/suite/innodb/r/foreign_key.result +++ b/mysql-test/suite/innodb/r/foreign_key.result @@ -413,6 +413,7 @@ CREATE TABLE x AS SELECT * FROM t1; ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state connect con1,localhost,root,,test; SET foreign_key_checks= OFF, innodb_lock_wait_timeout= 1; +SET lock_wait_timeout=5; ALTER TABLE t1 ADD FOREIGN KEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE; ERROR HY000: Lock wait timeout exceeded; try restarting transaction disconnect con1; diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result index 87d7d1c60d3..6c405627e08 100644 --- a/mysql-test/suite/innodb/r/innodb-autoinc.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc.result @@ -789,7 +789,7 @@ t2 CREATE TABLE `t2` ( `n` int(10) unsigned NOT NULL, `o` enum('FALSE','TRUE') DEFAULT NULL, PRIMARY KEY (`m`) -) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; SHOW CREATE TABLE t1; Table Create Table diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index 921f9880d47..326aed06901 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -2302,7 +2302,7 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/ create table t1 (v varchar(65530), key(v)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes SET GLOBAL innodb_large_prefix=default; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/ @@ -2477,11 +2477,11 @@ Warning 131 Using innodb_large_prefix is deprecated and the parameter may be rem create table t1 (col1 varchar(768), index(col1)) character set = latin1 engine = innodb; Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes create table t2 (col1 varbinary(768), index(col1)) character set = latin1 engine = innodb; Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes create table t3 (col1 text, index(col1(768))) character set = latin1 engine = innodb; Warnings: @@ -3373,3 +3373,20 @@ c1 c2 9 3 DROP TABLE t1; DROP TABLE t2; +# +# MDEV-24748 Extern field check missing +# in btr_index_rec_validate() +# +CREATE TABLE t1 (pk INT, c1 char(255), +c2 char(255), c3 char(255), c4 char(255), +c5 char(255), c6 char(255), c7 char(255), +c8 char(255), primary key (pk) +) CHARACTER SET utf32 ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'), +(2, 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 FORCE; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_bug60049.result b/mysql-test/suite/innodb/r/innodb_bug60049.result deleted file mode 100644 index f34ebc0a955..00000000000 --- a/mysql-test/suite/innodb/r/innodb_bug60049.result +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE t(a INT)ENGINE=InnoDB STATS_PERSISTENT=0; -RENAME TABLE t TO u; -DROP TABLE u; -SELECT @@innodb_fast_shutdown; -@@innodb_fast_shutdown -0 -Last record of ID_IND root page (9): -18080000180500c0000000000000000c5359535f464f524549474e5f434f4c53 diff --git a/mysql-test/suite/innodb/r/innodb_multi_update.result b/mysql-test/suite/innodb/r/innodb_multi_update.result index 64f9ebc2fc2..93bd4e6716c 100644 --- a/mysql-test/suite/innodb/r/innodb_multi_update.result +++ b/mysql-test/suite/innodb/r/innodb_multi_update.result @@ -81,4 +81,5 @@ CREATE TABLE t1(f1 INT) ENGINE=INNODB; INSERT INTO t1 VALUES(1); UPDATE (SELECT ((SELECT 1 FROM t1), 1) FROM t1 WHERE (SELECT 1 FROM t1)) x, (SELECT 1) AS d SET d.f1 = 1; ERROR 21000: Operand should contain 1 column(s) +UPDATE (SELECT ((SELECT 1 FROM t1),1) = (1,1) FROM t1 WHERE (SELECT 1 FROM t1)) x, t1 AS d SET d.f1 = 1; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index 0272ecd82b5..877f20cf195 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -1166,7 +1166,7 @@ drop table t1,t2; create table t1(f1 varchar(800) binary not null, key(f1)) character set utf8 collate utf8_general_ci; Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes insert into t1 values('aaa'); drop table t1; CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB; diff --git a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result b/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result deleted file mode 100644 index f35e4159603..00000000000 --- a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result +++ /dev/null @@ -1,17 +0,0 @@ -# -# Testing robustness against random compression failures -# -CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(msg)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `msg` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `msg_i` (`msg`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 -SET GLOBAL innodb_simulate_comp_failures = 25; -COMMIT; -SELECT COUNT(id) FROM t1; -COUNT(id) -1500 diff --git a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures_small.result b/mysql-test/suite/innodb/r/innodb_simulate_comp_failures_small.result deleted file mode 100644 index 099c673bca7..00000000000 --- a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures_small.result +++ /dev/null @@ -1,17 +0,0 @@ -# -# Testing robustness against random compression failures -# -CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(msg)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `msg` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `msg_i` (`msg`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 -SET GLOBAL innodb_simulate_comp_failures = 25; -COMMIT; -SELECT COUNT(id) FROM t1; -COUNT(id) -1000 diff --git a/mysql-test/suite/innodb/r/truncate_foreign.result b/mysql-test/suite/innodb/r/truncate_foreign.result index fc09b74d62f..12a41860708 100644 --- a/mysql-test/suite/innodb/r/truncate_foreign.result +++ b/mysql-test/suite/innodb/r/truncate_foreign.result @@ -57,3 +57,14 @@ disconnect dml; connection default; SET DEBUG_SYNC = RESET; DROP TABLE child, parent; +# +# MDEV-24532 Table corruption ER_NO_SUCH_TABLE_IN_ENGINE or +# ER_CRASHED_ON_USAGE after ALTER on table with foreign key +# +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FOREIGN KEY (b) REFERENCES t1 (a) ON UPDATE CASCADE; +LOCK TABLE t1 WRITE; +TRUNCATE TABLE t1; +ALTER TABLE t1 ADD c INT; +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/alter_large_dml.test b/mysql-test/suite/innodb/t/alter_large_dml.test index 5ab3f394115..54f5f171f05 100644 --- a/mysql-test/suite/innodb/t/alter_large_dml.test +++ b/mysql-test/suite/innodb/t/alter_large_dml.test @@ -25,17 +25,11 @@ SET DEBUG_SYNC = 'now WAIT_FOR dml_restart'; ROLLBACK; BEGIN; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; -INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384; +INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_81920; ROLLBACK; BEGIN; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; -INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_114688; ROLLBACK; SET DEBUG_SYNC = 'now SIGNAL dml_done'; diff --git a/mysql-test/suite/innodb/t/alter_mdl_timeout.opt b/mysql-test/suite/innodb/t/alter_mdl_timeout.opt new file mode 100644 index 00000000000..9e0e38bd64a --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_mdl_timeout.opt @@ -0,0 +1 @@ +--lock_wait_timeout=2 diff --git a/mysql-test/suite/innodb/t/alter_mdl_timeout.test b/mysql-test/suite/innodb/t/alter_mdl_timeout.test new file mode 100644 index 00000000000..15e7f524fd0 --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_mdl_timeout.test @@ -0,0 +1,32 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +create table t1(f1 char(10), f2 char(10) not null, f3 int not null, + f4 int not null, primary key(f3))engine=innodb; +insert into t1 values('a','a', 1, 1), ('b','b', 2, 2), ('c', 'c', 3, 3), ('d', 'd', 4, 4); +SET DEBUG_SYNC="row_merge_after_scan SIGNAL con1_start WAIT_FOR con1_insert"; +SET DEBUG_SYNC="innodb_commit_inplace_alter_table_wait SIGNAL con1_wait WAIT_FOR con1_update"; +send ALTER TABLE t1 ADD UNIQUE INDEX(f1(3), f4), ADD UNIQUE INDEX(f2), ALGORITHM=INPLACE; + +connect(con1,localhost,root,,,); +SET DEBUG_SYNC="now WAIT_FOR con1_start"; +begin; +INSERT INTO t1 VALUES('e','e',5, 5); +SET DEBUG_SYNC="now SIGNAL con1_insert"; +SET DEBUG_SYNC="now WAIT_FOR con1_wait"; +SET DEBUG_SYNC="before_row_upd_sec_new_index_entry SIGNAL con1_update WAIT_FOR alter_rollback"; +SEND UPDATE t1 set f4 = 10 order by f1 desc limit 2; + +connection default; +--error ER_LOCK_WAIT_TIMEOUT +reap; +SET DEBUG_SYNC="now SIGNAL alter_rollback"; + +connection con1; +reap; +commit; + +connection default; +disconnect con1; +DROP TABLE t1; +SET DEBUG_SYNC="RESET"; diff --git a/mysql-test/suite/innodb/t/alter_table.test b/mysql-test/suite/innodb/t/alter_table.test index 5050abdc087..5c06388cdba 100644 --- a/mysql-test/suite/innodb/t/alter_table.test +++ b/mysql-test/suite/innodb/t/alter_table.test @@ -79,3 +79,18 @@ ALTER TABLE t ENGINE INNODB; --error ER_TABLESPACE_DISCARDED ALTER TABLE t FORCE; DROP TABLE t; + +--echo # +--echo # MDEV-24763 ALTER TABLE fails to rename a column in SYS_FIELDS +--echo # +CREATE TABLE t1 (a INT, b TEXT, c INT, PRIMARY KEY(b(9)), INDEX(c,a)) +ENGINE=InnoDB; +ALTER TABLE t1 CHANGE COLUMN a u INT; +--replace_column 1 ID +SELECT sf.* FROM information_schema.innodb_sys_fields sf +INNER JOIN information_schema.innodb_sys_indexes si ON sf.index_id=si.index_id +INNER JOIN information_schema.innodb_sys_tables st ON si.table_id=st.table_id +WHERE st.name='test/t1' ORDER BY sf.index_id,sf.pos; +DROP TABLE t1; + +--echo # End of 10.2 tests diff --git a/mysql-test/suite/innodb/t/alter_varchar_change.test b/mysql-test/suite/innodb/t/alter_varchar_change.test index 6a5719a1ef0..98e32146b99 100644 --- a/mysql-test/suite/innodb/t/alter_varchar_change.test +++ b/mysql-test/suite/innodb/t/alter_varchar_change.test @@ -337,7 +337,15 @@ DROP PROCEDURE get_table_id; # LEN must increase here create table t (a varchar(100)) engine=innodb; -select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a'; +select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len +from information_schema.innodb_sys_columns sc +inner join information_schema.innodb_sys_tables st +on sc.table_id=st.table_id where st.name='test/t' and sc.name='a'; alter table t modify a varchar(110), algorithm=inplace; -select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a'; +select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len +from information_schema.innodb_sys_columns sc +inner join information_schema.innodb_sys_tables st +on sc.table_id=st.table_id where st.name='test/t' and sc.name='a'; drop table t; + +--echo # End of 10.2 tests diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test index 380d4520d87..7756d48046f 100644 --- a/mysql-test/suite/innodb/t/foreign_key.test +++ b/mysql-test/suite/innodb/t/foreign_key.test @@ -414,6 +414,7 @@ INSERT INTO t1 VALUES (1,2); CREATE TABLE x AS SELECT * FROM t1; --connect (con1,localhost,root,,test) SET foreign_key_checks= OFF, innodb_lock_wait_timeout= 1; +SET lock_wait_timeout=5; --error ER_LOCK_WAIT_TIMEOUT ALTER TABLE t1 ADD FOREIGN KEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE;# Cleanup --disconnect con1 diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index 7aa146d7d99..d494f40bcb6 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -2628,3 +2628,21 @@ SELECT * FROM t2; DROP TABLE t1; DROP TABLE t2; + +--echo # +--echo # MDEV-24748 Extern field check missing +--echo # in btr_index_rec_validate() +--echo # +CREATE TABLE t1 (pk INT, c1 char(255), +c2 char(255), c3 char(255), c4 char(255), +c5 char(255), c6 char(255), c7 char(255), +c8 char(255), primary key (pk) +) CHARACTER SET utf32 ENGINE=InnoDB; + +INSERT INTO t1 VALUES + (1, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'), + (2, 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'); +CHECK TABLE t1; +ALTER TABLE t1 FORCE; +# Cleanup +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_bug60049-master.opt b/mysql-test/suite/innodb/t/innodb_bug60049-master.opt deleted file mode 100644 index 22a5d4ed221..00000000000 --- a/mysql-test/suite/innodb/t/innodb_bug60049-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_fast_shutdown=0 diff --git a/mysql-test/suite/innodb/t/innodb_bug60049.test b/mysql-test/suite/innodb/t/innodb_bug60049.test deleted file mode 100644 index cb05ca297ea..00000000000 --- a/mysql-test/suite/innodb/t/innodb_bug60049.test +++ /dev/null @@ -1,49 +0,0 @@ -# Bug #60049 Verify that purge leaves no garbage in unique secondary indexes -# This test requires a fresh server start-up and a slow shutdown. -# This was a suspected bug (not a bug). - --- source include/not_embedded.inc --- source include/have_innodb.inc --- source include/have_innodb_16k.inc - --- disable_query_log -call mtr.add_suppression('\\[ERROR\\] InnoDB: Table `mysql`.`innodb_(table|index)_stats` not found'); -call mtr.add_suppression('\\[ERROR\\] InnoDB: Fetch of persistent statistics requested for table `mysql`.`gtid_executed`'); - -let $create1 = query_get_value(SHOW CREATE TABLE mysql.innodb_table_stats, Create Table, 1); -let $create2 = query_get_value(SHOW CREATE TABLE mysql.innodb_index_stats, Create Table, 1); -DROP TABLE mysql.innodb_index_stats; -DROP TABLE mysql.innodb_table_stats; --- enable_query_log - -CREATE TABLE t(a INT)ENGINE=InnoDB STATS_PERSISTENT=0; -RENAME TABLE t TO u; -DROP TABLE u; -SELECT @@innodb_fast_shutdown; -let $MYSQLD_DATADIR=`select @@datadir`; - ---source include/shutdown_mysqld.inc - -# Check the tail of ID_IND (SYS_TABLES.ID) -let IBDATA1=$MYSQLD_DATADIR/ibdata1; -perl; -my $file = $ENV{'IBDATA1'}; -open(FILE, "<$file") || die "Unable to open $file"; -# Read DICT_HDR_TABLE_IDS, the root page number of ID_IND (SYS_TABLES.ID). -seek(FILE, 7*16384+38+36, 0) || die "Unable to seek $file"; -die unless read(FILE, $_, 4) == 4; -my $sys_tables_id_root = unpack("N", $_); -print "Last record of ID_IND root page ($sys_tables_id_root):\n"; -# This should be the last record in ID_IND. Dump it in hexadecimal. -seek(FILE, $sys_tables_id_root*16384 + 152, 0) || die "Unable to seek $file"; -read(FILE, $_, 32) || die "Unable to read $file"; -close(FILE); -print unpack("H*", $_), "\n"; -EOF - ---source include/start_mysqld.inc - --- disable_query_log -USE mysql; -eval $create1; -eval $create2; diff --git a/mysql-test/suite/innodb/t/innodb_multi_update.test b/mysql-test/suite/innodb/t/innodb_multi_update.test index 8d5283a9ed5..74a7aea7d13 100644 --- a/mysql-test/suite/innodb/t/innodb_multi_update.test +++ b/mysql-test/suite/innodb/t/innodb_multi_update.test @@ -35,4 +35,5 @@ CREATE TABLE t1(f1 INT) ENGINE=INNODB; INSERT INTO t1 VALUES(1); --error ER_OPERAND_COLUMNS UPDATE (SELECT ((SELECT 1 FROM t1), 1) FROM t1 WHERE (SELECT 1 FROM t1)) x, (SELECT 1) AS d SET d.f1 = 1; +UPDATE (SELECT ((SELECT 1 FROM t1),1) = (1,1) FROM t1 WHERE (SELECT 1 FROM t1)) x, t1 AS d SET d.f1 = 1; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures-master.opt b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures-master.opt deleted file mode 100644 index 39b205c9b68..00000000000 --- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures-master.opt +++ /dev/null @@ -1,2 +0,0 @@ ---innodb-file-per-table ---skip-innodb-doublewrite diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test deleted file mode 100644 index 5a4978c9b37..00000000000 --- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/big_test.inc -# test takes too long with valgrind ---source include/not_valgrind.inc ---source include/have_debug.inc ---let $num_inserts = 1500 ---let $num_ops = 3500 ---source suite/innodb/include/innodb_simulate_comp_failures.inc -# clean exit ---exit diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small-master.opt b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small-master.opt deleted file mode 100644 index fae32059249..00000000000 --- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small-master.opt +++ /dev/null @@ -1,2 +0,0 @@ ---innodb-file-per-table - diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small.test b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small.test deleted file mode 100644 index 79a16d36917..00000000000 --- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small.test +++ /dev/null @@ -1,8 +0,0 @@ ---source include/have_debug.inc ---source include/not_valgrind.inc - ---let $num_inserts = 1000 ---let $num_ops = 30 ---source suite/innodb/include/innodb_simulate_comp_failures.inc -# clean exit ---exit diff --git a/mysql-test/suite/innodb/t/truncate_foreign.test b/mysql-test/suite/innodb/t/truncate_foreign.test index d9d647e69f0..1c150e5db40 100644 --- a/mysql-test/suite/innodb/t/truncate_foreign.test +++ b/mysql-test/suite/innodb/t/truncate_foreign.test @@ -67,3 +67,16 @@ connection default; SET DEBUG_SYNC = RESET; DROP TABLE child, parent; + +--echo # +--echo # MDEV-24532 Table corruption ER_NO_SUCH_TABLE_IN_ENGINE or +--echo # ER_CRASHED_ON_USAGE after ALTER on table with foreign key +--echo # + +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FOREIGN KEY (b) REFERENCES t1 (a) ON UPDATE CASCADE; +LOCK TABLE t1 WRITE; +TRUNCATE TABLE t1; +ALTER TABLE t1 ADD c INT; +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/create.result b/mysql-test/suite/innodb_fts/r/create.result index c3a14fa0281..963b31fdbd7 100644 --- a/mysql-test/suite/innodb_fts/r/create.result +++ b/mysql-test/suite/innodb_fts/r/create.result @@ -182,3 +182,13 @@ Table Op Msg_type Msg_text test.t1 optimize status OK DROP TABLE t1; SET GLOBAL innodb_optimize_fulltext_only= @optimize_fulltext.save; +# +# MDEV-24403 Segfault on CREATE TABLE with explicit FTS_DOC_ID_INDEX by multiple fields +# +create table t1 ( +f1 int, f2 text, +FTS_DOC_ID bigint unsigned not null, +unique key FTS_DOC_ID_INDEX(FTS_DOC_ID, f1), +fulltext (f2)) +engine=innodb; +ERROR 42000: Incorrect index name 'FTS_DOC_ID_INDEX' diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result index f23813aed48..f1e625037f3 100644 --- a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result +++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result @@ -234,3 +234,35 @@ CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY, f1 VARCHAR(200),FULLTEXT fidx(f1))engine=innodb; ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1); DROP TABLE t1; +# +# MDEV-21478 Inplace alter fails to report error when +# FTS_DOC_ID is added +SET NAMES utf8; +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY; +ALTER TABLE t1 DROP COLUMN FTS_DOC_ıD; +ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (f1 INT NOT NULL)ENGINE=InnoDB; +ALTER TABLE t1 ADD FTS_DOC_Ä°D BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'FTS_DOC_Ä°D' +ALTER TABLE t1 ADD FTS_DOC_Ä°D BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'FTS_DOC_Ä°D' +ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'fts_doc_id' +ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'fts_doc_id' +ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'fts_doc_id' +ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'fts_doc_id' +ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/misc_debug.result b/mysql-test/suite/innodb_fts/r/misc_debug.result index 8ef2ac425fc..b162b2f7415 100644 --- a/mysql-test/suite/innodb_fts/r/misc_debug.result +++ b/mysql-test/suite/innodb_fts/r/misc_debug.result @@ -26,3 +26,29 @@ SET DEBUG_DBUG="+d,fts_instrument_sync"; INSERT INTO t1 VALUES(1, "mariadb"); ALTER TABLE t1 FORCE; DROP TABLE t2, t1; +# +# MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX +# +CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB; +connect con1,localhost,root,,test; +SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL s1 WAIT_FOR g1'; +SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2'; +ALTER TABLE t1 ADD FULLTEXT(c); +connection default; +SET DEBUG_SYNC='now WAIT_FOR s1'; +KILL QUERY @id; +SET DEBUG_SYNC='now SIGNAL g1 WAIT_FOR s2'; +START TRANSACTION; +SELECT * FROM t1; +a b c +SET DEBUG_SYNC='now SIGNAL s2'; +connection con1; +ERROR 70100: Query execution was interrupted +disconnect con1; +connection default; +SET DEBUG_SYNC=RESET; +ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/t/create.test b/mysql-test/suite/innodb_fts/t/create.test index 4e522994fcc..38c93de4982 100644 --- a/mysql-test/suite/innodb_fts/t/create.test +++ b/mysql-test/suite/innodb_fts/t/create.test @@ -106,3 +106,14 @@ SET GLOBAL innodb_optimize_fulltext_only= 1; OPTIMIZE TABLE t1; DROP TABLE t1; SET GLOBAL innodb_optimize_fulltext_only= @optimize_fulltext.save; + +--echo # +--echo # MDEV-24403 Segfault on CREATE TABLE with explicit FTS_DOC_ID_INDEX by multiple fields +--echo # +--error ER_WRONG_NAME_FOR_INDEX +create table t1 ( + f1 int, f2 text, + FTS_DOC_ID bigint unsigned not null, + unique key FTS_DOC_ID_INDEX(FTS_DOC_ID, f1), + fulltext (f2)) +engine=innodb; diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test index cd292803fb3..e055acc4968 100644 --- a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test +++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test @@ -278,3 +278,44 @@ CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY, f1 VARCHAR(200),FULLTEXT fidx(f1))engine=innodb; ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1); DROP TABLE t1; + +--echo # +--echo # MDEV-21478 Inplace alter fails to report error when +--echo # FTS_DOC_ID is added + +SET NAMES utf8; + +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY; +ALTER TABLE t1 DROP COLUMN FTS_DOC_ıD; +ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; +DROP TABLE t1; + +CREATE TABLE t1 (f1 INT NOT NULL)ENGINE=InnoDB; + +--error ER_WRONG_COLUMN_NAME +ALTER TABLE t1 ADD FTS_DOC_Ä°D BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; + +--error ER_WRONG_COLUMN_NAME +ALTER TABLE t1 ADD FTS_DOC_Ä°D BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY; + +--error ER_WRONG_COLUMN_NAME +ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=COPY; + +--error ER_WRONG_COLUMN_NAME +ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=INPLACE; + +--error ER_WRONG_COLUMN_NAME +ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY; + +--error ER_WRONG_COLUMN_NAME +ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; + +--error ER_WRONG_COLUMN_NAME +ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=COPY; + +--error ER_WRONG_COLUMN_NAME +ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=INPLACE; + +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/t/misc_debug.test b/mysql-test/suite/innodb_fts/t/misc_debug.test index aaf628abe6d..461e3f1d9d4 100644 --- a/mysql-test/suite/innodb_fts/t/misc_debug.test +++ b/mysql-test/suite/innodb_fts/t/misc_debug.test @@ -5,6 +5,8 @@ --source include/have_innodb.inc --source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/count_sessions.inc # Following test is for Bug 14668777 - ASSERT ON IB_VECTOR_SIZE( # TABLE->FTS->INDEXES, ALTER TABLE @@ -52,3 +54,32 @@ INSERT INTO t1 VALUES(1, "mariadb"); ALTER TABLE t1 FORCE; # Cleanup DROP TABLE t2, t1; + +--echo # +--echo # MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX +--echo # +CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB; +connect(con1,localhost,root,,test); +let $ID= `SELECT @id := CONNECTION_ID()`; +SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL s1 WAIT_FOR g1'; +SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2'; +send ALTER TABLE t1 ADD FULLTEXT(c); +connection default; +SET DEBUG_SYNC='now WAIT_FOR s1'; +let $ignore= `SELECT @id := $ID`; +KILL QUERY @id; +SET DEBUG_SYNC='now SIGNAL g1 WAIT_FOR s2'; +START TRANSACTION; +SELECT * FROM t1; +SET DEBUG_SYNC='now SIGNAL s2'; +connection con1; +--error ER_QUERY_INTERRUPTED +reap; +disconnect con1; +connection default; +SET DEBUG_SYNC=RESET; +# Exploit MDEV-17468 to force the table definition to be reloaded +ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL; +CHECK TABLE t1; +DROP TABLE t1; +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb_gis/t/1.test b/mysql-test/suite/innodb_gis/t/1.test index 256cd1ab0ad..0e5fba6fc34 100644 --- a/mysql-test/suite/innodb_gis/t/1.test +++ b/mysql-test/suite/innodb_gis/t/1.test @@ -393,7 +393,6 @@ insert into t1 values (1); insert into t1 values (1.11); --error 1416 insert into t1 values ("qwerty"); -# --error ER_GIS_INVALID_DATA --error ER_BAD_NULL_ERROR insert into t1 values (ST_pointfromtext('point(1,1)')); @@ -437,7 +436,6 @@ select ST_y(b) IS NULL from t1; -# --error ER_GIS_INVALID_DATA select MBRwithin(b, b) IS NULL, MBRcontains(b, b) IS NULL, MBRoverlaps(b, b) IS NULL, MBRequals(b, b) IS NULL, MBRdisjoint(b, b) IS NULL, ST_touches(b, b) IS NULL, @@ -466,7 +464,6 @@ DROP TABLE t1; # CREATE TABLE `t1` ( `col9` set('a'), `col89` date); INSERT IGNORE INTO `t1` VALUES ('','0000-00-00'); -# --error ER_GIS_INVALID_DATA select ST_geomfromtext(col9,col89) as a from t1; DROP TABLE t1; @@ -623,17 +620,11 @@ SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRwithin FROM t1 a1 JOIN # MBROverlaps needs a few more tests, with point and line dimensions -# --error ER_GIS_INVALID_DATA SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); -# --error ER_GIS_INVALID_DATA SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); -# --error ER_GIS_INVALID_DATA SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); -# --error ER_GIS_INVALID_DATA SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); -# --error ER_GIS_INVALID_DATA SET @point1 = ST_GeomFromText('POLYGON ((0 0))'); -# --error ER_GIS_INVALID_DATA SET @point2 = ST_GeomFromText('POLYGON ((-2 0))'); SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name; @@ -772,10 +763,8 @@ SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUA --echo # BUG#51875: crash when loading data into geometry function ST_polyfromwkb --echo # SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; -# --error ER_GIS_INVALID_DATA SET @a=ST_POLYFROMWKB(@a); SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; -# --error ER_GIS_INVALID_DATA SET @a=ST_POLYFROMWKB(@a); @@ -899,7 +888,6 @@ DROP TABLE g1; CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255))); INSERT INTO g1 VALUES ('a'),('a'); -# --error ER_GIS_INVALID_DATA SELECT 1 FROM g1 WHERE a >= ANY (SELECT 1 FROM g1 WHERE a = ST_geomfromtext('') OR a) ; @@ -1447,5 +1435,4 @@ DROP DATABASE gis_ogs; --echo # Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE --echo # -# --error ER_GIS_INVALID_DATA SELECT ST_Union('', ''), md5(1); diff --git a/mysql-test/suite/innodb_gis/t/bug16236208.test b/mysql-test/suite/innodb_gis/t/bug16236208.test index b55ab1d0fd3..3a1fbefc52c 100644 --- a/mysql-test/suite/innodb_gis/t/bug16236208.test +++ b/mysql-test/suite/innodb_gis/t/bug16236208.test @@ -47,7 +47,6 @@ ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')); CREATE INDEX linestring_index ON linestring(linestring_nokey(5)); ALTER TABLE linestring ADD KEY (linestring_key(5)); -# --error ER_GIS_INVALID_DATA SELECT ST_AsText(linestring_nokey) FROM linestring FORCE KEY ( linestring_key ) WHERE ST_CONTAINS( ST_GeomFromText('POLYGON( ( 3923 2815 , 4246 2122 , 4028 2971 , 4017 3019 , 3923 2815 ) )') , linestring_key ) AND diff --git a/mysql-test/suite/innodb_gis/t/create_spatial_index.test b/mysql-test/suite/innodb_gis/t/create_spatial_index.test index 6a15b0f2d74..1c0a7e7aaa7 100644 --- a/mysql-test/suite/innodb_gis/t/create_spatial_index.test +++ b/mysql-test/suite/innodb_gis/t/create_spatial_index.test @@ -1141,7 +1141,6 @@ insert into `t1` values( linestring(point(1,1),point(1,1)) ); -# --error ER_GIS_INVALID_DATA --error ER_BAD_NULL_ERROR insert into `t1` values ( diff --git a/mysql-test/suite/innodb_gis/t/gis.test b/mysql-test/suite/innodb_gis/t/gis.test index 489934e957e..ba1b3b12ec2 100644 --- a/mysql-test/suite/innodb_gis/t/gis.test +++ b/mysql-test/suite/innodb_gis/t/gis.test @@ -388,7 +388,6 @@ insert into t1 values (1.11); --error 1416 insert into t1 values ("qwerty"); --error 1048 -# --error ER_GIS_INVALID_DATA insert into t1 values (ST_pointfromtext('point(1,1)')); drop table t1; @@ -431,7 +430,6 @@ select ST_y(b) IS NULL from t1; -# --error ER_GIS_INVALID_DATA select MBRwithin(b, b) IS NULL, MBRcontains(b, b) IS NULL, MBRoverlaps(b, b) IS NULL, MBRequals(b, b) IS NULL, MBRdisjoint(b, b) IS NULL, ST_touches(b, b) IS NULL, @@ -460,7 +458,6 @@ DROP TABLE t1; # CREATE TABLE `t1` ( `col9` set('a'), `col89` date); INSERT IGNORE INTO `t1` VALUES ('','0000-00-00'); -# --error ER_GIS_INVALID_DATA select ST_geomfromtext(col9,col89) as a from t1; DROP TABLE t1; @@ -617,17 +614,11 @@ SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRwithin FROM t1 a1 JOIN # MBROverlaps needs a few more tests, with point and line dimensions -# --error ER_GIS_INVALID_DATA SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); -# --error ER_GIS_INVALID_DATA SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); -# --error ER_GIS_INVALID_DATA SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); -# --error ER_GIS_INVALID_DATA SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); -# --error ER_GIS_INVALID_DATA SET @point1 = ST_GeomFromText('POLYGON ((0 0))'); -# --error ER_GIS_INVALID_DATA SET @point2 = ST_GeomFromText('POLYGON ((-2 0))'); SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name; @@ -766,10 +757,8 @@ SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUA --echo # BUG#51875: crash when loading data into geometry function ST_polyfromwkb --echo # SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; -# --error ER_GIS_INVALID_DATA SET @a=ST_POLYFROMWKB(@a); SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; -# --error ER_GIS_INVALID_DATA SET @a=ST_POLYFROMWKB(@a); @@ -901,7 +890,6 @@ DROP TABLE g1; CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255))); INSERT INTO g1 VALUES ('a'),('a'); -# --error ER_GIS_INVALID_DATA SELECT 1 FROM g1 WHERE a >= ANY (SELECT 1 FROM g1 WHERE a = ST_geomfromtext('') OR a) ; @@ -1440,5 +1428,4 @@ DROP DATABASE gis_ogs; --echo # Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE --echo # -# --error ER_GIS_INVALID_DATA SELECT ST_Union('', ''), md5(1); diff --git a/mysql-test/suite/innodb_gis/t/precise.test b/mysql-test/suite/innodb_gis/t/precise.test index 9174a100003..3936610530f 100644 --- a/mysql-test/suite/innodb_gis/t/precise.test +++ b/mysql-test/suite/innodb_gis/t/precise.test @@ -122,7 +122,6 @@ SELECT ST_Equals(ST_PointFromText('POINT (12 13)'),ST_PointFromText('POINT (12 1 --echo # BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL --echo # -# --error ER_GIS_INVALID_DATA SELECT ST_ASTEXT(ST_UNION(ST_GEOMFROMTEXT('POLYGON((525000 183300,525400 183300,525400 18370, 525000 183700,525000 183300))'), ST_geomfromtext('POLYGON((525298.67 183511.53,525296.57 @@ -140,7 +139,6 @@ ST_geomfromtext('POLYGON((525298.67 183511.53,525296.57 183491.55))'))) st_u; SET @a=0x0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000000000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F; -# --error ER_GIS_INVALID_DATA SELECT ST_ASTEXT(ST_TOUCHES(@a, ST_GEOMFROMTEXT('point(0 0)'))) t; diff --git a/mysql-test/suite/innodb_gis/t/rtree.test b/mysql-test/suite/innodb_gis/t/rtree.test index 58d81576b3e..98931e70e62 100644 --- a/mysql-test/suite/innodb_gis/t/rtree.test +++ b/mysql-test/suite/innodb_gis/t/rtree.test @@ -78,17 +78,11 @@ SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square); # MBROverlaps needs a few more tests, with point and line dimensions -# --error ER_GIS_INVALID_DATA SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); -# --error ER_GIS_INVALID_DATA SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); -# --error ER_GIS_INVALID_DATA SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); -# --error ER_GIS_INVALID_DATA SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); -# --error ER_GIS_INVALID_DATA SET @point1 = ST_GeomFromText('POLYGON ((0 0))'); -# --error ER_GIS_INVALID_DATA SET @point2 = ST_GeomFromText('POLYGON ((-2 0))'); SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name; diff --git a/mysql-test/suite/innodb_gis/t/rtree_purge.test b/mysql-test/suite/innodb_gis/t/rtree_purge.test index 42f00428b88..60ecbe2e53a 100644 --- a/mysql-test/suite/innodb_gis/t/rtree_purge.test +++ b/mysql-test/suite/innodb_gis/t/rtree_purge.test @@ -1,7 +1,7 @@ # This test case will test R-tree purge. --source include/innodb_page_size.inc -# Valgrind takes too much time on PB2 even in the --big-test runs. +--source include/have_sequence.inc --source include/not_valgrind.inc SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; @@ -16,9 +16,7 @@ set @p=point(1,1); let $n=200; while ($n) { begin; -insert into t values(@p,@p),(@p,@p); -insert into t select @p,@p -from t a,t b,t c,t d,t e,t f,t g; +insert into t select @p,@p from seq_1_to_130; delete from t; commit; dec $n; diff --git a/mysql-test/suite/innodb_zip/r/index_large_prefix.result b/mysql-test/suite/innodb_zip/r/index_large_prefix.result index fe03586546a..d125df09ae3 100644 --- a/mysql-test/suite/innodb_zip/r/index_large_prefix.result +++ b/mysql-test/suite/innodb_zip/r/index_large_prefix.result @@ -407,10 +407,10 @@ ROW_FORMAT=DYNAMIC; SET sql_mode=''; create index idx1 on worklog5743(a2); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx2 on worklog5743(a3); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743(a4); show warnings; Level Code Message @@ -419,7 +419,7 @@ create index idx4 on worklog5743(a1, a2); ERROR 42000: Specified key was too long; max key length is 3072 bytes show warnings; Level Code Message -Error 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1071 Specified key was too long; max key length is 3072 bytes create index idx5 on worklog5743(a1, a5); ERROR 42000: Specified key was too long; max key length is 3072 bytes diff --git a/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result b/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result index 6cb0b09dee0..a5da38e24db 100644 --- a/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result +++ b/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result @@ -1221,7 +1221,7 @@ DROP INDEX prefix_idx ON worklog5743; SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; CREATE INDEX prefix_idx ON worklog5743(col_1_varbinary (4000)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes SET sql_mode = default; INSERT INTO worklog5743 VALUES(REPEAT("a", 4000),REPEAT("o", 4000)); SELECT col_1_varbinary = REPEAT("a", 4000) FROM worklog5743; diff --git a/mysql-test/suite/maria/maria-ucs2.result b/mysql-test/suite/maria/maria-ucs2.result index 7499b37279b..73c45759373 100644 --- a/mysql-test/suite/maria/maria-ucs2.result +++ b/mysql-test/suite/maria/maria-ucs2.result @@ -17,7 +17,7 @@ test.t1 check status OK SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR ALTER TABLE t1 MODIFY a VARCHAR(800) CHARSET `ucs2`; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -30,7 +30,7 @@ t1 CREATE TABLE `t1` ( DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(800),KEY(a)) ENGINE=Aria CHARACTER SET ucs2; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes INSERT INTO t1 VALUES (REPEAT('abc ',200)); CHECK TABLE t1; Table Op Msg_type Msg_text diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result index 35ec098f7a8..1e85ee8b50c 100644 --- a/mysql-test/suite/maria/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -1585,7 +1585,7 @@ a b drop table t1; create table t1 (v varchar(65530), key(v)); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes drop table if exists t1; set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for create table t1 (v varchar(65536)); @@ -1855,7 +1855,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a varchar(2048), key `a` (a)); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1865,7 +1865,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a varchar(2048), key `a` (a) key_block_size=1024); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1875,7 +1875,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=1024; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1921,7 +1921,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=8192; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1933,7 +1933,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1963,7 +1963,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/maria/maria3.result b/mysql-test/suite/maria/maria3.result index e923039a07f..6005bedf7bb 100644 --- a/mysql-test/suite/maria/maria3.result +++ b/mysql-test/suite/maria/maria3.result @@ -17,7 +17,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/maria/mrr.result b/mysql-test/suite/maria/mrr.result index 06be64566e5..5f9fcb4f937 100644 --- a/mysql-test/suite/maria/mrr.result +++ b/mysql-test/suite/maria/mrr.result @@ -393,7 +393,7 @@ PRIMARY KEY (pk), KEY col_varchar_1024_latin1_key (col_varchar_1024_latin1_key) ) ENGINE=Aria; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes INSERT INTO t1 VALUES (1,'z'), (2,'abcdefjhjkl'), (3,'in'), (4,'abcdefjhjkl'), (6,'abcdefjhjkl'), (11,'zx'), (12,'abcdefjhjm'), (13,'jn'), (14,'abcdefjhjp'), (16,'abcdefjhjr'); @@ -430,7 +430,7 @@ f5 varchar(1024) COLLATE latin1_bin, KEY (f5) ) ENGINE=Aria TRANSACTIONAL=0 ; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes # Fill the table with some data SELECT alias2.* , alias1.f2 FROM diff --git a/mysql-test/suite/mariabackup/error_during_copyback.result b/mysql-test/suite/mariabackup/error_during_copyback.result new file mode 100644 index 00000000000..9b12c1135d2 --- /dev/null +++ b/mysql-test/suite/mariabackup/error_during_copyback.result @@ -0,0 +1,9 @@ +CREATE TABLE t(i INT) ENGINE INNODB; +INSERT INTO t VALUES(1); +# xtrabackup backup +# xtrabackup prepare +# restart server +SELECT * FROM t; +i +1 +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/error_during_copyback.test b/mysql-test/suite/mariabackup/error_during_copyback.test new file mode 100644 index 00000000000..3ec9fbfc3c3 --- /dev/null +++ b/mysql-test/suite/mariabackup/error_during_copyback.test @@ -0,0 +1,25 @@ +--source include/have_debug.inc +CREATE TABLE t(i INT) ENGINE INNODB; +INSERT INTO t VALUES(1); +echo # xtrabackup backup; +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir; +let $_datadir= `SELECT @@datadir`; +--source include/shutdown_mysqld.inc +rmdir $_datadir; +error 1; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir --dbug=+d,copy_file_error; +list_files $_datadir; +rmdir $_datadir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir; +echo # restart server; +--source include/start_mysqld.inc +SELECT * FROM t; +DROP TABLE t; +rmdir $targetdir; + diff --git a/mysql-test/suite/mariabackup/include/corrupt-page.pl b/mysql-test/suite/mariabackup/include/corrupt-page.pl new file mode 100644 index 00000000000..d5c75dbde55 --- /dev/null +++ b/mysql-test/suite/mariabackup/include/corrupt-page.pl @@ -0,0 +1,146 @@ +use strict; +use warnings; +use Fcntl qw(:DEFAULT :seek); +do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; + +sub corrupt_space_page_id { + my $file_name = shift; + my @pages_to_corrupt = @_; + + my $page_size = $ENV{INNODB_PAGE_SIZE}; + + sysopen my $ibd_file, $file_name, O_RDWR || die "Cannot open $file_name\n"; + sysread($ibd_file, $_, 38) || die "Cannot read $file_name\n"; + my $space = unpack("x[34]N", $_); + foreach my $page_no (@pages_to_corrupt) { + $space += 10; # generate wrong space id + sysseek($ibd_file, $page_size * $page_no, SEEK_SET) + || die "Cannot seek $file_name\n"; + + my $head = pack("Nx[18]", $page_no + 10); # generate wrong page number + my $body = chr(0) x ($page_size - 38 - 8); + + # Calculate innodb_checksum_algorithm=crc32 for the unencrypted page. + # The following bytes are excluded: + # bytes 0..3 (the checksum is stored there) + # bytes 26..37 (encryption key version, post-encryption checksum, tablespace id) + # bytes $page_size-8..$page_size-1 (checksum, LSB of FIL_PAGE_LSN) + my $polynomial = 0x82f63b78; # CRC-32C + my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); + + my $page= pack("N",$ck).$head.pack("NNN",1,$ck,$space).$body.pack("Nx[4]",$ck); + die unless syswrite($ibd_file, $page, $page_size) == $page_size; + } + close $ibd_file; +} + +sub extend_space { + my $file_name = shift; + my $n_pages = shift; + + my $page_size = $ENV{INNODB_PAGE_SIZE}; + my $page; + + sysopen my $ibd_file, $file_name, O_RDWR || die "Cannot open $file_name\n"; + sysread($ibd_file, $page, $page_size) + || die "Cannot read $file_name\n"; + my $size = unpack("N", substr($page, 46, 4)); + my $packed_new_size = pack("N", $size + $n_pages); + substr($page, 46, 4, $packed_new_size); + + my $head = substr($page, 4, 22); + my $body = substr($page, 38, $page_size - 38 - 8); + my $polynomial = 0x82f63b78; # CRC-32C + my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); + my $packed_ck = pack("N", $ck); + substr($page, 0, 4, $packed_ck); + substr($page, $page_size - 8, 4, $packed_ck); + + sysseek($ibd_file, 0, SEEK_SET) + || die "Cannot seek $file_name\n"; + die unless syswrite($ibd_file, $page, $page_size) == $page_size; + + sysseek($ibd_file, 0, SEEK_END) + || die "Cannot seek $file_name\n"; + my $pages_size = $page_size*$n_pages; + my $pages = chr(0) x $pages_size; + die unless syswrite($ibd_file, $pages, $pages_size) == $pages_size; + close $ibd_file; + return $size; +} + +sub die_if_page_is_not_zero { + my $file_name = shift; + my @pages_to_check = @_; + + no locale; + my $page_size = $ENV{INNODB_PAGE_SIZE}; + my $zero_page = chr(0) x $page_size; + sysopen my $ibd_file, $file_name, O_RDWR || die "Cannot open $file_name\n"; + foreach my $page_no_to_check (@pages_to_check) { + sysseek($ibd_file, $page_size*$page_no_to_check, SEEK_SET) || + die "Cannot seek $file_name\n"; + sysread($ibd_file, my $read_page, $page_size) || + die "Cannot read $file_name\n"; + die "The page $page_no_to_check is not zero-filed in $file_name" + if ($read_page cmp $zero_page); + } + close $ibd_file; +} + +sub print_corrupted_pages_file { + my $file_in = shift; + my $file_out = shift; + open my $fh, '<', $file_in || die $!; + my $line_number = 0; + my $space = {}; + my @spaces; + while (my $line = <$fh>) { + ++$line_number; + if ($line_number & 1) { + my ($name, $id) = split(/ /, $line); + $space->{name} = $name; + } + else { + $space->{pages} = $line; + push (@spaces, $space); + $space = {}; + } + } + close $fh; + my @sorted_spaces = sort { $a->{name} cmp $b->{name} } @spaces; + open $fh, '>', $file_out || die $!; + foreach my $space (@sorted_spaces) { + print $fh $space->{name}; + print $fh "\n"; + print $fh $space->{pages}; + } + close $fh; +} + +sub append_corrupted_pages { + my $file_name = shift; + my $space_name = shift; + my $pages = shift; + open my $fh, '<', $file_name || die $!; + my $line_number = 0; + my $space_line; + while (my $line = <$fh>) { + ++$line_number; + if ($line_number & 1) { + my ($name, $id) = split(/ /, $line); + if ($name eq $space_name) { + $space_line = $line; + last; + } + } + } + close $fh; + if (not defined $space_line) { + die "Can't find requested space $space_name in file $file_name"; + } + open $fh, '>>', $file_name || die $!; + print $fh $space_line; + print $fh "$pages\n"; + close $fh; +} diff --git a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test index 49e952eefea..1ee6038f072 100644 --- a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test +++ b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test @@ -22,7 +22,7 @@ INSERT into t1 values(1); --let after_copy_test_t2=DROP TABLE test.t2 --let after_copy_test_t3=CREATE INDEX a_i ON test.t3(i); --let before_copy_test_t10=DROP TABLE test.t10 ---let wait_innodb_redo_before_copy=test/t10 +--let wait_innodb_redo_before_copy_test_t10 = 1 # mariabackup should crash with assertion if MDEV-24026 is not fixed exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --dbug=+d,mariabackup_events,mariabackup_inject_code; diff --git a/mysql-test/suite/mariabackup/innodb_force_recovery.result b/mysql-test/suite/mariabackup/innodb_force_recovery.result new file mode 100644 index 00000000000..94a265cfabe --- /dev/null +++ b/mysql-test/suite/mariabackup/innodb_force_recovery.result @@ -0,0 +1,26 @@ +CREATE TABLE t(i INT) ENGINE INNODB; +INSERT INTO t VALUES(1); +# "innodb_force_recovery=1" should be allowed with "--prepare" only (mariabackup) +FOUND 1 /should only be used with "--prepare"/ in backup.log +# "innodb_force_recovery=1" should be allowed with "--apply-log" only (innobackupex) +FOUND 1 /should only be used with "--apply-log"/ in backup.log +# "innodb_force_recovery" should be limited to "SRV_FORCE_IGNORE_CORRUPT" (mariabackup) +FOUND 1 /innodb_force_recovery = 1/ in backup.log +# "innodb_force_recovery" should be limited to "SRV_FORCE_IGNORE_CORRUPT" (innobackupex) +FOUND 1 /innodb_force_recovery = 1/ in backup.log +# "innodb_force_recovery" should be read from "backup-my.cnf" (mariabackup) +FOUND 1 /innodb_force_recovery = 1/ in backup.log +# "innodb_force_recovery=1" should be read from "backup-my.cnf" (innobackupex) +FOUND 1 /innodb_force_recovery = 1/ in backup.log +# "innodb_force_recovery" from the command line should override "backup-my.cnf" (mariabackup) +NOT FOUND /innodb_force_recovery = 1/ in backup.log +# "innodb_force_recovery" from the command line should override "backup-my.cnf" (innobackupex) +NOT FOUND /innodb_force_recovery = 1/ in backup.log +# shutdown server +# remove datadir +# xtrabackup move back +# restart server +SELECT * FROM t; +i +1 +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/innodb_force_recovery.test b/mysql-test/suite/mariabackup/innodb_force_recovery.test new file mode 100644 index 00000000000..3a7b3c6106c --- /dev/null +++ b/mysql-test/suite/mariabackup/innodb_force_recovery.test @@ -0,0 +1,138 @@ +# This test checks if "innodb_force_recovery" is only allowed with "--prepare" +# (for mariabackup) and "--apply-log" (for innobackupex), and is limited to +# "SRV_FORCE_IGNORE_CORRUPT" only. + +# Setup. +--source include/have_innodb.inc + +--let targetdir=$MYSQLTEST_VARDIR/tmp/backup +--let backuplog=$MYSQLTEST_VARDIR/tmp/backup.log + +CREATE TABLE t(i INT) ENGINE INNODB; +INSERT INTO t VALUES(1); + +# Check for command line arguments. +--echo # "innodb_force_recovery=1" should be allowed with "--prepare" only (mariabackup) +--disable_result_log +--error 1 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --innodb-force-recovery=1 --target-dir=$targetdir >$backuplog; +--enable_result_log +--let SEARCH_PATTERN=should only be used with "--prepare" +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc + +--echo # "innodb_force_recovery=1" should be allowed with "--apply-log" only (innobackupex) +--disable_result_log +--error 1 +exec $XTRABACKUP --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --no-timestamp --innodb-force-recovery=1 $targetdir >$backuplog; +--enable_result_log +--let SEARCH_PATTERN=should only be used with "--apply-log" +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc + +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log +--echo # "innodb_force_recovery" should be limited to "SRV_FORCE_IGNORE_CORRUPT" (mariabackup) +--disable_result_log +exec $XTRABACKUP --prepare --innodb-force-recovery=2 --target-dir=$targetdir >$backuplog; +--enable_result_log +--let SEARCH_PATTERN=innodb_force_recovery = 1 +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +rmdir $targetdir; + +--disable_result_log +exec $XTRABACKUP --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --no-timestamp $targetdir; +--enable_result_log +--echo # "innodb_force_recovery" should be limited to "SRV_FORCE_IGNORE_CORRUPT" (innobackupex) +--disable_result_log +exec $XTRABACKUP --innobackupex --apply-log --innodb-force-recovery=2 $targetdir >$backuplog; +--enable_result_log +--let SEARCH_PATTERN=innodb_force_recovery = 1 +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +rmdir $targetdir; + +# Check for default file ("backup-my.cnf"). +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log +perl; +my $cfg_path="$ENV{'targetdir'}/backup-my.cnf"; +open(my $fd, '>>', "$cfg_path"); +print $fd "innodb_force_recovery=1\n"; +close $fd; +EOF +--echo # "innodb_force_recovery" should be read from "backup-my.cnf" (mariabackup) +--disable_result_log +exec $XTRABACKUP --defaults-file=$targetdir/backup-my.cnf --prepare --export --target-dir=$targetdir >$backuplog; +--enable_result_log +--let SEARCH_PATTERN=innodb_force_recovery = 1 +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +rmdir $targetdir; + +--disable_result_log +exec $XTRABACKUP --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --no-timestamp $targetdir; +--enable_result_log +perl; +my $cfg_path="$ENV{'targetdir'}/backup-my.cnf"; +open(my $fd, '>>', "$cfg_path"); +print $fd "innodb_force_recovery=2\n"; +close $fd; +EOF +--echo # "innodb_force_recovery=1" should be read from "backup-my.cnf" (innobackupex) +--disable_result_log +exec $XTRABACKUP --innobackupex --defaults-file=$targetdir/backup-my.cnf --apply-log --export $targetdir >$backuplog; +--enable_result_log +--let SEARCH_PATTERN=innodb_force_recovery = 1 +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +rmdir $targetdir; + +# Check for command line argument precedence. +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log +perl; +my $cfg_path="$ENV{'targetdir'}/backup-my.cnf"; +open(my $fd, '>>', "$cfg_path"); +print $fd "innodb_force_recovery=1\n"; +close $fd; +EOF +--echo # "innodb_force_recovery" from the command line should override "backup-my.cnf" (mariabackup) +--disable_result_log +exec $XTRABACKUP --defaults-file=$targetdir/backup-my.cnf --prepare --innodb-force-recovery=0 --target-dir=$targetdir >$backuplog; +--enable_result_log +--let SEARCH_PATTERN=innodb_force_recovery = 1 +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +rmdir $targetdir; + +--disable_result_log +exec $XTRABACKUP --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --no-timestamp $targetdir; +--enable_result_log +perl; +my $cfg_path="$ENV{'targetdir'}/backup-my.cnf"; +open(my $fd, '>>', "$cfg_path"); +print $fd "innodb_force_recovery=2\n"; +close $fd; +EOF +--echo # "innodb_force_recovery" from the command line should override "backup-my.cnf" (innobackupex) +--disable_result_log +exec $XTRABACKUP --innobackupex --defaults-file=$targetdir/backup-my.cnf --apply-log --innodb-force-recovery=0 --export $targetdir >$backuplog; +--enable_result_log +--let SEARCH_PATTERN=innodb_force_recovery = 1 +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc + +--source include/restart_and_restore.inc + +# Check for restore. +SELECT * FROM t; + +# Clean-up. +DROP TABLE t; +--rmdir $targetdir +--remove_file $backuplog diff --git a/mysql-test/suite/mariabackup/log_page_corruption.opt b/mysql-test/suite/mariabackup/log_page_corruption.opt new file mode 100644 index 00000000000..c44c611ed60 --- /dev/null +++ b/mysql-test/suite/mariabackup/log_page_corruption.opt @@ -0,0 +1 @@ +--innodb-checksum-algorithm=crc32 diff --git a/mysql-test/suite/mariabackup/log_page_corruption.result b/mysql-test/suite/mariabackup/log_page_corruption.result new file mode 100644 index 00000000000..01ad4422c6a --- /dev/null +++ b/mysql-test/suite/mariabackup/log_page_corruption.result @@ -0,0 +1,142 @@ +######## +# Test for generating "innodb_corrupted_pages" file during full and +# incremental backup, including DDL processing +### + +CREATE TABLE t1_corrupted(c INT) ENGINE INNODB; +CREATE TABLE t2_corrupted(c INT) ENGINE INNODB; +CREATE TABLE t3(c INT) ENGINE INNODB; +CREATE TABLE t5_corrupted_to_rename(c INT) ENGINE INNODB; +CREATE TABLE t6_corrupted_to_drop(c INT) ENGINE INNODB; +CREATE TABLE t7_corrupted_to_alter(c INT) ENGINE INNODB; +CREATE TABLE t1_inc_corrupted(c INT) ENGINE INNODB; +CREATE TABLE t2_inc_corrupted(c INT) ENGINE INNODB; +CREATE TABLE t3_inc(c INT) ENGINE INNODB; +CREATE TABLE t5_inc_corrupted_to_rename(c INT) ENGINE INNODB; +CREATE TABLE t6_inc_corrupted_to_drop(c INT) ENGINE INNODB; +CREATE TABLE t7_inc_corrupted_to_alter(c INT) ENGINE INNODB; +INSERT INTO t1_corrupted VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t2_corrupted VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t3 VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t5_corrupted_to_rename VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t6_corrupted_to_drop VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t7_corrupted_to_alter VALUES (3), (4), (5), (6), (7), (8), (9); +# Corrupt tables +# Backup must fail due to page corruption +FOUND 1 /Database page corruption detected.*/ in backup.log +# "innodb_corrupted_pages" file must not exist +# Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option +FOUND 1 /Database page corruption detected.*/ in backup.log +FOUND 1 /completed OK!/ in backup.log +--- "innodb_corrupted_pages" file content: --- +test/t1_corrupted +6 8 9 +test/t2_corrupted +7 8 10 +test/t4_corrupted_new +1 +test/t5_corrupted_to_rename_renamed +6 +test/t7_corrupted_to_alter +3 +------ +INSERT INTO t1_inc_corrupted VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t2_inc_corrupted VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t3_inc VALUES (3), (4), (5), (6), (7), (8), (9); +# Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option +--- "innodb_corrupted_pages" file content: --- +test/t1_corrupted +6 8 9 +test/t1_inc_corrupted +6 8 9 +test/t2_corrupted +7 8 10 +test/t2_inc_corrupted +7 8 10 +test/t4_inc_corrupted_new +1 +test/t5_corrupted_to_rename_renamed +6 +test/t5_inc_corrupted_to_rename_renamed +6 +test/t7_inc_corrupted_to_alter +3 +------ +# Check if corrupted pages were copied to delta files, and non-corrupted pages are not copied. +DROP TABLE t1_corrupted; +DROP TABLE t2_corrupted; +DROP TABLE t4_corrupted_new; +DROP TABLE t5_corrupted_to_rename_renamed; +DROP TABLE t7_corrupted_to_alter; +DROP TABLE t1_inc_corrupted; +DROP TABLE t2_inc_corrupted; +DROP TABLE t4_inc_corrupted_new; +DROP TABLE t5_inc_corrupted_to_rename_renamed; +DROP TABLE t7_inc_corrupted_to_alter; + +######## +# Test for --prepare with "innodb_corrupted_pages" file +### + +# Extend some tablespace and corrupt extended pages for full backup +# Full backup with --log-innodb-page-corruption +--- "innodb_corrupted_pages" file content: --- +test/t3 +6 8 +------ +# Extend some tablespace and corrupt extended pages for incremental backup +# Incremental backup --log-innodb-page-corruption +--- "innodb_corrupted_pages" file content: --- +test/t3 +6 8 +test/t3_inc +6 8 +------ +# Full backup prepare +# "innodb_corrupted_pages" file must not exist after successful prepare +FOUND 1 /was successfuly fixed.*/ in backup.log +# Check that fixed pages are zero-filled +# Incremental backup prepare +# "innodb_corrupted_pages" file must not exist after successful prepare +# do not remove "innodb_corrupted_pages" in incremental dir +FOUND 1 /was successfuly fixed.*/ in backup.log +# Check that fixed pages are zero-filled +# shutdown server +# remove datadir +# xtrabackup move back +# restart server +SELECT * FROM t3; +c +3 +4 +5 +6 +7 +8 +9 +SELECT * FROM t3_inc; +c +3 +4 +5 +6 +7 +8 +9 +# Test the case when not all corrupted pages are fixed + +# Add some fake corrupted pages +# Full backup prepare +FOUND 1 /Error: corrupted page.*/ in backup.log +--- "innodb_corrupted_pages" file content: --- +test/t3 +3 +------ +# Incremental backup prepare +FOUND 1 /Error: corrupted page.*/ in backup.log +--- "innodb_corrupted_pages" file content: --- +test/t3 +3 +------ +DROP TABLE t3; +DROP TABLE t3_inc; diff --git a/mysql-test/suite/mariabackup/log_page_corruption.test b/mysql-test/suite/mariabackup/log_page_corruption.test new file mode 100644 index 00000000000..0151afb96b4 --- /dev/null +++ b/mysql-test/suite/mariabackup/log_page_corruption.test @@ -0,0 +1,430 @@ +--source include/have_debug.inc + +--echo ######## +--echo # Test for generating "innodb_corrupted_pages" file during full and +--echo # incremental backup, including DDL processing +--echo ### +--echo + +CREATE TABLE t1_corrupted(c INT) ENGINE INNODB; +CREATE TABLE t2_corrupted(c INT) ENGINE INNODB; +CREATE TABLE t3(c INT) ENGINE INNODB; +CREATE TABLE t5_corrupted_to_rename(c INT) ENGINE INNODB; +CREATE TABLE t6_corrupted_to_drop(c INT) ENGINE INNODB; +CREATE TABLE t7_corrupted_to_alter(c INT) ENGINE INNODB; + +CREATE TABLE t1_inc_corrupted(c INT) ENGINE INNODB; +CREATE TABLE t2_inc_corrupted(c INT) ENGINE INNODB; +CREATE TABLE t3_inc(c INT) ENGINE INNODB; +CREATE TABLE t5_inc_corrupted_to_rename(c INT) ENGINE INNODB; +CREATE TABLE t6_inc_corrupted_to_drop(c INT) ENGINE INNODB; +CREATE TABLE t7_inc_corrupted_to_alter(c INT) ENGINE INNODB; + +# Fill tables with several pages +INSERT INTO t1_corrupted VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t2_corrupted VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t3 VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t5_corrupted_to_rename VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t6_corrupted_to_drop VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t7_corrupted_to_alter VALUES (3), (4), (5), (6), (7), (8), (9); + +--let MYSQLD_DATADIR=`select @@datadir` +--let INNODB_PAGE_SIZE=`select @@innodb_page_size` + +--source include/shutdown_mysqld.inc +--echo # Corrupt tables +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +my $schema = "$ENV{MYSQLD_DATADIR}/test"; + +my $last_page_no = extend_space("$schema/t1_corrupted.ibd", 4); +corrupt_space_page_id("$schema/t1_corrupted.ibd", + $last_page_no, $last_page_no + 2, $last_page_no + 3); + +$last_page_no = extend_space("$schema/t2_corrupted.ibd", 5); +corrupt_space_page_id("$schema/t2_corrupted.ibd", + $last_page_no + 1, $last_page_no + 2, $last_page_no + 4); + +$last_page_no = extend_space("$schema/t5_corrupted_to_rename.ibd", 1); +corrupt_space_page_id("$schema/t5_corrupted_to_rename.ibd", $last_page_no); + +$last_page_no = extend_space("$schema/t6_corrupted_to_drop.ibd", ); +corrupt_space_page_id("$schema/t6_corrupted_to_drop.ibd", $last_page_no); +EOF +--source include/start_mysqld.inc + +--let targetdir=$MYSQLTEST_VARDIR/tmp/backup +--let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log +--let corrupted_pages_file = $targetdir/innodb_corrupted_pages +--let corrupted_pages_file_filt = $MYSQLTEST_VARDIR/tmp/innodb_corrupted_pages_filt +--let perl_result_file=$MYSQLTEST_VARDIR/tmp/perl_result + +--echo # Backup must fail due to page corruption +--disable_result_log +--error 1 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog; +--enable_result_log + +--let SEARCH_PATTERN=Database page corruption detected.* +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +--echo # "innodb_corrupted_pages" file must not exist +--error 1 +--file_exists $corrupted_pages_file +--rmdir $targetdir + +--let after_load_tablespaces=CREATE TABLE test.t4_corrupted_new ENGINE=INNODB SELECT UUID() from test.seq_1_to_10 +--let add_corrupted_page_for_test_t4_corrupted_new=1 +--let after_copy_test_t5_corrupted_to_rename=RENAME TABLE test.t5_corrupted_to_rename TO test.t5_corrupted_to_rename_renamed +--let after_copy_test_t6_corrupted_to_drop=DROP TABLE test.t6_corrupted_to_drop +--let after_copy_test_t7_corrupted_to_alter=ALTER TABLE test.t7_corrupted_to_alter ADD COLUMN (d INT) +--let add_corrupted_page_for_test_t7_corrupted_to_alter=3 + +--echo # Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option +--disable_result_log +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --log-innodb-page-corruption --target-dir=$targetdir --dbug=+d,mariabackup_events,mariabackup_inject_code > $backuplog +--enable_result_log + +--let SEARCH_PATTERN=Database page corruption detected.* +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc + +--let SEARCH_PATTERN=completed OK! +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc + +--echo --- "innodb_corrupted_pages" file content: --- +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +print_corrupted_pages_file($ENV{corrupted_pages_file}, + $ENV{corrupted_pages_file_filt}); +EOF +--cat_file $corrupted_pages_file_filt +--echo ------ +--let after_load_tablespaces= +--let add_corrupted_page_for_test_t4_corrupted_new= +--let after_copy_test_t5_corrupted_to_rename= +--let after_copy_test_t6_corrupted_to_drop= +--let after_copy_test_t7_corrupted_to_alter= +--let add_corrupted_page_for_test_t7_corrupted_to_alter= +# Fill tables for incremental backup with several pages +INSERT INTO t1_inc_corrupted VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t2_inc_corrupted VALUES (3), (4), (5), (6), (7), (8), (9); +INSERT INTO t3_inc VALUES (3), (4), (5), (6), (7), (8), (9); + +--source include/shutdown_mysqld.inc +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +my $schema="$ENV{MYSQLD_DATADIR}/test"; + +open(my $fh, '>', $ENV{perl_result_file}) or die $!; + +my $last_page_no = extend_space("$schema/t1_inc_corrupted.ibd", 4); +corrupt_space_page_id("$schema/t1_inc_corrupted.ibd", + $last_page_no, $last_page_no + 2, $last_page_no + 3); +print $fh "$last_page_no\n"; + +$last_page_no = extend_space("$schema/t2_inc_corrupted.ibd", 5); +corrupt_space_page_id("$schema/t2_inc_corrupted.ibd", + $last_page_no + 1, $last_page_no + 2, $last_page_no + 4); +print $fh "$last_page_no\n"; + +$last_page_no = extend_space("$schema/t5_inc_corrupted_to_rename.ibd", 1); +corrupt_space_page_id("$schema/t5_inc_corrupted_to_rename.ibd", $last_page_no); +print $fh "$last_page_no\n"; + +$last_page_no = extend_space("$schema/t6_inc_corrupted_to_drop.ibd", ); +corrupt_space_page_id("$schema/t6_inc_corrupted_to_drop.ibd", $last_page_no); + +close $fh; +EOF +--source include/start_mysqld.inc + +--let incdir=$MYSQLTEST_VARDIR/tmp/backup_inc + +--let after_load_tablespaces=CREATE TABLE test.t4_inc_corrupted_new ENGINE=INNODB SELECT UUID() from test.seq_1_to_10 +--let add_corrupted_page_for_test_t4_inc_corrupted_new=1 +--let after_copy_test_t5_inc_corrupted_to_rename=RENAME TABLE test.t5_inc_corrupted_to_rename TO test.t5_inc_corrupted_to_rename_renamed +--let after_copy_test_t6_inc_corrupted_to_drop=DROP TABLE test.t6_inc_corrupted_to_drop +--let after_copy_test_t7_inc_corrupted_to_alter=ALTER TABLE test.t7_inc_corrupted_to_alter ADD COLUMN (d INT) +--let add_corrupted_page_for_test_t7_inc_corrupted_to_alter=3 + +--echo # Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option +--disable_result_log +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --log-innodb-page-corruption --target-dir=$incdir --incremental-basedir=$targetdir --dbug=+d,mariabackup_events,mariabackup_inject_code > $backuplog +--disable_result_log + +--let after_load_tablespaces= +--let add_corrupted_page_for_test_t4_inc_corrupted_new= +--let after_copy_test_t5_inc_corrupted_to_rename= +--let after_copy_test_t6_inc_corrupted_to_drop= +--let after_copy_test_t7_inc_corrupted_to_alter= +--let add_corrupted_page_for_test_t7_inc_corrupted_to_alter= + +--let SEARCH_PATTERN=Database page corruption detected.* +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN=completed OK! +--source include/search_pattern_in_file.inc + +--let corrupted_pages_file = $incdir/innodb_corrupted_pages +--echo --- "innodb_corrupted_pages" file content: --- +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +print_corrupted_pages_file($ENV{corrupted_pages_file}, + $ENV{corrupted_pages_file_filt}); +EOF +--cat_file $corrupted_pages_file_filt +--echo ------ + +--echo # Check if corrupted pages were copied to delta files, and non-corrupted pages are not copied. +perl; +use strict; +use warnings; +my $schema = "$ENV{incdir}/test"; + +open(my $fh, '<', $ENV{perl_result_file}) or die $!; + +my $last_page_no = <$fh>; +die_if_no_pages("$schema/t1_corrupted.ibd.delta", + $last_page_no, $last_page_no + 2, $last_page_no + 3); + +$last_page_no = <$fh>; +die_if_no_pages("$schema/t2_corrupted.ibd.delta", + $last_page_no + 1, $last_page_no + 2, $last_page_no + 4); + +$last_page_no = <$fh>; +die_if_no_pages("$schema/t5_corrupted_to_rename_renamed.ibd.delta", + $last_page_no); + +close $fh; + +die_if_not_empty("$schema/t3.ibd.delta"); + +sub read_first_page_from_delta { + my $file_name = shift; + my $pages_count = shift; + + open my $file, '<:raw', $file_name || die "Cannot open $file_name\n"; + read $file, my $buffer, $pages_count*4 || die "Cannot read $file_name\n"; + close $file; + + return unpack("N[$pages_count]", $buffer); +} + +sub die_if_no_pages { + my $file_name = shift; + my @check_pages = @_; + my @read_pages = + read_first_page_from_delta($file_name, scalar(@check_pages) + 1); + for (my $i = 1; $i < @check_pages + 1; ++$i) { + my $check_page_no = $check_pages[$i - 1]; + die "Corrupted page $check_page_no was not copied to $file_name." + if ($i >= @read_pages || $read_pages[$i] != $check_page_no); + } +} + +sub die_if_not_empty { + my $file_name = shift; + my ($magic, $full) = read_first_page_from_delta($file_name, 2); + die "Delta $file_name must be empty." + if ($full != 0xFFFFFFFF); +} +EOF +--rmdir $incdir +--rmdir $targetdir + +DROP TABLE t1_corrupted; +DROP TABLE t2_corrupted; +DROP TABLE t4_corrupted_new; +DROP TABLE t5_corrupted_to_rename_renamed; +DROP TABLE t7_corrupted_to_alter; +DROP TABLE t1_inc_corrupted; +DROP TABLE t2_inc_corrupted; +DROP TABLE t4_inc_corrupted_new; +DROP TABLE t5_inc_corrupted_to_rename_renamed; +DROP TABLE t7_inc_corrupted_to_alter; + +--echo +--echo ######## +--echo # Test for --prepare with "innodb_corrupted_pages" file +--echo ### +--echo + +--echo # Extend some tablespace and corrupt extended pages for full backup +--source include/shutdown_mysqld.inc +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +my $schema="$ENV{MYSQLD_DATADIR}/test"; +my $last_page_no = extend_space("$schema/t3.ibd", 3); +corrupt_space_page_id("$schema/t3.ibd", $last_page_no, $last_page_no + 2); +open(my $fh, '>', $ENV{perl_result_file}) or die $!; +print $fh "$last_page_no\n"; +close $fh; +EOF +--source include/start_mysqld.inc + +--echo # Full backup with --log-innodb-page-corruption +--disable_result_log +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --log-innodb-page-corruption --target-dir=$targetdir +--enable_result_log +--let corrupted_pages_file = $targetdir/innodb_corrupted_pages +--echo --- "innodb_corrupted_pages" file content: --- +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +print_corrupted_pages_file($ENV{corrupted_pages_file}, + $ENV{corrupted_pages_file_filt}); +EOF +--cat_file $corrupted_pages_file_filt +--echo ------ + +--echo # Extend some tablespace and corrupt extended pages for incremental backup +--source include/shutdown_mysqld.inc +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +my $schema="$ENV{MYSQLD_DATADIR}/test"; +my $last_page_no = extend_space("$schema/t3_inc.ibd", 3); +corrupt_space_page_id("$schema/t3_inc.ibd", $last_page_no, $last_page_no + 2); +open(my $fh, '>>', $ENV{perl_result_file}) or die $!; +print $fh "$last_page_no"; +close $fh; +EOF +--source include/start_mysqld.inc + +--echo # Incremental backup --log-innodb-page-corruption +--disable_result_log +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --log-innodb-page-corruption --target-dir=$incdir --incremental-basedir=$targetdir --dbug=+d,mariabackup_events,mariabackup_inject_code > $backuplog +--disable_result_log +--let corrupted_pages_file = $incdir/innodb_corrupted_pages +--echo --- "innodb_corrupted_pages" file content: --- +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +print_corrupted_pages_file($ENV{corrupted_pages_file}, + $ENV{corrupted_pages_file_filt}); +EOF +--cat_file $corrupted_pages_file_filt +--echo ------ + +--let targetdir2=$targetdir-2 +--let incdir2=$incdir-2 +perl; +use lib "lib"; +use My::Handles { suppress_init_messages => 1 }; +use My::File::Path; +copytree($ENV{'targetdir'}, $ENV{'targetdir2'}); +copytree($ENV{'incdir'}, $ENV{'incdir2'}); +EOF + +--echo # Full backup prepare +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir > $backuplog; +--enable_result_log + +--echo # "innodb_corrupted_pages" file must not exist after successful prepare +--error 1 +--file_exists $targetdir/innodb_corrupted_pages +--let SEARCH_PATTERN=was successfuly fixed.* +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc + +--echo # Check that fixed pages are zero-filled +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +open(my $fh, '<', $ENV{perl_result_file}) or die $!; +my $last_page_no = <$fh>; +close $fh; +my $schema = "$ENV{targetdir}/test"; +die_if_page_is_not_zero("$schema/t3.ibd", $last_page_no, $last_page_no + 2); +EOF + +--echo # Incremental backup prepare +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir --incremental-dir=$incdir > $backuplog; +--enable_result_log + +--echo # "innodb_corrupted_pages" file must not exist after successful prepare +--error 1 +--file_exists $targetdir/innodb_corrupted_pages +--echo # do not remove "innodb_corrupted_pages" in incremental dir +--file_exists $incdir/innodb_corrupted_pages +--let SEARCH_PATTERN=was successfuly fixed.* +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc + +--echo # Check that fixed pages are zero-filled +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +open(my $fh, '<', $ENV{perl_result_file}) or die $!; +my $last_page_no_full = <$fh>; +my $last_page_no_inc = <$fh>; +close $fh; +my $schema = "$ENV{targetdir}/test"; +die_if_page_is_not_zero("$schema/t3.ibd", + $last_page_no_full, $last_page_no_full + 2); +die_if_page_is_not_zero("$schema/t3_inc.ibd", + $last_page_no_inc, $last_page_no_inc + 2); +EOF + +--source include/restart_and_restore.inc + +SELECT * FROM t3; +SELECT * FROM t3_inc; + +--echo # Test the case when not all corrupted pages are fixed +--echo +--echo # Add some fake corrupted pages +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +append_corrupted_pages( + "$ENV{targetdir2}/innodb_corrupted_pages", 'test/t3', '3 4'); +append_corrupted_pages( + "$ENV{incdir2}/innodb_corrupted_pages", 'test/t3_inc', '4 5'); +EOF + +--echo # Full backup prepare +--disable_result_log +--error 1 +exec $XTRABACKUP --prepare --target-dir=$targetdir2 > $backuplog; +--enable_result_log + +--let SEARCH_PATTERN=Error: corrupted page.* +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +--let corrupted_pages_file = $targetdir2/innodb_corrupted_pages +--echo --- "innodb_corrupted_pages" file content: --- +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +print_corrupted_pages_file($ENV{corrupted_pages_file}, + $ENV{corrupted_pages_file_filt}); +EOF +--cat_file $corrupted_pages_file_filt +--echo ------ + +--echo # Incremental backup prepare +--disable_result_log +--error 1 +exec $XTRABACKUP --prepare --target-dir=$targetdir2 --incremental-dir=$incdir2 > $backuplog; +--enable_result_log + +--let SEARCH_PATTERN=Error: corrupted page.* +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +--let corrupted_pages_file = $targetdir2/innodb_corrupted_pages +--echo --- "innodb_corrupted_pages" file content: --- +perl; +do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl"; +print_corrupted_pages_file($ENV{corrupted_pages_file}, + $ENV{corrupted_pages_file_filt}); +EOF +--cat_file $corrupted_pages_file_filt +--echo ------ + +DROP TABLE t3; +DROP TABLE t3_inc; +--remove_file $backuplog +--remove_file $perl_result_file +--remove_file $corrupted_pages_file_filt +--rmdir $targetdir +--rmdir $targetdir2 +--rmdir $incdir +--rmdir $incdir2 diff --git a/mysql-test/suite/perfschema/r/schema.result b/mysql-test/suite/perfschema/r/schema.result index 1f331394df6..8ce4cad4f4b 100644 --- a/mysql-test/suite/perfschema/r/schema.result +++ b/mysql-test/suite/perfschema/r/schema.result @@ -62,7 +62,7 @@ users show create table accounts; Table Create Table accounts CREATE TABLE `accounts` ( - `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `CURRENT_CONNECTIONS` bigint(20) NOT NULL, `TOTAL_CONNECTIONS` bigint(20) NOT NULL @@ -140,7 +140,7 @@ events_stages_summary_by_thread_by_event_name CREATE TABLE `events_stages_summar show create table events_stages_summary_by_user_by_event_name; Table Create Table events_stages_summary_by_user_by_event_name CREATE TABLE `events_stages_summary_by_user_by_event_name` ( - `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `EVENT_NAME` varchar(128) NOT NULL, `COUNT_STAR` bigint(20) unsigned NOT NULL, `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL, @@ -151,7 +151,7 @@ events_stages_summary_by_user_by_event_name CREATE TABLE `events_stages_summary_ show create table events_stages_summary_by_account_by_event_name; Table Create Table events_stages_summary_by_account_by_event_name CREATE TABLE `events_stages_summary_by_account_by_event_name` ( - `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `EVENT_NAME` varchar(128) NOT NULL, `COUNT_STAR` bigint(20) unsigned NOT NULL, @@ -398,7 +398,7 @@ events_statements_summary_by_thread_by_event_name CREATE TABLE `events_statement show create table events_statements_summary_by_user_by_event_name; Table Create Table events_statements_summary_by_user_by_event_name CREATE TABLE `events_statements_summary_by_user_by_event_name` ( - `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `EVENT_NAME` varchar(128) NOT NULL, `COUNT_STAR` bigint(20) unsigned NOT NULL, `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL, @@ -428,7 +428,7 @@ events_statements_summary_by_user_by_event_name CREATE TABLE `events_statements_ show create table events_statements_summary_by_account_by_event_name; Table Create Table events_statements_summary_by_account_by_event_name CREATE TABLE `events_statements_summary_by_account_by_event_name` ( - `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `EVENT_NAME` varchar(128) NOT NULL, `COUNT_STAR` bigint(20) unsigned NOT NULL, @@ -590,7 +590,7 @@ events_waits_summary_by_thread_by_event_name CREATE TABLE `events_waits_summary_ show create table events_waits_summary_by_user_by_event_name; Table Create Table events_waits_summary_by_user_by_event_name CREATE TABLE `events_waits_summary_by_user_by_event_name` ( - `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `EVENT_NAME` varchar(128) NOT NULL, `COUNT_STAR` bigint(20) unsigned NOT NULL, `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL, @@ -601,7 +601,7 @@ events_waits_summary_by_user_by_event_name CREATE TABLE `events_waits_summary_by show create table events_waits_summary_by_account_by_event_name; Table Create Table events_waits_summary_by_account_by_event_name CREATE TABLE `events_waits_summary_by_account_by_event_name` ( - `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `EVENT_NAME` varchar(128) NOT NULL, `COUNT_STAR` bigint(20) unsigned NOT NULL, @@ -762,8 +762,8 @@ show create table setup_actors; Table Create Table setup_actors CREATE TABLE `setup_actors` ( `HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%', - `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%', - `ROLE` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%' + `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%', + `ROLE` char(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%' ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 show create table setup_consumers; Table Create Table @@ -1028,7 +1028,7 @@ threads CREATE TABLE `threads` ( `NAME` varchar(128) NOT NULL, `TYPE` varchar(10) NOT NULL, `PROCESSLIST_ID` bigint(20) unsigned DEFAULT NULL, - `PROCESSLIST_USER` varchar(16) DEFAULT NULL, + `PROCESSLIST_USER` varchar(128) DEFAULT NULL, `PROCESSLIST_HOST` varchar(60) DEFAULT NULL, `PROCESSLIST_DB` varchar(64) DEFAULT NULL, `PROCESSLIST_COMMAND` varchar(16) DEFAULT NULL, @@ -1042,7 +1042,7 @@ threads CREATE TABLE `threads` ( show create table users; Table Create Table users CREATE TABLE `users` ( - `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, + `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `CURRENT_CONNECTIONS` bigint(20) NOT NULL, `TOTAL_CONNECTIONS` bigint(20) NOT NULL ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 diff --git a/mysql-test/suite/perfschema/r/table_schema.result b/mysql-test/suite/perfschema/r/table_schema.result index 5c4cf88e9a5..a9beee31f28 100644 --- a/mysql-test/suite/perfschema/r/table_schema.result +++ b/mysql-test/suite/perfschema/r/table_schema.result @@ -1,7 +1,7 @@ select * from information_schema.columns where table_schema="performance_schema" order by table_name, ordinal_position; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION -def performance_schema accounts USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL +def performance_schema accounts USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL def performance_schema accounts HOST 2 NULL YES char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL def performance_schema accounts CURRENT_CONNECTIONS 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(20) select,insert,update,references NEVER NULL def performance_schema accounts TOTAL_CONNECTIONS 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(20) select,insert,update,references NEVER NULL @@ -37,7 +37,7 @@ def performance_schema events_stages_history_long TIMER_END 7 NULL YES bigint NU def performance_schema events_stages_history_long TIMER_WAIT 8 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_stages_history_long NESTING_EVENT_ID 9 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_stages_history_long NESTING_EVENT_TYPE 10 NULL YES enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references NEVER NULL -def performance_schema events_stages_summary_by_account_by_event_name USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL +def performance_schema events_stages_summary_by_account_by_event_name USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL def performance_schema events_stages_summary_by_account_by_event_name HOST 2 NULL YES char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL def performance_schema events_stages_summary_by_account_by_event_name EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL def performance_schema events_stages_summary_by_account_by_event_name COUNT_STAR 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL @@ -59,7 +59,7 @@ def performance_schema events_stages_summary_by_thread_by_event_name SUM_TIMER_W def performance_schema events_stages_summary_by_thread_by_event_name MIN_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_stages_summary_by_thread_by_event_name AVG_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_stages_summary_by_thread_by_event_name MAX_TIMER_WAIT 7 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL -def performance_schema events_stages_summary_by_user_by_event_name USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL +def performance_schema events_stages_summary_by_user_by_event_name USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL def performance_schema events_stages_summary_by_user_by_event_name EVENT_NAME 2 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL def performance_schema events_stages_summary_by_user_by_event_name COUNT_STAR 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_stages_summary_by_user_by_event_name SUM_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL @@ -192,7 +192,7 @@ def performance_schema events_statements_history_long NO_INDEX_USED 37 NULL NO b def performance_schema events_statements_history_long NO_GOOD_INDEX_USED 38 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_statements_history_long NESTING_EVENT_ID 39 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_statements_history_long NESTING_EVENT_TYPE 40 NULL YES enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references NEVER NULL -def performance_schema events_statements_summary_by_account_by_event_name USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL +def performance_schema events_statements_summary_by_account_by_event_name USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL def performance_schema events_statements_summary_by_account_by_event_name HOST 2 NULL YES char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL def performance_schema events_statements_summary_by_account_by_event_name EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL def performance_schema events_statements_summary_by_account_by_event_name COUNT_STAR 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL @@ -300,7 +300,7 @@ def performance_schema events_statements_summary_by_thread_by_event_name SUM_SOR def performance_schema events_statements_summary_by_thread_by_event_name SUM_SORT_SCAN 24 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_statements_summary_by_thread_by_event_name SUM_NO_INDEX_USED 25 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_statements_summary_by_thread_by_event_name SUM_NO_GOOD_INDEX_USED 26 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL -def performance_schema events_statements_summary_by_user_by_event_name USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL +def performance_schema events_statements_summary_by_user_by_event_name USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL def performance_schema events_statements_summary_by_user_by_event_name EVENT_NAME 2 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL def performance_schema events_statements_summary_by_user_by_event_name COUNT_STAR 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_statements_summary_by_user_by_event_name SUM_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL @@ -408,7 +408,7 @@ def performance_schema events_waits_history_long NESTING_EVENT_TYPE 16 NULL YES def performance_schema events_waits_history_long OPERATION 17 NULL NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select,insert,update,references NEVER NULL def performance_schema events_waits_history_long NUMBER_OF_BYTES 18 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(20) select,insert,update,references NEVER NULL def performance_schema events_waits_history_long FLAGS 19 NULL YES int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references NEVER NULL -def performance_schema events_waits_summary_by_account_by_event_name USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL +def performance_schema events_waits_summary_by_account_by_event_name USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL def performance_schema events_waits_summary_by_account_by_event_name HOST 2 NULL YES char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL def performance_schema events_waits_summary_by_account_by_event_name EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL def performance_schema events_waits_summary_by_account_by_event_name COUNT_STAR 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL @@ -437,7 +437,7 @@ def performance_schema events_waits_summary_by_thread_by_event_name SUM_TIMER_WA def performance_schema events_waits_summary_by_thread_by_event_name MIN_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_waits_summary_by_thread_by_event_name AVG_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_waits_summary_by_thread_by_event_name MAX_TIMER_WAIT 7 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL -def performance_schema events_waits_summary_by_user_by_event_name USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL +def performance_schema events_waits_summary_by_user_by_event_name USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL def performance_schema events_waits_summary_by_user_by_event_name EVENT_NAME 2 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL def performance_schema events_waits_summary_by_user_by_event_name COUNT_STAR 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema events_waits_summary_by_user_by_event_name SUM_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL @@ -561,8 +561,8 @@ def performance_schema session_connect_attrs ATTR_NAME 2 NULL NO varchar 32 96 N def performance_schema session_connect_attrs ATTR_VALUE 3 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_bin varchar(1024) select,insert,update,references NEVER NULL def performance_schema session_connect_attrs ORDINAL_POSITION 4 NULL YES int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references NEVER NULL def performance_schema setup_actors HOST 1 '%' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL -def performance_schema setup_actors USER 2 '%' NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL -def performance_schema setup_actors ROLE 3 '%' NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL +def performance_schema setup_actors USER 2 '%' NO char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL +def performance_schema setup_actors ROLE 3 '%' NO char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL def performance_schema setup_consumers NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references NEVER NULL def performance_schema setup_consumers ENABLED 2 NULL NO enum 3 9 NULL NULL NULL utf8 utf8_general_ci enum('YES','NO') select,insert,update,references NEVER NULL def performance_schema setup_instruments NAME 1 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL @@ -783,7 +783,7 @@ def performance_schema threads THREAD_ID 1 NULL NO bigint NULL NULL 20 0 NULL NU def performance_schema threads NAME 2 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL def performance_schema threads TYPE 3 NULL NO varchar 10 30 NULL NULL NULL utf8 utf8_general_ci varchar(10) select,insert,update,references NEVER NULL def performance_schema threads PROCESSLIST_ID 4 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL -def performance_schema threads PROCESSLIST_USER 5 NULL YES varchar 16 48 NULL NULL NULL utf8 utf8_general_ci varchar(16) select,insert,update,references NEVER NULL +def performance_schema threads PROCESSLIST_USER 5 NULL YES varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL def performance_schema threads PROCESSLIST_HOST 6 NULL YES varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) select,insert,update,references NEVER NULL def performance_schema threads PROCESSLIST_DB 7 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references NEVER NULL def performance_schema threads PROCESSLIST_COMMAND 8 NULL YES varchar 16 48 NULL NULL NULL utf8 utf8_general_ci varchar(16) select,insert,update,references NEVER NULL @@ -793,7 +793,7 @@ def performance_schema threads PROCESSLIST_INFO 11 NULL YES longtext 4294967295 def performance_schema threads PARENT_THREAD_ID 12 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema threads ROLE 13 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references NEVER NULL def performance_schema threads INSTRUMENTED 14 NULL NO enum 3 9 NULL NULL NULL utf8 utf8_general_ci enum('YES','NO') select,insert,update,references NEVER NULL -def performance_schema users USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL +def performance_schema users USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL def performance_schema users CURRENT_CONNECTIONS 2 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(20) select,insert,update,references NEVER NULL def performance_schema users TOTAL_CONNECTIONS 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(20) select,insert,update,references NEVER NULL select count(*) from information_schema.columns diff --git a/mysql-test/suite/perfschema/r/threads_mysql.result b/mysql-test/suite/perfschema/r/threads_mysql.result index 9f9c46fe6a6..169c22fb7a2 100644 --- a/mysql-test/suite/perfschema/r/threads_mysql.result +++ b/mysql-test/suite/perfschema/r/threads_mysql.result @@ -17,6 +17,16 @@ processlist_info NULL unified_parent_thread_id NULL role NULL instrumented YES +name thread/sql/manager +type BACKGROUND +processlist_user NULL +processlist_host NULL +processlist_db NULL +processlist_command NULL +processlist_info NULL +unified_parent_thread_id unified parent_thread_id +role NULL +instrumented YES name thread/sql/one_connection type FOREGROUND processlist_user root @@ -44,16 +54,6 @@ processlist_info NULL unified_parent_thread_id unified parent_thread_id role NULL instrumented YES -name thread/sql/slave_background -type BACKGROUND -processlist_user NULL -processlist_host NULL -processlist_db NULL -processlist_command NULL -processlist_info NULL -unified_parent_thread_id unified parent_thread_id -role NULL -instrumented YES CREATE TEMPORARY TABLE t1 AS SELECT thread_id FROM performance_schema.threads WHERE name LIKE 'thread/sql%'; @@ -113,7 +113,7 @@ WHERE t1.name LIKE 'thread/sql%' ORDER BY parent_thread_name, child_thread_name; parent_thread_name child_thread_name thread/sql/event_scheduler thread/sql/event_worker +thread/sql/main thread/sql/manager thread/sql/main thread/sql/one_connection thread/sql/main thread/sql/signal_handler -thread/sql/main thread/sql/slave_background thread/sql/one_connection thread/sql/event_scheduler diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index 7c287b369b1..b82b38f4f0a 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -118,6 +118,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123'; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; SET PASSWORD FOR u1 = PASSWORD('pwd 098'); CREATE USER u3 IDENTIFIED BY ''; +ALTER USER u3 IDENTIFIED BY 'pwd-456'; drop user u1, u2, u3; set global server_audit_events='query_ddl'; create table t1(id int); @@ -139,6 +140,10 @@ select 2; 2 2 drop table t1; +create procedure pr1() insert into test.t1 values ("foo", 42); +create function fn1(i int) returns int deterministic return i+1; +drop procedure pr1; +drop function fn1; set global server_audit_events='query_ddl,query_dml'; create table t1(id int); insert into t1 values (1), (2); @@ -210,6 +215,10 @@ select 2; 2 2 drop table t1; +create procedure pr1() insert into test.t1 values ("foo", 42); +create function fn1(i int) returns int deterministic return i+1; +drop procedure pr1; +drop function fn1; set global server_audit_events='table'; set global server_audit_incl_users='user1'; create user user1@localhost; @@ -227,6 +236,7 @@ set global server_audit_logging= on; disconnect cn1; drop user user1@localhost; set global server_audit_events=''; +set global server_audit_incl_users='root, plug_dest'; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; connect(localhost,plug,plug_dest,test,MYSQL_PORT,MYSQL_SOCK); @@ -277,7 +287,7 @@ server_audit_file_path server_audit_file_rotate_now OFF server_audit_file_rotate_size 1000000 server_audit_file_rotations 9 -server_audit_incl_users root +server_audit_incl_users root, plug_dest server_audit_logging ON server_audit_mode 1 server_audit_output_type file @@ -381,6 +391,8 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0 TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'ALTER USER u3 IDENTIFIED BY \'pwd-456\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv, @@ -390,6 +402,10 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create procedure pr1() insert into test.t1 values ("foo", 42)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create function fn1(i int) returns int deterministic return i+1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop procedure pr1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop function fn1',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0 @@ -419,6 +435,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_incl_users=\'root, plug_dest\'',0 TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, @@ -440,8 +457,9 @@ TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,,,0 TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT PROXY ON plug_dest TO plug',0 -TIME,HOSTNAME,plug,localhost,ID,0,PROXY_CONNECT,test,`plug_dest`@`%`,0 TIME,HOSTNAME,plug,localhost,ID,0,CONNECT,test,,0 +TIME,HOSTNAME,plug,localhost,ID,0,PROXY_CONNECT,test,`plug_dest`@`%`,0 +TIME,HOSTNAME,plug,localhost,ID,ID,QUERY,test,'select USER(),CURRENT_USER()',0 TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,test,,0 TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test index 397dd554962..eba3e5d6770 100644 --- a/mysql-test/suite/plugins/t/server_audit.test +++ b/mysql-test/suite/plugins/t/server_audit.test @@ -95,6 +95,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123'; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; SET PASSWORD FOR u1 = PASSWORD('pwd 098'); CREATE USER u3 IDENTIFIED BY ''; +ALTER USER u3 IDENTIFIED BY 'pwd-456'; drop user u1, u2, u3; set global server_audit_events='query_ddl'; @@ -106,6 +107,11 @@ select 2; /*! select 2*/; /*comment*/ select 2; drop table t1; +create procedure pr1() insert into test.t1 values ("foo", 42); +create function fn1(i int) returns int deterministic return i+1; +drop procedure pr1; +drop function fn1; + set global server_audit_events='query_ddl,query_dml'; create table t1(id int); insert into t1 values (1), (2); @@ -145,6 +151,10 @@ insert into t1 values (1), (2); select * from t1; select 2; drop table t1; +create procedure pr1() insert into test.t1 values ("foo", 42); +create function fn1(i int) returns int deterministic return i+1; +drop procedure pr1; +drop function fn1; set global server_audit_events='table'; set global server_audit_incl_users='user1'; @@ -173,6 +183,7 @@ source include/wait_until_count_sessions.inc; drop user user1@localhost; set global server_audit_events=''; +set global server_audit_incl_users='root, plug_dest'; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; diff --git a/mysql-test/suite/roles/show_grants.result b/mysql-test/suite/roles/show_grants.result index 5d46b038cf8..b523211420b 100644 --- a/mysql-test/suite/roles/show_grants.result +++ b/mysql-test/suite/roles/show_grants.result @@ -146,3 +146,18 @@ drop role test_role2; delete from mysql.roles_mapping where Role='test_role1'; delete from mysql.roles_mapping where Role='test_role2'; flush privileges; +# +# MDEV-24289: show grants missing with grant option +# +create role anel; +GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'anel'; +SHOW GRANTS for 'anel'; +Grants for anel +GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'anel' +create role MariaDB_admin; +GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'MariaDB_admin' WITH GRANT OPTION; +SHOW GRANTS for 'MariaDB_admin'; +Grants for MariaDB_admin +GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'MariaDB_admin' WITH GRANT OPTION +drop role MariaDB_admin; +drop role anel; diff --git a/mysql-test/suite/roles/show_grants.test b/mysql-test/suite/roles/show_grants.test index 9c15d8b8b2b..fc2165ac53b 100644 --- a/mysql-test/suite/roles/show_grants.test +++ b/mysql-test/suite/roles/show_grants.test @@ -88,3 +88,16 @@ drop role test_role2; delete from mysql.roles_mapping where Role='test_role1'; delete from mysql.roles_mapping where Role='test_role2'; flush privileges; + +--echo # +--echo # MDEV-24289: show grants missing with grant option +--echo # +create role anel; +GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'anel'; +SHOW GRANTS for 'anel'; + +create role MariaDB_admin; +GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'MariaDB_admin' WITH GRANT OPTION; +SHOW GRANTS for 'MariaDB_admin'; +drop role MariaDB_admin; +drop role anel; diff --git a/mysql-test/suite/rpl/disabled.def b/mysql-test/suite/rpl/disabled.def index 2bf2a69bd62..4508c8e4ca6 100644 --- a/mysql-test/suite/rpl/disabled.def +++ b/mysql-test/suite/rpl/disabled.def @@ -10,8 +10,7 @@ # ############################################################################## -rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux -#rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock +#rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_partition_archive : MDEV-5077 2013-09-27 svoj Cannot exchange partition with archive table rpl_row_binlog_max_cache_size : MDEV-11092 rpl_row_index_choice : MDEV-11666 diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result index 5439bdef72c..48cec72d917 100644 --- a/mysql-test/suite/rpl/r/rpl_change_master.result +++ b/mysql-test/suite/rpl/r/rpl_change_master.result @@ -22,4 +22,8 @@ n connection master; drop table t1; connection slave; +connection master; +CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='', +MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH=''; +CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result index 74648501fbe..9c36973427a 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result @@ -22,7 +22,7 @@ START SLAVE IO_THREAD; include/wait_for_slave_io_error.inc [errno=1236] connection master; FLUSH BINARY LOGS; -PURGE BINARY LOGS TO 'master-bin.000002';; +include/wait_for_purge.inc "master-bin.000002" FLUSH BINARY LOGS DELETE_DOMAIN_ID=(11); SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state; @@global.gtid_binlog_pos @@global.gtid_binlog_state diff --git a/mysql-test/suite/rpl/r/rpl_ignore_grant.result b/mysql-test/suite/rpl/r/rpl_ignore_grant.result index f3d69112efd..29e6bb6d6a4 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_grant.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_grant.result @@ -1,14 +1,12 @@ include/master-slave.inc [connection master] connection master; -set global sql_mode=""; -set local sql_mode=""; +set sql_mode=""; delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; connection slave; -set global sql_mode=""; -set local sql_mode=""; +set sql_mode=""; delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; @@ -43,7 +41,5 @@ connection slave; delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; -set global sql_mode=default; connection master; -set global sql_mode=default; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result index 18298986069..00ac06951ee 100644 --- a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result +++ b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result @@ -12,6 +12,7 @@ Note 1003 select master_pos_wait('master-bin.999999',0,2) AS `master_pos_wait('m select master_pos_wait('master-bin.999999',0); connection slave1; stop slave sql_thread; +include/wait_for_slave_sql_to_stop.inc connection slave; master_pos_wait('master-bin.999999',0) NULL diff --git a/mysql-test/suite/rpl/r/rpl_relay_max_extension.result b/mysql-test/suite/rpl/r/rpl_relay_max_extension.result new file mode 100644 index 00000000000..4444398203e --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_relay_max_extension.result @@ -0,0 +1,37 @@ +include/rpl_init.inc [topology=1->2] +connection server_2; +include/stop_slave.inc +RESET SLAVE; +include/start_slave.inc +include/stop_slave.inc +# +# Stop slave server +# +# +# Simulate file number get close to 999997 +# by renaming relay logs and modifying index/info files +# +# Restart slave server +# +SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads; +SET @save_max_relay_log_size= @@GLOBAL.max_relay_log_size; +SET GLOBAL slave_parallel_threads=1; +SET GLOBAL max_relay_log_size=100 * 1024; +include/start_slave.inc +connection server_1; +create table t1 (i int, c varchar(1024)); +# +# Insert some data to generate enough amount of binary logs +# +connection server_2; +# +# Assert that 'slave-relay-bin.999999' is purged. +# +NOT FOUND /slave-relay-bin.999999/ in slave-relay-bin.index +include/stop_slave.inc +SET GLOBAL slave_parallel_threads= @save_slave_parallel_threads; +SET GLOBAL max_relay_log_size= @save_max_relay_log_size; +include/start_slave.inc +connection server_1; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_USER.result b/mysql-test/suite/rpl/r/rpl_row_USER.result index 5a59bb57795..2771c674f44 100644 --- a/mysql-test/suite/rpl/r/rpl_row_USER.result +++ b/mysql-test/suite/rpl/r/rpl_row_USER.result @@ -1,6 +1,5 @@ include/master-slave.inc [connection master] -set global sql_mode=""; set local sql_mode=""; connection master; DROP DATABASE IF EXISTS mysqltest1; @@ -40,7 +39,6 @@ REVOKE ALL ON mysqltest1.* FROM 'tester'@'%'; REVOKE ALL ON mysqltest1.* FROM ''@'localhost%'; DROP USER tester@'%'; DROP USER ''@'localhost%'; +FLUSH PRIVILEGES; connection slave; include/rpl_end.inc -set global sql_mode=default; -set local sql_mode=default; diff --git a/mysql-test/suite/rpl/r/rpl_row_utf32.result b/mysql-test/suite/rpl/r/rpl_row_utf32.result index af6e709860e..6d177b7cda0 100644 --- a/mysql-test/suite/rpl/r/rpl_row_utf32.result +++ b/mysql-test/suite/rpl/r/rpl_row_utf32.result @@ -3,7 +3,7 @@ include/master-slave.inc SET SQL_LOG_BIN=0; CREATE TABLE t1 (c1 char(255) DEFAULT NULL, KEY c1 (c1)) DEFAULT CHARSET=utf32; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes SET SQL_LOG_BIN=1; connection slave; SET @saved_slave_type_conversions= @@global.slave_type_conversions; @@ -13,7 +13,7 @@ include/start_slave.inc SET SQL_LOG_BIN=0; CREATE TABLE t1 ( c1 varchar(255) DEFAULT NULL, KEY c1 (c1)) DEFAULT CHARSET=utf32; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes SET SQL_LOG_BIN=1; connection master; INSERT INTO t1(c1) VALUES ('insert into t1'); diff --git a/mysql-test/suite/rpl/r/rpl_row_vcol_crash.result b/mysql-test/suite/rpl/r/rpl_row_vcol_crash.result new file mode 100644 index 00000000000..f76d8935fa8 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_vcol_crash.result @@ -0,0 +1,380 @@ +include/master-slave.inc +[connection master] +# +# Test case 1: KEY on a virtual column with ON DELETE CASCADE +# +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2),(3); +CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, +t1_id INT NOT NULL, +v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id), +CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +INSERT INTO t2 VALUES (90,1,NULL); +INSERT INTO t2 VALUES (91,2,default); +DELETE FROM t1 WHERE id=1; +connection slave; +# +# Verify data consistency on slave +# +include/diff_tables.inc [master:test.t1, slave:test.t1] +include/diff_tables.inc [master:test.t2, slave:test.t2] +connection master; +DROP TABLE t2,t1; +connection slave; +# +# Test case 2: Verify "ON DELETE CASCADE" for parent->child->child scenario +# Parent table: users +# Child tables: matchmaking_groups, matchmaking_group_users +# Parent table: matchmaking_groups +# Child tables: matchmaking_group_users, matchmaking_group_maps +# +# Deleting a row from parent table should be reflected in +# child tables. +# matchmaking_groups->matchmaking_group_users->matchmaking_group_maps +# users->matchmaking_group_users->matchmaking_group_maps +# +connection master; +CREATE TABLE users (id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, +name VARCHAR(32) NOT NULL DEFAULT '' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE matchmaking_groups ( +id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, +host_user_id INT UNSIGNED NOT NULL UNIQUE, +v_col INT AS (host_user_id+1) VIRTUAL, KEY (v_col), +CONSTRAINT FOREIGN KEY (host_user_id) REFERENCES users (id) +ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE matchmaking_group_users ( +matchmaking_group_id BIGINT UNSIGNED NOT NULL, +user_id INT UNSIGNED NOT NULL, +v_col1 int as (user_id+1) virtual, KEY (v_col1), +PRIMARY KEY (matchmaking_group_id,user_id), +UNIQUE KEY user_id (user_id), +CONSTRAINT FOREIGN KEY (matchmaking_group_id) +REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE, +CONSTRAINT FOREIGN KEY (user_id) +REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE matchmaking_group_maps ( +matchmaking_group_id BIGINT UNSIGNED NOT NULL, +map_id TINYINT UNSIGNED NOT NULL, +v_col2 INT AS (map_id+1) VIRTUAL, KEY (v_col2), +PRIMARY KEY (matchmaking_group_id,map_id), +CONSTRAINT FOREIGN KEY (matchmaking_group_id) +REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +connection slave; +connection master; +INSERT INTO users VALUES (NULL,'foo'),(NULL,'bar'); +INSERT INTO matchmaking_groups VALUES (10,1,default),(11,2,default); +INSERT INTO matchmaking_group_users VALUES (10,1,default),(11,2,default); +INSERT INTO matchmaking_group_maps VALUES (10,55,default),(11,66,default); +DELETE FROM matchmaking_groups WHERE id = 10; +connection slave; +# +# No rows should be returned as ON DELETE CASCASE should have removed +# corresponding rows from child tables. There should not any mismatch +# of 'id' field between parent->child. +# +SELECT * FROM matchmaking_group_users WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups); +matchmaking_group_id user_id v_col1 +SELECT * FROM matchmaking_group_maps WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups); +matchmaking_group_id map_id v_col2 +# +# Rows with id=11 should be present +# +SELECT * FROM matchmaking_group_users; +matchmaking_group_id user_id v_col1 +11 2 3 +SELECT * FROM matchmaking_group_maps; +matchmaking_group_id map_id v_col2 +11 66 67 +connection master; +DELETE FROM users WHERE id = 2; +connection slave; +# +# No rows should be present in both the child tables +# +SELECT * FROM matchmaking_group_users; +matchmaking_group_id user_id v_col1 +SELECT * FROM matchmaking_group_maps; +matchmaking_group_id map_id v_col2 +connection master; +DROP TABLE matchmaking_group_maps, matchmaking_group_users, matchmaking_groups, users; +connection slave; +# +# Test case 3: KEY on a virtual column with ON UPDATE CASCADE +# +connection master; +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 80); +CREATE TABLE t2 (a INT KEY, b INT, +v_col int as (b+1) virtual, KEY (v_col), +CONSTRAINT b FOREIGN KEY (b) REFERENCES t1(a) ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT INTO t2 VALUES (51, 1, default); +connection slave; +connection master; +UPDATE t1 SET a = 50 WHERE a = 1; +# +# Master: Verify that ON UPDATE CASCADE works fine +# old_row: (51, 1, 2) ON UPDATE New_row: (51, 50, 51) +# +SELECT * FROM t2 WHERE b=50; +a b v_col +51 50 51 +connection slave; +# +# Slave: Verify that ON UPDATE CASCADE works fine +# old_row: (51, 1, 2) ON UPDATE New_row: (51, 50, 51) +# +SELECT * FROM t2 WHERE b=50; +a b v_col +51 50 51 +connection master; +DROP TABLE t2, t1; +connection slave; +# +# Test case 4: Define triggers on master, their results should be +# replicated as part of row events and they should be +# applied on slave with the default +# slave_run_triggers_for_rbr=NO +# +connection master; +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (count INT NOT NULL) ENGINE=InnoDB; +CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (1); +INSERT INTO t1 VALUES (2),(3); +connection slave; +SHOW GLOBAL VARIABLES LIKE 'slave_run_triggers_for_rbr'; +Variable_name Value +slave_run_triggers_for_rbr NO +# +# As two rows are inserted in table 't1', two rows should get inserted +# into table 't2' as part of trigger. +# +include/assert.inc [Table t2 should have two rows.] +connection master; +DROP TABLE t1,t2; +connection slave; +# +# Test case 5: Define triggers + Foreign Keys on master, their results +# should be replicated as part of row events and master +# and slave should be in sync. +# +connection master; +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (t1_id INT NOT NULL, +v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id), +CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB; +CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t3 VALUES (1); +INSERT INTO t1 VALUES (2),(3); +INSERT INTO t2 VALUES (2, default), (3, default); +connection slave; +# +# As two rows are inserted in table 't1', two rows should get inserted +# into table 't3' as part of trigger. +# +include/assert.inc [Table t3 should have two rows.] +# +# Verify ON DELETE CASCASE correctness +# +connection master; +DELETE FROM t1 WHERE id=2; +connection slave; +connection master; +include/diff_tables.inc [master:test.t1, slave:test.t1] +include/diff_tables.inc [master:test.t2, slave:test.t2] +include/diff_tables.inc [master:test.t3, slave:test.t3] +DROP TABLE t3,t2,t1; +connection slave; +# +# Test case 6: Triggers are present only on slave and +# 'slave_run_triggers_for_rbr=NO' +# +connection slave; +SET @save_slave_run_triggers_for_rbr= @@GLOBAL.slave_run_triggers_for_rbr; +SET GLOBAL slave_run_triggers_for_rbr= NO;; +SHOW GLOBAL VARIABLES LIKE '%slave_run_triggers_for_rbr%'; +Variable_name Value +slave_run_triggers_for_rbr NO +connection master; +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (t1_id INT NOT NULL, +v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), +KEY (t1_id), CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB; +connection slave; +CREATE TRIGGER trg AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t3 VALUES (1); +connection master; +INSERT INTO t1 VALUES (2),(3); +INSERT INTO t2 VALUES (2, default), (3, default); +connection slave; +# +# Count must be 0 +# +include/assert.inc [Table t3 should have zero rows.] +connection master; +DELETE FROM t1 WHERE id=2; +connection slave; +SET GLOBAL slave_run_triggers_for_rbr= @save_slave_run_triggers_for_rbr; +# +# Verify t1, t2 are consistent on slave. +# +include/diff_tables.inc [master:test.t1, slave:test.t1] +include/diff_tables.inc [master:test.t2, slave:test.t2] +connection master; +DROP TABLE t3,t2,t1; +connection slave; +# +# Test case 7: Triggers are present only on slave and +# 'slave_run_triggers_for_rbr=YES' +# +connection slave; +SET @save_slave_run_triggers_for_rbr= @@GLOBAL.slave_run_triggers_for_rbr; +SET GLOBAL slave_run_triggers_for_rbr= YES;; +SHOW GLOBAL VARIABLES LIKE '%slave_run_triggers_for_rbr%'; +Variable_name Value +slave_run_triggers_for_rbr YES +connection master; +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (t1_id INT NOT NULL, +v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), +KEY (t1_id), CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB; +connection slave; +CREATE TRIGGER trg AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t3 VALUES (1); +connection master; +INSERT INTO t1 VALUES (2),(3); +INSERT INTO t2 VALUES (2, default), (3, default); +connection slave; +# +# Count must be 2 +# +include/assert.inc [Table t3 should have two rows.] +connection master; +DELETE FROM t1 WHERE id=2; +connection slave; +SET GLOBAL slave_run_triggers_for_rbr= @save_slave_run_triggers_for_rbr; +# +# Verify t1, t2 are consistent on slave. +# +include/diff_tables.inc [master:test.t1, slave:test.t1] +include/diff_tables.inc [master:test.t2, slave:test.t2] +connection master; +DROP TABLE t3,t2,t1; +connection slave; +# +# Test case 8: Triggers and Foreign Keys are present only on slave and +# 'slave_run_triggers_for_rbr=NO' +# +connection slave; +SET @save_slave_run_triggers_for_rbr= @@GLOBAL.slave_run_triggers_for_rbr; +SET GLOBAL slave_run_triggers_for_rbr= NO;; +SHOW GLOBAL VARIABLES LIKE '%slave_run_triggers_for_rbr%'; +Variable_name Value +slave_run_triggers_for_rbr NO +connection master; +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +SET sql_log_bin=0; +CREATE TABLE t2 (t1_id INT NOT NULL,v_col INT AS (t1_id+1) VIRTUAL) ENGINE=INNODB; +SET sql_log_bin=1; +CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB; +connection slave; +CREATE TABLE t2 (t1_id INT NOT NULL, +v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id), +CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +CREATE TRIGGER trg AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t3 VALUES (1); +connection master; +INSERT INTO t1 VALUES (2),(3); +INSERT INTO t2 VALUES (2, default), (3, default); +connection slave; +# +# Count must be 0 +# +include/assert.inc [Table t3 should have zero rows.] +connection master; +DELETE FROM t1 WHERE id=2; +# t1: Should have one row +SELECT * FROM t1; +id +3 +# t2: Should have two rows +SELECT * FROM t2; +t1_id v_col +2 3 +3 4 +connection slave; +# t1: Should have one row +SELECT * FROM t1; +id +3 +# t2: Should have one row on slave due to ON DELETE CASCASE +SELECT * FROM t2; +t1_id v_col +3 4 +SET GLOBAL slave_run_triggers_for_rbr= @save_slave_run_triggers_for_rbr; +connection master; +DROP TABLE t3,t2,t1; +connection slave; +# +# Test case 9: Triggers are Foreign Keys are present only on slave and +# 'slave_run_triggers_for_rbr=YES' +# +connection slave; +SET @save_slave_run_triggers_for_rbr= @@GLOBAL.slave_run_triggers_for_rbr; +SET GLOBAL slave_run_triggers_for_rbr= YES;; +SHOW GLOBAL VARIABLES LIKE '%slave_run_triggers_for_rbr%'; +Variable_name Value +slave_run_triggers_for_rbr YES +connection master; +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +SET sql_log_bin=0; +CREATE TABLE t2 (t1_id INT NOT NULL,v_col INT AS (t1_id+1) VIRTUAL) ENGINE=INNODB; +SET sql_log_bin=1; +CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB; +connection slave; +CREATE TABLE t2 (t1_id INT NOT NULL, +v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id), +CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +CREATE TRIGGER trg AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t3 VALUES (1); +connection master; +INSERT INTO t1 VALUES (2),(3); +INSERT INTO t2 VALUES (2, default), (3, default); +connection slave; +# +# Count must be 2 +# +include/assert.inc [Table t3 should have two rows.] +connection master; +DELETE FROM t1 WHERE id=2; +# t1: Should have one row +SELECT * FROM t1; +id +3 +# t2: Should have two rows +SELECT * FROM t2; +t1_id v_col +2 3 +3 4 +connection slave; +# t1: Should have one row +SELECT * FROM t1; +id +3 +# t2: Should have one row on slave due to ON DELETE CASCASE +SELECT * FROM t2; +t1_id v_col +3 4 +SET GLOBAL slave_run_triggers_for_rbr= @save_slave_run_triggers_for_rbr; +connection master; +DROP TABLE t3,t2,t1; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result index 6d574681d73..ad6a89648ad 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result @@ -163,20 +163,15 @@ connection slave; connection slave; include/stop_slave.inc connection master; +include/kill_binlog_dump_threads.inc set global rpl_semi_sync_master_timeout= 5000; [ master status should be ON ] -show status like 'Rpl_semi_sync_master_status'; -Variable_name Value -Rpl_semi_sync_master_status ON show status like 'Rpl_semi_sync_master_no_tx'; Variable_name Value Rpl_semi_sync_master_no_tx 0 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value Rpl_semi_sync_master_yes_tx 14 -show status like 'Rpl_semi_sync_master_clients'; -Variable_name Value -Rpl_semi_sync_master_clients 1 [ semi-sync replication of these transactions will fail ] insert into t1 values (500); [ master status should be OFF ] @@ -234,9 +229,6 @@ max(a) 500 connection master; [ master status should be ON again after slave catches up ] -show status like 'Rpl_semi_sync_master_status'; -Variable_name Value -Rpl_semi_sync_master_status ON show status like 'Rpl_semi_sync_master_no_tx'; Variable_name Value Rpl_semi_sync_master_no_tx 12 @@ -303,8 +295,6 @@ connection master; create table t1 (a int) engine = ENGINE_TYPE; drop table t1; connection slave; -show status like 'Rpl_relay%'; -Variable_name Value [ test reset master ] connection master; reset master; @@ -320,8 +310,7 @@ Rpl_semi_sync_master_yes_tx 0 connection slave; include/stop_slave.inc reset slave; -connection master; -kill query _tid; +include/kill_binlog_dump_threads.inc connection slave; include/start_slave.inc connection master; @@ -353,7 +342,7 @@ include/stop_slave.inc reset slave; connection master; reset master; -kill query _tid; +include/kill_binlog_dump_threads.inc set sql_log_bin=0; grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; flush privileges; @@ -404,11 +393,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; Variable_name Value Rpl_semi_sync_slave_status OFF connection master; -kill query _tid; +include/kill_binlog_dump_threads.inc [ Semi-sync status on master should be ON ] -show status like 'Rpl_semi_sync_master_clients'; -Variable_name Value -Rpl_semi_sync_master_clients 0 show status like 'Rpl_semi_sync_master_status'; Variable_name Value Rpl_semi_sync_master_status ON diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result index 927113726fa..11affc4d803 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result @@ -164,20 +164,15 @@ connection slave; connection slave; include/stop_slave.inc connection master; +include/kill_binlog_dump_threads.inc set global rpl_semi_sync_master_timeout= 5000; [ master status should be ON ] -show status like 'Rpl_semi_sync_master_status'; -Variable_name Value -Rpl_semi_sync_master_status ON show status like 'Rpl_semi_sync_master_no_tx'; Variable_name Value Rpl_semi_sync_master_no_tx 0 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value Rpl_semi_sync_master_yes_tx 16 -show status like 'Rpl_semi_sync_master_clients'; -Variable_name Value -Rpl_semi_sync_master_clients 1 [ semi-sync replication of these transactions will fail ] insert into t1 values (500); [ master status should be OFF ] @@ -235,9 +230,6 @@ max(a) 500 connection master; [ master status should be ON again after slave catches up ] -show status like 'Rpl_semi_sync_master_status'; -Variable_name Value -Rpl_semi_sync_master_status ON show status like 'Rpl_semi_sync_master_no_tx'; Variable_name Value Rpl_semi_sync_master_no_tx 12 @@ -304,8 +296,6 @@ connection master; create table t1 (a int) engine = ENGINE_TYPE; drop table t1; connection slave; -show status like 'Rpl_relay%'; -Variable_name Value [ test reset master ] connection master; reset master; @@ -321,8 +311,7 @@ Rpl_semi_sync_master_yes_tx 0 connection slave; include/stop_slave.inc reset slave; -connection master; -kill query _tid; +include/kill_binlog_dump_threads.inc connection slave; include/start_slave.inc connection master; @@ -354,7 +343,7 @@ include/stop_slave.inc reset slave; connection master; reset master; -kill query _tid; +include/kill_binlog_dump_threads.inc set sql_log_bin=0; grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; flush privileges; @@ -405,11 +394,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; Variable_name Value Rpl_semi_sync_slave_status OFF connection master; -kill query _tid; +include/kill_binlog_dump_threads.inc [ Semi-sync status on master should be ON ] -show status like 'Rpl_semi_sync_master_clients'; -Variable_name Value -Rpl_semi_sync_master_clients 0 show status like 'Rpl_semi_sync_master_status'; Variable_name Value Rpl_semi_sync_master_status ON diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result index 30280551ce2..1a550be05a7 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result @@ -164,20 +164,15 @@ connection slave; connection slave; include/stop_slave.inc connection master; +include/kill_binlog_dump_threads.inc set global rpl_semi_sync_master_timeout= 5000; [ master status should be ON ] -show status like 'Rpl_semi_sync_master_status'; -Variable_name Value -Rpl_semi_sync_master_status ON show status like 'Rpl_semi_sync_master_no_tx'; Variable_name Value Rpl_semi_sync_master_no_tx 0 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value Rpl_semi_sync_master_yes_tx 14 -show status like 'Rpl_semi_sync_master_clients'; -Variable_name Value -Rpl_semi_sync_master_clients 1 [ semi-sync replication of these transactions will fail ] insert into t1 values (500); [ master status should be OFF ] @@ -235,9 +230,6 @@ max(a) 500 connection master; [ master status should be ON again after slave catches up ] -show status like 'Rpl_semi_sync_master_status'; -Variable_name Value -Rpl_semi_sync_master_status ON show status like 'Rpl_semi_sync_master_no_tx'; Variable_name Value Rpl_semi_sync_master_no_tx 12 @@ -304,8 +296,6 @@ connection master; create table t1 (a int) engine = ENGINE_TYPE; drop table t1; connection slave; -show status like 'Rpl_relay%'; -Variable_name Value [ test reset master ] connection master; reset master; @@ -321,8 +311,7 @@ Rpl_semi_sync_master_yes_tx 0 connection slave; include/stop_slave.inc reset slave; -connection master; -kill query _tid; +include/kill_binlog_dump_threads.inc connection slave; include/start_slave.inc connection master; @@ -354,7 +343,7 @@ include/stop_slave.inc reset slave; connection master; reset master; -kill query _tid; +include/kill_binlog_dump_threads.inc set sql_log_bin=0; grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; flush privileges; @@ -405,11 +394,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; Variable_name Value Rpl_semi_sync_slave_status OFF connection master; -kill query _tid; +include/kill_binlog_dump_threads.inc [ Semi-sync status on master should be ON ] -show status like 'Rpl_semi_sync_master_clients'; -Variable_name Value -Rpl_semi_sync_master_clients 0 show status like 'Rpl_semi_sync_master_status'; Variable_name Value Rpl_semi_sync_master_status ON diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 411a24278d5..f2f61ee0245 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -1,7 +1,6 @@ include/master-slave.inc [connection master] set local sql_mode=''; -set global sql_mode=''; drop database if exists mysqltest1; create database mysqltest1; use mysqltest1; @@ -174,16 +173,16 @@ fn1(20) insert into t2 values(fn1(21)); select * from t1; a -21 20 +21 select * from t2; a 23 connection slave; select * from t1; a -21 20 +21 select * from t2; a 23 @@ -242,7 +241,7 @@ return unix_timestamp(); end mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); -end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +end zedjzlcsjhd@localhost # # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci begin return unix_timestamp(); end mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin @@ -267,7 +266,7 @@ return unix_timestamp(); end mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); -end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +end zedjzlcsjhd@localhost # # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci begin return unix_timestamp(); end mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin @@ -863,6 +862,7 @@ SET TIMESTAMP=t/*!*/; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 /*!*/; SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=1411383296/*!*/; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`() DETERMINISTIC begin @@ -881,6 +881,7 @@ COMMIT BEGIN /*!*/; SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=0/*!*/; insert into t1 values (15) /*!*/; SET TIMESTAMP=t/*!*/; @@ -889,17 +890,20 @@ COMMIT BEGIN /*!*/; SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=1411383296/*!*/; insert into t2 values(3) /*!*/; SET TIMESTAMP=t/*!*/; COMMIT /*!*/; SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=0/*!*/; alter procedure foo4 sql security invoker /*!*/; BEGIN /*!*/; SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=1411383296/*!*/; insert into t2 values(3) /*!*/; SET TIMESTAMP=t/*!*/; @@ -916,6 +920,7 @@ COMMIT BEGIN /*!*/; SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=0/*!*/; delete from t2 /*!*/; SET TIMESTAMP=t/*!*/; @@ -1013,6 +1018,7 @@ SET TIMESTAMP=t/*!*/; COMMIT /*!*/; SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=1411383296/*!*/; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11) NO SQL begin @@ -1020,6 +1026,7 @@ return unix_timestamp(); end /*!*/; SET TIMESTAMP=t/*!*/; +SET @@session.sql_mode=0/*!*/; CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11) READS SQL DATA begin @@ -1382,4 +1389,3 @@ drop procedure p1; # End of 5.5 tests. connection slave; include/rpl_end.inc -set global sql_mode=default; diff --git a/mysql-test/suite/rpl/r/rpl_spec_variables.result b/mysql-test/suite/rpl/r/rpl_spec_variables.result index 96f63a50ea9..8b4c398f308 100644 --- a/mysql-test/suite/rpl/r/rpl_spec_variables.result +++ b/mysql-test/suite/rpl/r/rpl_spec_variables.result @@ -2,14 +2,17 @@ include/master-slave.inc [connection master] * auto_increment_increment, auto_increment_offset * +connection master; SET @@global.auto_increment_increment=2; SET @@session.auto_increment_increment=2; SET @@global.auto_increment_offset=10; SET @@session.auto_increment_offset=10; +connection slave; SET @@global.auto_increment_increment=3; SET @@session.auto_increment_increment=3; SET @@global.auto_increment_offset=20; SET @@session.auto_increment_offset=20; +connection master; CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; INSERT INTO t1 (b) VALUES ('master'); INSERT INTO t1 (b) VALUES ('master'); @@ -17,6 +20,7 @@ SELECT * FROM t1 ORDER BY a; a b 2 master 4 master +connection slave; CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; INSERT INTO t1 (b) VALUES ('slave'); INSERT INTO t1 (b) VALUES ('slave'); @@ -32,102 +36,123 @@ SELECT * FROM t2 ORDER BY a; a b 1 slave 4 slave +connection master; DROP TABLE IF EXISTS t1,t2; SET @@global.auto_increment_increment=1; SET @@session.auto_increment_increment=1; SET @@global.auto_increment_offset=1; SET @@session.auto_increment_offset=1; +connection slave; SET @@global.auto_increment_increment=1; SET @@session.auto_increment_increment=1; SET @@global.auto_increment_offset=1; SET @@session.auto_increment_offset=1; +connection slave; SET auto_increment_increment=1; SET auto_increment_offset=1; * character_set_database, collation_server * +connection master; SET @restore_master_character_set_database=@@global.character_set_database; SET @restore_master_collation_server=@@global.collation_server; SET @@global.character_set_database=latin1; SET @@session.character_set_database=latin1; SET @@global.collation_server=latin1_german1_ci; SET @@session.collation_server=latin1_german1_ci; +connection slave; SET @restore_slave_character_set_database=@@global.character_set_database; SET @restore_slave_collation_server=@@global.collation_server; SET @@global.character_set_database=utf8; SET @@session.character_set_database=utf8; SET @@global.collation_server=utf8_bin; SET @@session.collation_server=utf8_bin; +connection master; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, - `b` varchar(10) COLLATE latin1_german1_ci DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +connection slave; CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, - `b` varchar(10) COLLATE latin1_german1_ci DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci +) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, - `b` varchar(10) COLLATE utf8_bin DEFAULT NULL, + `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin +) ENGINE=MyISAM DEFAULT CHARSET=latin1 SET @@global.collation_server=latin1_swedish_ci; SET @@session.collation_server=latin1_swedish_ci; +connection master; SET @@global.collation_server=latin1_swedish_ci; SET @@session.collation_server=latin1_swedish_ci; DROP TABLE IF EXISTS t1,t2; * default_week_format * +connection master; SET @@global.default_week_format=0; SET @@session.default_week_format=0; +connection slave; SET @@global.default_week_format=1; SET @@session.default_week_format=1; +connection master; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (1, 'master ', WEEK('2008-01-07')); SELECT * FROM t1 ORDER BY a; a b c 1 master 1 +connection slave; INSERT INTO t1 VALUES (2, 'slave ', WEEK('2008-01-07')); SELECT * FROM t1 ORDER BY a; a b c 1 master 1 2 slave 2 +connection master; DROP TABLE t1; +connection slave; SET @@global.default_week_format=0; SET @@session.default_week_format=0; * local_infile * +connection slave; SET @@global.local_infile=0; +connection master; CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(20), c CHAR(254)) ENGINE=MyISAM; LOAD DATA LOCAL INFILE 'FILE' INTO TABLE t1 (b); SELECT COUNT(*) FROM t1; COUNT(*) 70 +connection slave; LOAD DATA LOCAL INFILE 'FILE2' INTO TABLE t1 (b); -ERROR 42000: The used command is not allowed with this MySQL version +ERROR 42000: The used command is not allowed with this MariaDB version SELECT COUNT(*) FROM t1; COUNT(*) 70 SET @@global.local_infile=1; +connection master; DROP TABLE t1; * max_heap_table_size * +connection slave; SET @restore_slave_max_heap_table_size=@@global.max_heap_table_size; SET @@global.max_heap_table_size=16384; SET @@session.max_heap_table_size=16384; +connection master; CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), c CHAR(254)) ENGINE=MEMORY; SELECT COUNT(*)=2000 FROM t1; COUNT(*)=2000 1 +connection slave; SELECT COUNT(*)=2000 FROM t1 WHERE b='master' GROUP BY b ORDER BY b; COUNT(*)=2000 1 @@ -137,18 +162,24 @@ COUNT(*)<2000 AND COUNT(*)>0 SELECT COUNT(*)<2000 AND COUNT(*)>0 FROM t2 WHERE b='slave' GROUP BY b ORDER BY b; COUNT(*)<2000 AND COUNT(*)>0 1 +connection master; DROP TABLE IF EXISTS t1,t2; * storage_engine * +connection master; SET @restore_master_storage_engine=@@global.storage_engine; SET @@global.storage_engine=InnoDB; SET @@session.storage_engine=InnoDB; +connection slave; SET @restore_slave_storage_engine=@@global.storage_engine; SET @@global.storage_engine=Memory; SET @@session.storage_engine=Memory; +connection master; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)); CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; +connection slave; CREATE TABLE t3 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)); +connection master; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -163,6 +194,7 @@ t2 CREATE TABLE `t2` ( `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 +connection slave; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -186,37 +218,49 @@ t3 CREATE TABLE `t3` ( ) ENGINE=MEMORY DEFAULT CHARSET=latin1 SET @@global.storage_engine=InnoDB; SET @@session.storage_engine=InnoDB; +connection master; DROP TABLE IF EXISTS t1,t2,t3; * sql_mode * +connection master; +SET @old_sql_mode_master= @@global.sql_mode; SET @@global.sql_mode=ANSI; SET @@session.sql_mode=ANSI; +connection slave; +SET @old_sql_mode_slave= @@global.sql_mode; SET @@global.sql_mode=TRADITIONAL; SET @@session.sql_mode=TRADITIONAL; +connection master; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c DATE); INSERT INTO t1 VALUES (1, 'master', '0000-00-00'); SELECT * FROM t1 ORDER BY a; a b c 1 master 0000-00-00 +connection slave; INSERT INTO t1 VALUES (1, 'slave', '0000-00-00'); -ERROR 22007: Incorrect date value: '0000-00-00' for column 'c' at row 1 +ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`c` at row 1 SELECT * FROM t1 ORDER BY a; a b c 1 master 0000-00-00 SET @@global.sql_mode=''; SET @@session.sql_mode=''; +connection master; SET @@global.sql_mode=''; SET @@session.sql_mode=''; DROP TABLE t1; *** clean up *** +connection master; SET @@global.character_set_database=@restore_master_character_set_database; SET @@global.collation_server=@restore_master_collation_server; SET @@global.storage_engine=@restore_master_storage_engine; +SET @@global.sql_mode=@old_sql_mode_master; +connection slave; SET @@global.character_set_database=@restore_slave_character_set_database; SET @@global.collation_server=@restore_slave_collation_server; SET @@global.max_heap_table_size=@restore_slave_max_heap_table_size; SET @@global.storage_engine=@restore_slave_storage_engine; +SET @@global.sql_mode=@old_sql_mode_slave; call mtr.add_suppression("The table 't[12]' is full"); include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_table_options.result b/mysql-test/suite/rpl/r/rpl_table_options.result index 87fd8c2b2fb..14af4e390c2 100644 --- a/mysql-test/suite/rpl/r/rpl_table_options.result +++ b/mysql-test/suite/rpl/r/rpl_table_options.result @@ -5,24 +5,27 @@ set storage_engine=example; connection slave; connection master; create table t1 (a int not null) ull=12340; +alter table t1 ull=12350; +Warnings: +Note 1105 EXAMPLE DEBUG: ULL 12340 -> 12350 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12350 connection slave; connection slave; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /* `ull`=12340 */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /* `ull`=12350 */ set sql_mode=ignore_bad_table_options; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 `ull`=12340 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 `ull`=12350 connection master; drop table t1; set storage_engine=default; diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test index 5e170d5acce..9ab49a585e6 100644 --- a/mysql-test/suite/rpl/t/rpl_change_master.test +++ b/mysql-test/suite/rpl/t/rpl_change_master.test @@ -101,4 +101,11 @@ connection master; drop table t1; } +--connection master +# MDEV-22741: *SAN: ERROR: AddressSanitizer: use-after-poison on address in +# instrings/strmake.c:36 from change_master (on optimized builds) +CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='', + MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH=''; +CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0; + --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test index 0262998798a..5537b6fbf86 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test @@ -53,17 +53,11 @@ START SLAVE IO_THREAD; # adjust the master binlog state FLUSH BINARY LOGS; --let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1) ---eval PURGE BINARY LOGS TO '$purge_to_binlog'; +--let $purge_binlogs_to=$purge_to_binlog +--source include/wait_for_purge.inc + # with final removal of the extra domain -###adding to debug info to catch the failure (1076): ---error 0,1076 --eval FLUSH BINARY LOGS DELETE_DOMAIN_ID=($extra_domain_id) - -if ($mysql_errno == 1076) { - --echo ### Failure "Could not delete gtid domain" - --source include/show_rpl_debug_info.inc - } - SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state; --connection slave diff --git a/mysql-test/suite/rpl/t/rpl_ignore_grant.test b/mysql-test/suite/rpl/t/rpl_ignore_grant.test index ee049a515d7..58457c14817 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_grant.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_grant.test @@ -6,16 +6,12 @@ source include/master-slave.inc; # do not be influenced by other tests. connection master; -set global sql_mode=""; -set local sql_mode=""; +set sql_mode=""; delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; -save_master_pos; -connection slave; -set global sql_mode=""; -set local sql_mode=""; -sync_with_master; +--sync_slave_with_master +set sql_mode=""; # as these DELETE were not replicated, we need to do them manually on the # slave. delete from mysql.user where user=_binary'rpl_ignore_grant'; @@ -27,9 +23,7 @@ connection master; grant select on *.* to rpl_ignore_grant@localhost; grant drop on test.* to rpl_ignore_grant@localhost; show grants for rpl_ignore_grant@localhost; -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master --error 1141 #("no such grant for user") show grants for rpl_ignore_grant@localhost; # check it another way @@ -43,9 +37,7 @@ select count(*) from mysql.db where user=_binary'rpl_ignore_grant'; grant select on *.* to rpl_ignore_grant@localhost; connection master; set password for rpl_ignore_grant@localhost=password("does it work?"); -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant'; # clear what we have done, to not influence other tests. @@ -53,15 +45,11 @@ connection master; delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master delete from mysql.user where user=_binary'rpl_ignore_grant'; delete from mysql.db where user=_binary'rpl_ignore_grant'; flush privileges; -set global sql_mode=default; connection master; -set global sql_mode=default; # End of 4.1 tests --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table_update.test b/mysql-test/suite/rpl/t/rpl_ignore_table_update.test index 840052e2f25..6591dbbc6ad 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_table_update.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_table_update.test @@ -24,15 +24,11 @@ create table mysqltest_bar (m int); insert into mysqltest_bar values(15); create table t1 (k int); insert into t1 values(55); -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1; connection master; drop table mysqltest_foo,mysqltest_bar,t1; -save_master_pos; -connection slave; -sync_with_master; +--sync_slave_with_master drop table mysqltest_foo,mysqltest_bar,t1; # End of 4.1 tests diff --git a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test index a3f3ff56464..768a834514b 100644 --- a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test +++ b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test @@ -10,6 +10,7 @@ explain extended select master_pos_wait('master-bin.999999',0,2); send select master_pos_wait('master-bin.999999',0); connection slave1; stop slave sql_thread; +--source include/wait_for_slave_sql_to_stop.inc connection slave; reap; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_retry.test b/mysql-test/suite/rpl/t/rpl_parallel_retry.test index 96863f9021d..0140784c8b9 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_retry.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_retry.test @@ -436,6 +436,9 @@ SET @@DEBUG_SYNC='now SIGNAL proceed_by_1000'; --connection spoiler_21 ROLLBACK; +--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE '%debug sync point%'; +--source include/wait_condition.inc + --echo # Release the 2nd worker to proceed --connection spoiler_22 ROLLBACK; diff --git a/mysql-test/suite/rpl/t/rpl_relay_max_extension.test b/mysql-test/suite/rpl/t/rpl_relay_max_extension.test new file mode 100644 index 00000000000..e1e087f2e0e --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_relay_max_extension.test @@ -0,0 +1,109 @@ +# ==== Purpose ==== +# +# Test verifies that auto purging mechanism of relay logs works fine when the +# file extension grows beyond 999999. +# +# ==== Implementation ==== +# +# Steps: +# 0 - In master-slave setup clear all the relay logs on the slave server. +# 1 - Start the slave so that new relay logs starting from +# 'slave-relay-bin.000001' are created. +# 2 - Get the active relay-log file name by using SHOW SLAVE STATUS. +# Shutdown the slave server. +# 3 - Rename active relay log to '999997' in both 'relay-log.info' and +# 'slave-relay-bin.index' files. +# 4 - Restart the slave server by configuring 'slave_parallel_threads=1' +# and 'max_relay_log_size=100K'. +# 5 - Generate load on master such that few relay logs are generated on +# slave. The relay log sequence number will change to 7 digits. +# 6 - Sync slave with master to ensure that relay logs are applied on +# slave. They should have been automatically purged. +# 7 - Assert that there is no 'slave-relay-bin.999999' file in +# 'relay-log.info'. +# +# ==== References ==== +# +# MDEV-8134: The relay-log is not flushed after the slave-relay-log.999999 +# showed +# + +--source include/have_innodb.inc +--source include/have_binlog_format_row.inc +--let $rpl_topology=1->2 +--source include/rpl_init.inc + +--connection server_2 +--source include/stop_slave.inc +RESET SLAVE; +--source include/start_slave.inc +--source include/stop_slave.inc +--let $relay_log=query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) + +--echo # +--echo # Stop slave server +--echo # + +--let $datadir = `select @@datadir` +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--shutdown_server 10 +--source include/wait_until_disconnected.inc + +--exec sed -i "s/$relay_log/slave-relay-bin.999997/g" $datadir/relay-log.info +--exec sed -i "s/$relay_log/slave-relay-bin.999997/g" $datadir/slave-relay-bin.index + +--echo # +--echo # Simulate file number get close to 999997 +--echo # by renaming relay logs and modifying index/info files + +--move_file $datadir/$relay_log $datadir/slave-relay-bin.999997 + +--echo # +--echo # Restart slave server +--echo # + +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--enable_reconnect +--source include/wait_until_connected_again.inc +SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads; +SET @save_max_relay_log_size= @@GLOBAL.max_relay_log_size; + +SET GLOBAL slave_parallel_threads=1; +SET GLOBAL max_relay_log_size=100 * 1024; +--source include/start_slave.inc + +--connection server_1 +create table t1 (i int, c varchar(1024)); +--echo # +--echo # Insert some data to generate enough amount of binary logs +--echo # +--let $count = 1000 +--disable_query_log +while ($count) +{ + eval insert into t1 values (1001 - $count, repeat('a',1000)); + dec $count; +} +--enable_query_log +--save_master_pos + +--connection server_2 +--sync_with_master + +--let $relay_log=query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) + +--echo # +--echo # Assert that 'slave-relay-bin.999999' is purged. +--echo # +let SEARCH_FILE=$datadir/slave-relay-bin.index; +let SEARCH_PATTERN=slave-relay-bin.999999; +source include/search_pattern_in_file.inc; + +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads= @save_slave_parallel_threads; +SET GLOBAL max_relay_log_size= @save_max_relay_log_size; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_USER.test b/mysql-test/suite/rpl/t/rpl_row_USER.test index 31826812efa..405f609f0f6 100644 --- a/mysql-test/suite/rpl/t/rpl_row_USER.test +++ b/mysql-test/suite/rpl/t/rpl_row_USER.test @@ -11,7 +11,6 @@ # Includes -- source include/have_binlog_format_row.inc -- source include/master-slave.inc -set global sql_mode=""; set local sql_mode=""; # Begin clean up test section @@ -43,23 +42,18 @@ delimiter ;| CALL mysqltest1.p1(); connection master; SELECT * FROM mysqltest1.t1 ORDER BY a; -sync_slave_with_master; +--sync_slave_with_master SELECT * FROM mysqltest1.t1 ORDER BY a; connection master; # Lets cleanup -#show binlog events; DROP DATABASE mysqltest1; REVOKE ALL ON mysqltest1.* FROM 'tester'@'%'; REVOKE ALL ON mysqltest1.* FROM ''@'localhost%'; DROP USER tester@'%'; DROP USER ''@'localhost%'; - -sync_slave_with_master; - +FLUSH PRIVILEGES; +--sync_slave_with_master # End of 5.0 test case --source include/rpl_end.inc - -set global sql_mode=default; -set local sql_mode=default; diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test index 65f14295c19..cb76d6c4dcb 100644 --- a/mysql-test/suite/rpl/t/rpl_row_create_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test @@ -7,11 +7,6 @@ connection slave; --source include/have_innodb.inc connection master; -# Bug#18326: Do not lock table for writing during prepare of statement -# The use of the ps protocol causes extra table maps in the binlog, so -# we disable the ps-protocol for this statement. ---disable_ps_protocol - # Set the default storage engine to different values on master and # slave. We need to stop the slave for the server variable to take # effect, since the variable is only read on start-up. diff --git a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test index 71cd4a5b9ae..4d786794f5f 100644 --- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test +++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test @@ -4,10 +4,4 @@ let $rename_event_pos= `select @binlog_start_pos + 819`; -# Bug#18326: Do not lock table for writing during prepare of statement -# The use of the ps protocol causes extra table maps in the binlog, so -# we disable the ps-protocol for this statement. - ---disable_ps_protocol -- source extra/rpl_tests/rpl_flsh_tbls.test ---enable_ps_protocol diff --git a/mysql-test/suite/rpl/t/rpl_row_trig002.test b/mysql-test/suite/rpl/t/rpl_row_trig002.test index 46f9ad91a3d..f04d1e6d478 100644 --- a/mysql-test/suite/rpl/t/rpl_row_trig002.test +++ b/mysql-test/suite/rpl/t/rpl_row_trig002.test @@ -48,9 +48,11 @@ INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming'); INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming'); select * from test.t2; +--sorted_result select * from test.t3; sync_slave_with_master; select * from test.t2; +--sorted_result select * from test.t3; connection master; diff --git a/mysql-test/suite/rpl/t/rpl_row_vcol_crash.test b/mysql-test/suite/rpl/t/rpl_row_vcol_crash.test new file mode 100644 index 00000000000..84ee14977f3 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_vcol_crash.test @@ -0,0 +1,425 @@ +# ==== Purpose ==== +# +# Test verifies that, slave doesn't report any assert on UPDATE or DELETE of +# row which tries to update the virtual columns with associated KEYs. +# +# Test scenarios are listed below. +# 1) KEY on a virtual column with ON DELETE CASCADE +# 2) Verify "ON DELETE CASCADE" for parent->child->child scenario +# 3) KEY on a virtual column with ON UPDATE CASCADE +# 4) Define triggers on master, their results should be replicated +# as part of row events and they should be applied on slave with +# the default slave_run_triggers_for_rbr=NO +# 5) Define triggers + Foreign Keys on master, their results should be +# replicated as part of row events and master and slave should be in sync. +# 6) Triggers are present only on slave and 'slave_run_triggers_for_rbr=NO' +# 7) Triggers are present only on slave and 'slave_run_triggers_for_rbr=YES' +# 8) Triggers and Foreign Keys are present only on slave and +# 'slave_run_triggers_for_rbr=NO' +# 9) Triggers are Foreign Keys are present only on slave and +# 'slave_run_triggers_for_rbr=YES' +# +# ==== References ==== +# +# MDEV-23033: All slaves crash once in ~24 hours and loop restart with signal 11 +# + +--source include/have_binlog_format_row.inc +--source include/have_innodb.inc +--source include/master-slave.inc + + +--echo # +--echo # Test case 1: KEY on a virtual column with ON DELETE CASCADE +--echo # +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2),(3); + +CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, + t1_id INT NOT NULL, + v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id), + CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; + +INSERT INTO t2 VALUES (90,1,NULL); +INSERT INTO t2 VALUES (91,2,default); + +# Following query results in an assert on slave +DELETE FROM t1 WHERE id=1; +--sync_slave_with_master + +--echo # +--echo # Verify data consistency on slave +--echo # +--let $diff_tables= master:test.t1, slave:test.t1 +--source include/diff_tables.inc +--let $diff_tables= master:test.t2, slave:test.t2 +--source include/diff_tables.inc + +--connection master +DROP TABLE t2,t1; +--sync_slave_with_master + +--echo # +--echo # Test case 2: Verify "ON DELETE CASCADE" for parent->child->child scenario +--echo # Parent table: users +--echo # Child tables: matchmaking_groups, matchmaking_group_users +--echo # Parent table: matchmaking_groups +--echo # Child tables: matchmaking_group_users, matchmaking_group_maps +--echo # +--echo # Deleting a row from parent table should be reflected in +--echo # child tables. +--echo # matchmaking_groups->matchmaking_group_users->matchmaking_group_maps +--echo # users->matchmaking_group_users->matchmaking_group_maps +--echo # + +--connection master +CREATE TABLE users (id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(32) NOT NULL DEFAULT '' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE matchmaking_groups ( + id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + host_user_id INT UNSIGNED NOT NULL UNIQUE, + v_col INT AS (host_user_id+1) VIRTUAL, KEY (v_col), + CONSTRAINT FOREIGN KEY (host_user_id) REFERENCES users (id) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE matchmaking_group_users ( + matchmaking_group_id BIGINT UNSIGNED NOT NULL, + user_id INT UNSIGNED NOT NULL, + v_col1 int as (user_id+1) virtual, KEY (v_col1), + PRIMARY KEY (matchmaking_group_id,user_id), + UNIQUE KEY user_id (user_id), + CONSTRAINT FOREIGN KEY (matchmaking_group_id) + REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT FOREIGN KEY (user_id) + REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE matchmaking_group_maps ( + matchmaking_group_id BIGINT UNSIGNED NOT NULL, + map_id TINYINT UNSIGNED NOT NULL, + v_col2 INT AS (map_id+1) VIRTUAL, KEY (v_col2), + PRIMARY KEY (matchmaking_group_id,map_id), + CONSTRAINT FOREIGN KEY (matchmaking_group_id) + REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +--sync_slave_with_master + +--connection master +INSERT INTO users VALUES (NULL,'foo'),(NULL,'bar'); +INSERT INTO matchmaking_groups VALUES (10,1,default),(11,2,default); +INSERT INTO matchmaking_group_users VALUES (10,1,default),(11,2,default); +INSERT INTO matchmaking_group_maps VALUES (10,55,default),(11,66,default); + +DELETE FROM matchmaking_groups WHERE id = 10; +--sync_slave_with_master + +--echo # +--echo # No rows should be returned as ON DELETE CASCASE should have removed +--echo # corresponding rows from child tables. There should not any mismatch +--echo # of 'id' field between parent->child. +--echo # +SELECT * FROM matchmaking_group_users WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups); +SELECT * FROM matchmaking_group_maps WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups); + +--echo # +--echo # Rows with id=11 should be present +--echo # +SELECT * FROM matchmaking_group_users; +SELECT * FROM matchmaking_group_maps; + +--connection master +DELETE FROM users WHERE id = 2; +--sync_slave_with_master + +--echo # +--echo # No rows should be present in both the child tables +--echo # +SELECT * FROM matchmaking_group_users; +SELECT * FROM matchmaking_group_maps; + +--connection master +DROP TABLE matchmaking_group_maps, matchmaking_group_users, matchmaking_groups, users; +--sync_slave_with_master + +--echo # +--echo # Test case 3: KEY on a virtual column with ON UPDATE CASCADE +--echo # + +--connection master +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 80); + +CREATE TABLE t2 (a INT KEY, b INT, + v_col int as (b+1) virtual, KEY (v_col), + CONSTRAINT b FOREIGN KEY (b) REFERENCES t1(a) ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT INTO t2 VALUES (51, 1, default); +--sync_slave_with_master + +--connection master +UPDATE t1 SET a = 50 WHERE a = 1; + +--echo # +--echo # Master: Verify that ON UPDATE CASCADE works fine +--echo # old_row: (51, 1, 2) ON UPDATE New_row: (51, 50, 51) +--echo # +SELECT * FROM t2 WHERE b=50; +--sync_slave_with_master + +--echo # +--echo # Slave: Verify that ON UPDATE CASCADE works fine +--echo # old_row: (51, 1, 2) ON UPDATE New_row: (51, 50, 51) +--echo # +SELECT * FROM t2 WHERE b=50; + +--connection master +DROP TABLE t2, t1; +--sync_slave_with_master + +--echo # +--echo # Test case 4: Define triggers on master, their results should be +--echo # replicated as part of row events and they should be +--echo # applied on slave with the default +--echo # slave_run_triggers_for_rbr=NO +--echo # + +# In row-based replication, the binary log contains row changes. It will have +# both the changes made by the statement itself, and the changes made by the +# triggers that were invoked by the statement. Slave server(s) do not need to +# run triggers for row changes they are applying. Hence verify that this +# property remains the same and data should be available as if trigger was +# executed. Please note by default slave_run_triggers_for_rbr=NO. + +--connection master +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (count INT NOT NULL) ENGINE=InnoDB; +CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (1); +INSERT INTO t1 VALUES (2),(3); +--sync_slave_with_master + +SHOW GLOBAL VARIABLES LIKE 'slave_run_triggers_for_rbr'; +--echo # +--echo # As two rows are inserted in table 't1', two rows should get inserted +--echo # into table 't2' as part of trigger. +--echo # +--let $assert_cond= COUNT(*) = 2 FROM t2 +--let $assert_text= Table t2 should have two rows. +--source include/assert.inc + +--connection master +DROP TABLE t1,t2; +--sync_slave_with_master + +--echo # +--echo # Test case 5: Define triggers + Foreign Keys on master, their results +--echo # should be replicated as part of row events and master +--echo # and slave should be in sync. +--echo # +--connection master +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (t1_id INT NOT NULL, + v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id), + CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB; +CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t3 VALUES (1); + +INSERT INTO t1 VALUES (2),(3); +INSERT INTO t2 VALUES (2, default), (3, default); +--sync_slave_with_master + +--echo # +--echo # As two rows are inserted in table 't1', two rows should get inserted +--echo # into table 't3' as part of trigger. +--echo # +--let $assert_cond= COUNT(*) = 2 FROM t3 +--let $assert_text= Table t3 should have two rows. +--source include/assert.inc + +--echo # +--echo # Verify ON DELETE CASCASE correctness +--echo # +--connection master +DELETE FROM t1 WHERE id=2; +--sync_slave_with_master + +--connection master +--let $diff_tables= master:test.t1, slave:test.t1 +--source include/diff_tables.inc +--let $diff_tables= master:test.t2, slave:test.t2 +--source include/diff_tables.inc +--let $diff_tables= master:test.t3, slave:test.t3 +--source include/diff_tables.inc + +DROP TABLE t3,t2,t1; +--sync_slave_with_master + +# +# Test case: Triggers only on slave +# +--write_file $MYSQLTEST_VARDIR/tmp/trig_on_slave.inc PROCEDURE + if ($slave_run_triggers_for_rbr == '') { + --die !!!ERROR IN TEST: you must set $slave_run_triggers_for_rbr + } + +--connection slave +SET @save_slave_run_triggers_for_rbr= @@GLOBAL.slave_run_triggers_for_rbr; +--eval SET GLOBAL slave_run_triggers_for_rbr= $slave_run_triggers_for_rbr; +SHOW GLOBAL VARIABLES LIKE '%slave_run_triggers_for_rbr%'; + +--connection master +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (t1_id INT NOT NULL, + v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), + KEY (t1_id), CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB; +--sync_slave_with_master + +CREATE TRIGGER trg AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t3 VALUES (1); + +--connection master +INSERT INTO t1 VALUES (2),(3); +INSERT INTO t2 VALUES (2, default), (3, default); +--sync_slave_with_master + +if ($slave_run_triggers_for_rbr == 'NO') { +--echo # +--echo # Count must be 0 +--echo # +--let $assert_cond= COUNT(*) = 0 FROM t3 +--let $assert_text= Table t3 should have zero rows. +--source include/assert.inc +} +if ($slave_run_triggers_for_rbr == 'YES') { +--echo # +--echo # Count must be 2 +--echo # +--let $assert_cond= COUNT(*) = 2 FROM t3 +--let $assert_text= Table t3 should have two rows. +--source include/assert.inc +} + +--connection master +DELETE FROM t1 WHERE id=2; +--sync_slave_with_master +SET GLOBAL slave_run_triggers_for_rbr= @save_slave_run_triggers_for_rbr; + +--echo # +--echo # Verify t1, t2 are consistent on slave. +--echo # +--let $diff_tables= master:test.t1, slave:test.t1 +--source include/diff_tables.inc +--let $diff_tables= master:test.t2, slave:test.t2 +--source include/diff_tables.inc + +--connection master +DROP TABLE t3,t2,t1; +--sync_slave_with_master +#END OF +PROCEDURE + +--echo # +--echo # Test case 6: Triggers are present only on slave and +--echo # 'slave_run_triggers_for_rbr=NO' +--echo # +--let $slave_run_triggers_for_rbr=NO +--source $MYSQLTEST_VARDIR/tmp/trig_on_slave.inc + +--echo # +--echo # Test case 7: Triggers are present only on slave and +--echo # 'slave_run_triggers_for_rbr=YES' +--echo # +--let $slave_run_triggers_for_rbr=YES +--source $MYSQLTEST_VARDIR/tmp/trig_on_slave.inc +--remove_file $MYSQLTEST_VARDIR/tmp/trig_on_slave.inc + +# +# Test case: Trigger and Foreign Key are present only on slave +# +--write_file $MYSQLTEST_VARDIR/tmp/trig_fk_on_slave.inc PROCEDURE + if ($slave_run_triggers_for_rbr == '') { + --die !!!ERROR IN TEST: you must set $slave_run_triggers_for_rbr + } + +--connection slave +SET @save_slave_run_triggers_for_rbr= @@GLOBAL.slave_run_triggers_for_rbr; +--eval SET GLOBAL slave_run_triggers_for_rbr= $slave_run_triggers_for_rbr; +SHOW GLOBAL VARIABLES LIKE '%slave_run_triggers_for_rbr%'; + +--connection master +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; +SET sql_log_bin=0; +CREATE TABLE t2 (t1_id INT NOT NULL,v_col INT AS (t1_id+1) VIRTUAL) ENGINE=INNODB; +SET sql_log_bin=1; +CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB; +--sync_slave_with_master + +# Have foreign key and trigger on slave. +CREATE TABLE t2 (t1_id INT NOT NULL, + v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id), + CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +CREATE TRIGGER trg AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t3 VALUES (1); + +--connection master +INSERT INTO t1 VALUES (2),(3); +INSERT INTO t2 VALUES (2, default), (3, default); +--sync_slave_with_master + +if ($slave_run_triggers_for_rbr == 'NO') { +--echo # +--echo # Count must be 0 +--echo # +--let $assert_cond= COUNT(*) = 0 FROM t3 +--let $assert_text= Table t3 should have zero rows. +--source include/assert.inc +} +if ($slave_run_triggers_for_rbr == 'YES') { +--echo # +--echo # Count must be 2 +--echo # +--let $assert_cond= COUNT(*) = 2 FROM t3 +--let $assert_text= Table t3 should have two rows. +--source include/assert.inc +} + +--connection master +DELETE FROM t1 WHERE id=2; +--echo # t1: Should have one row +SELECT * FROM t1; +--echo # t2: Should have two rows +SELECT * FROM t2; +--sync_slave_with_master +--echo # t1: Should have one row +SELECT * FROM t1; +--echo # t2: Should have one row on slave due to ON DELETE CASCASE +SELECT * FROM t2; +SET GLOBAL slave_run_triggers_for_rbr= @save_slave_run_triggers_for_rbr; + +--connection master +DROP TABLE t3,t2,t1; +--sync_slave_with_master +#END OF +PROCEDURE + +--echo # +--echo # Test case 8: Triggers and Foreign Keys are present only on slave and +--echo # 'slave_run_triggers_for_rbr=NO' +--echo # +--let $slave_run_triggers_for_rbr=NO +--source $MYSQLTEST_VARDIR/tmp/trig_fk_on_slave.inc + +--echo # +--echo # Test case 9: Triggers are Foreign Keys are present only on slave and +--echo # 'slave_run_triggers_for_rbr=YES' +--echo # +--let $slave_run_triggers_for_rbr=YES +--source $MYSQLTEST_VARDIR/tmp/trig_fk_on_slave.inc +--remove_file $MYSQLTEST_VARDIR/tmp/trig_fk_on_slave.inc + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test index 2d91d2e4118..f8726deb61d 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test @@ -1,4 +1,5 @@ --source include/have_binlog_format_statement.inc +--source include/have_semisync.inc set global rpl_semi_sync_master_wait_point=AFTER_SYNC; source rpl_semi_sync.test; set global rpl_semi_sync_master_wait_point=default; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test index 47af6c34fcf..3e89bed640b 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test @@ -1,4 +1,5 @@ --source include/have_binlog_format_row.inc +--source include/have_semisync.inc set global rpl_semi_sync_master_wait_point=AFTER_SYNC; source rpl_semi_sync.test; set global rpl_semi_sync_master_wait_point=default; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_event_after_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync_event_after_sync.test index 527900fd949..9bca4965f15 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_event_after_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_event_after_sync.test @@ -1,3 +1,4 @@ +source include/have_semisync.inc; set global rpl_semi_sync_master_wait_point=AFTER_SYNC; source rpl_semi_sync_event.test; set global rpl_semi_sync_master_wait_point=default; diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test index fb30c5708bc..637dda47489 100644 --- a/mysql-test/suite/rpl/t/rpl_sp.test +++ b/mysql-test/suite/rpl/t/rpl_sp.test @@ -7,8 +7,6 @@ source include/have_binlog_format_mixed.inc; source include/master-slave.inc; set local sql_mode=''; -set global sql_mode=''; - # we need a db != test, where we don't have automatic grants --disable_warnings drop database if exists mysqltest1; @@ -199,9 +197,11 @@ delimiter ;| delete t1,t2 from t1,t2; select fn1(20); insert into t2 values(fn1(21)); +--sorted_result select * from t1; select * from t2; sync_slave_with_master; +--sorted_result select * from t1; select * from t2; @@ -728,4 +728,3 @@ drop procedure p1; # Cleanup sync_slave_with_master; --source include/rpl_end.inc -set global sql_mode=default; diff --git a/mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt b/mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/suite/rpl/t/rpl_spec_variables.test b/mysql-test/suite/rpl/t/rpl_spec_variables.test index 2cb580fce83..e2d5175036c 100644 --- a/mysql-test/suite/rpl/t/rpl_spec_variables.test +++ b/mysql-test/suite/rpl/t/rpl_spec_variables.test @@ -260,10 +260,12 @@ DROP TABLE IF EXISTS t1,t2,t3; --echo * sql_mode * --connection master +SET @old_sql_mode_master= @@global.sql_mode; SET @@global.sql_mode=ANSI; SET @@session.sql_mode=ANSI; --connection slave +SET @old_sql_mode_slave= @@global.sql_mode; SET @@global.sql_mode=TRADITIONAL; SET @@session.sql_mode=TRADITIONAL; @@ -292,14 +294,16 @@ DROP TABLE t1; SET @@global.character_set_database=@restore_master_character_set_database; SET @@global.collation_server=@restore_master_collation_server; SET @@global.storage_engine=@restore_master_storage_engine; +SET @@global.sql_mode=@old_sql_mode_master; --sync_slave_with_master SET @@global.character_set_database=@restore_slave_character_set_database; SET @@global.collation_server=@restore_slave_collation_server; SET @@global.max_heap_table_size=@restore_slave_max_heap_table_size; SET @@global.storage_engine=@restore_slave_storage_engine; - +SET @@global.sql_mode=@old_sql_mode_slave; # Put at the end since the test otherwise emptied the table. - +remove_file $MYSQLTEST_VARDIR/tmp/words.dat; +remove_file $MYSQLTEST_VARDIR/tmp/words2.dat; --echo call mtr.add_suppression("The table 't[12]' is full"); diff --git a/mysql-test/suite/rpl/t/rpl_table_options.test b/mysql-test/suite/rpl/t/rpl_table_options.test index 3f52444a3c7..6dd1c9bd20d 100644 --- a/mysql-test/suite/rpl/t/rpl_table_options.test +++ b/mysql-test/suite/rpl/t/rpl_table_options.test @@ -18,6 +18,7 @@ connection master; # the option is unknown. # create table t1 (a int not null) ull=12340; +alter table t1 ull=12350; show create table t1; sync_slave_with_master; diff --git a/mysql-test/suite/sys_vars/r/innodb_idle_flush_pct_basic.result b/mysql-test/suite/sys_vars/r/innodb_idle_flush_pct_basic.result index a2c328f38fd..915343fcff2 100644 --- a/mysql-test/suite/sys_vars/r/innodb_idle_flush_pct_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_idle_flush_pct_basic.result @@ -24,6 +24,8 @@ select * from information_schema.session_variables where variable_name='innodb_i VARIABLE_NAME VARIABLE_VALUE INNODB_IDLE_FLUSH_PCT 100 set global innodb_idle_flush_pct=10; +Warnings: +Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect. select @@global.innodb_idle_flush_pct; @@global.innodb_idle_flush_pct 10 @@ -44,6 +46,7 @@ ERROR 42000: Incorrect argument type to variable 'innodb_idle_flush_pct' set global innodb_idle_flush_pct=-7; Warnings: Warning 1292 Truncated incorrect innodb_idle_flush_pct value: '-7' +Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect. select @@global.innodb_idle_flush_pct; @@global.innodb_idle_flush_pct 0 @@ -53,6 +56,7 @@ INNODB_IDLE_FLUSH_PCT 0 set global innodb_idle_flush_pct=106; Warnings: Warning 1292 Truncated incorrect innodb_idle_flush_pct value: '106' +Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect. select @@global.innodb_idle_flush_pct; @@global.innodb_idle_flush_pct 100 @@ -60,18 +64,26 @@ select * from information_schema.global_variables where variable_name='innodb_id VARIABLE_NAME VARIABLE_VALUE INNODB_IDLE_FLUSH_PCT 100 set global innodb_idle_flush_pct=0; +Warnings: +Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect. select @@global.innodb_idle_flush_pct; @@global.innodb_idle_flush_pct 0 set global innodb_idle_flush_pct=100; +Warnings: +Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect. select @@global.innodb_idle_flush_pct; @@global.innodb_idle_flush_pct 100 set global innodb_idle_flush_pct=DEFAULT; +Warnings: +Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect. select @@global.innodb_idle_flush_pct; @@global.innodb_idle_flush_pct 100 SET @@global.innodb_idle_flush_pct = @start_global_value; +Warnings: +Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect. SELECT @@global.innodb_idle_flush_pct; @@global.innodb_idle_flush_pct 100 diff --git a/mysql-test/suite/sys_vars/r/innodb_simulate_comp_failures_basic.result b/mysql-test/suite/sys_vars/r/innodb_simulate_comp_failures_basic.result deleted file mode 100644 index 7a6c9ca2db6..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_simulate_comp_failures_basic.result +++ /dev/null @@ -1,77 +0,0 @@ -SET @start_global_value = @@global.innodb_simulate_comp_failures; -SELECT @start_global_value; -@start_global_value -0 -Valid values are between 0 and 99 -select @@global.innodb_simulate_comp_failures between 0 and 99; -@@global.innodb_simulate_comp_failures between 0 and 99 -1 -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -0 -select @@session.innodb_simulate_comp_failures; -ERROR HY000: Variable 'innodb_simulate_comp_failures' is a GLOBAL variable -show global variables like 'innodb_simulate_comp_failures'; -Variable_name Value -innodb_simulate_comp_failures 0 -show session variables like 'innodb_simulate_comp_failures'; -Variable_name Value -innodb_simulate_comp_failures 0 -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_SIMULATE_COMP_FAILURES 0 -select * from information_schema.session_variables where variable_name='innodb_simulate_comp_failures'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_SIMULATE_COMP_FAILURES 0 -set global innodb_simulate_comp_failures=10; -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -10 -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_SIMULATE_COMP_FAILURES 10 -select * from information_schema.session_variables where variable_name='innodb_simulate_comp_failures'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_SIMULATE_COMP_FAILURES 10 -set session innodb_simulate_comp_failures=1; -ERROR HY000: Variable 'innodb_simulate_comp_failures' is a GLOBAL variable and should be set with SET GLOBAL -set global innodb_simulate_comp_failures=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_simulate_comp_failures' -set global innodb_simulate_comp_failures=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_simulate_comp_failures' -set global innodb_simulate_comp_failures="foo"; -ERROR 42000: Incorrect argument type to variable 'innodb_simulate_comp_failures' -set global innodb_simulate_comp_failures=-7; -Warnings: -Warning 1292 Truncated incorrect innodb_simulate_comp_failures value: '-7' -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -0 -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_SIMULATE_COMP_FAILURES 0 -set global innodb_simulate_comp_failures=106; -Warnings: -Warning 1292 Truncated incorrect innodb_simulate_comp_failures value: '106' -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -99 -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_SIMULATE_COMP_FAILURES 99 -set global innodb_simulate_comp_failures=0; -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -0 -set global innodb_simulate_comp_failures=99; -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -99 -set global innodb_simulate_comp_failures=DEFAULT; -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -0 -SET @@global.innodb_simulate_comp_failures = @start_global_value; -SELECT @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -0 diff --git a/mysql-test/suite/sys_vars/r/max_sort_length_basic.result b/mysql-test/suite/sys_vars/r/max_sort_length_basic.result deleted file mode 100644 index b48b045897c..00000000000 --- a/mysql-test/suite/sys_vars/r/max_sort_length_basic.result +++ /dev/null @@ -1,199 +0,0 @@ -SET @start_global_value = @@global.max_sort_length; -SELECT @start_global_value; -@start_global_value -1024 -SET @start_session_value = @@session.max_sort_length; -SELECT @start_session_value; -@start_session_value -1024 -'#--------------------FN_DYNVARS_084_01-------------------------#' -SET @@global.max_sort_length = 1000; -SET @@global.max_sort_length = DEFAULT; -SELECT @@global.max_sort_length; -@@global.max_sort_length -1024 -SET @@session.max_sort_length = 1000; -SET @@session.max_sort_length = DEFAULT; -SELECT @@session.max_sort_length; -@@session.max_sort_length -1024 -'#--------------------FN_DYNVARS_084_02-------------------------#' -SET @@global.max_sort_length = DEFAULT; -SELECT @@global.max_sort_length = 1024; -@@global.max_sort_length = 1024 -1 -SET @@session.max_sort_length = DEFAULT; -SELECT @@session.max_sort_length = 1024; -@@session.max_sort_length = 1024 -1 -'#--------------------FN_DYNVARS_084_03-------------------------#' -SET @@global.max_sort_length = 8; -SELECT @@global.max_sort_length; -@@global.max_sort_length -8 -SET @@global.max_sort_length = 9; -SELECT @@global.max_sort_length; -@@global.max_sort_length -9 -SET @@global.max_sort_length = 8388608; -SELECT @@global.max_sort_length; -@@global.max_sort_length -8388608 -SET @@global.max_sort_length = 8388607; -SELECT @@global.max_sort_length; -@@global.max_sort_length -8388607 -SET @@global.max_sort_length = 65536; -SELECT @@global.max_sort_length; -@@global.max_sort_length -65536 -'#--------------------FN_DYNVARS_084_04-------------------------#' -SET @@session.max_sort_length = 8; -SELECT @@session.max_sort_length; -@@session.max_sort_length -8 -SET @@session.max_sort_length = 9; -SELECT @@session.max_sort_length; -@@session.max_sort_length -9 -SET @@session.max_sort_length = 8388608; -SELECT @@session.max_sort_length; -@@session.max_sort_length -8388608 -SET @@session.max_sort_length = 8388607; -SELECT @@session.max_sort_length; -@@session.max_sort_length -8388607 -SET @@session.max_sort_length = 65536; -SELECT @@session.max_sort_length; -@@session.max_sort_length -65536 -'#------------------FN_DYNVARS_084_05-----------------------#' -SET @@global.max_sort_length = -1024; -Warnings: -Warning 1292 Truncated incorrect max_sort_length value: '-1024' -SELECT @@global.max_sort_length; -@@global.max_sort_length -8 -SET @@global.max_sort_length = 3; -Warnings: -Warning 1292 Truncated incorrect max_sort_length value: '3' -SELECT @@global.max_sort_length; -@@global.max_sort_length -8 -SET @@global.max_sort_length = 8388609; -Warnings: -Warning 1292 Truncated incorrect max_sort_length value: '8388609' -SELECT @@global.max_sort_length; -@@global.max_sort_length -8388608 -SET @@global.max_sort_length = 0; -Warnings: -Warning 1292 Truncated incorrect max_sort_length value: '0' -SELECT @@global.max_sort_length; -@@global.max_sort_length -8 -SET @@global.max_sort_length = 65530.34; -ERROR 42000: Incorrect argument type to variable 'max_sort_length' -SELECT @@global.max_sort_length; -@@global.max_sort_length -8 -SET @@global.max_sort_length = test; -ERROR 42000: Incorrect argument type to variable 'max_sort_length' -SELECT @@global.max_sort_length; -@@global.max_sort_length -8 -SET @@session.max_sort_length = 8388610; -Warnings: -Warning 1292 Truncated incorrect max_sort_length value: '8388610' -SELECT @@session.max_sort_length; -@@session.max_sort_length -8388608 -SET @@session.max_sort_length = -1; -Warnings: -Warning 1292 Truncated incorrect max_sort_length value: '-1' -SELECT @@session.max_sort_length; -@@session.max_sort_length -8 -SET @@session.max_sort_length = 3; -Warnings: -Warning 1292 Truncated incorrect max_sort_length value: '3' -SELECT @@session.max_sort_length; -@@session.max_sort_length -8 -SET @@session.max_sort_length = 0; -Warnings: -Warning 1292 Truncated incorrect max_sort_length value: '0' -SELECT @@session.max_sort_length; -@@session.max_sort_length -8 -SET @@session.max_sort_length = 65530.34; -ERROR 42000: Incorrect argument type to variable 'max_sort_length' -SET @@session.max_sort_length = 10737418241; -Warnings: -Warning 1292 Truncated incorrect max_sort_length value: '10737418241' -SELECT @@session.max_sort_length; -@@session.max_sort_length -8388608 -SET @@session.max_sort_length = test; -ERROR 42000: Incorrect argument type to variable 'max_sort_length' -SELECT @@session.max_sort_length; -@@session.max_sort_length -8388608 -'#------------------FN_DYNVARS_084_06-----------------------#' -SELECT @@global.max_sort_length = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='max_sort_length'; -@@global.max_sort_length = VARIABLE_VALUE -1 -'#------------------FN_DYNVARS_084_07-----------------------#' -SELECT @@session.max_sort_length = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='max_sort_length'; -@@session.max_sort_length = VARIABLE_VALUE -1 -'#------------------FN_DYNVARS_084_08-----------------------#' -SET @@global.max_sort_length = TRUE; -Warnings: -Warning 1292 Truncated incorrect max_sort_length value: '1' -SELECT @@global.max_sort_length; -@@global.max_sort_length -8 -SET @@global.max_sort_length = FALSE; -Warnings: -Warning 1292 Truncated incorrect max_sort_length value: '0' -SELECT @@global.max_sort_length; -@@global.max_sort_length -8 -'#---------------------FN_DYNVARS_084_09----------------------#' -SET @@global.max_sort_length = 2048; -SELECT @@max_sort_length = @@global.max_sort_length; -@@max_sort_length = @@global.max_sort_length -0 -'#---------------------FN_DYNVARS_084_10----------------------#' -SET @@max_sort_length = 100000; -SELECT @@max_sort_length = @@local.max_sort_length; -@@max_sort_length = @@local.max_sort_length -1 -SELECT @@local.max_sort_length = @@session.max_sort_length; -@@local.max_sort_length = @@session.max_sort_length -1 -'#---------------------FN_DYNVARS_084_11----------------------#' -SET max_sort_length = 1024; -SELECT @@max_sort_length; -@@max_sort_length -1024 -SELECT local.max_sort_length; -ERROR 42S02: Unknown table 'local' in field list -SELECT session.max_sort_length; -ERROR 42S02: Unknown table 'session' in field list -SELECT max_sort_length = @@session.max_sort_length; -ERROR 42S22: Unknown column 'max_sort_length' in 'field list' -SET @@global.max_sort_length = @start_global_value; -SELECT @@global.max_sort_length; -@@global.max_sort_length -1024 -SET @@session.max_sort_length = @start_session_value; -SELECT @@session.max_sort_length; -@@session.max_sort_length -1024 diff --git a/mysql-test/suite/sys_vars/r/max_sort_length_func.result b/mysql-test/suite/sys_vars/r/max_sort_length_func.result index 36f5518287a..3ec8faf1b7e 100644 --- a/mysql-test/suite/sys_vars/r/max_sort_length_func.result +++ b/mysql-test/suite/sys_vars/r/max_sort_length_func.result @@ -1,301 +1,279 @@ SET @start_value= @@global.max_sort_length; -SET @session_max_sort_length = @@Session.max_sort_length; -DROP TABLE IF EXISTS t; ** creating tables ** -CREATE TABLE t -( -id INT AUTO_INCREMENT PRIMARY KEY, -c TEXT(30) -); -CREATE TABLE t1 -( -id INT AUTO_INCREMENT PRIMARY KEY, -c BLOB(30) -); -CREATE TABLE t2 -( -id INT AUTO_INCREMENT PRIMARY KEY, -c TEXT(30) -); +CREATE TABLE t (id INT AUTO_INCREMENT PRIMARY KEY, c TEXT); +CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, c BLOB); +CREATE TABLE t2 (id INT AUTO_INCREMENT PRIMARY KEY, c TEXT); '#--------------------FN_DYNVARS_098_01-------------------------#' connect test_con1,localhost,root,,; -connection test_con1; -SELECT @@global.max_sort_length = 10; -@@global.max_sort_length = 10 -0 -SELECT @@session.max_sort_length = 10; -@@session.max_sort_length = 10 -0 -** Setting value to 30 and inserting data ** -SET @@global.max_sort_length = 30; +** Setting value to 70 and inserting data ** +SET @@global.max_sort_length = 70; SELECT @@global.max_sort_length; @@global.max_sort_length -30 -INSERT INTO t set c = repeat('x',29); -INSERT INTO t set c = concat(repeat('x',28),'r','x'); -INSERT INTO t set c = concat(repeat('x',28),'s','y'); -INSERT INTO t set c = concat(repeat('x',28),'g','w'); +70 +INSERT INTO t set c = repeat('x',69); +INSERT INTO t set c = concat(repeat('x',68),'r','x'); +INSERT INTO t set c = concat(repeat('x',68),'s','y'); +INSERT INTO t set c = concat(repeat('x',68),'g','w'); SELECT c from t ORDER BY c, id; c -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ** Results should be sorted ** -SET @@session.max_sort_length = 29; +SET @@session.max_sort_length = 69; SELECT @@session.max_sort_length; @@session.max_sort_length -29 -INSERT INTO t set c = repeat('x',29); -INSERT INTO t set c = concat(repeat('x',28),'r','x'); -INSERT INTO t set c = concat(repeat('x',28),'s','y'); -INSERT INTO t set c = concat(repeat('x',28),'g','w'); +69 +INSERT INTO t set c = repeat('x',69); +INSERT INTO t set c = concat(repeat('x',68),'r','x'); +INSERT INTO t set c = concat(repeat('x',68),'s','y'); +INSERT INTO t set c = concat(repeat('x',68),'g','w'); SELECT c from t ORDER BY c, id; c -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ** Results should be sorted ** '#--------------------FN_DYNVARS_098_02-------------------------#' connect test_con2,localhost,root,,; -connection test_con2; -SET @@global.max_sort_length = 30; +SET @@global.max_sort_length = 70; SELECT @@global.max_sort_length; @@global.max_sort_length -30 -INSERT INTO t set c = repeat('x',29); -INSERT INTO t set c = concat(repeat('x',28),'r','x'); -INSERT INTO t set c = concat(repeat('x',28),'s','y'); -INSERT INTO t set c = concat(repeat('x',28),'g','w'); +70 +INSERT INTO t set c = repeat('x',69); +INSERT INTO t set c = concat(repeat('x',68),'r','x'); +INSERT INTO t set c = concat(repeat('x',68),'s','y'); +INSERT INTO t set c = concat(repeat('x',68),'g','w'); SELECT c from t ORDER BY c, id; c -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ** Results should be sorted ** -SET @@session.max_sort_length = 20; +SET @@session.max_sort_length = 64; SELECT @@session.max_sort_length; @@session.max_sort_length -20 -INSERT INTO t set c = repeat('x',29); -INSERT INTO t set c = concat(repeat('x',28),'r','x'); -INSERT INTO t set c = concat(repeat('x',28),'s','y'); -INSERT INTO t set c = concat(repeat('x',28),'g','w'); +64 +INSERT INTO t set c = repeat('x',69); +INSERT INTO t set c = concat(repeat('x',68),'r','x'); +INSERT INTO t set c = concat(repeat('x',68),'s','y'); +INSERT INTO t set c = concat(repeat('x',68),'g','w'); SELECT c from t ORDER BY c, id; c -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw ** Results should not be sorted ** '#--------------------FN_DYNVARS_098_03-------------------------#' -SET max_sort_length=20; -INSERT INTO t set c = repeat('x',29); -INSERT INTO t set c = concat(repeat('x',28),'r','x'); -INSERT INTO t set c = concat(repeat('x',28),'s','y'); -INSERT INTO t set c = concat(repeat('x',28),'g','w'); +SET max_sort_length=64; +INSERT INTO t set c = repeat('x',69); +INSERT INTO t set c = concat(repeat('x',68),'r','x'); +INSERT INTO t set c = concat(repeat('x',68),'s','y'); +INSERT INTO t set c = concat(repeat('x',68),'g','w'); SELECT c from t ORDER BY c, id; c -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw ** Results should not be sorted ** RESET QUERY CACHE; '#--------------------FN_DYNVARS_098_04-------------------------#' -SET max_sort_length=29; +SET max_sort_length=69; SELECT c from t ORDER BY c, id; c -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ** Results should be sorted ** '#--------------------FN_DYNVARS_098_05-------------------------#' -SET max_sort_length=30; +SET max_sort_length=70; SELECT c from t ORDER BY c, id; c -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ** Results should be sorted ** '#--------------------FN_DYNVARS_098_06-------------------------#' SET max_sort_length=default; +SELECT @@max_sort_length; +@@max_sort_length +70 SELECT c from t ORDER BY c, id; c -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ** Results should be sorted ** '#--------------------FN_DYNVARS_098_07-------------------------#' Testing type BLOB -SET @@global.max_sort_length = 30; -SELECT @@global.max_sort_length; -@@global.max_sort_length -30 -INSERT INTO t1 set c = repeat('x',29); -INSERT INTO t1 set c = concat(repeat('x',28),'r','x'); -INSERT INTO t1 set c = concat(repeat('x',28),'s','y'); -INSERT INTO t1 set c = concat(repeat('x',28),'g','w'); -SELECT c from t1 ORDER BY c, id; +SET @@max_sort_length = 70; +SELECT @@max_sort_length; +@@max_sort_length +70 +INSERT INTO t1 set c = repeat('x',69); +INSERT INTO t1 set c = concat(repeat('x',68),'r','x'); +INSERT INTO t1 set c = concat(repeat('x',68),'s','y'); +INSERT INTO t1 set c = concat(repeat('x',68),'g','w'); +SELECT c from t1 ORDER BY c, id DESC; c -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx ** Results should be sorted ** -SET @@session.max_sort_length = 20; +SET @@session.max_sort_length = 64; SELECT @@session.max_sort_length; @@session.max_sort_length -20 -INSERT INTO t1 set c = repeat('x',29); -INSERT INTO t1 set c = concat(repeat('x',28),'r','x'); -INSERT INTO t1 set c = concat(repeat('x',28),'s','y'); -INSERT INTO t1 set c = concat(repeat('x',28),'g','w'); +64 +INSERT INTO t1 set c = repeat('x',69); +INSERT INTO t1 set c = concat(repeat('x',68),'r','x'); +INSERT INTO t1 set c = concat(repeat('x',68),'s','y'); +INSERT INTO t1 set c = concat(repeat('x',68),'g','w'); SELECT c from t1 ORDER BY c, id; c -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw ** Results should not be sorted ** '#--------------------FN_DYNVARS_098_08-------------------------#' Testing type CHAR -SET @@global.max_sort_length = 30; +SET @@global.max_sort_length = 70; SELECT @@global.max_sort_length; @@global.max_sort_length -30 -INSERT INTO t2 set c = repeat('x',29); -INSERT INTO t2 set c = concat(repeat('x',28),'r','x'); -INSERT INTO t2 set c = concat(repeat('x',28),'s','y'); -INSERT INTO t2 set c = concat(repeat('x',28),'g','w'); +70 +INSERT INTO t2 set c = repeat('x',69); +INSERT INTO t2 set c = concat(repeat('x',68),'r','x'); +INSERT INTO t2 set c = concat(repeat('x',68),'s','y'); +INSERT INTO t2 set c = concat(repeat('x',68),'g','w'); SELECT c from t2 ORDER BY c, id; c -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw ** Results should not be sorted ** -SET @@session.max_sort_length = 20; +SET @@session.max_sort_length = 64; SELECT @@session.max_sort_length; @@session.max_sort_length -20 -INSERT INTO t2 set c = repeat('x',29); -INSERT INTO t2 set c = concat(repeat('x',28),'r','x'); -INSERT INTO t2 set c = concat(repeat('x',28),'s','y'); -INSERT INTO t2 set c = concat(repeat('x',28),'g','w'); +64 +INSERT INTO t2 set c = repeat('x',69); +INSERT INTO t2 set c = concat(repeat('x',68),'r','x'); +INSERT INTO t2 set c = concat(repeat('x',68),'s','y'); +INSERT INTO t2 set c = concat(repeat('x',68),'g','w'); SELECT c from t2 ORDER BY c, id; c -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw -xxxxxxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx -xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy -xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw ** Results should not be sorted ** connection default; disconnect test_con1; disconnect test_con2; -SET @@SESSION.max_sort_length = @session_max_sort_length; -DROP TABLE IF EXISTS t; -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; +DROP TABLE t, t1, t2; SET @@global.max_sort_length= @start_value; diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff index 0e4bb7cf7d6..0a1954f6cd5 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff @@ -331,7 +331,7 @@ VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Up to what percentage of dirty pages should be flushed when innodb finds it has spare resources to do so. + VARIABLE_COMMENT DEPRECATED. This setting has no effect. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 @@ -1306,22 +1306,22 @@ diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 89138c2fedd..440efc6a9cd 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -1283,7 +1283,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Up to what percentage of dirty pages should be flushed when innodb finds it has spare resources to do so. +VARIABLE_COMMENT DEPRECATED. This setting has no effect. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 NUMERIC_BLOCK_SIZE 0 @@ -2202,18 +2202,6 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED -VARIABLE_NAME INNODB_SIMULATE_COMP_FAILURES -SESSION_VALUE NULL -DEFAULT_VALUE 0 -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE INT UNSIGNED -VARIABLE_COMMENT Simulate compression failures. -NUMERIC_MIN_VALUE 0 -NUMERIC_MAX_VALUE 99 -NUMERIC_BLOCK_SIZE 0 -ENUM_VALUE_LIST NULL -READ_ONLY NO -COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_SORT_BUFFER_SIZE SESSION_VALUE NULL DEFAULT_VALUE 1048576 @@ -2603,7 +2591,7 @@ SESSION_VALUE NULL DEFAULT_VALUE ON VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Enable atomic writes, instead of using the doublewrite buffer, for files on devices that supports atomic writes. To use this option one must use file_per_table=1, flush_method=O_DIRECT and use_fallocate=1. This option only works on Linux with either FusionIO cards using the directFS filesystem or with Shannon cards using any file system. +VARIABLE_COMMENT Enable atomic writes, instead of using the doublewrite buffer, for files on devices that supports atomic writes. This option only works on Linux with either FusionIO cards using the directFS filesystem or with Shannon cards using any file system. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 87795f802e2..5ccabeecf2d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -944,10 +944,10 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME GROUP_CONCAT_MAX_LEN VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT() NUMERIC_MIN_VALUE 4 -NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO @@ -1766,7 +1766,7 @@ VARIABLE_NAME MAX_SORT_LENGTH VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored) -NUMERIC_MIN_VALUE 8 +NUMERIC_MIN_VALUE 64 NUMERIC_MAX_VALUE 8388608 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index aaaf1afb8b7..42c236bf54a 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -964,10 +964,10 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME GROUP_CONCAT_MAX_LEN VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT() NUMERIC_MIN_VALUE 4 -NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO @@ -1906,7 +1906,7 @@ VARIABLE_NAME MAX_SORT_LENGTH VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored) -NUMERIC_MIN_VALUE 8 +NUMERIC_MIN_VALUE 64 NUMERIC_MAX_VALUE 8388608 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result index e54afd2d64a..67e15405313 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result +++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result @@ -349,7 +349,7 @@ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL -READ_ONLY NO +READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME WSREP_ON SESSION_VALUE OFF @@ -405,7 +405,7 @@ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL -READ_ONLY NO +READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME WSREP_PROVIDER_OPTIONS SESSION_VALUE NULL diff --git a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result b/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result deleted file mode 100644 index 056ff8c817b..00000000000 --- a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result +++ /dev/null @@ -1,47 +0,0 @@ -# -# wsrep_notify_cmd -# -call mtr.add_suppression("WSREP: Failed to get provider options"); -# save the initial value -SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd; -# default -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd - - -# scope -SELECT @@session.wsrep_notify_cmd; -ERROR HY000: Variable 'wsrep_notify_cmd' is a GLOBAL variable -SET @@global.wsrep_notify_cmd='notify_cmd'; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -notify_cmd - -# valid values -SET @@global.wsrep_notify_cmd='command'; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -command -SET @@global.wsrep_notify_cmd='hyphenated-command'; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -hyphenated-command -SET @@global.wsrep_notify_cmd=default; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd - -SET @@global.wsrep_notify_cmd=NULL; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -NULL - -# invalid values -SET @@global.wsrep_notify_cmd=1; -ERROR 42000: Incorrect argument type to variable 'wsrep_notify_cmd' -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -NULL - -# restore the initial value -SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved; -# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result deleted file mode 100644 index 3e4ac8ca883..00000000000 --- a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result +++ /dev/null @@ -1,40 +0,0 @@ -# -# wsrep_provider -# -# save the initial value -SET @wsrep_provider_global_saved = @@global.wsrep_provider; -# default -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none - -# scope -SELECT @@session.wsrep_provider; -ERROR HY000: Variable 'wsrep_provider' is a GLOBAL variable -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none - -# valid values -SET @@global.wsrep_provider=default; -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none - -# invalid values -SET @@global.wsrep_provider='/invalid/libgalera_smm.so'; -ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/invalid/libgalera_smm.so' -SET @@global.wsrep_provider=NULL; -ERROR 42000: Variable 'wsrep_provider' can't be set to the value of 'NULL' -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none -SET @@global.wsrep_provider=1; -ERROR 42000: Incorrect argument type to variable 'wsrep_provider' -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none - -# restore the initial value -SET @@global.wsrep_provider = @wsrep_provider_global_saved; -# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result deleted file mode 100644 index b2e07c55b38..00000000000 --- a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result +++ /dev/null @@ -1,49 +0,0 @@ -# -# wsrep_provider_options -# -call mtr.add_suppression("WSREP: Failed to get provider options"); -SET @@global.wsrep_provider = @@global.wsrep_provider; -# save the initial value -SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options; -# default -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - - -# scope -SELECT @@session.wsrep_provider_options; -ERROR HY000: Variable 'wsrep_provider_options' is a GLOBAL variable -SET @@global.wsrep_provider_options='option1'; -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options -option1 - -# valid values -SET @@global.wsrep_provider_options='name1=value1;name2=value2'; -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options -name1=value1;name2=value2 -SET @@global.wsrep_provider_options='hyphenated-name:value'; -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options -hyphenated-name:value -SET @@global.wsrep_provider_options=default; -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - - -# invalid values -SET @@global.wsrep_provider_options=1; -ERROR 42000: Incorrect argument type to variable 'wsrep_provider_options' -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - -SET @@global.wsrep_provider_options=NULL; -Got one of the listed errors -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options -NULL - -# restore the initial value -SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved; -# End of test diff --git a/mysql-test/suite/sys_vars/t/innodb_simulate_comp_failures_basic.test b/mysql-test/suite/sys_vars/t/innodb_simulate_comp_failures_basic.test deleted file mode 100644 index 07e70bf7343..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_simulate_comp_failures_basic.test +++ /dev/null @@ -1,65 +0,0 @@ ---source include/have_innodb.inc ---source include/have_debug.inc - -SET @start_global_value = @@global.innodb_simulate_comp_failures; -SELECT @start_global_value; - -# -# exists as global only -# - ---echo Valid values are between 0 and 99 -select @@global.innodb_simulate_comp_failures between 0 and 99; -select @@global.innodb_simulate_comp_failures; - ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.innodb_simulate_comp_failures; - -show global variables like 'innodb_simulate_comp_failures'; -show session variables like 'innodb_simulate_comp_failures'; -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -select * from information_schema.session_variables where variable_name='innodb_simulate_comp_failures'; - -# -# show that it's writable -# - -set global innodb_simulate_comp_failures=10; -select @@global.innodb_simulate_comp_failures; -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -select * from information_schema.session_variables where variable_name='innodb_simulate_comp_failures'; - ---error ER_GLOBAL_VARIABLE -set session innodb_simulate_comp_failures=1; - -# -# incorrect types -# - ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_simulate_comp_failures=1.1; ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_simulate_comp_failures=1e1; ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_simulate_comp_failures="foo"; - -set global innodb_simulate_comp_failures=-7; -select @@global.innodb_simulate_comp_failures; -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -set global innodb_simulate_comp_failures=106; -select @@global.innodb_simulate_comp_failures; -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; - -# -# min/max/DEFAULT values -# - -set global innodb_simulate_comp_failures=0; -select @@global.innodb_simulate_comp_failures; -set global innodb_simulate_comp_failures=99; -select @@global.innodb_simulate_comp_failures; -set global innodb_simulate_comp_failures=DEFAULT; -select @@global.innodb_simulate_comp_failures; - -SET @@global.innodb_simulate_comp_failures = @start_global_value; -SELECT @@global.innodb_simulate_comp_failures; diff --git a/mysql-test/suite/sys_vars/t/max_sort_length_basic.test b/mysql-test/suite/sys_vars/t/max_sort_length_basic.test deleted file mode 100644 index fcd6db017f1..00000000000 --- a/mysql-test/suite/sys_vars/t/max_sort_length_basic.test +++ /dev/null @@ -1,225 +0,0 @@ -############## mysql-test\t\max_sort_length_basic.test ############### -# # -# Variable Name: max_sort_length # -# Scope: GLOBAL | SESSION # -# Access Type: Dynamic # -# Data Type: numeric # -# Default Value: 1024 # -# Range: 4-8388608 # -# # -# # -# Creation Date: 2008-02-07 # -# Author: Salman # -# # -# Description: Test Cases of Dynamic System Variable max_sort_length # -# that checks the behavior of this variable in the following ways# -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Data Integrity # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # -# # -############################################################################### - ---source include/load_sysvars.inc - - -############################################ -# START OF max_sort_length TESTS # -############################################ - - -############################################################# -# Save initial value # -############################################################# - -SET @start_global_value = @@global.max_sort_length; -SELECT @start_global_value; -SET @start_session_value = @@session.max_sort_length; -SELECT @start_session_value; - - ---echo '#--------------------FN_DYNVARS_084_01-------------------------#' -####################################################### -# Display the DEFAULT value of max_sort_length # -####################################################### - -SET @@global.max_sort_length = 1000; -SET @@global.max_sort_length = DEFAULT; -SELECT @@global.max_sort_length; - - -SET @@session.max_sort_length = 1000; -SET @@session.max_sort_length = DEFAULT; -SELECT @@session.max_sort_length; - - ---echo '#--------------------FN_DYNVARS_084_02-------------------------#' -####################################################### -# Check the DEFAULT value of max_sort_length # -####################################################### - -SET @@global.max_sort_length = DEFAULT; -SELECT @@global.max_sort_length = 1024; - -SET @@session.max_sort_length = DEFAULT; -SELECT @@session.max_sort_length = 1024; - - - ---echo '#--------------------FN_DYNVARS_084_03-------------------------#' -######################################################################### -# Change the value of max_sort_length to a valid value for GLOBAL Scope # -######################################################################### - -SET @@global.max_sort_length = 8; -SELECT @@global.max_sort_length; -SET @@global.max_sort_length = 9; -SELECT @@global.max_sort_length; -SET @@global.max_sort_length = 8388608; -SELECT @@global.max_sort_length; -SET @@global.max_sort_length = 8388607; -SELECT @@global.max_sort_length; -SET @@global.max_sort_length = 65536; -SELECT @@global.max_sort_length; - ---echo '#--------------------FN_DYNVARS_084_04-------------------------#' -########################################################################## -# Change the value of max_sort_length to a valid value for SESSION Scope # -########################################################################## - -SET @@session.max_sort_length = 8; -SELECT @@session.max_sort_length; - -SET @@session.max_sort_length = 9; -SELECT @@session.max_sort_length; - -SET @@session.max_sort_length = 8388608; -SELECT @@session.max_sort_length; - -SET @@session.max_sort_length = 8388607; -SELECT @@session.max_sort_length; - -SET @@session.max_sort_length = 65536; -SELECT @@session.max_sort_length; - - ---echo '#------------------FN_DYNVARS_084_05-----------------------#' -########################################################### -# Change the value of max_sort_length to an invalid value # -########################################################### - -SET @@global.max_sort_length = -1024; -SELECT @@global.max_sort_length; -SET @@global.max_sort_length = 3; -SELECT @@global.max_sort_length; -SET @@global.max_sort_length = 8388609; -SELECT @@global.max_sort_length; -SET @@global.max_sort_length = 0; -SELECT @@global.max_sort_length; ---Error ER_WRONG_TYPE_FOR_VAR -SET @@global.max_sort_length = 65530.34; -SELECT @@global.max_sort_length; ---Error ER_WRONG_TYPE_FOR_VAR -SET @@global.max_sort_length = test; -SELECT @@global.max_sort_length; - -SET @@session.max_sort_length = 8388610; -SELECT @@session.max_sort_length; -SET @@session.max_sort_length = -1; -SELECT @@session.max_sort_length; -SET @@session.max_sort_length = 3; -SELECT @@session.max_sort_length; -SET @@session.max_sort_length = 0; -SELECT @@session.max_sort_length; ---Error ER_WRONG_TYPE_FOR_VAR -SET @@session.max_sort_length = 65530.34; -SET @@session.max_sort_length = 10737418241; -SELECT @@session.max_sort_length; ---Error ER_WRONG_TYPE_FOR_VAR -SET @@session.max_sort_length = test; -SELECT @@session.max_sort_length; - - ---echo '#------------------FN_DYNVARS_084_06-----------------------#' -#################################################################### -# Check if the value in GLOBAL Table matches value in variable # -#################################################################### - - -SELECT @@global.max_sort_length = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='max_sort_length'; - ---echo '#------------------FN_DYNVARS_084_07-----------------------#' -#################################################################### -# Check if the value in SESSION Table matches value in variable # -#################################################################### - -SELECT @@session.max_sort_length = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='max_sort_length'; - - ---echo '#------------------FN_DYNVARS_084_08-----------------------#' -#################################################################### -# Check if TRUE and FALSE values can be used on variable # -#################################################################### - -SET @@global.max_sort_length = TRUE; -SELECT @@global.max_sort_length; -SET @@global.max_sort_length = FALSE; -SELECT @@global.max_sort_length; - - ---echo '#---------------------FN_DYNVARS_084_09----------------------#' -################################################################################# -# Check if accessing variable with and without GLOBAL point to same variable # -################################################################################# - -SET @@global.max_sort_length = 2048; -SELECT @@max_sort_length = @@global.max_sort_length; - - ---echo '#---------------------FN_DYNVARS_084_10----------------------#' -######################################################################################################## -# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # -######################################################################################################## - -SET @@max_sort_length = 100000; -SELECT @@max_sort_length = @@local.max_sort_length; -SELECT @@local.max_sort_length = @@session.max_sort_length; - - ---echo '#---------------------FN_DYNVARS_084_11----------------------#' -########################################################################## -# Check if max_sort_length can be accessed with and without @@ sign # -########################################################################## - - -SET max_sort_length = 1024; -SELECT @@max_sort_length; ---Error ER_UNKNOWN_TABLE -SELECT local.max_sort_length; ---Error ER_UNKNOWN_TABLE -SELECT session.max_sort_length; ---Error ER_BAD_FIELD_ERROR -SELECT max_sort_length = @@session.max_sort_length; - - -#################################### -# Restore initial value # -#################################### - -SET @@global.max_sort_length = @start_global_value; -SELECT @@global.max_sort_length; -SET @@session.max_sort_length = @start_session_value; -SELECT @@session.max_sort_length; - - -#################################################### -# END OF max_sort_length TESTS # -#################################################### - diff --git a/mysql-test/suite/sys_vars/t/max_sort_length_func.test b/mysql-test/suite/sys_vars/t/max_sort_length_func.test index fd0b87750a1..d54453a57b6 100644 --- a/mysql-test/suite/sys_vars/t/max_sort_length_func.test +++ b/mysql-test/suite/sys_vars/t/max_sort_length_func.test @@ -26,70 +26,40 @@ SET @start_value= @@global.max_sort_length; -SET @session_max_sort_length = @@Session.max_sort_length; - - ---disable_warnings -DROP TABLE IF EXISTS t; ---enable_warnings - ######################### # Creating new table # ######################### - --echo ** creating tables ** -CREATE TABLE t -( -id INT AUTO_INCREMENT PRIMARY KEY, -c TEXT(30) -); - -CREATE TABLE t1 -( -id INT AUTO_INCREMENT PRIMARY KEY, -c BLOB(30) -); - -CREATE TABLE t2 -( -id INT AUTO_INCREMENT PRIMARY KEY, -c TEXT(30) -); - - +CREATE TABLE t (id INT AUTO_INCREMENT PRIMARY KEY, c TEXT); +CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, c BLOB); +CREATE TABLE t2 (id INT AUTO_INCREMENT PRIMARY KEY, c TEXT); --echo '#--------------------FN_DYNVARS_098_01-------------------------#' ########################################################## # Test behavior of variable on new connection # 01 # ########################################################## - connect (test_con1,localhost,root,,); -connection test_con1; - -# Value of session & global vairable here should be 10 -SELECT @@global.max_sort_length = 10; -SELECT @@session.max_sort_length = 10; # Setting global value of variable and inserting data in table ---echo ** Setting value to 30 and inserting data ** -SET @@global.max_sort_length = 30; +--echo ** Setting value to 70 and inserting data ** +SET @@global.max_sort_length = 70; SELECT @@global.max_sort_length; -INSERT INTO t set c = repeat('x',29); -INSERT INTO t set c = concat(repeat('x',28),'r','x'); -INSERT INTO t set c = concat(repeat('x',28),'s','y'); -INSERT INTO t set c = concat(repeat('x',28),'g','w'); +INSERT INTO t set c = repeat('x',69); +INSERT INTO t set c = concat(repeat('x',68),'r','x'); +INSERT INTO t set c = concat(repeat('x',68),'s','y'); +INSERT INTO t set c = concat(repeat('x',68),'g','w'); SELECT c from t ORDER BY c, id; --echo ** Results should be sorted ** # Setting session value of variable and inserting data in table -SET @@session.max_sort_length = 29; +SET @@session.max_sort_length = 69; SELECT @@session.max_sort_length; -INSERT INTO t set c = repeat('x',29); -INSERT INTO t set c = concat(repeat('x',28),'r','x'); -INSERT INTO t set c = concat(repeat('x',28),'s','y'); -INSERT INTO t set c = concat(repeat('x',28),'g','w'); +INSERT INTO t set c = repeat('x',69); +INSERT INTO t set c = concat(repeat('x',68),'r','x'); +INSERT INTO t set c = concat(repeat('x',68),'s','y'); +INSERT INTO t set c = concat(repeat('x',68),'g','w'); SELECT c from t ORDER BY c, id; --echo ** Results should be sorted ** @@ -99,72 +69,69 @@ SELECT c from t ORDER BY c, id; ########################################################## connect (test_con2,localhost,root,,); -connection test_con2; - ## Setting global value of variable and inserting data in table -SET @@global.max_sort_length = 30; +SET @@global.max_sort_length = 70; SELECT @@global.max_sort_length; -INSERT INTO t set c = repeat('x',29); -INSERT INTO t set c = concat(repeat('x',28),'r','x'); -INSERT INTO t set c = concat(repeat('x',28),'s','y'); -INSERT INTO t set c = concat(repeat('x',28),'g','w'); +INSERT INTO t set c = repeat('x',69); +INSERT INTO t set c = concat(repeat('x',68),'r','x'); +INSERT INTO t set c = concat(repeat('x',68),'s','y'); +INSERT INTO t set c = concat(repeat('x',68),'g','w'); SELECT c from t ORDER BY c, id; --echo ** Results should be sorted ** # Setting session value of variable and inserting data in table -SET @@session.max_sort_length = 20; +SET @@session.max_sort_length = 64; SELECT @@session.max_sort_length; -INSERT INTO t set c = repeat('x',29); -INSERT INTO t set c = concat(repeat('x',28),'r','x'); -INSERT INTO t set c = concat(repeat('x',28),'s','y'); -INSERT INTO t set c = concat(repeat('x',28),'g','w'); +INSERT INTO t set c = repeat('x',69); +INSERT INTO t set c = concat(repeat('x',68),'r','x'); +INSERT INTO t set c = concat(repeat('x',68),'s','y'); +INSERT INTO t set c = concat(repeat('x',68),'g','w'); SELECT c from t ORDER BY c, id; --echo ** Results should not be sorted ** --echo '#--------------------FN_DYNVARS_098_03-------------------------#' ######################################################### -#Check if sorting is applied with the max_sort_length=20# +#Check if sorting is applied with the max_sort_length=64# ######################################################### ########################################### # Setting new value for max_sort_length # ########################################### -SET max_sort_length=20; +SET max_sort_length=64; ################################### # Inserting values in table t # ################################### -INSERT INTO t set c = repeat('x',29); -INSERT INTO t set c = concat(repeat('x',28),'r','x'); -INSERT INTO t set c = concat(repeat('x',28),'s','y'); -INSERT INTO t set c = concat(repeat('x',28),'g','w'); +INSERT INTO t set c = repeat('x',69); +INSERT INTO t set c = concat(repeat('x',68),'r','x'); +INSERT INTO t set c = concat(repeat('x',68),'s','y'); +INSERT INTO t set c = concat(repeat('x',68),'g','w'); SELECT c from t ORDER BY c, id; --echo ** Results should not be sorted ** RESET QUERY CACHE; - --echo '#--------------------FN_DYNVARS_098_04-------------------------#' ######################################################### -#Check if sorting is applied with the max_sort_length=29# +#Check if sorting is applied with the max_sort_length=69# ######################################################### -SET max_sort_length=29; +SET max_sort_length=69; SELECT c from t ORDER BY c, id; --echo ** Results should be sorted ** --echo '#--------------------FN_DYNVARS_098_05-------------------------#' ######################################################### -#Check if sorting is applied with the max_sort_length=30# +#Check if sorting is applied with the max_sort_length=70# ######################################################### -SET max_sort_length=30; +SET max_sort_length=70; SELECT c from t ORDER BY c, id; --echo ** Results should be sorted ** @@ -173,34 +140,33 @@ SELECT c from t ORDER BY c, id; #Check if sorting is applied with the max_sort_length=Default# ############################################################## - SET max_sort_length=default; +SELECT @@max_sort_length; SELECT c from t ORDER BY c, id; --echo ** Results should be sorted ** - --echo '#--------------------FN_DYNVARS_098_07-------------------------#' ########################################### #Check if sorting is applied on BLOB type # ########################################### --echo Testing type BLOB # Setting global value of variable and inserting data in table -SET @@global.max_sort_length = 30; -SELECT @@global.max_sort_length; -INSERT INTO t1 set c = repeat('x',29); -INSERT INTO t1 set c = concat(repeat('x',28),'r','x'); -INSERT INTO t1 set c = concat(repeat('x',28),'s','y'); -INSERT INTO t1 set c = concat(repeat('x',28),'g','w'); -SELECT c from t1 ORDER BY c, id; +SET @@max_sort_length = 70; +SELECT @@max_sort_length; +INSERT INTO t1 set c = repeat('x',69); +INSERT INTO t1 set c = concat(repeat('x',68),'r','x'); +INSERT INTO t1 set c = concat(repeat('x',68),'s','y'); +INSERT INTO t1 set c = concat(repeat('x',68),'g','w'); +SELECT c from t1 ORDER BY c, id DESC; --echo ** Results should be sorted ** # Setting session value of variable and inserting data in table -SET @@session.max_sort_length = 20; +SET @@session.max_sort_length = 64; SELECT @@session.max_sort_length; -INSERT INTO t1 set c = repeat('x',29); -INSERT INTO t1 set c = concat(repeat('x',28),'r','x'); -INSERT INTO t1 set c = concat(repeat('x',28),'s','y'); -INSERT INTO t1 set c = concat(repeat('x',28),'g','w'); +INSERT INTO t1 set c = repeat('x',69); +INSERT INTO t1 set c = concat(repeat('x',68),'r','x'); +INSERT INTO t1 set c = concat(repeat('x',68),'s','y'); +INSERT INTO t1 set c = concat(repeat('x',68),'g','w'); SELECT c from t1 ORDER BY c, id; --echo ** Results should not be sorted ** @@ -210,26 +176,25 @@ SELECT c from t1 ORDER BY c, id; ########################################### --echo Testing type CHAR # Setting global value of variable and inserting data in table -SET @@global.max_sort_length = 30; +SET @@global.max_sort_length = 70; SELECT @@global.max_sort_length; -INSERT INTO t2 set c = repeat('x',29); -INSERT INTO t2 set c = concat(repeat('x',28),'r','x'); -INSERT INTO t2 set c = concat(repeat('x',28),'s','y'); -INSERT INTO t2 set c = concat(repeat('x',28),'g','w'); +INSERT INTO t2 set c = repeat('x',69); +INSERT INTO t2 set c = concat(repeat('x',68),'r','x'); +INSERT INTO t2 set c = concat(repeat('x',68),'s','y'); +INSERT INTO t2 set c = concat(repeat('x',68),'g','w'); SELECT c from t2 ORDER BY c, id; --echo ** Results should not be sorted ** # Setting session value of variable and inserting data in table -SET @@session.max_sort_length = 20; +SET @@session.max_sort_length = 64; SELECT @@session.max_sort_length; -INSERT INTO t2 set c = repeat('x',29); -INSERT INTO t2 set c = concat(repeat('x',28),'r','x'); -INSERT INTO t2 set c = concat(repeat('x',28),'s','y'); -INSERT INTO t2 set c = concat(repeat('x',28),'g','w'); +INSERT INTO t2 set c = repeat('x',69); +INSERT INTO t2 set c = concat(repeat('x',68),'r','x'); +INSERT INTO t2 set c = concat(repeat('x',68),'s','y'); +INSERT INTO t2 set c = concat(repeat('x',68),'g','w'); SELECT c from t2 ORDER BY c, id; --echo ** Results should not be sorted ** - # # Cleanup # @@ -239,12 +204,6 @@ connection default; disconnect test_con1; disconnect test_con2; -SET @@SESSION.max_sort_length = @session_max_sort_length; - ---disable_warnings -DROP TABLE IF EXISTS t; -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; ---enable_warnings +DROP TABLE t, t1, t2; SET @@global.max_sort_length= @start_value; diff --git a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test b/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test deleted file mode 100644 index 6d1535ba148..00000000000 --- a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test +++ /dev/null @@ -1,43 +0,0 @@ ---source include/have_wsrep.inc - ---echo # ---echo # wsrep_notify_cmd ---echo # - -call mtr.add_suppression("WSREP: Failed to get provider options"); - ---echo # save the initial value -SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd; - ---echo # default -SELECT @@global.wsrep_notify_cmd; - ---echo ---echo # scope ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.wsrep_notify_cmd; -SET @@global.wsrep_notify_cmd='notify_cmd'; -SELECT @@global.wsrep_notify_cmd; - ---echo ---echo # valid values -SET @@global.wsrep_notify_cmd='command'; -SELECT @@global.wsrep_notify_cmd; -SET @@global.wsrep_notify_cmd='hyphenated-command'; -SELECT @@global.wsrep_notify_cmd; -SET @@global.wsrep_notify_cmd=default; -SELECT @@global.wsrep_notify_cmd; -SET @@global.wsrep_notify_cmd=NULL; -SELECT @@global.wsrep_notify_cmd; - ---echo ---echo # invalid values ---error ER_WRONG_TYPE_FOR_VAR -SET @@global.wsrep_notify_cmd=1; -SELECT @@global.wsrep_notify_cmd; - ---echo ---echo # restore the initial value -SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved; - ---echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test deleted file mode 100644 index 1190ab41bb0..00000000000 --- a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test +++ /dev/null @@ -1,39 +0,0 @@ ---source include/have_wsrep.inc - ---echo # ---echo # wsrep_provider ---echo # - ---echo # save the initial value -SET @wsrep_provider_global_saved = @@global.wsrep_provider; - ---echo # default -SELECT @@global.wsrep_provider; - ---echo ---echo # scope ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.wsrep_provider; -SELECT @@global.wsrep_provider; - ---echo ---echo # valid values -SET @@global.wsrep_provider=default; -SELECT @@global.wsrep_provider; - ---echo ---echo # invalid values ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.wsrep_provider='/invalid/libgalera_smm.so'; ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.wsrep_provider=NULL; -SELECT @@global.wsrep_provider; ---error ER_WRONG_TYPE_FOR_VAR -SET @@global.wsrep_provider=1; -SELECT @@global.wsrep_provider; - ---echo ---echo # restore the initial value -SET @@global.wsrep_provider = @wsrep_provider_global_saved; - ---echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test deleted file mode 100644 index d2ea32a0637..00000000000 --- a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test +++ /dev/null @@ -1,51 +0,0 @@ ---source include/have_wsrep.inc - ---echo # ---echo # wsrep_provider_options ---echo # - -call mtr.add_suppression("WSREP: Failed to get provider options"); - -SET @@global.wsrep_provider = @@global.wsrep_provider; - ---echo # save the initial value -SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options; - ---echo # default -SELECT @@global.wsrep_provider_options; - ---echo ---echo # scope ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.wsrep_provider_options; ---error 0,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options='option1'; -SELECT @@global.wsrep_provider_options; - ---echo ---echo # valid values ---error 0,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options='name1=value1;name2=value2'; -SELECT @@global.wsrep_provider_options; ---error 0,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options='hyphenated-name:value'; -SELECT @@global.wsrep_provider_options; ---error 0,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options=default; -SELECT @@global.wsrep_provider_options; - ---echo ---echo # invalid values ---error ER_WRONG_TYPE_FOR_VAR -SET @@global.wsrep_provider_options=1; -SELECT @@global.wsrep_provider_options; ---error ER_WRONG_ARGUMENTS,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options=NULL; -SELECT @@global.wsrep_provider_options; - ---echo ---echo # restore the initial value ---error 0,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved; - ---echo # End of test diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def index 11577bfe8b0..3d204db6945 100644 --- a/mysql-test/suite/wsrep/disabled.def +++ b/mysql-test/suite/wsrep/disabled.def @@ -10,3 +10,5 @@ # ############################################################################## + +mdev_6832: wsrep_provider is read-only for security reasons diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index c9c0c5af9c5..df7ca3787aa 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -14,79 +14,17 @@ SET SESSION wsrep_replicate_myisam= ON; ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable and should be set with SET GLOBAL SET GLOBAL wsrep_replicate_myisam= ON; SET GLOBAL wsrep_replicate_myisam= OFF; -SET GLOBAL wsrep_provider=none; # # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of # variables when using "_" # CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*"); -# wsrep -SHOW GLOBAL STATUS LIKE 'wsrep%'; -Variable_name Value -wsrep_applier_thread_count # -wsrep_apply_oooe # -wsrep_apply_oool # -wsrep_apply_window # -wsrep_causal_reads # -wsrep_cert_deps_distance # -wsrep_cert_index_size # -wsrep_cert_interval # -wsrep_cluster_conf_id # -wsrep_cluster_size # -wsrep_cluster_state_uuid # -wsrep_cluster_status # -wsrep_commit_oooe # -wsrep_commit_oool # -wsrep_commit_window # -wsrep_connected # -wsrep_debug_sync_waiters # -wsrep_flow_control_paused # -wsrep_flow_control_paused_ns # -wsrep_flow_control_recv # -wsrep_flow_control_sent # -wsrep_incoming_addresses # -wsrep_last_committed # -wsrep_local_bf_aborts # -wsrep_local_cached_downto # -wsrep_local_cert_failures # -wsrep_local_commits # -wsrep_local_index # -wsrep_local_recv_queue # -wsrep_local_recv_queue_avg # -wsrep_local_recv_queue_max # -wsrep_local_recv_queue_min # -wsrep_local_replays # -wsrep_local_send_queue # -wsrep_local_send_queue_avg # -wsrep_local_send_queue_max # -wsrep_local_send_queue_min # -wsrep_local_state # -wsrep_local_state_comment # -wsrep_local_state_uuid # -wsrep_open_connections # -wsrep_open_transactions # -wsrep_protocol_version # -wsrep_provider_name # -wsrep_provider_vendor # -wsrep_provider_version # -wsrep_ready # -wsrep_received # -wsrep_received_bytes # -wsrep_repl_data_bytes # -wsrep_repl_keys # -wsrep_repl_keys_bytes # -wsrep_repl_other_bytes # -wsrep_replicated # -wsrep_replicated_bytes # -wsrep_rollbacker_thread_count # -wsrep_thread_count # SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment'; Variable_name Value wsrep_local_state_comment # # Should show nothing. SHOW STATUS LIKE 'x'; Variable_name Value -SET GLOBAL wsrep_provider=none; SHOW STATUS LIKE 'wsrep_local_state_uuid'; Variable_name Value @@ -95,7 +33,6 @@ wsrep_local_state_uuid # SHOW STATUS LIKE 'wsrep_last_committed'; Variable_name Value wsrep_last_committed # -SET GLOBAL wsrep_provider=none; # # MDEV#6206: wsrep_slave_threads subtracts from max_connections @@ -109,7 +46,7 @@ SELECT @@global.wsrep_slave_threads; 1 SELECT @@global.wsrep_cluster_address; @@global.wsrep_cluster_address - +gcomm:// SELECT @@global.wsrep_on; @@global.wsrep_on 1 @@ -118,14 +55,14 @@ Variable_name Value Threads_connected 1 SHOW STATUS LIKE 'wsrep_thread_count'; Variable_name Value -wsrep_thread_count 0 +wsrep_thread_count 2 SELECT @@global.wsrep_provider; @@global.wsrep_provider libgalera_smm.so SELECT @@global.wsrep_cluster_address; @@global.wsrep_cluster_address - +gcomm:// SELECT @@global.wsrep_on; @@global.wsrep_on 1 @@ -134,11 +71,10 @@ Variable_name Value Threads_connected 1 SHOW STATUS LIKE 'wsrep_thread_count'; Variable_name Value -wsrep_thread_count 0 +wsrep_thread_count 2 # Setting wsrep_cluster_address triggers the creation of # applier/rollbacker threads. -SET GLOBAL wsrep_cluster_address= 'gcomm://'; # Wait for applier thread to get created 1. # Wait for applier thread to get created 2. SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; @@ -196,16 +132,7 @@ drop user test@localhost; # SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth; SET @@global.wsrep_sst_auth= 'user:pass'; -SELECT @@global.wsrep_sst_auth; -@@global.wsrep_sst_auth -******** SET @@global.wsrep_sst_auth= ''; -SELECT @@global.wsrep_sst_auth; -@@global.wsrep_sst_auth - SET @@global.wsrep_sst_auth= NULL; -SELECT @@global.wsrep_sst_auth; -@@global.wsrep_sst_auth -NULL SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved; # End of test. diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index 2556d8ede4f..0cf13650ce0 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -1,7 +1,6 @@ --source include/have_wsrep.inc --source include/force_restart.inc --source include/have_innodb.inc ---source include/galera_have_debug_sync.inc call mtr.add_suppression("WSREP: Initial position was provided by configuration or SST, avoiding override"); @@ -23,7 +22,7 @@ SET GLOBAL wsrep_replicate_myisam= ON; # Reset it back. SET GLOBAL wsrep_replicate_myisam= OFF; -SET GLOBAL wsrep_provider=none; +#SET GLOBAL wsrep_provider=none; --echo # --echo # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of @@ -32,18 +31,9 @@ SET GLOBAL wsrep_provider=none; CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*"); ---disable_result_log ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; +#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; --let $galera_version=25.3.24 source include/check_galera_version.inc; ---enable_result_log ---enable_query_log - ---echo # wsrep ---sorted_result ---replace_column 2 # -SHOW GLOBAL STATUS LIKE 'wsrep%'; --replace_column 2 # SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment'; @@ -52,11 +42,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment'; SHOW STATUS LIKE 'x'; # Reset it back. -SET GLOBAL wsrep_provider=none; +#SET GLOBAL wsrep_provider=none; ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ---enable_query_log +#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; # The following 2 variables are used by mariabackup # SST. @@ -68,7 +56,7 @@ SHOW STATUS LIKE 'wsrep_local_state_uuid'; SHOW STATUS LIKE 'wsrep_last_committed'; # Reset it back. -SET GLOBAL wsrep_provider=none; +#SET GLOBAL wsrep_provider=none; --echo --echo # @@ -76,9 +64,7 @@ SET GLOBAL wsrep_provider=none; --echo # call mtr.add_suppression("WSREP: Failed to get provider options"); ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ---enable_query_log +#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; --replace_regex /.*libgalera_smm.*/libgalera_smm.so/ SELECT @@global.wsrep_provider; @@ -89,9 +75,7 @@ SHOW STATUS LIKE 'threads_connected'; SHOW STATUS LIKE 'wsrep_thread_count'; --echo ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ---enable_query_log +#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; --replace_regex /.*libgalera_smm.*/libgalera_smm.so/ SELECT @@global.wsrep_provider; @@ -103,7 +87,7 @@ SHOW STATUS LIKE 'wsrep_thread_count'; --echo # Setting wsrep_cluster_address triggers the creation of --echo # applier/rollbacker threads. -SET GLOBAL wsrep_cluster_address= 'gcomm://'; +#SET GLOBAL wsrep_cluster_address= 'gcomm://'; --echo # Wait for applier thread to get created 1. --let $wait_timeout=600 @@ -158,21 +142,10 @@ drop user test@localhost; --echo # SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth; SET @@global.wsrep_sst_auth= 'user:pass'; -SELECT @@global.wsrep_sst_auth; SET @@global.wsrep_sst_auth= ''; -SELECT @@global.wsrep_sst_auth; SET @@global.wsrep_sst_auth= NULL; -SELECT @@global.wsrep_sst_auth; SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved; -# Reset (for mtr internal checks) ---disable_query_log -SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved; -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; -SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved; -SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved; ---enable_query_log - --source include/galera_wait_ready.inc --echo # End of test. diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 11f641c6033..396de147ec2 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -5,12 +5,6 @@ call mtr.add_suppression("table or database name 't-1'"); # Check some special create statements. # ---disable_warnings -drop table if exists t1,t2,t3,t4,t5; -drop database if exists mysqltest; -drop view if exists v1; ---enable_warnings - create table t1 (b char(0)); insert into t1 values (""),(null); select * from t1; @@ -29,30 +23,30 @@ drop table t1; # Test of some CREATE TABLE'S that should fail # ---error 1146 +--error ER_NO_SUCH_TABLE create table t2 engine=heap select * from t1; ---error 1146 +--error ER_NO_SUCH_TABLE create table t2 select auto+1 from t1; drop table if exists t1,t2; ---error 1167 +--error ER_WRONG_KEY_COLUMN create table t1 (b char(0) not null, index(b)); ---error 1163 +--error ER_TABLE_CANT_HANDLE_BLOB create table t1 (a int not null,b text) engine=heap; drop table if exists t1; ---error 1075 +--error ER_WRONG_AUTO_KEY create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=heap; --- error 1049 +--error ER_BAD_DB_ERROR create table not_existing_database.test (a int); create table `a/a` (a int); show create table `a/a`; create table t1 like `a/a`; drop table `a/a`; drop table `t1`; ---error 1103 +--error ER_WRONG_TABLE_NAME create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int); ---error 1059 +--error ER_TOO_LONG_IDENT create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int); # @@ -62,17 +56,17 @@ create table t1 (a datetime default now()); drop table t1; create table t1 (a datetime on update now()); drop table t1; ---error 1067 +--error ER_INVALID_DEFAULT create table t1 (a int default 100 auto_increment); ---error 1067 +--error ER_INVALID_DEFAULT create table t1 (a tinyint default 1000); ---error 1067 +--error ER_INVALID_DEFAULT create table t1 (a varchar(5) default 'abcdef'); create table t1 (a varchar(5) default 'abcde'); insert into t1 values(); select * from t1; ---error 1067 +--error ER_INVALID_DEFAULT SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR alter table t1 alter column a set default 'abcdef'; drop table t1; @@ -97,13 +91,13 @@ create table mysqltest.test2$ (a int); drop table mysqltest.test2$; drop database mysqltest; ---error 1103 +--error ER_WRONG_TABLE_NAME create table `` (a int); ---error 1103 +--error ER_WRONG_TABLE_NAME drop table if exists ``; ---error 1166 +--error ER_WRONG_COLUMN_NAME create table t1 (`` int); ---error 1280 +--error ER_WRONG_NAME_FOR_INDEX create table t1 (i int, index `` (i)); # @@ -158,13 +152,13 @@ create table t2 (a int) select * from t1; describe t1; describe t2; drop table if exists t2; ---error 1060 +--error ER_DUP_FIELDNAME create table t2 (a int, a float) select * from t1; drop table if exists t2; ---error 1060 +--error ER_DUP_FIELDNAME create table t2 (a int) select a as b, a+1 as b from t1; drop table if exists t2; ---error 1060 +--error ER_DUP_FIELDNAME create table t2 (b int) select a as b, a+1 as b from t1; drop table if exists t1,t2; @@ -176,7 +170,7 @@ CREATE TABLE t1 (a int not null); INSERT INTO t1 values (1),(2),(1); --error ER_DUP_ENTRY CREATE TABLE t2 (primary key(a)) SELECT * FROM t1; ---error 1146 +--error ER_NO_SUCH_TABLE SELECT * from t2; DROP TABLE t1; DROP TABLE IF EXISTS t2; @@ -202,7 +196,7 @@ SELECT @@storage_engine; CREATE TABLE t1 (a int not null); show create table t1; drop table t1; ---error 1286 +--error ER_UNKNOWN_STORAGE_ENGINE SET SESSION storage_engine="gemini"; SELECT @@storage_engine; CREATE TABLE t1 (a int not null); @@ -216,11 +210,11 @@ drop table t1; # create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2)); insert into t1 values ("a", 1), ("b", 2); ---error 1048 +--error ER_BAD_NULL_ERROR insert into t1 values ("c", NULL); ---error 1048 +--error ER_BAD_NULL_ERROR insert into t1 values (NULL, 3); ---error 1048 +--error ER_BAD_NULL_ERROR insert into t1 values (NULL, NULL); drop table t1; @@ -262,11 +256,11 @@ drop table t1; # "Table truncated when creating another table name with Spaces" # ---error 1103 +--error ER_WRONG_TABLE_NAME create table `t1 `(a int); ---error 1102 +--error ER_WRONG_DB_NAME create database `db1 `; ---error 1166 +--error ER_WRONG_COLUMN_NAME create table t1(`a ` int); # @@ -274,11 +268,11 @@ create table t1(`a ` int); # "Parser permits multiple commas without syntax error" # ---error 1064 +--error ER_PARSE_ERROR create table t1 (a int,); ---error 1064 +--error ER_PARSE_ERROR create table t1 (a int,,b int); ---error 1064 +--error ER_PARSE_ERROR create table t1 (,b int); # @@ -320,13 +314,13 @@ create table t2 like t3; show create table t2; select * from t2; create table t3 like t1; ---error 1050 +--error ER_TABLE_EXISTS_ERROR create table t3 like mysqltest.t3; ---error 1049 +--error ER_BAD_DB_ERROR create table non_existing_database.t1 like t1; --error ER_NO_SUCH_TABLE create table t3 like non_existing_table; ---error 1050 +--error ER_TABLE_EXISTS_ERROR create temporary table t3 like t1; drop table t1, t2, t3; drop table t3; @@ -360,7 +354,7 @@ SELECT @@storage_engine; CREATE TABLE t1 (a int not null); show create table t1; drop table t1; ---error 1286 +--error ER_UNKNOWN_STORAGE_ENGINE SET SESSION storage_engine="gemini"; SELECT @@storage_engine; CREATE TABLE t1 (a int not null); @@ -464,9 +458,9 @@ use test; # Test for Bug 856 'Naming a key "Primary" causes trouble' # ---error 1280 +--error ER_WRONG_NAME_FOR_INDEX create table t1 (a int, index `primary` (a)); ---error 1280 +--error ER_WRONG_NAME_FOR_INDEX create table t1 (a int, index `PRIMARY` (a)); create table t1 (`primary` int, index(`primary`)); @@ -475,9 +469,9 @@ create table t2 (`PRIMARY` int, index(`PRIMARY`)); show create table t2; create table t3 (a int); ---error 1280 +--error ER_WRONG_NAME_FOR_INDEX alter table t3 add index `primary` (a); ---error 1280 +--error ER_WRONG_NAME_FOR_INDEX alter table t3 add index `PRIMARY` (a); create table t4 (`primary` int); @@ -532,11 +526,11 @@ drop table t1; # # Bug#10413: Invalid column name is not rejected # ---error 1103 +--error ER_WRONG_TABLE_NAME create table t1(column.name int); ---error 1103 +--error ER_WRONG_TABLE_NAME create table t1(test.column.name int); ---error 1102 +--error ER_WRONG_DB_NAME create table t1(xyz.t1.name int); create table t1(t1.name int); create table t2(test.t2.name int); @@ -575,7 +569,7 @@ drop table if exists test.t1; create database mysqltest; use mysqltest; create view v1 as select 'foo' from dual; ---error 1347 +--error ER_WRONG_OBJECT create table t1 like v1; drop view v1; drop database mysqltest; @@ -696,7 +690,7 @@ drop table t1, t2; # # Bug #15316 SET value having comma not correctly handled # ---error 1367 +--error ER_ILLEGAL_VALUE_FOR_TYPE create table t1(a set("a,b","c,d") not null); # End of 4.1 tests @@ -894,9 +888,9 @@ INSERT IGNORE INTO t1 (b) VALUES (5); CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY) SELECT a FROM t1; ---error 1062 +--error ER_DUP_ENTRY INSERT INTO t2 SELECT a FROM t1; ---error 1062 +--error ER_DUP_ENTRY INSERT INTO t2 SELECT a FROM t1; DROP TABLE t1, t2; @@ -956,24 +950,24 @@ drop table t1,t2; # Test incorrect database names # ---error 1102 +--error ER_WRONG_DB_NAME CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; ---error 1102 +--error ER_WRONG_DB_NAME DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; # TODO: enable these tests when RENAME DATABASE is implemented. -# --error 1049 +# --error ER_BAD_DB_ERROR # RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a; -# --error 1102 +# --error ER_WRONG_DB_NAME # RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; # create database mysqltest; -# --error 1102 +# --error ER_WRONG_DB_NAME # RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; # drop database mysqltest; ---error 1102 +--error ER_WRONG_DB_NAME USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; ---error 1102 +--error ER_WRONG_DB_NAME SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; # @@ -1025,11 +1019,11 @@ before insert on имÑ_таблицы_в_кодировке_утф8_длиноРselect TRIGGER_NAME from information_schema.triggers where trigger_schema='test'; drop trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49; ---error 1059 +--error ER_TOO_LONG_IDENT create trigger очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66 before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1; ---error 1059 +--error ER_TOO_LONG_IDENT drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66; create procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50() @@ -1038,7 +1032,7 @@ end; select ROUTINE_NAME from information_schema.routines where routine_schema='test'; drop procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50; ---error 1059 +--error ER_TOO_LONG_IDENT create procedure очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66() begin end; @@ -1049,7 +1043,7 @@ return 0; select ROUTINE_NAME from information_schema.routines where routine_schema='test'; drop function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49; ---error 1059 +--error ER_TOO_LONG_IDENT create function очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66() returns int return 0; @@ -1917,16 +1911,32 @@ alter table t1 add key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0064 (f64) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'; drop table t1; ---echo End of 5.5 tests +--echo # +--echo # End of 5.5 tests +--echo # -# -# MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS -# +--echo # +--echo # MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS +--echo # --error ER_TABLE_MUST_HAVE_COLUMNS create table t1; -# -# MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT -# +--echo # +--echo # MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT +--echo # create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j; drop table t1; + +--echo # +--echo # End of 10.0 tests +--echo # + +--echo # +--echo # MDEV-18428 Memory: If transactional=0 is specified in CREATE TABLE, it is not possible to ALTER TABLE +--echo # +--error ER_ILLEGAL_HA_CREATE_OPTION +create table t1 (c int(10) unsigned) engine=memory transactional=0; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test index 41a5b815bc7..c2ebc92c858 100644 --- a/mysql-test/t/cte_nonrecursive.test +++ b/mysql-test/t/cte_nonrecursive.test @@ -1201,4 +1201,64 @@ DROP TABLE test.t; --connection default --disconnect con1 +--echo # +--echo # MDEV-22781: create view with CTE without default database +--echo # + +drop database test; +create database db1; +create table db1.t1 (a int); +insert into db1.t1 values (3),(7),(1); + +create view db1.v1 as with t as (select * from db1.t1) select * from t; +show create view db1.v1; +select * from db1.v1; +drop view db1.v1; + +prepare stmt from " +create view db1.v1 as with t as (select * from db1.t1) select * from t; +"; +execute stmt; +deallocate prepare stmt; +show create view db1.v1; +select * from db1.v1; +drop view db1.v1; + +drop table db1.t1; +drop database db1; + +create database test; +use test; + +--echo # +--echo # MDEV-24597: CTE with union used multiple times in query +--echo # + +with cte(a) as +(select 1 as d union select 2 as d) +select a from cte as r1 +union +select a from cte as r2; + +create table t1 (a int, b int) engine=myisam; +insert into t1 values +(3,30), (7,70), (1,10), (7,71), (2,20), (7,72), (3,33), (4,44), +(5,50), (4,40), (3,33), (4,42), (4,43), (5,51); + +with cte(c) as +(select a from t1 where b < 30 union select a from t1 where b > 40) +select * from cte as r1, cte as r2 where r1.c = r2.c; + +with cte(a,c) as +( + select a, count(*) from t1 group by a having count(*) = 1 + union + select a, count(*) from t1 group by a having count(*) = 3 +) +select a, c from cte as r1 where a < 3 +union +select a, c from cte as r2 where a > 4; + +drop table t1; + --echo # End of 10.2 tests diff --git a/mysql-test/t/cte_nonrecursive_not_embedded.test b/mysql-test/t/cte_nonrecursive_not_embedded.test new file mode 100644 index 00000000000..e80baeaf591 --- /dev/null +++ b/mysql-test/t/cte_nonrecursive_not_embedded.test @@ -0,0 +1,58 @@ +-- source include/not_embedded.inc + +--echo # +--echo # MDEV-20751: query using many CTEs with grant_tables enabled +--echo # + +--connection default + +CREATE DATABASE db; +USE db; + +CREATE TABLE t1 (a int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (3), (7), (1); +CREATE TABLE t2 (a int) ENGINE=MYISAM; +INSERT INTO t2 VALUES (2), (8), (4); + + +CREATE USER 'u1'@'localhost'; +GRANT USAGE ON db.* TO 'u1'@'localhost'; +GRANT SELECT ON db.t1 TO 'u1'@'localhost'; +FLUSH PRIVILEGES; + +--connect (u1,'localhost',u1,,) +--connection u1 +USE db; + +WITH +cte1 AS +(SELECT a FROM t1), +cte2 AS +(SELECT cte1.a FROM t1,cte1 WHERE cte1.a = t1.a), +cte3 AS +(SELECT cte2.a FROM t1,cte1,cte2 WHERE cte1.a = t1.a AND t1.a = cte2.a), +cte4 AS +(SELECT cte2.a FROM t1,cte2 WHERE cte2.a = t1.a) +SELECT * FROM cte4 as r; + +--error ER_TABLEACCESS_DENIED_ERROR +WITH +cte1 AS +(SELECT a FROM t2), +cte2 AS +(SELECT cte1.a FROM t2,cte1 WHERE cte1.a = t2.a), +cte3 AS +(SELECT cte2.a FROM t2,cte1,cte2 WHERE cte1.a = t2.a AND t2.a = cte2.a), +cte4 AS +(SELECT cte2.a FROM t2,cte2 WHERE cte2.a = t2.a) +SELECT * FROM cte4 as r; + +--disconnect u1 +--connection default + +DROP USER 'u1'@'localhost'; +DROP DATABASE db; + +USE test; + +--echo # End of 10.2 tests diff --git a/mysql-test/t/cte_recursive.test b/mysql-test/t/cte_recursive.test index d1904586ffe..849e76b0436 100644 --- a/mysql-test/t/cte_recursive.test +++ b/mysql-test/t/cte_recursive.test @@ -2641,5 +2641,184 @@ DROP PROCEDURE p; DROP TABLE t1,t2,t3,t4; --echo # +--echo # MDEV-23619: recursive CTE used only in the second operand of UNION +--echo # + +create table t1 ( + a bigint(10) not null auto_increment, + b int(5) not null, + c bigint(10) default null, + primary key (a) +) engine myisam; +insert into t1 values + (1,3,12), (2,7,15), (3,1,3), (4,3,1); + +let $q= +with recursive r_cte as +( select * from t1 as s + union + select t1.* from t1, r_cte as r where t1.c = r.a ) +select 0 as b FROM dual union all select b FROM r_cte as t; + +eval explain $q; +eval $q; +--source include/analyze-format.inc +eval analyze format=json $q; +eval prepare stmt from "$q"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +--echo #checking hanging cte that uses a recursive cte +let $q1= +with h_cte as +( with recursive r_cte as + ( select * from t1 as s + union + select t1.* from t1, r_cte as r where t1.c = r.a ) + select 0 as b FROM dual union all select b FROM r_cte as t) +select * from t1 as tt; + +eval explain $q1; +eval $q1; +--source include/analyze-format.inc +eval analyze format=json $q1; +eval prepare stmt from "$q1"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +drop table t1; + +--echo # +--echo # MDEV-24019: query with recursive CTE when no default database is set +--echo # + +drop database test; + +let $q= +with recursive a as + (select 1 from dual union select * from a as r) +select * from a; + +eval $q; + +create database db1; +create table db1.t1 (a int); +insert into db1.t1 values (3), (7), (1); + +let $q= +with recursive cte as + (select * from db1.t1 union select * from (select * from cte) as t) +select * from cte; + +eval $q; +eval explain $q; + +eval prepare stmt from "$q"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +drop database db1; + +create database test; +use test; + +--echo # +--echo # MDEV-23406: query with mutually recursive CTEs when big_tables=1 +--echo # + +set @save_big_tables=@@big_tables; +set big_tables=1; + +create table folks(id int, name char(32), dob date, father int, mother int); + +insert into folks values +(100, 'Me', '2000-01-01', 20, 30), +(20, 'Dad', '1970-02-02', 10, 9), +(30, 'Mom', '1975-03-03', 8, 7), +(10, 'Grandpa Bill', '1940-04-05', null, null), +(9, 'Grandma Ann', '1941-10-15', null, null), +(25, 'Uncle Jim', '1968-11-18', 8, 7), +(98, 'Sister Amy', '2001-06-20', 20, 30), +(7, 'Grandma Sally', '1943-08-23', null, 6), +(8, 'Grandpa Ben', '1940-10-21', null, null), +(6, 'Grandgrandma Martha', '1923-05-17', null, null), +(67, 'Cousin Eddie', '1992-02-28', 25, 27), +(27, 'Auntie Melinda', '1971-03-29', null, null); + +let q= +with recursive +ancestor_couples(h_id, h_name, h_dob, h_father, h_mother, + w_id, w_name, w_dob, w_father, w_mother) +as +( + select h.*, w.* + from folks h, folks w, coupled_ancestors a + where a.father = h.id AND a.mother = w.id + union + select h.*, w.* + from folks v, folks h, folks w + where v.name = 'Me' and + (v.father = h.id AND v.mother= w.id) +), +coupled_ancestors (id, name, dob, father, mother) +as +( + select h_id, h_name, h_dob, h_father, h_mother + from ancestor_couples + union + select w_id, w_name, w_dob, w_father, w_mother + from ancestor_couples +) +select h_name, h_dob, w_name, w_dob + from ancestor_couples; + +eval $q; +eval explain $q; +eval prepare stmt from "$q"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +let $q= +with recursive +ancestor_couples(h_id, h_name, h_dob, h_father, h_mother, + w_id, w_name, w_dob, w_father, w_mother) +as +( + select h.*, w.* + from folks h, folks w, coupled_ancestors a + where a.father = h.id AND a.mother = w.id +), +coupled_ancestors (id, name, dob, father, mother) +as +( + select * + from folks + where name = 'Me' + union all + select h_id, h_name, h_dob, h_father, h_mother + from ancestor_couples + union all + select w_id, w_name, w_dob, w_father, w_mother + from ancestor_couples +) +select h_name, h_dob, w_name, w_dob + from ancestor_couples; + +eval $q; +eval explain $q; +eval prepare stmt from "$q"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +drop table folks; + +set big_tables=@save_big_tables; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test index 532729dafde..8fbbee872ce 100644 --- a/mysql-test/t/ctype_utf8mb4.test +++ b/mysql-test/t/ctype_utf8mb4.test @@ -1520,7 +1520,7 @@ drop table t1; --echo # --echo # Check strnxfrm() with odd length --echo # -set max_sort_length=9; +set max_sort_length=65; select @@max_sort_length; create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci); insert into t1 values ('a'),('b'),('c'); diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test index a7df65f2951..31b49047bf1 100644 --- a/mysql-test/t/derived_cond_pushdown.test +++ b/mysql-test/t/derived_cond_pushdown.test @@ -2184,4 +2184,32 @@ SELECT * FROM v1 WHERE IF( a REGEXP 'def', 'foo', a ) IN ('abc', 'foobar'); DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # MDEV-19179: pushdown into UNION of aggregation selects whose +--echo # corresponding columns have different names +--echo # + +create table t1 (a int); +insert into t1 values (3), (7), (1); + +let $q= +select * +from (select min(a) as x from t1 union all select max(a) as y from t1) t +where x>0; + +eval $q; +eval explain extended $q; + +eval prepare stmt from "$q"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +create view v1(m) as +select min(a) as x from t1 union all select max(a) as y from t1; +select * from v1 where m > 0; + +drop view v1; +drop table t1; + --echo # End of 10.2 tests diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index e752d9fcd50..b699d39e953 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -939,6 +939,16 @@ DROP VIEW v1; DROP TABLE t1; + +--echo # +--echo # MDEV-4677 GROUP_CONCAT not showing any output with group_concat_max_len >= 4Gb +--echo # +set group_concat_max_len=1024*1024*1024*4; +create table t1 (i int, j int); +insert into t1 values (1,1),(1,2); +select i, group_concat(j) from t1 group by i; +drop table t1; + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 8bbc9e6a040..d7da9fe8c96 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -1703,4 +1703,32 @@ select count(*)+sleep(0) from t1; drop table t1; +--echo # +--echo # MDEV-25112: MIN/MAX optimization for query containing BETWEEN in WHERE +--echo # + +create table t1 (a int) engine=myisam; +insert into t1 values (267), (273), (287), (303), (308); + +let $q1= +select max(a) from t1 where a < 303 and (a between 267 AND 287); +let $q2= +select min(a) from t1 where a > 267 and (a between 273 AND 303); + +eval $q1; +eval explain $q1; +eval $q2; +eval explain $q2; + +create index idx on t1(a); +eval $q1; +eval explain $q1; +eval $q2; +eval explain $q2; + +drop table t1; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test index 5026bb76aa3..c7a59a6fcbd 100644 --- a/mysql-test/t/func_like.test +++ b/mysql-test/t/func_like.test @@ -187,7 +187,7 @@ DROP TABLE t1; --echo # # -# Item_func_line::print() +# Item_func_like::print() # create view v1 as select 'foo!' like 'foo!!', 'foo!' like 'foo!!' escape '!'; show create view v1; @@ -207,3 +207,30 @@ insert t1 (a) values ('3 f_'), ('3 f\_'); set sql_mode=default; select * from t1; drop table t1; + +# +# Item_func_like::fix_fields() +# +create table t1 (f int); +insert t1 values (1),(2); +select 1 from (select distinct * from t1) as x where f < (select 1 like 2 escape (3=1)); +drop table t1; + +# +# Item_func_like::fix_fields, ESCAPE, const_item() +# +create table t1(f1 int); +insert into t1 values(1); +--error ER_WRONG_ARGUMENTS +update (select 1 like 2 escape (1 in (select 1 from t1))) x, t1 as d set d.f1 = 1; +select * from (select 1 like 2 escape (1 in (select 1 from t1))) x; +drop table t1; + +# +# Item_func_like::walk +# +create table t1 (f int); +insert t1 values (1),(2); +create view v1 as select * from t1 where (1 like 2 escape (3 in (('h', 'b') in (select 'k', 'k' union select 'g', 'j'))) and f >= 0); +drop view v1; +drop table t1; diff --git a/mysql-test/t/gis-json.test b/mysql-test/t/gis-json.test index b91ef235fd0..a97e9411e5c 100644 --- a/mysql-test/t/gis-json.test +++ b/mysql-test/t/gis-json.test @@ -44,6 +44,8 @@ SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": [ SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a; SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a; +SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }"); + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/gis-precise.test b/mysql-test/t/gis-precise.test index ede535596da..b75318e034b 100644 --- a/mysql-test/t/gis-precise.test +++ b/mysql-test/t/gis-precise.test @@ -393,3 +393,81 @@ with cte1 as( select (st_symdifference(point(1,1),point(1,1))) as a1 ), cte2 a --source include/gis_debug.inc + +--echo # +--echo # MDEV-13467 Feature request: Support for ST_Distance_Sphere() +--echo # + +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT ST_DISTANCE_SPHERE(); +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT ST_DISTANCE_SPHERE(NULL); +SELECT ST_DISTANCE_SPHERE(NULL, NULL); +# NULL args and optional radius will return NULL +SELECT ST_DISTANCE_SPHERE(NULL, NULL, 3); +# At least 1 NULL arg and optional radius will return NULL +SELECT ST_DISTANCE_SPHERE(NULL, 1, 3); +# At least 1 NULL arg and optional radius will return NULL +SELECT ST_DISTANCE_SPHERE(1, NULL, 3); +# Return ER_GIS_INVALID_DATA for invalid geometry +--error ER_GIS_INVALID_DATA +SELECT ST_DISTANCE_SPHERE(1, 1); +--error ER_GIS_INVALID_DATA +SELECT ST_DISTANCE_SPHERE(1, 1, 3); +# Return NULL if radius is NULL +SELECT ST_DISTANCE_SPHERE(1, 1, NULL); +# Wrong geometry +--error ER_INTERNAL_ERROR +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')); + +--echo # Test Points and radius +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')); +# make bb x86 happy +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1); +--error ER_INTERNAL_ERROR +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0); +--error ER_INTERNAL_ERROR +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1); +--echo # Test longitude/lattitude +# make bb x86 happy +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10); +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10); +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)')); +--echo # Test Points - Multipoints +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)')); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)')); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)')); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)')); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1); +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1); +--echo # Test Multipoints - Multipoints +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')); +# make bb x86 happy +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10); +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10); +# make bb x86 happy +SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17); +--error ER_INTERNAL_ERROR +SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0); + +# Longitude out of range [-180,180] +set @pt1 = ST_GeomFromText('POINT(190 -30)'); +set @pt2 = ST_GeomFromText('POINT(-30 50)'); +--error ER_STD_OUT_OF_RANGE_ERROR +SELECT ST_Distance_Sphere(@pt1, @pt2); + +# Latitude out of range [-90, 90] +set @pt1 = ST_GeomFromText('POINT(135 -30)'); +set @pt2 = ST_GeomFromText('POINT(-30 91)'); +--error ER_STD_OUT_OF_RANGE_ERROR +SELECT ST_Distance_Sphere(@pt1, @pt2); + +# POINT in form (longitude[-180, 180] latitude[-90, 90]) +set @zenica = ST_GeomFromText('POINT(17.907743 44.203438)'); +set @sarajevo = ST_GeomFromText('POINT(18.413076 43.856258)'); +SELECT TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10); +SELECT TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10); diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 324b41ce23c..d4c6d6527d5 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1996,3 +1996,36 @@ ON t.table_schema=c.table_schema WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type) GROUP BY t.table_name; SET max_sort_length= @save_max_sort_length; + + +--echo # +--echo # MDEV-23826: ORDER BY in view definition leads to wrong result with GROUP BY on query using view +--echo # + +CREATE TABLE t1 +( + id INT PRIMARY KEY AUTO_INCREMENT, + dt datetime, + INDEX(dt), + foo int +); + +INSERT INTO t1 VALUES (1,'2020-09-26 12:00:00',1); +INSERT INTO t1 VALUES (2,'2020-09-26 13:00:00',1); +INSERT INTO t1 VALUES (3,'2020-09-27 13:00:00',1); +INSERT INTO t1 VALUES (4,'2020-09-27 12:00:00',1); +INSERT INTO t1 VALUES (5,'2020-09-28 12:00:00',1); +INSERT INTO t1 VALUES (6,'2020-09-28 13:00:00',1); +INSERT INTO t1 VALUES (7,'2020-09-25 12:00:00',1); +INSERT INTO t1 VALUES (8,'2020-09-25 13:00:00',1); +INSERT INTO t1 VALUES (9,'2020-09-26 13:00:00',1); + +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE VIEW v2 AS SELECT * FROM t1 ORDER BY dt; +SELECT dt, sum(foo) AS foo FROM v1 WHERE dt>DATE_SUB('2020-09-27 00:00:00', INTERVAL 3 DAY) GROUP BY dt; +SELECT dt, sum(foo) AS foo FROM v2 WHERE dt>DATE_SUB('2020-09-27 00:00:00', INTERVAL 3 DAY) GROUP BY dt; + +DROP TABLE t1; +DROP VIEW v1,v2; + +--echo # End of 10.2 tests diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index df00ff26908..9ff94d2deb7 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1914,8 +1914,26 @@ SELECT SCHEMA_NAME from information_schema.schemata where schema_name=REPEAT('a' --echo # Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED --echo # +replace_regex /at least \d+ rows/at least ### rows/; SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10; --echo # +--echo # MDEV-24179: AAssertion `m_status == DA_ERROR || m_status == DA_OK || +--echo # m_status == DA_OK_BULK' failed in Diagnostics_area::message() +--echo # + +call mtr.add_suppression("Sort aborted.*"); + +DROP DATABASE test; +CREATE DATABASE test; +USE test; +CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema; + +--error ER_FILSORT_ABORT +SELECT * FROM v LIMIT ROWS EXAMINED 9; + +DROP VIEW v; + +--echo # --echo # End of 10.2 Test --echo # diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test index f5edd736490..04ebcc1e41b 100644 --- a/mysql-test/t/innodb_ext_key.test +++ b/mysql-test/t/innodb_ext_key.test @@ -606,3 +606,23 @@ explain format= json select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and f1 <= '3'; drop table t1; SET optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; + +--echo # +--echo # MDEV-11172: EXPLAIN shows non-sensical value for key_len with type=index +--echo # + +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +CREATE TABLE t2 ( + pk VARCHAR(50), + a VARCHAR(20), + KEY k1(a), + PRIMARY KEY(pk) +)ENGINE=INNODB; + +INSERT INTO t2 SELECT a,a FROM t1; +--replace_column 9 # +EXPLAIN SELECT pk FROM t2 FORCE INDEX(k1); + +DROP TABLE t1,t2; diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test index 9576d598125..55ae6afc436 100644 --- a/mysql-test/t/join_cache.test +++ b/mysql-test/t/join_cache.test @@ -4014,5 +4014,65 @@ select f2 from t2,t1 where f2 = 0; drop table t1, t2; set join_buffer_size=@save_join_buffer_size; + +--echo # +--echo # MDEV-21104: BNLH used for multi-join query with embedded outer join +--echo # and possible 'not exists' optimization +--echo # + +set join_cache_level=4; + +CREATE TABLE t1 (a int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b int, c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2),(2,4); +CREATE TABLE t3 (d int, KEY(d)) ENGINE=MyISAM; +INSERT INTO t3 VALUES (1),(2); +CREATE TABLE t4 (e int primary key) ENGINE=MyISAM; +INSERT INTO t4 VALUES (1),(2); +ANALYZE TABLE t1,t2,t3,t4; + +SELECT * FROM t2 LEFT JOIN t3 ON c = d; +SELECT * FROM (t2 LEFT JOIN t3 ON c = d ) JOIN t4; + +let $q1= +SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e; +eval EXPLAIN $q1; +eval $q1; + +let $q2= +SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e + WHERE e IS NULL; +eval EXPLAIN $q2; +eval $q2; + +DROP TABLE t1,t2,t3,t4; + +set join_cache_level=@save_join_cache_level; + +--echo # +--echo # MDEV-24767: forced BNLH used for equi-join supported by compound index +--echo # + +create table t1 (a int, b int, c int ) engine=myisam ; +create table t2 (a int, b int, c int, primary key (c,a,b)) engine=myisam ; +insert into t1 values (3,4,2), (5,6,4); +insert into t2 values (3,4,2), (5,6,4); + +let $q= +select t1.a, t1.b, t1.c from t1,t2 + where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c; + +eval $q; +eval explain $q; + +set join_cache_level=3; +eval $q; +eval explain $q; + +drop table t1,t2; + +set join_cache_level=@save_join_cache_level; + # The following command must be the last one in the file set @@optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index 78de8a784f3..6eb9d55f9b8 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -663,3 +663,9 @@ ALTER TABLE t2 DROP c; UNLOCK TABLES; DROP VIEW v1; DROP TABLE t1, t2; + +--echo # +--echo # KILL QUERY ID USER +--echo # +--error ER_PARSE_ERROR +kill query id user 'foo'; diff --git a/mysql-test/t/lock_view.test b/mysql-test/t/lock_view.test index dd8809ab89d..abb8d317946 100644 --- a/mysql-test/t/lock_view.test +++ b/mysql-test/t/lock_view.test @@ -1,4 +1,5 @@ source include/not_embedded.inc; +source include/have_perfschema.inc; # # LOCK TABLES and privileges on views # @@ -74,3 +75,20 @@ drop user definer@localhost; drop database mysqltest1; drop database mysqltest2; drop database mysqltest3; + +--echo # +--echo # MDEV-24331 mysqldump fails with "Got error: 1356" if the database contains a view with a subquery +--echo # +create user u1@localhost; +grant all privileges on test.* to u1@localhost; +connect con1,localhost,u1; +use test; +create table t1 (id int not null); +create view v1 as select * from (select * from t1) dt; +lock table v1 read; +disconnect con1; +connection default; +exec $MYSQL_DUMP test v1 -uu1 --compact; +drop view v1; +drop table t1; +drop user u1@localhost; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 217789fccb2..d6efdea982f 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1539,6 +1539,7 @@ DROP TABLE t1; # MariaDB: Note that the table will still have 'TRANSACTIONAL=1' attribute. # That's the intended behavior atm. # +set statement sql_mode='' for create table t1 (n int not null, c char(1)) transactional=1; show create table t1; drop table t1; diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test index 5dad8702fc5..c116af860a6 100644 --- a/mysql-test/t/mysql_upgrade.test +++ b/mysql-test/t/mysql_upgrade.test @@ -173,8 +173,6 @@ DROP PROCEDURE test.pr; # MDEV-13274 mysql_upgrade fails if dbname+tablename+partioname > 64 chars # use test; -call mtr.add_suppression('Column last_update in table `mysql`.`innodb_table_stats` is INT NOT NULL but should be'); -alter table mysql.innodb_table_stats modify last_update int not null; create table extralongname_extralongname_extralongname_extralongname_ext ( id int(10) unsigned not null, @@ -248,6 +246,36 @@ FLUSH PRIVILEGES; SET ROLE `aRole`; SELECT `User`, `is_role` FROM `mysql`.`user`; +DROP ROLE aRole; + +--echo # +--echo # MDEV-24122: Fix previously MySQL-5.7 data directories that upgraded prior to MDEV-23201 +--echo # +--echo # + +# For 10.4 merge - dropping the view. +# DROP VIEW IF EXISTS mysql.user; +DROP TABLE IF EXISTS mysql.user; +--copy_file std_data/mysql57user.frm $MYSQLD_DATADIR/mysql/user.frm +--copy_file std_data/mysql57user.MYI $MYSQLD_DATADIR/mysql/user.MYI +--copy_file std_data/mysql57user.MYD $MYSQLD_DATADIR/mysql/user.MYD +FLUSH TABLES mysql.user; + +# What prior to MDEV-23201 would of done: +ALTER TABLE mysql.user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; +ALTER TABLE mysql.user ADD default_role char(80) binary DEFAULT '' NOT NULL; +ALTER TABLE mysql.user ADD max_statement_time decimal(12,6) DEFAULT 0 NOT NULL; +FLUSH PRIVILEGES; + +--exec $MYSQL_UPGRADE --force 2>&1 +SHOW CREATE TABLE mysql.user; + +CREATE ROLE `aRole`; +SET DEFAULT ROLE aRole; +SHOW GRANTS; +SET DEFAULT ROLE NONE; +SHOW GRANTS; + DROP ROLE `aRole`; --exec $MYSQL mysql < $MYSQLTEST_VARDIR/tmp/user.sql FLUSH PRIVILEGES; diff --git a/mysql-test/t/mysqldump-system.test b/mysql-test/t/mysqldump-system.test new file mode 100644 index 00000000000..3efe8376e18 --- /dev/null +++ b/mysql-test/t/mysqldump-system.test @@ -0,0 +1,157 @@ +--source include/not_embedded.inc +--source include/have_innodb.inc +--source include/have_udf.inc +--source include/platform.inc + +if (!$AUTH_SOCKET_SO) { + --skip Need auth socket plugin +} + +--echo # +--echo # MDEV-23630: mysqldump to logically dump system tables +--echo # +--echo # + +# might need fixing in 10.4 to different mechanism +create table backup_users like mysql.user; +insert into backup_users select * from mysql.user where host not in ('localhost'); +delete from mysql.user where host not in ('localhost'); +flush privileges; + +create user USER; + +if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`) +{ +--error 0,ER_PLUGIN_INSTALLED +--eval install plugin /*M!100401 IF NOT EXISTS */ unix_socket soname '$AUTH_SOCKET_SO'; +alter user USER identified via unix_socket; +} + +# time zone data already loaded + +CREATE ROLE role_1; +CREATE ROLE role_2 WITH ADMIN role_1; + +GRANT SHOW DATABASES ON *.* TO role_1; +GRANT role_1 TO USER; +GRANT role_2 TO USER; +SET DEFAULT ROLE role_2 FOR USER; + +ALTER TABLE mysql.roles_mapping ORDER BY Host, User, Role; + +# innodb and EITS tables statistics +# +set @save_innodb_stats_persistent= @@innodb_stats_persistent; +create table mysql.tz like mysql.time_zone_transition; +alter table mysql.tz engine=innodb; +insert into mysql.tz select * from mysql.time_zone_transition; +set global innodb_stats_persistent=1; +ANALYZE TABLE mysql.tz PERSISTENT FOR ALL; +# for predictable output in tests +delete from mysql.index_stats where prefix_arity!=1; +delete from mysql.column_stats where column_name!='Time_zone_id'; +set time_zone="+03:00"; +update mysql.innodb_index_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz"; +update mysql.innodb_table_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz"; +set global innodb_stats_persistent= @save_innodb_stats_persistent; +alter table mysql.time_zone_name ORDER BY Name; + +CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(Host 'localhost'); + +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; + + +# +# Lets actually do some tests. +# + +--echo # +--echo # mysqldump of system tables with --system=all +--echo # + +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +--exec $MYSQL_DUMP --skip-comments --system=all + + +--echo # +--echo # mysqldump of system tables with --system=all --replace +--echo # + +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +--exec $MYSQL_DUMP --skip-comments --system=all --replace + + +# save this for restore +--exec $MYSQL_DUMP --system=users,servers,stats,timezones,udfs --replace > $MYSQLTEST_VARDIR/tmp/dump1.sql + +--echo # +--echo # mysqldump of system tables with --system=all --insert-ignore +--echo # + +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +--exec $MYSQL_DUMP --skip-comments --system=all --insert-ignore + + +CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin, + mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats; + +--echo # Opps.... + +CREATE USER mariadb_test_restore IDENTIFIED BY 'getitback'; +GRANT ALL ON *.* TO mariadb_test_restore WITH GRANT OPTION; +GRANT PROXY ON ''@'%' TO mariadb_test_restore WITH GRANT OPTION; +GRANT SUPER, CREATE USER /*M!100502 ,FEDERATED ADMIN */ ON *.* TO mariadb_test_restore WITH GRANT OPTION; + +drop user USER; +delete from mysql.table_stats; +delete from mysql.innodb_table_stats; +delete from mysql.time_zone_transition; +delete from mysql.time_zone_transition_type; +delete from mysql.time_zone; +delete from mysql.time_zone_name; +delete from mysql.time_zone_leap_second; +DROP FUNCTION IF EXISTS metaphon; +DROP SERVER s1; +set time_zone= @@global.time_zone; + +--echo # Restore from mysqldump +--exec $MYSQL --user mariadb_test_restore --password=getitback --show-warnings < $MYSQLTEST_VARDIR/tmp/dump1.sql +#--remove_file $MYSQLTEST_VARDIR/tmp/dump1.sql; + +DROP USER mariadb_test_restore; + +# successful restore? + +CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin, + mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats; + +# +# Cleanup +# + +DROP FUNCTION IF EXISTS metaphon; + +DROP SERVER s1; + +# EITS && innodb stats +DELETE FROM mysql.column_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos'); +DELETE FROM mysql.index_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos'); +DELETE FROM mysql.table_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos'); +DELETE FROM mysql.innodb_index_stats WHERE database_name='mysql' and table_name in ('tz','gtid_slave_pos'); +DELETE FROM mysql.innodb_table_stats WHERE database_name='mysql' and table_name in ('tz','gtid_slave_pos'); +drop table mysql.tz; + +DROP ROLE role_2; +DROP ROLE role_1; + +drop user USER; + +if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`) +{ +uninstall plugin unix_socket; +} + +insert into mysql.user select * from backup_users; +flush privileges; +drop table backup_users; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 4478406b395..8249810d1e5 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -2735,4 +2735,27 @@ INSERT INTO t1 (a) VALUES (1),(2),(3); --exec $MYSQL_DUMP --default-character-set=utf8mb4 --triggers --no-data --no-create-info --add-drop-trigger --skip-comments --databases test DROP TABLE t1; +--echo # +--echo # MDEV-20939: Race condition between mysqldump import and InnoDB +--echo # persistent statistics calculation +--echo # + +--let $ignore= --ignore-table=mysql.proxies_priv --ignore-table=mysql.user --ignore-table=mysql.column_stats --ignore-table=mysql.columns_priv --ignore-table=mysql.db --ignore-table=mysql.event --ignore-table=mysql.func --ignore-table=mysql.gtid_slave_pos --ignore-table=mysql.help_category --ignore-table=mysql.help_keyword --ignore-table=mysql.help_relation --ignore-table=mysql.help_topic --ignore-table=mysql.host --ignore-table=mysql.index_stats --ignore-table=mysql.plugin --ignore-table=mysql.proc --ignore-table=mysql.procs_priv --ignore-table=mysql.roles_mapping --ignore-table=mysql.servers --ignore-table=mysql.table_stats --ignore-table=mysql.tables_priv --ignore-table=mysql.time_zone --ignore-table=mysql.time_zone_leap_second --ignore-table=mysql.time_zone_name --ignore-table=mysql.time_zone_transition --ignore-table=mysql.time_zone_transition_type --ignore-table=mysql.general_log --ignore-table=mysql.slow_log +--let $skip_opts= --skip-dump-date --skip-comments + +--echo # +--echo # Without --replace and --insert-ignore +--echo # +--exec $MYSQL_DUMP $ignore $skip_opts mysql + +--echo # +--echo # With --replace +--echo # +--exec $MYSQL_DUMP $ignore $skip_opts --replace mysql + +--echo # +--echo # With --insert-ignore +--echo # +--exec $MYSQL_DUMP $ignore $skip_opts --insert-ignore mysql + --echo # End of 10.2 tests diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index e9802f95721..36c25ed37fb 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -531,11 +531,11 @@ drop table t1, t2; # Bug #5428: a problem with small max_sort_length value # -create table t1 (a char(25)); +create table t1 (a char(70)); insert into t1 set a = repeat('x', 20); -insert into t1 set a = concat(repeat('x', 19), 'z'); -insert into t1 set a = concat(repeat('x', 19), 'ab'); -insert into t1 set a = concat(repeat('x', 19), 'aa'); +insert into t1 set a = concat(repeat('x', 63), 'z'); +insert into t1 set a = concat(repeat('x', 63), 'ab'); +insert into t1 set a = concat(repeat('x', 63), 'aa'); set max_sort_length=20; select a from t1 order by a; drop table t1; diff --git a/mysql-test/t/precedence.test b/mysql-test/t/precedence.test index ad367c23603..cd7cee4f911 100644 --- a/mysql-test/t/precedence.test +++ b/mysql-test/t/precedence.test @@ -4785,4 +4785,7 @@ Select view_definition from information_schema.views where table_schema='test' a create or replace view v1 as select 1 IS TRUE IS FALSE, 2 IS FALSE IS UNKNOWN, 3 IS UNKNOWN IS NULL, 4 IS NULL IS TRUE; Select view_definition from information_schema.views where table_schema='test' and table_name='v1'; +create or replace view v1 as select 2 IS TRUE = 3, 2 IS FALSE = 3, 2 IS UNKNOWN = 3, 2 IS NULL = 3, ISNULL(2) = 1; +Select view_definition from information_schema.views where table_schema='test' and table_name='v1'; + drop view v1; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 90af3ff7ce1..a267c8b0e42 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -4903,5 +4903,29 @@ EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING DEFAULT; EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0; --echo # +--echo # MDEV-24779: main.subselect fails in buildbot with --ps-protocol +--echo # + +CREATE TABLE t1(a INT); +PREPARE stmt FROM "SELECT EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1))"; +EXECUTE stmt; +EXECUTE stmt; +DROP TABLE t1; + +--echo # +--echo # MDEV-25006: Failed assertion on executing EXPLAIN DELETE statement as a prepared statement +--echo # + +CREATE TABLE t1(c1 CHAR(255) PRIMARY KEY); +PREPARE stmt FROM 'EXPLAIN DELETE b FROM t1 AS a JOIN t1 AS b'; +EXECUTE stmt; +DROP TABLE t1; +CREATE TABLE t1(a INT); +PREPARE stmt FROM 'EXPLAIN DELETE FROM t1.* USING t1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/ps_show_log.test b/mysql-test/t/ps_show_log.test new file mode 100644 index 00000000000..95000d2d7e0 --- /dev/null +++ b/mysql-test/t/ps_show_log.test @@ -0,0 +1,73 @@ +--echo # +--echo # MDEV-24208 SHOW RELAYLOG EVENTS command is not supported in the prepared +--echo # statement protocol yet +--echo # + +CREATE USER u1; + +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc +--connection master +CREATE TABLE t1(n INT); + +DROP TABLE t1; + +--sync_slave_with_master +PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS'; + +--replace_column 2 # 4 # 5 # +--replace_regex /Server ver:.*Binlog ver: .*/#/ /slave-bin.*/#/ +EXECUTE stmt_1; + +--echo # Execute the same prepared statement the second time to check that +--echo # no internal structures used for handling the statement +--echo # 'SHOW BINLOG EVENTS' were damaged. + +--replace_column 2 # 4 # 5 # +--replace_regex /Server ver:.*Binlog ver: .*/#/ /slave-bin.*/#/ +EXECUTE stmt_1; + +DEALLOCATE PREPARE stmt_1; + +--connection slave +PREPARE stmt_1 FROM 'SHOW RELAYLOG EVENTS'; +--replace_column 2 # 4 # 5 # +--replace_regex /Server ver:.*Binlog ver: .*/#/ /slave-relay-bin.*;pos=.*/#/ +EXECUTE stmt_1; + +--echo # Execute the same prepared statement the second time to check that +--echo # no internal structures used for handling the statement +--echo # 'SHOW RELAYLOG EVENTS' were damaged. + +--replace_column 2 # 4 # 5 # +--replace_regex /Server ver:.*Binlog ver: .*/#/ /slave-relay-bin.*;pos=.*/#/ +EXECUTE stmt_1; + +DEALLOCATE PREPARE stmt_1; + +--echo # Create the user u1 without the REPLICATION SLAVE privilege required +--echo # for running the statements SHOW BINLOG EVENTS/SHOW RELAYLOG EVENTS +--echo # and check that attempt to execute the statements SHOW BINLOG EVENTS/ +--echo # SHOW RELAYLOG EVENTS as a prepred statements by a user without required +--echo # privileges results in error. + +--connect (con2,localhost,u1,,test) +PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS'; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +EXECUTE stmt_1; + +PREPARE stmt_1 FROM 'SHOW RELAYLOG EVENTS'; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +EXECUTE stmt_1; + +DEALLOCATE PREPARE stmt_1; + +--source include/rpl_end.inc + +--connection default +# Clean up +DROP USER u1; + +--echo # End of 10.2 tests diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 7235c6af3b3..d518d7a3956 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -606,15 +606,15 @@ set character_set_results=default; # # max_sort_length set GLOBAL query_cache_size=1355776; -create table t1 (id int auto_increment primary key, c char(25)); +create table t1 (id int auto_increment primary key, c char(65)); insert into t1 set c = repeat('x',24); -insert into t1 set c = concat(repeat('x',24),'x'); -insert into t1 set c = concat(repeat('x',24),'w'); -insert into t1 set c = concat(repeat('x',24),'y'); +insert into t1 set c = concat(repeat('x',64),'x'); +insert into t1 set c = concat(repeat('x',64),'w'); +insert into t1 set c = concat(repeat('x',64),'y'); set max_sort_length=200; select c from t1 order by c, id; reset query cache; -set max_sort_length=20; +set max_sort_length=64; select c from t1 order by c, id; set max_sort_length=200; select c from t1 order by c, id; diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 264f7c784ce..890377ed977 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -2183,6 +2183,54 @@ eval $q4; drop table t1; +# +# MDEV-21958: Query having many NOT-IN clauses running forever (testcase 2) +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t2 ( + pk int primary key, + key1 int, + col1 varchar(255), + key (key1, pk) +); + +insert into t2 (pk, key1) +select A.a+10 *B.a + 100*C.a, A.a+10 *B.a +100*C.a from t1 A, t1 B, t1 C; + +--echo # This must use ALL, not range: +explain select * from t2 force index (primary) where pk not in (1,2,3); + +drop table t1,t2; + +--echo # +--echo # MDEV-24444: ASAN use-after-poison in Item_func_in::get_func_mm_tree with NOT IN +--echo # +CREATE TABLE t1 (id INT, a CHAR(3), b INT, PRIMARY KEY(id), KEY(b), KEY(a)); +INSERT INTO t1 VALUES (1,'foo',10),(2,'bar',20); + +CREATE TABLE t2 (code CHAR(8), num INT, PRIMARY KEY (code)); +INSERT INTO t2 VALUES ('100',1),('111',2); + +SELECT * FROM t1 JOIN t2 ON (t2.code = t1.b) WHERE t1.a NOT IN ('baz', 'qux') OR t2.num != 3; + +DROP TABLE t1, t2; + + +--echo # +--echo # MDEV-22251: get_key_scans_params: Conditional jump or move depends on uninitialised value +--echo # + +create table t1 (pk int, i int, v int, primary key (pk), key(v)); +insert into t1 (pk,i,v) values (1,1,2),(2,2,4),(3,3,6),(4,4,8),(5,5,10),(6,6,12),(7,7,14),(8,8,16); +create table t2 (a int, b int); +insert into t2 values (1,2),(2,4); +EXPLAIN +select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk); +select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk); +drop table t1, t2; + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test index a31573edb8e..4d7dcdc9781 100644 --- a/mysql-test/t/selectivity.test +++ b/mysql-test/t/selectivity.test @@ -1286,6 +1286,51 @@ drop table t1; --echo # End of 10.1 tests +--echo # +--echo # MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect +--echo # + +SET optimizer_use_condition_selectivity=4; +SET histogram_size=255; +CREATE TABLE t1 (a BIT(32), b INT); +INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82); +ANALYZE TABLE t1 PERSISTENT FOR ALL; +EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81; +SELECT HEX(a), b from t1 where t1.a >= 81; + +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +DROP TABLE t1; + +--echo # +--echo # MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3 +--echo # + +CREATE TABLE t1(a int); +INSERT INTO t1 values (1),(2),(2),(3),(4); +SET optimizer_use_condition_selectivity=4; +SET histogram_size= 255; + +set use_stat_tables='preferably'; + +ANALYZE TABLE t1 PERSISTENT FOR ALL; + +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +SET optimizer_use_condition_selectivity=3; + +--echo # filtered should show 25 % +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +FLUSH TABLES; + +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set histogram_size=@save_histogram_size; +set use_stat_tables= @save_use_stat_tables; + +DROP TABLE t1; + +--echo # End of 10.2 tests + # # Clean up # diff --git a/mysql-test/t/set_statement.test b/mysql-test/t/set_statement.test index 1c70ed6281a..a5f5c03098d 100644 --- a/mysql-test/t/set_statement.test +++ b/mysql-test/t/set_statement.test @@ -1136,3 +1136,26 @@ while ($1) --enable_query_log --echo # @rnd should be 0 select @rnd; + +--echo # +--echo # MDEV-24860: Incorrect behaviour of SET STATEMENT in case +--echo # it is executed as a prepared statement +--echo # +PREPARE stmt FROM "SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1"; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +--echo # Show definition of the table t1 created using Prepared Statement +SHOW CREATE TABLE t1; + +DROP TABLE t1; + +--echo # Create the table t1 with the same definition as it used before +--echo # using regular statement execution mode. +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1; + +--echo # Show that the table has the same definition as it is in case the table +--echo # created in prepared statement mode. +SHOW CREATE TABLE t1; + +DROP TABLE t1; diff --git a/mysql-test/t/skip_grants-master.opt b/mysql-test/t/skip_grants.opt index 5699a3387b8..5699a3387b8 100644 --- a/mysql-test/t/skip_grants-master.opt +++ b/mysql-test/t/skip_grants.opt diff --git a/mysql-test/t/skip_grants.test b/mysql-test/t/skip_grants.test index 5f79404e7e4..0ecaa022fd4 100644 --- a/mysql-test/t/skip_grants.test +++ b/mysql-test/t/skip_grants.test @@ -17,24 +17,6 @@ use test; # Prepare. ---disable_warnings - -DROP VIEW IF EXISTS v1; -DROP VIEW IF EXISTS v2; -DROP VIEW IF EXISTS v3; - -DROP TABLE IF EXISTS t1; - -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS p2; -DROP PROCEDURE IF EXISTS p3; - -DROP FUNCTION IF EXISTS f1; -DROP FUNCTION IF EXISTS f2; -DROP FUNCTION IF EXISTS f3; - ---enable_warnings - # Test case. CREATE TABLE t1(c INT); @@ -109,20 +91,23 @@ DROP FUNCTION f1; DROP FUNCTION f2; DROP FUNCTION f3; -# -# Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server -# +--echo # +--echo # Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server +--echo # set global event_scheduler=1; set global event_scheduler=0; -# -# Bug#26285 Selecting information_schema crahes server -# +--echo # +--echo # Bug#26285 Selecting information_schema crahes server +--echo # select count(*) from information_schema.COLUMN_PRIVILEGES; select count(*) from information_schema.SCHEMA_PRIVILEGES; select count(*) from information_schema.TABLE_PRIVILEGES; select count(*) from information_schema.USER_PRIVILEGES; ---echo End of 5.0 tests + +--echo # +--echo # End of 5.0 tests +--echo # --echo # --echo # Bug#29817 Queries with UDF fail with non-descriptive error @@ -131,9 +116,26 @@ select count(*) from information_schema.USER_PRIVILEGES; --error ER_SP_DOES_NOT_EXIST select no_such_function(1); ---echo End of 5.1 tests +--echo # +--echo # End of 5.1 tests +--echo # -# -# MDEV-8280 crash in 'show global status' with --skip-grant-tables -# +--echo # +--echo # MDEV-8280 crash in 'show global status' with --skip-grant-tables +--echo # show global status like 'Acl%'; + +--echo # +--echo # End of 10.1 tests +--echo # + +--echo # +--echo # MDEV-22966 Server crashes or hangs with SET ROLE when started with skip-grant-tables +--echo # + +--error ER_OPTION_PREVENTS_STATEMENT +set role x; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/sp-ucs2.test b/mysql-test/t/sp-ucs2.test index a1aec8071b4..95021bcb8ef 100644 --- a/mysql-test/t/sp-ucs2.test +++ b/mysql-test/t/sp-ucs2.test @@ -114,35 +114,35 @@ DROP FUNCTION f1| # # COLLATE with no CHARACTER SET in IN param # ---error ER_COLLATION_CHARSET_MISMATCH CREATE FUNCTION f(f1 VARCHAR(64) COLLATE ucs2_unicode_ci) RETURNS VARCHAR(64) CHARACTER SET ucs2 BEGIN RETURN 'str'; END| +DROP FUNCTION f| # # COLLATE with no CHARACTER SET in RETURNS # ---error ER_COLLATION_CHARSET_MISMATCH CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2) RETURNS VARCHAR(64) COLLATE ucs2_unicode_ci BEGIN RETURN 'str'; END| +DROP FUNCTION f| # # COLLATE with no CHARACTER SET in DECLARE # ---error ER_COLLATION_CHARSET_MISMATCH CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2) RETURNS VARCHAR(64) CHARACTER SET ucs2 BEGIN DECLARE f2 VARCHAR(64) COLLATE ucs2_unicode_ci; RETURN 'str'; END| +DROP FUNCTION f| delimiter ;| diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 99b843059ec..f13b3fbc281 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -10001,3 +10001,28 @@ $$ DELIMITER ;$$ DROP TABLE t1; SET sql_mode=DEFAULT; + +--echo # +--echo # MDEV-24220: error when opening a table for the second call of SP +--echo # + +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1),(2,2); +CREATE VIEW v1 AS SELECT MAX(a) as f FROM t1; +--delimiter $ +CREATE PROCEDURE p1() +BEGIN + SELECT * FROM v1; +END $ +--delimiter ; + +CALL p1; +ALTER TABLE t1 DROP a; +-- error ER_VIEW_INVALID +CALL p1; + +DROP PROCEDURE p1; +DROP VIEW v1; +DROP TABLE t1; + +--echo #End of 10.2 tests diff --git a/mysql-test/t/stat_tables.test b/mysql-test/t/stat_tables.test index 4c21e21ea70..f7c18637cdd 100644 --- a/mysql-test/t/stat_tables.test +++ b/mysql-test/t/stat_tables.test @@ -1,4 +1,5 @@ --source include/have_stat_tables.inc +--source include/have_partition.inc select @@global.use_stat_tables; select @@session.use_stat_tables; @@ -568,5 +569,16 @@ set names latin1; set @@use_stat_tables=@save_use_stat_tables; drop table t1; +--echo # +--echo # MDEV-23753: SIGSEGV in Column_stat::store_stat_fields +--echo # + +CREATE TABLE t1 (a INT, b INT) PARTITION BY HASH (b) PARTITIONS 2; +LOCK TABLES t1 WRITE; +ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (a) INDEXES (); +ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (nonexisting) INDEXES (nonexisting); +DROP TABLE t1; + + --echo # please keep this at the last set @@global.histogram_size=@save_histogram_size; diff --git a/mysql-test/t/status2.test b/mysql-test/t/status2.test index fa3b718efaa..ea674c2ed7c 100644 --- a/mysql-test/t/status2.test +++ b/mysql-test/t/status2.test @@ -64,5 +64,14 @@ DROP TRIGGER trigg1; DROP FUNCTION testQuestion; DROP EVENT ev1; DROP TABLE t1,t2; ---echo End of 6.0 tests + +--echo # +--echo # End of 5.5 tests +--echo # + +select variable_value < 1024*1024*1024 from information_schema.global_status where variable_name='memory_used'; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 7e16321dac1..57ac43176bb 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -6188,4 +6188,39 @@ SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk) DROP TABLE t; +--echo # +--echo # MDEV-25002: Outer reference in ON clause of subselect +--echo # + +create table t1 ( + pk int primary key, + a int +) engine=myisam; +insert into t1 values (1,1), (2,2); + +create table t2 ( + pk int primary key, + b int +) engine=myisam; +insert into t2 values (1,1), (2,3); + +create table t3 (a int); +insert into t3 values (1),(2); + +select a, + (select count(*) from t1, t2 + where t2.pk=t3.a and t1.pk=1) as sq +from t3; +select a, + (select count(*) from t1 join t2 on t2.pk=t3.a + where t1.pk=1) as sq +from t3; + +select a from t3 + where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1); +select a from t3 + where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1); + +drop table t1,t2,t3; + --echo # End of 10.2 tests diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index 6eada9b27d9..f19a654de64 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -2201,4 +2201,39 @@ SELECT * FROM t2; DROP TABLE t1, t2; +--echo # +--echo # MDEV-23449: alias do not exist and a query do not report an error +--echo # + +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); + +--error ER_BAD_FIELD_ERROR +SELECT a, b FROM t1 WHERE a IN (SELECT A.a FROM t1 A GROUP BY s.id); +DROP TABLE t1; + +--echo # +--echo # MDEV-24519: Server crashes in Charset::set_charset upon SELECT +--echo # + +CREATE TABLE t1 (a VARBINARY(8)); +INSERT INTO t1 VALUES ('foo'),('bar'); +CREATE TABLE t2 (b VARBINARY(8)); + +EXPLAIN +SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2); +SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b VARBINARY(8)); + +EXPLAIN +SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2); +SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2); + +DROP TABLE t1,t2; + --echo # End of 10.2 tests diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 77c9c2875e2..80c196b11f1 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -670,5 +670,49 @@ DROP TABLE t1; DROP TABLE t1dec102; --echo # +--echo # MDEV-24790 CAST('0e1111111111' AS DECIMAL(38,0)) returns a wrong result +--echo # + +SELECT CAST('0e111111111' AS DECIMAL(38,0)) AS a; +SELECT CAST('0e1111111111' AS DECIMAL(38,0)) AS a; +SELECT CAST('.00000000000000000000000000000000000001e111111111111111111111' AS DECIMAL(38,0)) AS a; + +CREATE TABLE t1 (str VARCHAR(128), comment VARCHAR(128)); +INSERT INTO t1 VALUES +('0e111111111111111111111', 'Zero mantissa and a huge positive exponent'), +('1e111111111111111111111', 'Non-zero mantissa, huge positive exponent'), +('0e-111111111111111111111', 'Zero mantissa and a huge negative exponent'), +('1e-111111111111111111111', 'Non-zero mantissa and a huge negative exponent'); + +# The loop below issues SHOW WARNINGS manually, disable automatic warnings +--disable_warnings +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE done INT DEFAULT FALSE; + DECLARE vstr, vcomment VARCHAR(128); + DECLARE cur1 CURSOR FOR SELECT str, comment FROM t1 ORDER BY str; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + OPEN cur1; +read_loop: + LOOP + FETCH cur1 INTO vstr, vcomment; + IF done THEN + LEAVE read_loop; + END IF; + SELECT vstr AS `--------`, vcomment AS `--------`; + SELECT CAST(str AS DECIMAL(38,0)) FROM t1 WHERE str=vstr; + SHOW WARNINGS; + SELECT CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) FROM t1 WHERE str=vstr; + SHOW WARNINGS; + END LOOP; +END; +$$ +DELIMITER ;$$ +--enable_warnings + + +DROP TABLE t1; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test index af26a69c581..34c417d9026 100644 --- a/mysql-test/t/type_year.test +++ b/mysql-test/t/type_year.test @@ -1,9 +1,6 @@ # # Test year # ---disable_warnings -drop table if exists t1; ---enable_warnings create table t1 (y year,y2 year(2)); insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69); @@ -12,24 +9,27 @@ select * from t1 order by y; select * from t1 order by y2; drop table t1; -# -# Bug 2335 -# +--echo # +--echo # Bug 2335 +--echo # create table t1 (y year); insert ignore into t1 values (now()); select if(y = now(), 1, 0) from t1; drop table t1; -# -# Bug #27176: Assigning a string to an year column has unexpected results -# +--echo # +--echo # Bug #27176: Assigning a string to an year column has unexpected results +--echo # + create table t1(a year); insert into t1 values (2000.5), ('2000.5'), ('2001a'), ('2.001E3'); select * from t1; drop table t1; ---echo End of 5.0 tests +--echo # +--echo # End of 5.0 tests +--echo # --echo # --echo # Bug #49480: WHERE using YEAR columns returns unexpected results @@ -169,8 +169,9 @@ ALTER TABLE t1 MODIFY COLUMN c2 YEAR(2); DROP TABLE t1; --echo # +--echo # End of 5.1 tests +--echo # ---echo End of 5.1 tests # # fun with convert_const_to_int # in some cases 00 is equal to 2000, in others it is not. @@ -230,10 +231,6 @@ DROP TABLE t1; --echo # --echo # ---echo # Start of 10.2 tests ---echo # - ---echo # --echo # MDEV-9392 Copying from DECIMAL to YEAR is not consistent about warnings --echo # CREATE TABLE t1 (a YEAR); @@ -268,6 +265,17 @@ SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR ALTER TABLE t1 MODIFY a YEAR; DROP TABLE t1; +--echo # +--echo # Various widths of the YEAR +--echo # +create or replace table t1 (a YEAR(0)); SHOW CREATE TABLE t1; +create or replace table t1 (a YEAR(1)); SHOW CREATE TABLE t1; +create or replace table t1 (a YEAR(2)); SHOW CREATE TABLE t1; +create or replace table t1 (a YEAR(3)); SHOW CREATE TABLE t1; +create or replace table t1 (a YEAR(4)); SHOW CREATE TABLE t1; +create or replace table t1 (a YEAR(5)); SHOW CREATE TABLE t1; +create or replace table t1 (a YEAR(100)); SHOW CREATE TABLE t1; +drop table t1; --echo # --echo # End of 10.2 tests diff --git a/mysql-test/t/user_limits.test b/mysql-test/t/user_limits.test index ebb4fd4fb88..36524febd8d 100644 --- a/mysql-test/t/user_limits.test +++ b/mysql-test/t/user_limits.test @@ -216,3 +216,29 @@ drop table t1; --source include/wait_until_count_sessions.inc set global max_user_connections= @my_max_user_connections; + +--echo # +--echo # End of 10.1 tests +--echo # + +--echo # +--echo # MDEV-17852 Altered connection limits for user have no effect +--echo # +create user foo@'%' with max_user_connections 1; +--connect con1,localhost,foo +select current_user(); +--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK +--error ER_USER_LIMIT_REACHED +--connect con2,localhost,foo +--connection default +alter user foo with max_user_connections 2; +--connect con3,localhost,foo +select current_user(); +--disconnect con3 +--disconnect con1 +--connection default +drop user foo@'%'; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/userstat.test b/mysql-test/t/userstat.test index 547138cfeaa..6d486810db1 100644 --- a/mysql-test/t/userstat.test +++ b/mysql-test/t/userstat.test @@ -5,10 +5,7 @@ -- source include/have_innodb.inc -- source include/have_log_bin.inc - ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings +-- source include/have_perfschema.inc select variable_value from information_schema.global_status where variable_name="handler_read_key" into @global_read_key; show columns from information_schema.client_statistics; @@ -115,5 +112,20 @@ set @@autocommit=1; select @@in_transaction; drop table t1; -# Cleanup set @@global.general_log=@save_general_log; + +--echo # +--echo # MDEV-25242 Server crashes in check_grant upon invoking function with userstat enabled +--echo # +create function f() returns int return (select 1 from performance_schema.threads); +set global userstat= 1; +--error ER_SUBQUERY_NO_1_ROW +select f() from information_schema.table_statistics; +--error ER_SUBQUERY_NO_1_ROW +select f() from information_schema.index_statistics; +set global userstat= 0; +drop function f; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index cd5cc6efade..8cb00f7a6f4 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -6492,5 +6492,73 @@ DROP VIEW v1; DROP TABLE t1; --echo # +--echo # MDEV-24314: create view with derived table without default database +--echo # + +drop database test; + +create database db1; +create table db1.t1 (a int); +insert into db1.t1 values (3),(7),(1); + +create view db1.v1 as select * from (select * from db1.t1) t; +show create view db1.v1; +select * from db1.v1; +drop view db1.v1; + +prepare stmt from " +create view db1.v1 as select * from (select * from db1.t1) t; +"; +execute stmt; +deallocate prepare stmt; +show create view db1.v1; +select * from db1.v1; +drop view db1.v1; + +drop table db1.t1; +drop database db1; + +create database test; +use test; + +--echo # +--echo # MDEV-16940: update of multi-table view returning error used in SP +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1), (2); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (2), (3); + +CREATE VIEW v1 AS SELECT a, b FROM t1,t2; + +CREATE PROCEDURE sp1() UPDATE v1 SET a = 8, b = 9; + +--error ER_VIEW_MULTIUPDATE +CALL sp1; +--error ER_VIEW_MULTIUPDATE +CALL sp1; + +DROP PROCEDURE sp1; +DROP VIEW v1; +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-23291: SUM column from a derived table returns invalid values +--echo # + +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,1), (2,2); + +CREATE view v1 AS +SELECT a as x, (select x) as y, (select y) as z FROM t1; + +SELECT sum(z) FROM (SELECT a as x, (select x) as y, (select y) as z FROM t1) q; +SELECT sum(z) FROM v1; + +DROP TABLE t1; +DROP VIEW v1; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index c7e3dac598b..57214ab0165 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -2523,5 +2523,25 @@ DROP VIEW v1; DROP TABLE t1,t2; --echo # +--echo # MDEV-25032 Window functions without column references get removed from ORDER BY +--echo # + +create table t1 (id int, score double); +insert into t1 values +(1, 5), +(1, 6), +(1, 6), +(1, 6), +(1, 7), +(1, 8.1), +(1, 9), +(1, 10); +select id, row_number() over () rn +from t1 +order by rn desc; + +drop table t1; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test index 58ad1caaeef..ecce563b8c8 100644 --- a/mysql-test/t/xa.test +++ b/mysql-test/t/xa.test @@ -342,7 +342,7 @@ DROP TABLE t1; --echo # --echo # Bug#12352846 - TRANS_XA_START(THD*): --echo # ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL() ---echo # FAILED +--echo # FAILED --echo # --disable_warnings @@ -401,7 +401,7 @@ CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t2 VALUES (1),(2); CREATE TABLE t3 (i INT) ENGINE=InnoDB; - + XA BEGIN 'xid1'; REPLACE INTO t1 SELECT * FROM t2; @@ -430,5 +430,43 @@ XA END 'xid1'; XA ROLLBACK 'xid1'; DROP TABLE t1, t2, t3; ---source include/wait_until_count_sessions.inc +--echo # +--echo # MDEV 15532 XA: Assertion `!log->same_pk' failed in +--echo # row_log_table_apply_delete +--echo # + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); + +--connect (con1,localhost,root,,test) + +XA START 'xid'; +UPDATE t1 SET a = 5; + +--connection default +SET innodb_lock_wait_timeout= 2, lock_wait_timeout= 2; + +--error ER_NO_SUCH_TABLE +ALTER TABLE non_existing_table1; + +--send ALTER TABLE t1 FORCE; +--connection con1 +--error ER_XAER_RMFAIL + +ALTER TABLE non_existing_table2; +DELETE FROM t1 LIMIT 1; + +--connection default +--error ER_LOCK_WAIT_TIMEOUT +--reap + +# Cleanup +--connection con1 +XA END 'xid'; +XA ROLLBACK 'xid'; +DROP TABLE t1; +--disconnect con1 +connection default; + +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 7eac636dc5d..286c99cba14 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,28 +23,31 @@ # ############################################################################## # -# Based on bb-10.2-release 72eea39d4c4a8bcadccfdac457e61abc7b618ff8 -# Fri Oct 30 12:58:16 2020 +0200 -# MDEV-23991 fixup: Initialize the memory +# Based on 10.2 9c84852809214e97cf91327a798204c1b745881e +# for main suite changes and failures, and +# bb-10.2-release 72eea39d4c4a8bcadccfdac457e61abc7b618ff8 +# for the rest -main.alter_table : Modified in 10.2.35 -main.alter_table_trans : MDEV-12084 - timeout +main.alter_table_trans : MDEV-12084 - Timeout main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result -main.aria_icp_debug : Added in 10.2.35 main.auth_named_pipe : MDEV-14724 - System error 2 -main.blackhole : Modified in 10.2.35 -main.bootstrap_innodb : Added in 10.2.35 main.connect : MDEV-17282 - Wrong result main.connect2 : MDEV-13885 - Server crash -main.count_distinct2 : MDEV-11768 - timeout +main.create : Modified in 10.2.37 main.create_delayed : MDEV-10605 - failed with timeout main.create_drop_event : MDEV-16271 - Wrong result +main.cte_nonrecursive : Modified in 10.2.37 +main.cte_nonrecursive_not_embedded : Added in 10.2.37 +main.cte_recursive : Modified in 10.2.37 main.ctype_ucs : MDEV-17681 - Data too long for column main.ctype_upgrade : MDEV-16945 - Error upon mysql_upgrade main.ctype_utf16 : MDEV-10675: timeout or extra warnings -main.ctype_utf8 : Modified in 10.2.35 +main.ctype_utf8mb4 : Modified in 10.2.37 +main.ctype_utf8mb4_heap : Include file modified in 10.2.37 +main.ctype_utf8mb4_innodb : Include file modified in 10.2.37 +main.ctype_utf8mb4_myisam : Include file modified in 10.2.37 main.debug_sync : MDEV-10607 - internal error -main.derived_opt : MDEV-11768 - timeout +main.derived_cond_pushdown : Modified in 10.2.37 main.dirty_close : MDEV-19368 - mysqltest failed but provided no output main.distinct : MDEV-14194 - Crash main.drop_bad_db_type : MDEV-15676 - Wrong result @@ -52,104 +55,92 @@ main.events_2 : MDEV-13277 - Crash main.events_bugs : MDEV-12892 - Crash main.events_restart : MDEV-12236 - Server shutdown problem main.events_slowlog : MDEV-12821 - Wrong result -main.fast_prefix_index_fetch_innodb : Modified in 10.2.35 main.flush : MDEV-19368 - mysqltest failed but provided no output -main.func_gconcat : MDEV-21379 - Valgrind warnings -main.func_json : Modified in 10.2.35 -main.func_test : Modified in 10.2.35 +main.func_gconcat : MDEV-21379 - Valgrind warnings; modified in 10.2.37 +main.func_like : Modified in 10.2.37 main.gis : MDEV-13411 - wrong result on P8 +main.gis-json : Modified in 10.2.37 main.gis_notembedded : MDEV-21264 - Wrong result with different default charset -main.grant : Modified in 10.2.35 -main.grant5 : Modified in 10.2.35 +main.group_by : Modified in 10.2.37 main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown main.index_intersect_innodb : MDEV-10643 - failed with timeout main.index_merge_innodb : MDEV-7142 - Plan mismatch -main.information_schema : Modified in 10.2.35 -main.innodb_ext_key : Modified in 10.2.35 -main.innodb_icp_debug : Added in 10.2.35 +main.information_schema : Modified in 10.2.37 +main.innodb_mrr_cpk : MDEV-24737 - Server crash main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure (Fixed in 10.3+, MDEV-22947) +main.kill : Modified in 10.2.37 main.kill-2 : MDEV-13257 - Wrong result main.kill_processlist-6619 : MDEV-10793 - Wrong result -main.limit_rows_examined : Modified in 10.2.35 main.loaddata : MDEV-19368 - mysqltest failed but provided no output main.locale : MDEV-20521 - Missing warning -main.lock_view : Added in 10.2.35 +main.lock_tables_lost_commit : MDEV-24624 - Timeout +main.lock_view : Modified in 10.2.37 main.log_slow : MDEV-13263 - Wrong result -main.log_tables : Modified in 10.2.35 main.log_tables-big : MDEV-13408 - wrong result main.mdev-504 : MDEV-15171 - warning main.mdev375 : MDEV-10607 - sporadic "can't connect" main.merge : MDEV-10607 - sporadic "can't connect" -main.multi_update_big : Modified in 10.2.35 -main.myisam_icp_debug : Added in 10.2.35 +main.myisam : Modified in 10.2.37 main.mysql_client_test : MDEV-19369 - error: 5888, status: 23, errno: 2 main.mysql_client_test_comp : MDEV-16641 - Error in exec main.mysql_client_test_nonblock : CONC-208 - Error on Power; MDEV-15096 - exec failed -main.mysql_upgrade : Modified in 10.2.35 +main.mysql_upgrade : Modified in 10.2.37 main.mysql_upgrade_noengine : MDEV-14355 - Wrong result -main.mysqlbinlog_row_minimal : Modified in 10.2.35 -main.mysqld--help : Modified in 10.2.35 main.mysqld_option_err : MDEV-21571 - Crash on bootstrap -main.mysqldump : MDEV-14800 - Stack smashing detected -main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug +main.mysqldump : Modified in 10.2.37 +main.mysqldump-system : Added in 10.2.37 main.mysqlslap : MDEV-11801 - timeout main.mysqltest : MDEV-9269 - fails on Alpha; MDEV-13887 - Wrong result main.old-mode : MDEV-19373 - Wrong result main.openssl_6975 : MDEV-17184 - Failures with OpenSSL 1.1.1 -main.order_by : Modified in 10.2.35 +main.order_by : Modified in 10.2.37 main.order_by_optimizer_innodb : MDEV-10683 - Wrong result -main.parser : Modified in 10.2.35 -main.partition : Modified in 10.2.35 main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings main.partition_innodb_semi_consistent : MDEV-19411 - Failed to start mysqld.1 -main.plugin_innodb : Modified in 10.2.35 -main.pool_of_threads : Modified in 10.2.35 -main.precedence : Added in 10.2.35 -main.precedence_bugs : Added in 10.2.35 -main.processlist_notembedded : Modified in 10.2.35 +main.precedence : Modified in 10.2.37 +main.processlist_notembedded : MDEV-23752 - Not explainable command main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count -main.query_cache : MDEV-16180 - Wrong result +main.ps_show_log : Added in 10.2.37 +main.query_cache : MDEV-16180 - Wrong result; modified in 10.2.37 main.query_cache_debug : MDEV-15281 - Query cache is disabled -main.range : Modified in 10.2.35 +main.range : Modified in 10.2.37 main.range_innodb : MDEV-23371 - Server crash main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away main.set_statement : MDEV-13183 - Wrong result main.set_statement_notembedded : MDEV-19414 - Wrong result main.shm : MDEV-12727 - Mismatch, ERROR 2013 main.show_explain : MDEV-10674 - Wrong result code +main.skip_grants : Modified in 10.2.37 +main.sp : Modified in 10.2.37 main.sp-security : MDEV-10607 - sporadic "can't connect" +main.sp-ucs2 : Modified in 10.2.37 main.sp_notembedded : MDEV-10607 - internal error main.ssl : MDEV-17184 - Failures with OpenSSL 1.1.1 main.ssl_ca : MDEV-10895 - SSL connection error on Power main.ssl_cipher : MDEV-17184 - Failures with OpenSSL 1.1.1 main.ssl_timeout : MDEV-11244 - Crash +main.stat_tables : Modified in 10.2.37 main.stat_tables_par_innodb : MDEV-14155 - Wrong rounding main.status : MDEV-13255 - Wrong result -main.subselect4 : Modified in 10.2.35 -main.subselect_innodb : MDEV-10614 - Sporadic wrong results; modified in 10.2.35 -main.sum_distinct-big : Modified in 10.2.35 +main.subselect_innodb : MDEV-10614 - Sporadic wrong results main.tc_heuristic_recover : MDEV-14189 - Wrong result -main.temp_table_symlink : MDEV-24058 - Wrong error code; added in 10.2.35 +main.temp_table_symlink : MDEV-24058 - Wrong error code main.type_blob : MDEV-15195 - Wrong result -main.type_date : Modified in 10.2.35 -main.type_datetime : Modified in 10.2.35 main.type_datetime_hires : MDEV-10687 - Timeout -main.type_newdecimal : Modified in 10.2.35 main.type_temporal_innodb : MDEV-24025 - Wrong result -main.udf : Modified in 10.2.35 +main.type_year : Modified in 10.2.37 +main.user_limits : Modified in 10.2.37 main.userstat : MDEV-12904 - SSL errors -main.view : Modified in 10.2.35 +main.view : Modified in 10.2.37 main.wait_timeout : MDEV-19023 - Lost connection to MySQL server during query -main.win : Modified in 10.2.35 -main.xa : MDEV-11769 - lock wait timeout +main.xa : MDEV-11769 - lock wait timeout; modified in 10.2.37 #----------------------------------------------------------------------- -archive.archive_bitfield : MDEV-11771 - table is marked as crashed -archive.archive_symlink : MDEV-12170 - unexpected error on rmdir -archive.discover : MDEV-10510 - Table is marked as crashed -archive.mysqlhotcopy_archive : MDEV-10995 - Hang on debug +archive.archive_bitfield : MDEV-11771 - table is marked as crashed +archive.archive_symlink : MDEV-12170 - unexpected error on rmdir +archive.discover : MDEV-10510 - Table is marked as crashed #----------------------------------------------------------------------- @@ -157,18 +148,14 @@ archive-test_sql_discovery.discover : MDEV-16817 - Table marked as crashed #----------------------------------------------------------------------- -binlog.binlog_commit_wait : MDEV-10150 - Mismatch -binlog.binlog_killed : MDEV-12925 - Wrong result -binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown -binlog.binlog_mysqlbinlog_row : Modified in 10.2.35 -binlog.binlog_mysqlbinlog_row_frag : Modified in 10.2.35 -binlog.binlog_no_uniqfile_crash : MDEV-24078 - Server crash upon shutdown -binlog.binlog_recover_checksum_error : Added in 10.2.35 -binlog.binlog_show_binlog_event_random_pos : Modified in 10.2.35 -binlog.binlog_stm_mix_innodb_myisam : MDEV-24057 - Wrong result -binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint -binlog.flashback-largebinlog : MDEV-19764 - Out of memory -binlog.load_data_stm_view : MDEV-16948 - Wrong result +binlog.binlog_commit_wait : MDEV-10150 - Mismatch +binlog.binlog_killed : MDEV-12925 - Wrong result +binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown +binlog.binlog_no_uniqfile_crash : MDEV-24078 - Server crash upon shutdown +binlog.binlog_stm_mix_innodb_myisam : MDEV-24057 - Wrong result +binlog.binlog_xa_recover : MDEV-12908 - Extra checkpoint +binlog.flashback-largebinlog : MDEV-19764 - Out of memory +binlog.load_data_stm_view : MDEV-16948 - Wrong result #----------------------------------------------------------------------- @@ -193,10 +180,9 @@ binlog_encryption.rpl_typeconv : MDEV-14362 - Lost con #----------------------------------------------------------------------- -connect.pivot : MDEV-14803 - Failed to discover table -connect.updelx : Modified in 10.2.35 -connect.vcol : MDEV-12374 - Fails on Windows -connect.zip : MDEV-13884 - Wrong result +connect.pivot : MDEV-14803 - Failed to discover table +connect.vcol : MDEV-12374 - Fails on Windows +connect.zip : MDEV-13884 - Wrong result #----------------------------------------------------------------------- @@ -204,40 +190,34 @@ disks.disks_notembedded : MDEV-21587 - Wrong result #----------------------------------------------------------------------- -encryption.create_or_replace : Modified in 10.2.35 -encryption.create_or_replace_big : Added in 10.2.35 -encryption.debug_key_management : MDEV-13841 - Timeout -encryption.encrypt_and_grep : MDEV-13765 - Wrong result -encryption.innochecksum : MDEV-13644 - Assertion failure -encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect through socket -encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate -encryption.innodb-discard-import : MDEV-19113 - Timeout -encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout -encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition -encryption.innodb-force-corrupt : MDEV-17286 - SSL error -encryption.innodb-missing-key : MDEV-17286 - SSL error -encryption.innodb-page_encryption : MDEV-10641 - mutex problem -encryption.innodb-page_encryption_compression : Modified in 10.2.35 -encryption.innodb-page_encryption_log_encryption : Modified in 10.2.35 -encryption.innodb-read-only : MDEV-16563 - Crash on startup -encryption.innodb-redo-badkey : MDEV-12898 - Server hang on startup -encryption.innodb-remove-encryption : MDEV-16493 - Timeout in wait condition -encryption.innodb-spatial-index : MDEV-13746 - Wrong result -encryption.innodb_encrypt_key_rotation_age : MDEV-19763 - Timeout -encryption.innodb_encrypt_log : MDEV-13725 - Wrong result -encryption.innodb_encrypt_log_corruption : MDEV-14379 - Server crash -encryption.innodb_encrypt_temporary_tables : MDEV-20142 - Wrong result -encryption.innodb_encryption : MDEV-14728 - Unable to get certificate; MDEV-15675 - Timeout -encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure -encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result -encryption.innodb_encryption_is : MDEV-12898 - Server hang on startup -encryption.innodb_encryption_row_compressed : MDEV-16113 - Crash -encryption.innodb_first_page : MDEV-10689 - Crash -encryption.innodb_onlinealter_encryption : MDEV-17287 - SIGABRT on server restart -encryption.innodb_scrub : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+) -encryption.innodb_scrub_background : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+) -encryption.innodb_scrub_compressed : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+) -encryption.tempfiles_encrypted : Added in 10.2.35 +encryption.create_or_replace : MDEV-24081 - Lock wait timeout exceeded +encryption.debug_key_management : MDEV-13841 - Timeout +encryption.encrypt_and_grep : MDEV-13765 - Wrong result +encryption.innochecksum : MDEV-13644 - Assertion failure +encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect through socket +encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate +encryption.innodb-discard-import : MDEV-19113 - Timeout +encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout +encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition +encryption.innodb-force-corrupt : MDEV-17286 - SSL error +encryption.innodb-missing-key : MDEV-17286 - SSL error +encryption.innodb-page_encryption : MDEV-10641 - mutex problem +encryption.innodb-read-only : MDEV-16563 - Crash on startup +encryption.innodb-remove-encryption : MDEV-16493 - Timeout in wait condition +encryption.innodb-spatial-index : MDEV-13746 - Wrong result +encryption.innodb_encrypt_key_rotation_age : MDEV-19763 - Timeout +encryption.innodb_encrypt_log : MDEV-13725 - Wrong result +encryption.innodb_encrypt_log_corruption : MDEV-14379 - Server crash +encryption.innodb_encrypt_temporary_tables : MDEV-20142 - Wrong result +encryption.innodb_encryption : MDEV-14728 - Unable to get certificate; MDEV-15675 - Timeout +encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure +encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result +encryption.innodb_encryption_row_compressed : MDEV-16113 - Crash +encryption.innodb_first_page : MDEV-10689 - Crash +encryption.innodb_onlinealter_encryption : MDEV-17287 - SIGABRT on server restart +encryption.innodb_scrub : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+) +encryption.innodb_scrub_background : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+) +encryption.innodb_scrub_compressed : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+) #----------------------------------------------------------------------- @@ -285,33 +265,20 @@ galera_3nodes.* : Suite is not stable yet #----------------------------------------------------------------------- -gcol.gcol_keys_innodb : Include file modified in 10.2.35 -gcol.gcol_keys_myisam : Include file modified in 10.2.35 -gcol.gcol_partition_innodb : Include file modified in 10.2.35 -gcol.gcol_update : Include file modified in 10.2.35 -gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion -gcol.innodb_virtual_debug : MDEV-23111 - Server crash -gcol.innodb_virtual_debug_purge : Include file modified in 10.2.35 -gcol.innodb_virtual_fk : Modified in 10.2.35 -gcol.innodb_virtual_index : Modified in 10.2.35 -gcol.innodb_virtual_purge : Include file modified in 10.2.35 +gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion +gcol.innodb_virtual_debug : MDEV-23111 - Server crash #----------------------------------------------------------------------- innodb.101_compatibility : MDEV-13891 - Wrong result innodb.alter_copy : MDEV-16181 - Assertion failure innodb.alter_crash : MDEV-16944 - The process cannot access the file -innodb.alter_table : Modified in 10.2.35 innodb.binlog_consistent : MDEV-10618 - Server fails to start innodb.blob-crash : MDEV-20481 - Failures upon recovery innodb.doublewrite : MDEV-12905 - Server crash -innodb.foreign-keys : Modified in 10.2.35 -innodb.foreign_key : Modified in 10.2.35 innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed innodb.group_commit_crash_no_optimize_thread : MDEV-11770 - Checksum mismatch innodb.ibuf_not_empty : MDEV-19021 - Wrong result -innodb.innodb : Modified in 10.2.35 -innodb.innodb-64k : Modified in 10.2.35 innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS innodb.innodb-alter-table : MDEV-10619 - Testcase timeout @@ -319,18 +286,15 @@ innodb.innodb-blob : MDEV-12053 - Client crash innodb.innodb-change-buffer-recovery : MDEV-19115 - Lost connection to MySQL server during query innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown innodb.innodb-get-fk : MDEV-13276 - Server crash -innodb.innodb-index : Include file modified in 10.2.35 -innodb.innodb-index-debug : Include file modified in 10.2.35 innodb.innodb-index-online : MDEV-14809 - Cannot save statistics innodb.innodb-page_compression_default : MDEV-13644 - Assertion failure innodb.innodb-page_compression_lzma : MDEV-14353 - Wrong result innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem innodb.innodb-table-online : MDEV-13894 - Wrong result +innodb.innodb-ucs2 : MDEV-24505 - Assertion failure innodb.innodb-wl5522-1 : MDEV-22945 - Server crash innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno innodb.innodb_buffer_pool_dump_pct : MDEV-20139 - Timeout in wait_condition.inc -innodb.innodb_buffer_pool_resize_with_chunks : MDEV-16964 - Assertion failure -innodb.innodb_bug14147491 : MDEV-11808 - Index is corrupt innodb.innodb_bug30423 : MDEV-7311 - Wrong result innodb.innodb_bug47167 : MDEV-20524 - Table 'user' is marked as crashed and should be repaired innodb.innodb_bug48024 : MDEV-14352 - Assertion failure @@ -339,14 +303,11 @@ innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full innodb.innodb_information_schema : MDEV-8851 - Wrong result innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result -innodb.innodb_monitor : MDEV-10939 - Testcase timeout innodb.innodb_mysql : MDEV-19873 - Wrong result innodb.innodb_stats : MDEV-10682 - wrong result -innodb.innodb_stats_drop_locked : Modified in 10.2.35 innodb.innodb_stats_persistent : MDEV-21567 - Wrong result in execution plan innodb.innodb_stats_persistent_debug : MDEV-14801 - Operation failed innodb.innodb_sys_semaphore_waits : MDEV-10331 - Semaphore wait -innodb.innodb_trx_weight : Configuration deleted in 10.2.35 innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks innodb.log_corruption : MDEV-13251 - Wrong result innodb.log_data_file_size : MDEV-14204 - Server failed to start @@ -357,24 +318,19 @@ innodb.purge_secondary : MDEV-15681 - Wrong result innodb.purge_thread_shutdown : MDEV-13792 - Wrong result innodb.read_only_recovery : MDEV-13886 - Server crash innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile -innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace; modified in 10.2.35 -innodb.stats_persistent : Added in 10.2.35 +innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace innodb.table_definition_cache_debug : MDEV-14206 - Extra warning innodb.table_flags : MDEV-13572 - Wrong result; MDEV-19374 - Server failed to start innodb.temp_table_savepoint : MDEV-24077 - Assertion failure innodb.temporary_table : MDEV-13265 - Wrong result -innodb.truncate : Modified in 10.2.35 innodb.undo_truncate : MDEV-17340 - Server hung innodb.undo_truncate_recover : MDEV-17679 - MySQL server has gone away -innodb.update-cascade : Combinations added in 10.2.35 innodb.update_time : MDEV-14804 - Wrong result innodb.xa_recovery : MDEV-15279 - mysqld got exception #----------------------------------------------------------------------- -innodb_fts.basic : Modified in 10.2.35 innodb_fts.fulltext2 : MDEV-24074 - Server crash -innodb_fts.innodb_fts_misc_1 : Modified in 10.2.35 innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log innodb_fts.innodb_fts_stopword_charset : MDEV-13259 - Table crashed @@ -383,13 +339,11 @@ innodb_fts.sync_ddl : MDEV-21568 - Errno: 2000 #----------------------------------------------------------------------- innodb_gis.gis_split_nan : MDEV-21678 - Cannot get geometry object -innodb_gis.rtree_add_index : Include file modified in 10.2.35 -innodb_gis.rtree_compress : Include file modified in 10.2.35 innodb_gis.rtree_concurrent_srch : MDEV-15284 - Wrong result with embedded -innodb_gis.rtree_purge : MDEV-15275 - Timeout; include file modified in 10.2.35 +innodb_gis.rtree_purge : MDEV-15275 - Timeout innodb_gis.rtree_recovery : MDEV-15274 - Error on check innodb_gis.rtree_split : MDEV-14208 - Too many arguments -innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file; include file modified in 10.2.35 +innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file innodb_gis.types : MDEV-15679 - Table is marked as crashed #----------------------------------------------------------------------- @@ -412,24 +366,18 @@ maria.maria : MDEV-14430 - Extra warning #----------------------------------------------------------------------- -mariabackup.apply-log-only : MDEV-20135 - Timeout -mariabackup.backup_ssl : MDEV-24073 - Server crash upon shutdown -mariabackup.data_directory : MDEV-15270 - Error on exec -mariabackup.ddl_incremental_encrypted : Added in 10.2.35 -mariabackup.full_backup : MDEV-16571 - Wrong result -mariabackup.huge_lsn : MDEV-17286 - SSL error -mariabackup.incremental_backup : MDEV-21222 - Memory allocation failure -mariabackup.incremental_ddl_during_backup : Modified in 10.2.35 -mariabackup.incremental_encrypted : MDEV-15667 - Timeout -mariabackup.innodb_redo_overwrite : Added in 10.2.35 -mariabackup.mdev-14447 : MDEV-15201 - Timeout -mariabackup.mlog_index_load : Modified in 10.2.35 -mariabackup.partial_exclude : MDEV-15270 - Error on exec -mariabackup.rpl_slave_info : Added in 10.2.35 -mariabackup.unencrypted_page_compressed : Include file modified in 10.2.35 -mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault -mariabackup.xb_page_compress : MDEV-14810 - status: 1, errno: 11 -mariabackup.xb_partition : MDEV-17584 - Crash on shutdown +mariabackup.apply-log-only : MDEV-20135 - Timeout +mariabackup.backup_ssl : MDEV-24073 - Server crash upon shutdown +mariabackup.data_directory : MDEV-15270 - Error on exec +mariabackup.full_backup : MDEV-16571 - Wrong result +mariabackup.huge_lsn : MDEV-17286 - SSL error +mariabackup.incremental_backup : MDEV-21222 - Memory allocation failure +mariabackup.incremental_encrypted : MDEV-15667 - Timeout +mariabackup.mdev-14447 : MDEV-15201 - Timeout +mariabackup.partial_exclude : MDEV-15270 - Error on exec +mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault +mariabackup.xb_page_compress : MDEV-14810 - status: 1, errno: 11 +mariabackup.xb_partition : MDEV-17584 - Crash on shutdown #----------------------------------------------------------------------- @@ -453,8 +401,6 @@ multi_source.info_logs : MDEV-12629 - Valgrind, MDEV-10042 - Wrong result, MDE multi_source.mdev-8874 : MDEV-19415 - AddressSanitizer: heap-use-after-free multi_source.mdev-9544 : MDEV-19415 - AddressSanitizer: heap-use-after-free multi_source.multisource : MDEV-10417 - Fails on Mips -multi_source.reset_slave : MDEV-10690 - Wrong result -multi_source.simple : MDEV-4633 - Wrong result multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_heartbeats #----------------------------------------------------------------------- @@ -503,7 +449,7 @@ perfschema_stress.* : MDEV-10996 - Not maintained plugins.feedback_plugin_send : MDEV-7932, MDEV-11118 - Connection problems and such plugins.processlist : MDEV-16574 - Wrong result -plugins.server_audit : MDEV-9562 - crashes on sol10-sparc; modified in 10.2.35 +plugins.server_audit : MDEV-9562 - crashes on sol10-sparc plugins.thread_pool_server_audit : MDEV-14295 - Wrong result #----------------------------------------------------------------------- @@ -553,7 +499,6 @@ rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log rpl.rpl_binlog_errors : MDEV-12742 - Crash -rpl.rpl_binlog_index : Modified in 10.2.35 rpl.rpl_checksum_cache : MDEV-22510 - Server crash rpl.rpl_colSize : MDEV-16112 - Server crash rpl.rpl_ctype_latin1 : MDEV-14813 - Wrong result on Mac @@ -563,13 +508,10 @@ rpl.rpl_domain_id_filter_master_crash : MDEV-19043 - Warnings/errors rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result rpl.rpl_drop_db_fail : MDEV-16898 - Slave fails to start rpl.rpl_extra_col_master_innodb : MDEV-16570 - Extra warning -rpl.rpl_filter_tables_dynamic : Modified in 10.2.35 -rpl.rpl_filter_wild_tables_dynamic : Modified in 10.2.35 rpl.rpl_flushlog_loop : MDEV-21570 - Server crash rpl.rpl_get_lock : MDEV-19368 - mysqltest failed but provided no output rpl.rpl_gtid_basic : MDEV-10681 - server startup problem -rpl.rpl_gtid_crash : MDEV-13643 - Lost connection; modified in 10.2.35 -rpl.rpl_gtid_delete_domain : MDEV-14463 - Timeout; MDEV-23103 - Could not delete gtid domain; modified in 10.2.35 +rpl.rpl_gtid_crash : MDEV-13643 - Lost connection rpl.rpl_gtid_errorhandling : MDEV-13261 - Crash rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings rpl.rpl_gtid_reconnect : MDEV-14497 - Crash @@ -587,12 +529,9 @@ rpl.rpl_mariadb_slave_capability : MDEV-11018 - Extra lines in binlog rpl.rpl_mdev12179 : MDEV-19043 - Warnings/errors rpl.rpl_mdev6020 : MDEV-23426 - Server crash, ASAN failures; MDEV-15272 - Server crash rpl.rpl_mixed_mixing_engines : MDEV-21266 - Timeout -rpl.rpl_mysql_upgrade : Modified in 10.2.35 rpl.rpl_non_direct_row_mixing_engines : MDEV-16561 - Timeout in master_pos_wait rpl.rpl_parallel : MDEV-10653 - Timeouts -rpl.rpl_parallel2 : Modified in 10.2.35 rpl.rpl_parallel_conflicts : MDEV-15272 - Server crash -rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure rpl.rpl_parallel_multilevel2 : MDEV-14723 - Timeout rpl.rpl_parallel_optimistic : MDEV-15278 - Failed to sync with master rpl.rpl_parallel_optimistic_nobinlog : MDEV-15278 - Failed to sync with master @@ -613,19 +552,15 @@ rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed rpl.rpl_row_index_choice : MDEV-15196 - Slave crash rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x rpl.rpl_row_until : MDEV-14052 - Master will not send events with checksum -rpl.rpl_semi_sync : MDEV-11220 - Wrong result -rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result -rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings -rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Assorted failures +rpl.rpl_semi_sync_uninstall_plugin : MDEV-24561 - Wrong usage of mutex; MDEV-7140 - Assorted failures rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition rpl.rpl_show_slave_hosts : MDEV-10681 - Crash rpl.rpl_skip_replication : MDEV-23372 - Extra warning -rpl.rpl_slave_grp_exec : MDEV-10514 - Deadlock; ; modified in 10.2.35 rpl.rpl_slave_load_tmpdir_not_exist : MDEV-23372 - Extra warning rpl.rpl_slow_query_log : MDEV-13250 - Test abort rpl.rpl_sp_effects : MDEV-13249 - Crash -rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout; modified in 10.2.35 +rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion rpl.rpl_stm_stop_middle_group : MDEV-13791 - Server crash rpl.rpl_sync : MDEV-10633 - Database page corruption @@ -635,7 +570,6 @@ rpl.rpl_trigger : MDEV-18055 - Wrong result rpl.rpl_truncate_3innodb : MDEV-19454 - Sporadic syntax error rpl.rpl_user_variables : MDEV-20522 - Wrong result rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result -rpl.show_status_stop_slave_race-7126 : Modified in 10.2.35 #----------------------------------------------------------------------- @@ -682,14 +616,9 @@ sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected err sys_vars.innodb_checksum_algorithm_basic : MDEV-21568 - Errno: 2000 sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash -sys_vars.replicate_do_db_basic : Modified in 10.2.35 -sys_vars.rpl_init_slave_func : Modified in 10.2.35 -sys_vars.session_track_system_variables_basic : Modified in 10.2.35 sys_vars.slow_query_log_func : MDEV-14273 - Wrong result sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result sys_vars.wait_timeout_func : MDEV-12896 - Wrong result -sys_vars.wsrep_cluster_address_basic : Modified in 10.2.35 -sys_vars.wsrep_on_basic : Configuration deleted in 10.2.35 #----------------------------------------------------------------------- @@ -721,7 +650,7 @@ tokudb_alter_table.hcad_all_add2 : MDEV-15269 - Timeout #----------------------------------------------------------------------- -tokudb_backup.* : MDEV-11001 - Missing include file +tokudb_backup.* : MDEV-11001 - Missing include file (Won't fix) #----------------------------------------------------------------------- @@ -738,11 +667,11 @@ tokudb_parts.partition_alter4_tokudb : MDEV-12640 - Lost connection #----------------------------------------------------------------------- -tokudb_rpl.* : MDEV-11001 - Missing include file +tokudb_rpl.* : MDEV-11001 - Missing include file (Won't fix) #----------------------------------------------------------------------- -tokudb_sys_vars.* : MDEV-11001 - Missing include file +tokudb_sys_vars.* : MDEV-11001 - Missing include file (Won't fix) #----------------------------------------------------------------------- @@ -760,14 +689,13 @@ unit.mf_iocache : MDEV-20952 - Buffer overflow vcol.not_supported : MDEV-10639 - Testcase timeout vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout -vcol.vcol_misc : MDEV-16651 - Wrong error message; modified in 10.2.35 +vcol.vcol_misc : MDEV-16651 - Wrong error message #----------------------------------------------------------------------- wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node wsrep.mdev_6832 : MDEV-14195 - Check testcase failed wsrep.pool_of_threads : MDEV-17345 - WSREP has not yet prepared node for application use -wsrep.variables : Modified in 10.2.35 #----------------------------------------------------------------------- |