From c7e68606c02b7f87a48c27eb358d4d07480f40f4 Mon Sep 17 00:00:00 2001 From: Arun Kuruvila Date: Tue, 1 Mar 2016 10:17:25 +0530 Subject: Bug#21920657: SSL-CA FAILS SILENTLY IF THE PATH CANNOT BE FOUND Description:- Failure during the validation of CA certificate path which is provided as an option for 'ssl-ca' returns two different errors for YaSSL and OPENSSL. Analysis:- 'ssl-ca', option used for specifying the ssl ca certificate path. Failing to validate this certificate with OPENSSL returns an error, "ERROR 2026 (HY000): SSL connection error: SSL_CTX_set_default_verify_paths failed". While YASSL returns "ERROR 2026 (HY000): SSL connection error: ASN: bad other signature confirmation". Error returned by the OPENSSL is correct since "SSL_CTX_load_verify_locations()" returns 0 (in case of OPENSSL) for the failure and sets error as "SSL_INITERR_BAD_PATHS". In case of YASSL, "SSL_CTX_load_verify_locations()" returns an error number which is less than or equal to 0 in case of error. Error numbers for YASSL is mentioned in the file, 'extra/yassl/include/openssl/ssl.h'(line no : 292). Also 'ssl-ca' does not accept tilde home directory path substitution. Fix:- The condition which checks for the error in the "SSL_CTX_load_verify_locations()" is changed in order to accommodate YASSL as well. A logic is written in "mysql_ssl_set()" in order accept the tilde home directory path substitution for all ssl options. --- mysql-test/r/ssl_ca.result | 24 ++++++++++++++++++++++++ mysql-test/t/ssl_ca.test | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 mysql-test/r/ssl_ca.result create mode 100644 mysql-test/t/ssl_ca.test (limited to 'mysql-test') diff --git a/mysql-test/r/ssl_ca.result b/mysql-test/r/ssl_ca.result new file mode 100644 index 00000000000..ffc5671f85f --- /dev/null +++ b/mysql-test/r/ssl_ca.result @@ -0,0 +1,24 @@ +# +# Bug#21920657: SSL-CA FAILS SILENTLY IF THE PATH CANNOT BE FOUND +# +# try to connect with wrong '--ssl-ca' path : should fail +ERROR 2026 (HY000): SSL connection error: SSL_CTX_set_default_verify_paths failed +# try to connect with correct '--ssl-ca' path : should connect +Variable_name Value +Ssl_cipher DHE-RSA-AES256-SHA +# +# Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY +# PATH SUBSTITUTION +# +# try to connect with '--ssl-ca' option using tilde home directoy +# path substitution : should connect +Variable_name Value +Ssl_cipher DHE-RSA-AES256-SHA +# try to connect with '--ssl-key' option using tilde home directoy +# path substitution : should connect +Variable_name Value +Ssl_cipher DHE-RSA-AES256-SHA +# try to connect with '--ssl-cert' option using tilde home directoy +# path substitution : should connect +Variable_name Value +Ssl_cipher DHE-RSA-AES256-SHA diff --git a/mysql-test/t/ssl_ca.test b/mysql-test/t/ssl_ca.test new file mode 100644 index 00000000000..92695de4b0d --- /dev/null +++ b/mysql-test/t/ssl_ca.test @@ -0,0 +1,35 @@ +--source include/have_ssl.inc +--source include/not_embedded.inc + +--echo # +--echo # Bug#21920657: SSL-CA FAILS SILENTLY IF THE PATH CANNOT BE FOUND +--echo # + +--echo # try to connect with wrong '--ssl-ca' path : should fail +--error 1 +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/wrong-cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1 + +--echo # try to connect with correct '--ssl-ca' path : should connect +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" + +--echo # +--echo # Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY +--echo # PATH SUBSTITUTION +--echo # + +--let $mysql_test_dir_path= `SELECT REPLACE('$MYSQL_TEST_DIR', '$HOME', '~')` + +--echo # try to connect with '--ssl-ca' option using tilde home directoy +--echo # path substitution : should connect +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--exec $MYSQL --ssl-ca=$mysql_test_dir_path/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" + +--echo # try to connect with '--ssl-key' option using tilde home directoy +--echo # path substitution : should connect +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$mysql_test_dir_path/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" + +--echo # try to connect with '--ssl-cert' option using tilde home directoy +--echo # path substitution : should connect +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$mysql_test_dir_path/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" -- cgit v1.2.1 From 8361151765cc5efd72ad18c5553f80aa440a1d83 Mon Sep 17 00:00:00 2001 From: Sujatha Sivakumar Date: Tue, 1 Mar 2016 12:29:51 +0530 Subject: Bug#20685029: SLAVE IO THREAD SHOULD STOP WHEN DISK IS FULL Bug#21753696: MAKE SHOW SLAVE STATUS NON BLOCKING IF IO THREAD WAITS FOR DISK SPACE Problem: ======== Currently SHOW SLAVE STATUS blocks if IO thread waits for disk space. This makes automation tools verifying server health block on taking relevant action. Finally this will create SHOW SLAVE STATUS piles. Analysis: ========= SHOW SLAVE STATUS hangs on mi->data_lock if relay log write is waiting for free disk space while holding mi->data_lock. mi->data_lock is needed to protect the format description event (mi->format_description_event) which is accessed by the clients running FLUSH LOGS and slave IO thread. Note relay log writes don't need to be protected by mi->data_lock, LOCK_log is used to protect relay log between IO and SQL thread (see MYSQL_BIN_LOG::append_event). The code takes mi->data_lock to protect mi->format_description_event during relay log rotate which might get triggered right after relay log write. Fix: ==== Release the data_lock just for the duration of writing into relay log. Made change to ensure the following lock order is maintained to avoid deadlocks. data_lock, LOCK_log data_lock is held during relay log rotations to protect the description event. --- mysql-test/include/assert_grep.inc | 154 +++++++++++++++++++++ mysql-test/include/rpl_init.inc | 31 ++++- mysql-test/include/rpl_reconnect.inc | 33 +++-- mysql-test/include/start_slave_sql.inc | 39 ++++++ .../rpl/r/rpl_io_thd_wait_for_disk_space.result | 15 ++ .../rpl/t/rpl_io_thd_wait_for_disk_space.test | 71 ++++++++++ 6 files changed, 329 insertions(+), 14 deletions(-) create mode 100644 mysql-test/include/assert_grep.inc create mode 100644 mysql-test/include/start_slave_sql.inc create mode 100644 mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result create mode 100644 mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test (limited to 'mysql-test') diff --git a/mysql-test/include/assert_grep.inc b/mysql-test/include/assert_grep.inc new file mode 100644 index 00000000000..a980a6d73b1 --- /dev/null +++ b/mysql-test/include/assert_grep.inc @@ -0,0 +1,154 @@ +# ==== Purpose ==== +# +# Grep a file for a pattern, produce a single string out of the +# matching lines, and assert that the string matches a given regular +# expression. +# +# ==== Usage ==== +# +# --let $assert_text= TEXT +# --let $assert_file= FILE +# --let $assert_select= REGEX +# [--let $assert_match= REGEX | --let $assert_count= NUMBER] +# [--let $assert_only_after= REGEX] +# --source include/assert_grep.inc +# +# Parameters: +# +# $assert_text +# Text that describes what is being checked. This text is written to +# the query log so it should not contain non-deterministic elements. +# +# $assert_file +# File to search. +# +# $assert_select +# All lines matching this text will be checked. +# +# $assert_match +# The script will find all lines that match $assert_select, +# concatenate them to a long string, and assert that it matches +# $assert_match. +# +# $assert_count +# Instead of asserting that the selected lines match +# $assert_match, assert that there were exactly $assert_count +# matching lines. +# +# $assert_only_after +# Reset all the lines matched and the counter when finding this pattern. +# It is useful for searching things in the mysqld.err log file just +# after the last server restart for example (discarding the log content +# of previous server executions). + + +if (!$assert_text) +{ + --die !!!ERROR IN TEST: you must set $assert_text +} +if (!$assert_file) +{ + --die !!!ERROR IN TEST: you must set $assert_file +} +if (!$assert_select) +{ + --die !!!ERROR IN TEST: you must set $assert_select +} +if ($assert_match == '') +{ + if ($assert_count == '') + { + --die !!!ERROR IN TEST: you must set either $assert_match or $assert_count + } +} +if ($assert_match != '') +{ + if ($assert_count != '') + { + --echo assert_text='$assert_text' assert_count='$assert_count' + --die !!!ERROR IN TEST: you must set only one of $assert_match or $assert_count + } +} + + +--let $include_filename= assert_grep.inc [$assert_text] +--source include/begin_include_file.inc + + +--let _AG_ASSERT_TEXT= $assert_text +--let _AG_ASSERT_FILE= $assert_file +--let _AG_ASSERT_SELECT= $assert_select +--let _AG_ASSERT_MATCH= $assert_match +--let _AG_ASSERT_COUNT= $assert_count +--let _AG_OUT= `SELECT CONCAT('$MYSQLTEST_VARDIR/tmp/_ag_', UUID())` +--let _AG_ASSERT_ONLY_AFTER= $assert_only_after + + +--perl + use strict; + use warnings; + my $file= $ENV{'_AG_ASSERT_FILE'}; + my $assert_select= $ENV{'_AG_ASSERT_SELECT'}; + my $assert_match= $ENV{'_AG_ASSERT_MATCH'}; + my $assert_count= $ENV{'_AG_ASSERT_COUNT'}; + my $assert_only_after= $ENV{'_AG_ASSERT_ONLY_AFTER'}; + my $out= $ENV{'_AG_OUT'}; + + my $result= ''; + my $count= 0; + open(FILE, "$file") or die("Error $? opening $file: $!\n"); + while () { + my $line = $_; + if ($assert_only_after && $line =~ /$assert_only_after/) { + $result = ""; + $count = 0; + } + if ($line =~ /$assert_select/) { + if ($assert_count ne '') { + $count++; + } + else { + $result .= $line; + } + } + } + close(FILE) or die("Error $? closing $file: $!"); + open OUT, "> $out" or die("Error $? opening $out: $!"); + if ($assert_count ne '' && ($count != $assert_count)) { + print OUT ($count) or die("Error $? writing $out: $!"); + } + elsif ($assert_count eq '' && $result !~ /$assert_match/) { + print OUT ($result) or die("Error $? writing $out: $!"); + } + else { + print OUT ("assert_grep.inc ok"); + } + close OUT or die("Error $? closing $out: $!"); +EOF + + +--let $_ag_outcome= `SELECT LOAD_FILE('$_AG_OUT')` +if ($_ag_outcome != 'assert_grep.inc ok') +{ + --source include/show_rpl_debug_info.inc + --echo include/assert_grep.inc failed! + --echo assert_text: '$assert_text' + --echo assert_file: '$assert_file' + --echo assert_select: '$assert_select' + --echo assert_match: '$assert_match' + --echo assert_count: '$assert_count' + --echo assert_only_after: '$assert_only_after' + if ($assert_match != '') + { + --echo matching lines: '$_ag_outcome' + } + if ($assert_count != '') + { + --echo number of matching lines: $_ag_outcome + } + --die assert_grep.inc failed. +} + + +--let $include_filename= include/assert_grep.inc [$assert_text] +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_init.inc b/mysql-test/include/rpl_init.inc index 2abfd901b03..820bc8e9016 100644 --- a/mysql-test/include/rpl_init.inc +++ b/mysql-test/include/rpl_init.inc @@ -43,6 +43,7 @@ # # [--let $rpl_server_count= 7] # --let $rpl_topology= 1->2->3->1->4, 2->5, 6->7 +# [--let $rpl_extra_connections_per_server= 1] # [--let $rpl_check_server_ids= 1] # [--let $rpl_skip_change_master= 1] # [--let $rpl_skip_start_slave= 1] @@ -65,6 +66,12 @@ # want to specify the empty topology (no server replicates at # all), you have to set $rpl_topology=none. # +# $rpl_extra_connections_per_server +# By default, this script creates connections server_N and +# server_N_1. If you can set this variable to a number, the +# script creates: +# server_N, server_N_1, ..., server_N_$rpl_extra_connections_per_server +# # $rpl_check_server_ids # If $rpl_check_server_ids is set, this script checks that the # @@server_id of all servers are different. This is normally @@ -139,8 +146,17 @@ if (!$SERVER_MYPORT_4) # Check that $rpl_server_count is set if (!$rpl_server_count) { - --let $_compute_rpl_server_count= `SELECT REPLACE('$rpl_topology', '->', ',')` - --let $rpl_server_count= `SELECT GREATEST($_compute_rpl_server_count)` + --let $rpl_server_count= `SELECT REPLACE('$rpl_topology', '->', ',')` + if (`SELECT LOCATE(',', '$rpl_server_count')`) + { + --let $rpl_server_count= `SELECT GREATEST($rpl_server_count)` + } +} + +--let $_rpl_extra_connections_per_server= $rpl_extra_connections_per_server +if ($_rpl_extra_connections_per_server == '') +{ + --let $_rpl_extra_connections_per_server= 1 } @@ -159,15 +175,20 @@ if (!$rpl_debug) # Create two connections to each server; reset master/slave, select # database, set autoinc variables. --let $_rpl_server= $rpl_server_count ---let $_rpl_one= _1 +--let $underscore= _ while ($_rpl_server) { # Connect. --let $rpl_server_number= $_rpl_server --let $rpl_connection_name= server_$_rpl_server --source include/rpl_connect.inc - --let $rpl_connection_name= server_$_rpl_server$_rpl_one - --source include/rpl_connect.inc + --let $_rpl_connection_number= 1 + while ($_rpl_connection_number <= $_rpl_extra_connections_per_server) + { + --let $rpl_connection_name= server_$_rpl_server$underscore$_rpl_connection_number + --source include/rpl_connect.inc + --inc $_rpl_connection_number + } # Configure server. --let $rpl_connection_name= server_$_rpl_server diff --git a/mysql-test/include/rpl_reconnect.inc b/mysql-test/include/rpl_reconnect.inc index cdbbd0a1bf1..673f382bac0 100644 --- a/mysql-test/include/rpl_reconnect.inc +++ b/mysql-test/include/rpl_reconnect.inc @@ -12,6 +12,7 @@ # ==== Usage ==== # # --let $rpl_server_number= N +# [--let $rpl_extra_connections_per_server= 1] # [--let $rpl_debug= 1] # --source include/rpl_reconnect.inc # @@ -21,7 +22,7 @@ # master server, 2 the slave server, 3 the 3rd server, and so on. # Cf. include/rpl_init.inc # -# $rpl_debug +# $rpl_extra_connections_per_server, $rpl_debug # See include/rpl_init.inc --let $include_filename= rpl_reconnect.inc @@ -32,6 +33,11 @@ if (!$rpl_server_number) --die ERROR IN TEST: you must set $rpl_server_number before you source rpl_connect.inc } +if ($_rpl_extra_connections_per_server == '') +{ + --let $_rpl_extra_connections_per_server= 1 +} + if ($rpl_debug) { @@ -72,10 +78,14 @@ if (!$_rpl_server_number) --source include/rpl_connection.inc --enable_reconnect ---let $_rpl_one= _1 ---let $rpl_connection_name= server_$rpl_server_number$_rpl_one ---source include/rpl_connection.inc ---enable_reconnect +--let $_rpl_connection_number= 1 +while ($_rpl_connection_number <= $_rpl_extra_connections_per_server) +{ + --let $rpl_connection_name= server_$rpl_server_number$underscore$_rpl_connection_number + --source include/rpl_connection.inc + --enable_reconnect + --inc $_rpl_connection_number +} if ($rpl_debug) { @@ -122,10 +132,15 @@ if (!$_rpl_server_number) --source include/wait_until_connected_again.inc --disable_reconnect ---let $rpl_connection_name= server_$rpl_server_number$_rpl_one ---source include/rpl_connection.inc ---source include/wait_until_connected_again.inc ---disable_reconnect +--let $_rpl_connection_number= 1 +while ($_rpl_connection_number <= $_rpl_extra_connections_per_server) +{ + --let $rpl_connection_name= server_$rpl_server_number$underscore$_rpl_connection_number + --source include/rpl_connection.inc + --source include/wait_until_connected_again.inc + --disable_reconnect + --inc $_rpl_connection_number +} --let $include_filename= rpl_reconnect.inc diff --git a/mysql-test/include/start_slave_sql.inc b/mysql-test/include/start_slave_sql.inc new file mode 100644 index 00000000000..9cb66a2eb40 --- /dev/null +++ b/mysql-test/include/start_slave_sql.inc @@ -0,0 +1,39 @@ +# ==== Purpose ==== +# +# Issues START SLAVE SQL_THREAD on the current connection. Then waits +# until the SQL thread has started, or until a timeout is reached. +# +# Please use this instead of 'START SLAVE SQL_THREAD', to reduce the +# risk of races in test cases. +# +# +# ==== Usage ==== +# +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/start_slave_sql.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= start_slave_sql.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +START SLAVE SQL_THREAD; +--source include/wait_for_slave_sql_to_start.inc + + +--let $include_filename= start_slave_sql.inc +--source include/end_include_file.inc diff --git a/mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result b/mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result new file mode 100644 index 00000000000..c601c9a4169 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result @@ -0,0 +1,15 @@ +include/master-slave.inc +[connection master] +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1); +CALL mtr.add_suppression("Disk is full writing"); +CALL mtr.add_suppression("Retry in 60 secs"); +include/stop_slave_sql.inc +SET @@GLOBAL.DEBUG= 'd,simulate_io_thd_wait_for_disk_space'; +INSERT INTO t1 VALUES(2); +include/wait_for_slave_param.inc [Slave_IO_State] +SET @@GLOBAL.DEBUG= '$debug_saved'; +include/assert_grep.inc [Found the disk full error message on the slave] +include/start_slave_sql.inc +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test b/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test new file mode 100644 index 00000000000..d0c74b94cd1 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test @@ -0,0 +1,71 @@ +# ==== Purpose ==== +# +# Check that the execution of SHOW SLAVE STATUS command is not blocked when IO +# thread is blocked waiting for disk space. +# +# ==== Implementation ==== +# +# Simulate a scenario where IO thread is waiting for disk space while writing +# into the relay log. Execute SHOW SLAVE STATUS command after IO thread is +# blocked waiting for space. The command should not be blocked. +# +# ==== References ==== +# +# Bug#21753696: MAKE SHOW SLAVE STATUS NON BLOCKING IF IO THREAD WAITS FOR +# DISK SPACE +# Bug#20685029: SLAVE IO THREAD SHOULD STOP WHEN DISK IS FULL +# +############################################################################### +--source include/have_debug.inc +--source include/master-slave.inc + +# Generate events to be replicated to the slave +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1); +--sync_slave_with_master + +# Those errors will only happen in the slave +CALL mtr.add_suppression("Disk is full writing"); +CALL mtr.add_suppression("Retry in 60 secs"); + +# Stop the SQL thread to avoid writing on disk +--source include/stop_slave_sql.inc + +# Set the debug option that will simulate disk full +--let $debug_saved= `SELECT @@GLOBAL.DEBUG` +SET @@GLOBAL.DEBUG= 'd,simulate_io_thd_wait_for_disk_space'; + +# Generate events to be replicated to the slave +--connection master +INSERT INTO t1 VALUES(2); + +--connection slave +# Wait until IO thread is queuing events from master +# Notice that this is performed by querying SHOW SLAVE STATUS +--let $slave_param= Slave_IO_State +--let $slave_param_value= Queueing master event to the relay log +--source include/wait_for_slave_param.inc + +# Get the relay log file name, also using SHOW SLAVE STATUS +--let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) + +# Restore the debug options to "simulate" freed space on disk +SET @@GLOBAL.DEBUG= '$debug_saved'; + +# There should be a message in the error log of the slave stating +# that it was waiting for space to write on the relay log. +--let $assert_file=$MYSQLTEST_VARDIR/log/mysqld.2.err +# Grep only after the message that the I/O thread has started +--let $assert_only_after= Slave I/O .* connected to master .*replication started in log .* at position +--let $assert_count= 1 +--let $assert_select=Disk is full writing .*$relay_log_file.* +--let $assert_text= Found the disk full error message on the slave +--source include/assert_grep.inc + +# Start the SQL thread to let the slave to sync and finish gracefully +--source include/start_slave_sql.inc + +# Cleanup +--connection master +DROP TABLE t1; +--source include/rpl_end.inc -- cgit v1.2.1 From 5102a7f278460027fc0ff8d47f2d3f4d72deeacd Mon Sep 17 00:00:00 2001 From: Sujatha Sivakumar Date: Mon, 7 Mar 2016 18:19:26 +0530 Subject: Bug#20685029: SLAVE IO THREAD SHOULD STOP WHEN DISK IS FULL Bug#21753696: MAKE SHOW SLAVE STATUS NON BLOCKING IF IO THREAD WAITS FOR DISK SPACE Fixing a post push test issue. --- mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test b/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test index d0c74b94cd1..9eed1089e6d 100644 --- a/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test +++ b/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test @@ -17,6 +17,9 @@ # ############################################################################### --source include/have_debug.inc +# Inorder to grep a specific error pattern in error log a fresh error log +# needs to be generated. +--source include/force_restart.inc --source include/master-slave.inc # Generate events to be replicated to the slave -- cgit v1.2.1 From 3a8f43bec76d3d93a809b6a3c76e26e946ba0425 Mon Sep 17 00:00:00 2001 From: Sujatha Sivakumar Date: Mon, 11 Apr 2016 11:41:47 +0530 Subject: Bug#22897202: RPL_IO_THD_WAIT_FOR_DISK_SPACE HAS OCCASIONAL FAILURES Analysis: ========= Test script is not ensuring that "assert_grep.inc" should be called only after 'Disk is full' error is written to the error log. Test checks for "Queueing master event to the relay log" state. But this state is set before invoking 'queue_event'. Actual 'Disk is full' error happens at a very lower level. It can happen that we might even reset the debug point before even the actual disk full simulation occurs and the "Disk is full" message will never appear in the error log. In order to guarentee that we must have some mechanism where in after we write "Disk is full" error messge into the error log we must signal the test to execute SSS and then reset the debug point. So that test is deterministic. Fix: === Added debug sync point to make script deterministic. --- mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result | 2 +- mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result b/mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result index c601c9a4169..b11ad4f53bd 100644 --- a/mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result +++ b/mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result @@ -7,7 +7,7 @@ CALL mtr.add_suppression("Retry in 60 secs"); include/stop_slave_sql.inc SET @@GLOBAL.DEBUG= 'd,simulate_io_thd_wait_for_disk_space'; INSERT INTO t1 VALUES(2); -include/wait_for_slave_param.inc [Slave_IO_State] +SET DEBUG_SYNC='now WAIT_FOR parked'; SET @@GLOBAL.DEBUG= '$debug_saved'; include/assert_grep.inc [Found the disk full error message on the slave] include/start_slave_sql.inc diff --git a/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test b/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test index 9eed1089e6d..6076be60ebc 100644 --- a/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test +++ b/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test @@ -42,16 +42,13 @@ SET @@GLOBAL.DEBUG= 'd,simulate_io_thd_wait_for_disk_space'; --connection master INSERT INTO t1 VALUES(2); ---connection slave -# Wait until IO thread is queuing events from master -# Notice that this is performed by querying SHOW SLAVE STATUS ---let $slave_param= Slave_IO_State ---let $slave_param_value= Queueing master event to the relay log ---source include/wait_for_slave_param.inc +--connection slave1 +SET DEBUG_SYNC='now WAIT_FOR parked'; -# Get the relay log file name, also using SHOW SLAVE STATUS +# Get the relay log file name using SHOW SLAVE STATUS --let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) +--connection slave # Restore the debug options to "simulate" freed space on disk SET @@GLOBAL.DEBUG= '$debug_saved'; -- cgit v1.2.1 From 3b6f9aac02b126db57fa3e3f1873713438d0a950 Mon Sep 17 00:00:00 2001 From: Nisha Gopalakrishnan Date: Fri, 22 Apr 2016 10:25:16 +0530 Subject: BUG#23135731: INSERT WITH DUPLICATE KEY UPDATE REPORTS INCORRECT ERROR. Analysis ======== INSERT with DUPLICATE KEY UPDATE and REPLACE on a table where foreign key constraint is defined fails with an incorrect 'duplicate entry' error rather than foreign key constraint violation error. As part of the bug fix for BUG#22037930, a new flag 'HA_CHECK_FK_ERROR' was added while checking for non fatal errors to manage FK errors based on the 'IGNORE' flag. For INSERT with DUPLICATE KEY UPDATE and REPLACE queries, the foreign key constraint violation error was marked as non-fatal, even though IGNORE was not set. Hence it continued with the duplicate key processing resulting in an incorrect error. Fix: === Foreign key violation errors are treated as non fatal only when the IGNORE is not set in the above mentioned queries. Hence reports the appropriate foreign key violation error. --- mysql-test/r/insert.result | 15 +++++++++++++++ mysql-test/t/insert.test | 22 ++++++++++++++++++++++ 2 files changed, 37 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 1aa22349593..e840b95f1ba 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -724,3 +724,18 @@ ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (` UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3; ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) DROP TABLE t2, t1; +# +# BUG#22037930: INSERT IGNORE FAILS TO IGNORE FOREIGN +# KEY CONSTRAINT +CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= INNODB; +CREATE TABLE t2 (fld1 VARCHAR(10), fld2 INT NOT NULL, +CONSTRAINT fk FOREIGN KEY (fld2) REFERENCES t1(fld1)) ENGINE= INNODB; +# Without patch, reports incorrect error. +INSERT INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def'; +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) +REPLACE INTO t2 VALUES('abc', 2); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) +INSERT IGNORE INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def'; +Warnings: +Warning 1452 `test`.`t2`, CONSTRAINT `fk` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`) +DROP TABLE t2, t1; diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index ea89872200c..94cf5d3b475 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -591,3 +591,25 @@ UPDATE t1, t2 SET t2.fld2= t2.fld2 + 3; UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3; DROP TABLE t2, t1; + + +--echo # +--echo # BUG#22037930: INSERT IGNORE FAILS TO IGNORE FOREIGN +--echo # KEY CONSTRAINT + +CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= INNODB; + +CREATE TABLE t2 (fld1 VARCHAR(10), fld2 INT NOT NULL, +CONSTRAINT fk FOREIGN KEY (fld2) REFERENCES t1(fld1)) ENGINE= INNODB; + +--echo # Without patch, reports incorrect error. +--error ER_NO_REFERENCED_ROW_2 +INSERT INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def'; +--error ER_NO_REFERENCED_ROW_2 +REPLACE INTO t2 VALUES('abc', 2); + +--enable_warnings +INSERT IGNORE INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def'; +--disable_warnings + +DROP TABLE t2, t1; -- cgit v1.2.1 From 72d23896d6590de7af3566e1f74f8dd1134f11f3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 26 Apr 2016 19:06:20 +0200 Subject: 5.6.30 --- mysql-test/suite/perfschema/r/sizing_low.result | 1 + mysql-test/suite/perfschema/r/table_name.result | 156 ++++++++++++++++++++++ mysql-test/suite/perfschema/t/sizing_low.test | 1 + mysql-test/suite/perfschema/t/table_name.test | 164 ++++++++++++++++++++++++ 4 files changed, 322 insertions(+) create mode 100644 mysql-test/suite/perfschema/r/table_name.result create mode 100644 mysql-test/suite/perfschema/t/table_name.test (limited to 'mysql-test') diff --git a/mysql-test/suite/perfschema/r/sizing_low.result b/mysql-test/suite/perfschema/r/sizing_low.result index dce5a994099..a698f55aa07 100644 --- a/mysql-test/suite/perfschema/r/sizing_low.result +++ b/mysql-test/suite/perfschema/r/sizing_low.result @@ -67,3 +67,4 @@ Performance_schema_table_instances_lost 0 Performance_schema_thread_classes_lost 0 Performance_schema_thread_instances_lost 0 Performance_schema_users_lost 0 +CALL mtr.add_suppression("innodb_open_files should not be greater than the open_files_limit."); diff --git a/mysql-test/suite/perfschema/r/table_name.result b/mysql-test/suite/perfschema/r/table_name.result new file mode 100644 index 00000000000..d6369ffc79e --- /dev/null +++ b/mysql-test/suite/perfschema/r/table_name.result @@ -0,0 +1,156 @@ + +# +# TEST 1: Normal tables prefixed with "#sql" and "sql". +# +USE test; +CREATE TABLE `#sql_1` (a int, b text); +INSERT INTO `#sql_1` VALUES(1,'one'); + +CREATE TABLE `sql_1` (a int, b text); +INSERT INTO `sql_1` VALUES(1,'one'); + +# Verify that the tables are treated as normal tables . + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name +TABLE test #sql_1 +TABLE test sql_1 + +# Drop the tables, verify that the table objects are removed. + +DROP TABLE `#sql_1`; +DROP TABLE `sql_1`; + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# +# TEST 2: Temporary tables, no special prefix. +# +CREATE TEMPORARY TABLE sql_temp2_myisam (a int, b text) ENGINE=MYISAM; +INSERT INTO sql_temp2_myisam VALUES(1,'one'); + +CREATE TEMPORARY TABLE sql_temp2_innodb (a int, b text) ENGINE=INNODB; +INSERT INTO sql_temp2_innodb VALUES(1,'one'); + +# Confirm that the temporary tables are ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# Drop the tables, verify that the table objects are not created. + +DROP TABLE sql_temp2_myisam; +DROP TABLE sql_temp2_innodb; + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# +# TEST 3: Temporary tables with the "#sql" prefix. +# +CREATE TEMPORARY TABLE `#sql_temp3_myisam` (a int, b text) ENGINE=MYISAM; +CHECK TABLE `#sql_temp3_myisam`; +Table Op Msg_type Msg_text +test.#sql_temp3_myisam check status OK +INSERT INTO `#sql_temp3_myisam` VALUES(1,'one'); + +CREATE TEMPORARY TABLE `#sql_temp3_innodb` (a int, b text) ENGINE=INNODB; +CHECK TABLE `#sql_temp3_innodb`; +Table Op Msg_type Msg_text +test.#sql_temp3_innodb check status OK +INSERT INTO `#sql_temp3_innodb` VALUES(1,'one'); + +# Confirm that the temporary tables are ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# Drop the temporary tables. + +DROP TABLE `#sql_temp3_myisam`; +DROP TABLE `#sql_temp3_innodb`; + +# Confirm that the temporary tables are still ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# +# TEST 4: Special case: MyISAM temporary tables are recreated as non-temporary +# when they are truncated. +# +CREATE TEMPORARY TABLE `sql_temp4_myisam` (a int, b text) ENGINE=MYISAM; +INSERT INTO `sql_temp4_myisam` VALUES(1,'one'); + +CREATE TEMPORARY TABLE `#sql_temp4_myisam` (a int, b text) ENGINE=MYISAM; +INSERT INTO `#sql_temp4_myisam` VALUES(1,'one'); + +# Confirm that the MyISAM temporary tables are ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# Truncate the MyISAM temporary tables, forcing them to be recreated as non-temporary. + +TRUNCATE TABLE `sql_temp4_myisam`; +TRUNCATE TABLE `#sql_temp4_myisam`; + +# Confirm that the recreated MyISAM tables are still regarded as temporary and ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# Drop the recreated MyISAM tables; + +DROP TABLE `sql_temp4_myisam`; +DROP TABLE `#sql_temp4_myisam`; + +# Confirm that the recreated temporary tables are still ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# +# TEST 5: Generate temporary tables with ALTER MyISAM table. +# +USE test; +CREATE TABLE t1 (a int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1), (2), (3); +ALTER TABLE t1 ADD COLUMN (b int); + +# Confirm that the recreated temporary tables are still ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# Drop the MyISAM table + +DROP TABLE t1; + +# Confirm that no tables remain; + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name diff --git a/mysql-test/suite/perfschema/t/sizing_low.test b/mysql-test/suite/perfschema/t/sizing_low.test index 4d02d41aecd..56446fd6973 100644 --- a/mysql-test/suite/perfschema/t/sizing_low.test +++ b/mysql-test/suite/perfschema/t/sizing_low.test @@ -7,3 +7,4 @@ --source ../include/sizing_auto.inc +CALL mtr.add_suppression("innodb_open_files should not be greater than the open_files_limit."); diff --git a/mysql-test/suite/perfschema/t/table_name.test b/mysql-test/suite/perfschema/t/table_name.test new file mode 100644 index 00000000000..00df678a392 --- /dev/null +++ b/mysql-test/suite/perfschema/t/table_name.test @@ -0,0 +1,164 @@ +# +# Performance Schema +# +# Verify that the Performance Schema correctly identifies normal and temporary +# tables with non-standard names. + +# The server uses the table name prefix "#sql" for temporary and intermediate +# tables, however user-defined tables having the "#sql" prefix are also permitted. +# Independent of the table name, temporary or intermediate tables always have the +# "#sql" prefix in the filename. (For non-temporary tables starting with "#", +# the "#" is encoded to @0023 in the filename.) +# +# Given the ambiguity with temporary table names, the Performance Schema identifies +# temporary tables tables either by the table category or by the filename. +# +--source include/have_perfschema.inc +--source include/not_embedded.inc + +--echo +--echo # +--echo # TEST 1: Normal tables prefixed with "#sql" and "sql". +--echo # +USE test; +CREATE TABLE `#sql_1` (a int, b text); +# INSERT forces path through get_table_share() +INSERT INTO `#sql_1` VALUES(1,'one'); +--echo +CREATE TABLE `sql_1` (a int, b text); +INSERT INTO `sql_1` VALUES(1,'one'); +--echo +--echo # Verify that the tables are treated as normal tables . +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +--echo +--echo # Drop the tables, verify that the table objects are removed. +--echo +DROP TABLE `#sql_1`; +DROP TABLE `sql_1`; +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; + +--echo +--echo # +--echo # TEST 2: Temporary tables, no special prefix. +--echo # +CREATE TEMPORARY TABLE sql_temp2_myisam (a int, b text) ENGINE=MYISAM; +INSERT INTO sql_temp2_myisam VALUES(1,'one'); +--echo +CREATE TEMPORARY TABLE sql_temp2_innodb (a int, b text) ENGINE=INNODB; +INSERT INTO sql_temp2_innodb VALUES(1,'one'); +--echo +--echo # Confirm that the temporary tables are ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +--echo +--echo # Drop the tables, verify that the table objects are not created. +--echo +DROP TABLE sql_temp2_myisam; +DROP TABLE sql_temp2_innodb; +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; + +--echo +--echo # +--echo # TEST 3: Temporary tables with the "#sql" prefix. +--echo # +CREATE TEMPORARY TABLE `#sql_temp3_myisam` (a int, b text) ENGINE=MYISAM; +CHECK TABLE `#sql_temp3_myisam`; +INSERT INTO `#sql_temp3_myisam` VALUES(1,'one'); +--echo +CREATE TEMPORARY TABLE `#sql_temp3_innodb` (a int, b text) ENGINE=INNODB; +CHECK TABLE `#sql_temp3_innodb`; +INSERT INTO `#sql_temp3_innodb` VALUES(1,'one'); +--echo +--echo # Confirm that the temporary tables are ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +--echo +--echo # Drop the temporary tables. +--echo +DROP TABLE `#sql_temp3_myisam`; +DROP TABLE `#sql_temp3_innodb`; +--echo +--echo # Confirm that the temporary tables are still ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; + +--echo +--echo # +--echo # TEST 4: Special case: MyISAM temporary tables are recreated as non-temporary +--echo # when they are truncated. +--echo # +CREATE TEMPORARY TABLE `sql_temp4_myisam` (a int, b text) ENGINE=MYISAM; +INSERT INTO `sql_temp4_myisam` VALUES(1,'one'); +--echo +CREATE TEMPORARY TABLE `#sql_temp4_myisam` (a int, b text) ENGINE=MYISAM; +INSERT INTO `#sql_temp4_myisam` VALUES(1,'one'); +--echo +--echo # Confirm that the MyISAM temporary tables are ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +--echo +--echo # Truncate the MyISAM temporary tables, forcing them to be recreated as non-temporary. +--echo +TRUNCATE TABLE `sql_temp4_myisam`; +TRUNCATE TABLE `#sql_temp4_myisam`; +--echo +--echo # Confirm that the recreated MyISAM tables are still regarded as temporary and ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +--echo +--echo # Drop the recreated MyISAM tables; +--echo +DROP TABLE `sql_temp4_myisam`; +DROP TABLE `#sql_temp4_myisam`; +--echo +--echo # Confirm that the recreated temporary tables are still ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; + +--echo +--echo # +--echo # TEST 5: Generate temporary tables with ALTER MyISAM table. +--echo # +USE test; +CREATE TABLE t1 (a int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1), (2), (3); +# Force a path throug mysql_alter_table() and ha_create_table(). +ALTER TABLE t1 ADD COLUMN (b int); +--echo +--echo # Confirm that the recreated temporary tables are still ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +--echo +--echo # Drop the MyISAM table +--echo +DROP TABLE t1; + +--echo +--echo # Confirm that no tables remain; +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; -- cgit v1.2.1 From 964c4f070a7e96bf45979d8755beb10aa6e6617b Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 10 May 2016 19:13:06 +0400 Subject: MDEV-10052 Illegal mix of collations with DAYNAME(date_field)<>varchar_field --- mysql-test/r/locale.result | 28 ++++++++++++++++++++++++++++ mysql-test/t/locale.test | 19 +++++++++++++++++++ 2 files changed, 47 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/locale.result b/mysql-test/r/locale.result index 195468c4c12..6de1d0708ca 100644 --- a/mysql-test/r/locale.result +++ b/mysql-test/r/locale.result @@ -101,3 +101,31 @@ Februar SELECT monthname('2001-03-01'); monthname('2001-03-01') März +# +# MDEV-10052 Illegal mix of collations with DAYNAME(date_field)<>varchar_field +# +SET NAMES utf8; +CREATE TABLE t1 (c VARCHAR(8) CHARACTER SET latin1, d DATE); +INSERT INTO t1 VALUES ('test',now()); +Warnings: +Note 1265 Data truncated for column 'd' at row 1 +SET lc_time_names=ru_RU; +SELECT c FROM t1 WHERE DAYNAME(d)<>c; +ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<>' +SELECT c FROM t1 WHERE MONTHNAME(d)<>c; +ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<>' +SET lc_time_names=en_US; +SELECT c FROM t1 WHERE DAYNAME(d)<>c; +c +test +SELECT c FROM t1 WHERE MONTHNAME(d)<>c; +c +test +SET NAMES latin1; +SELECT c FROM t1 WHERE DAYNAME(d)<>c; +c +test +SELECT c FROM t1 WHERE MONTHNAME(d)<>c; +c +test +DROP TABLE t1; diff --git a/mysql-test/t/locale.test b/mysql-test/t/locale.test index 899d293545d..4944dc7a228 100644 --- a/mysql-test/t/locale.test +++ b/mysql-test/t/locale.test @@ -63,3 +63,22 @@ SET lc_time_names=de_AT; SELECT monthname('2001-01-01'); SELECT monthname('2001-02-01'); SELECT monthname('2001-03-01'); + +--echo # +--echo # MDEV-10052 Illegal mix of collations with DAYNAME(date_field)<>varchar_field +--echo # +SET NAMES utf8; +CREATE TABLE t1 (c VARCHAR(8) CHARACTER SET latin1, d DATE); +INSERT INTO t1 VALUES ('test',now()); +SET lc_time_names=ru_RU; +--error ER_CANT_AGGREGATE_2COLLATIONS +SELECT c FROM t1 WHERE DAYNAME(d)<>c; +--error ER_CANT_AGGREGATE_2COLLATIONS +SELECT c FROM t1 WHERE MONTHNAME(d)<>c; +SET lc_time_names=en_US; +SELECT c FROM t1 WHERE DAYNAME(d)<>c; +SELECT c FROM t1 WHERE MONTHNAME(d)<>c; +SET NAMES latin1; +SELECT c FROM t1 WHERE DAYNAME(d)<>c; +SELECT c FROM t1 WHERE MONTHNAME(d)<>c; +DROP TABLE t1; -- cgit v1.2.1 From ef3f09f0c9e62ea1bf86b33b5d97e954b3ae34fe Mon Sep 17 00:00:00 2001 From: Sujatha Sivakumar Date: Fri, 13 May 2016 16:42:45 +0530 Subject: Bug#23251517: SEMISYNC REPLICATION HANGING Revert following bug fix: Bug#20685029: SLAVE IO THREAD SHOULD STOP WHEN DISK IS FULL Bug#21753696: MAKE SHOW SLAVE STATUS NON BLOCKING IF IO THREAD WAITS FOR DISK SPACE This fix results in a deadlock between slave IO thread and SQL thread. (cherry picked from commit e3fea6c6dbb36c6ab21c4ab777224560e9608b53) --- mysql-test/include/assert_grep.inc | 154 --------------------- mysql-test/include/rpl_init.inc | 31 +---- mysql-test/include/rpl_reconnect.inc | 33 ++--- mysql-test/include/start_slave_sql.inc | 39 ------ .../rpl/r/rpl_io_thd_wait_for_disk_space.result | 15 -- .../rpl/t/rpl_io_thd_wait_for_disk_space.test | 71 ---------- 6 files changed, 14 insertions(+), 329 deletions(-) delete mode 100644 mysql-test/include/assert_grep.inc delete mode 100644 mysql-test/include/start_slave_sql.inc delete mode 100644 mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result delete mode 100644 mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test (limited to 'mysql-test') diff --git a/mysql-test/include/assert_grep.inc b/mysql-test/include/assert_grep.inc deleted file mode 100644 index a980a6d73b1..00000000000 --- a/mysql-test/include/assert_grep.inc +++ /dev/null @@ -1,154 +0,0 @@ -# ==== Purpose ==== -# -# Grep a file for a pattern, produce a single string out of the -# matching lines, and assert that the string matches a given regular -# expression. -# -# ==== Usage ==== -# -# --let $assert_text= TEXT -# --let $assert_file= FILE -# --let $assert_select= REGEX -# [--let $assert_match= REGEX | --let $assert_count= NUMBER] -# [--let $assert_only_after= REGEX] -# --source include/assert_grep.inc -# -# Parameters: -# -# $assert_text -# Text that describes what is being checked. This text is written to -# the query log so it should not contain non-deterministic elements. -# -# $assert_file -# File to search. -# -# $assert_select -# All lines matching this text will be checked. -# -# $assert_match -# The script will find all lines that match $assert_select, -# concatenate them to a long string, and assert that it matches -# $assert_match. -# -# $assert_count -# Instead of asserting that the selected lines match -# $assert_match, assert that there were exactly $assert_count -# matching lines. -# -# $assert_only_after -# Reset all the lines matched and the counter when finding this pattern. -# It is useful for searching things in the mysqld.err log file just -# after the last server restart for example (discarding the log content -# of previous server executions). - - -if (!$assert_text) -{ - --die !!!ERROR IN TEST: you must set $assert_text -} -if (!$assert_file) -{ - --die !!!ERROR IN TEST: you must set $assert_file -} -if (!$assert_select) -{ - --die !!!ERROR IN TEST: you must set $assert_select -} -if ($assert_match == '') -{ - if ($assert_count == '') - { - --die !!!ERROR IN TEST: you must set either $assert_match or $assert_count - } -} -if ($assert_match != '') -{ - if ($assert_count != '') - { - --echo assert_text='$assert_text' assert_count='$assert_count' - --die !!!ERROR IN TEST: you must set only one of $assert_match or $assert_count - } -} - - ---let $include_filename= assert_grep.inc [$assert_text] ---source include/begin_include_file.inc - - ---let _AG_ASSERT_TEXT= $assert_text ---let _AG_ASSERT_FILE= $assert_file ---let _AG_ASSERT_SELECT= $assert_select ---let _AG_ASSERT_MATCH= $assert_match ---let _AG_ASSERT_COUNT= $assert_count ---let _AG_OUT= `SELECT CONCAT('$MYSQLTEST_VARDIR/tmp/_ag_', UUID())` ---let _AG_ASSERT_ONLY_AFTER= $assert_only_after - - ---perl - use strict; - use warnings; - my $file= $ENV{'_AG_ASSERT_FILE'}; - my $assert_select= $ENV{'_AG_ASSERT_SELECT'}; - my $assert_match= $ENV{'_AG_ASSERT_MATCH'}; - my $assert_count= $ENV{'_AG_ASSERT_COUNT'}; - my $assert_only_after= $ENV{'_AG_ASSERT_ONLY_AFTER'}; - my $out= $ENV{'_AG_OUT'}; - - my $result= ''; - my $count= 0; - open(FILE, "$file") or die("Error $? opening $file: $!\n"); - while () { - my $line = $_; - if ($assert_only_after && $line =~ /$assert_only_after/) { - $result = ""; - $count = 0; - } - if ($line =~ /$assert_select/) { - if ($assert_count ne '') { - $count++; - } - else { - $result .= $line; - } - } - } - close(FILE) or die("Error $? closing $file: $!"); - open OUT, "> $out" or die("Error $? opening $out: $!"); - if ($assert_count ne '' && ($count != $assert_count)) { - print OUT ($count) or die("Error $? writing $out: $!"); - } - elsif ($assert_count eq '' && $result !~ /$assert_match/) { - print OUT ($result) or die("Error $? writing $out: $!"); - } - else { - print OUT ("assert_grep.inc ok"); - } - close OUT or die("Error $? closing $out: $!"); -EOF - - ---let $_ag_outcome= `SELECT LOAD_FILE('$_AG_OUT')` -if ($_ag_outcome != 'assert_grep.inc ok') -{ - --source include/show_rpl_debug_info.inc - --echo include/assert_grep.inc failed! - --echo assert_text: '$assert_text' - --echo assert_file: '$assert_file' - --echo assert_select: '$assert_select' - --echo assert_match: '$assert_match' - --echo assert_count: '$assert_count' - --echo assert_only_after: '$assert_only_after' - if ($assert_match != '') - { - --echo matching lines: '$_ag_outcome' - } - if ($assert_count != '') - { - --echo number of matching lines: $_ag_outcome - } - --die assert_grep.inc failed. -} - - ---let $include_filename= include/assert_grep.inc [$assert_text] ---source include/end_include_file.inc diff --git a/mysql-test/include/rpl_init.inc b/mysql-test/include/rpl_init.inc index 820bc8e9016..2abfd901b03 100644 --- a/mysql-test/include/rpl_init.inc +++ b/mysql-test/include/rpl_init.inc @@ -43,7 +43,6 @@ # # [--let $rpl_server_count= 7] # --let $rpl_topology= 1->2->3->1->4, 2->5, 6->7 -# [--let $rpl_extra_connections_per_server= 1] # [--let $rpl_check_server_ids= 1] # [--let $rpl_skip_change_master= 1] # [--let $rpl_skip_start_slave= 1] @@ -66,12 +65,6 @@ # want to specify the empty topology (no server replicates at # all), you have to set $rpl_topology=none. # -# $rpl_extra_connections_per_server -# By default, this script creates connections server_N and -# server_N_1. If you can set this variable to a number, the -# script creates: -# server_N, server_N_1, ..., server_N_$rpl_extra_connections_per_server -# # $rpl_check_server_ids # If $rpl_check_server_ids is set, this script checks that the # @@server_id of all servers are different. This is normally @@ -146,17 +139,8 @@ if (!$SERVER_MYPORT_4) # Check that $rpl_server_count is set if (!$rpl_server_count) { - --let $rpl_server_count= `SELECT REPLACE('$rpl_topology', '->', ',')` - if (`SELECT LOCATE(',', '$rpl_server_count')`) - { - --let $rpl_server_count= `SELECT GREATEST($rpl_server_count)` - } -} - ---let $_rpl_extra_connections_per_server= $rpl_extra_connections_per_server -if ($_rpl_extra_connections_per_server == '') -{ - --let $_rpl_extra_connections_per_server= 1 + --let $_compute_rpl_server_count= `SELECT REPLACE('$rpl_topology', '->', ',')` + --let $rpl_server_count= `SELECT GREATEST($_compute_rpl_server_count)` } @@ -175,20 +159,15 @@ if (!$rpl_debug) # Create two connections to each server; reset master/slave, select # database, set autoinc variables. --let $_rpl_server= $rpl_server_count ---let $underscore= _ +--let $_rpl_one= _1 while ($_rpl_server) { # Connect. --let $rpl_server_number= $_rpl_server --let $rpl_connection_name= server_$_rpl_server --source include/rpl_connect.inc - --let $_rpl_connection_number= 1 - while ($_rpl_connection_number <= $_rpl_extra_connections_per_server) - { - --let $rpl_connection_name= server_$_rpl_server$underscore$_rpl_connection_number - --source include/rpl_connect.inc - --inc $_rpl_connection_number - } + --let $rpl_connection_name= server_$_rpl_server$_rpl_one + --source include/rpl_connect.inc # Configure server. --let $rpl_connection_name= server_$_rpl_server diff --git a/mysql-test/include/rpl_reconnect.inc b/mysql-test/include/rpl_reconnect.inc index 673f382bac0..cdbbd0a1bf1 100644 --- a/mysql-test/include/rpl_reconnect.inc +++ b/mysql-test/include/rpl_reconnect.inc @@ -12,7 +12,6 @@ # ==== Usage ==== # # --let $rpl_server_number= N -# [--let $rpl_extra_connections_per_server= 1] # [--let $rpl_debug= 1] # --source include/rpl_reconnect.inc # @@ -22,7 +21,7 @@ # master server, 2 the slave server, 3 the 3rd server, and so on. # Cf. include/rpl_init.inc # -# $rpl_extra_connections_per_server, $rpl_debug +# $rpl_debug # See include/rpl_init.inc --let $include_filename= rpl_reconnect.inc @@ -33,11 +32,6 @@ if (!$rpl_server_number) --die ERROR IN TEST: you must set $rpl_server_number before you source rpl_connect.inc } -if ($_rpl_extra_connections_per_server == '') -{ - --let $_rpl_extra_connections_per_server= 1 -} - if ($rpl_debug) { @@ -78,14 +72,10 @@ if (!$_rpl_server_number) --source include/rpl_connection.inc --enable_reconnect ---let $_rpl_connection_number= 1 -while ($_rpl_connection_number <= $_rpl_extra_connections_per_server) -{ - --let $rpl_connection_name= server_$rpl_server_number$underscore$_rpl_connection_number - --source include/rpl_connection.inc - --enable_reconnect - --inc $_rpl_connection_number -} +--let $_rpl_one= _1 +--let $rpl_connection_name= server_$rpl_server_number$_rpl_one +--source include/rpl_connection.inc +--enable_reconnect if ($rpl_debug) { @@ -132,15 +122,10 @@ if (!$_rpl_server_number) --source include/wait_until_connected_again.inc --disable_reconnect ---let $_rpl_connection_number= 1 -while ($_rpl_connection_number <= $_rpl_extra_connections_per_server) -{ - --let $rpl_connection_name= server_$rpl_server_number$underscore$_rpl_connection_number - --source include/rpl_connection.inc - --source include/wait_until_connected_again.inc - --disable_reconnect - --inc $_rpl_connection_number -} +--let $rpl_connection_name= server_$rpl_server_number$_rpl_one +--source include/rpl_connection.inc +--source include/wait_until_connected_again.inc +--disable_reconnect --let $include_filename= rpl_reconnect.inc diff --git a/mysql-test/include/start_slave_sql.inc b/mysql-test/include/start_slave_sql.inc deleted file mode 100644 index 9cb66a2eb40..00000000000 --- a/mysql-test/include/start_slave_sql.inc +++ /dev/null @@ -1,39 +0,0 @@ -# ==== Purpose ==== -# -# Issues START SLAVE SQL_THREAD on the current connection. Then waits -# until the SQL thread has started, or until a timeout is reached. -# -# Please use this instead of 'START SLAVE SQL_THREAD', to reduce the -# risk of races in test cases. -# -# -# ==== Usage ==== -# -# [--let $slave_timeout= NUMBER] -# [--let $rpl_debug= 1] -# --source include/start_slave_sql.inc -# -# Parameters: -# $slave_timeout -# See include/wait_for_slave_param.inc -# -# $rpl_debug -# See include/rpl_init.inc - - ---let $include_filename= start_slave_sql.inc ---source include/begin_include_file.inc - - -if (!$rpl_debug) -{ - --disable_query_log -} - - -START SLAVE SQL_THREAD; ---source include/wait_for_slave_sql_to_start.inc - - ---let $include_filename= start_slave_sql.inc ---source include/end_include_file.inc diff --git a/mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result b/mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result deleted file mode 100644 index b11ad4f53bd..00000000000 --- a/mysql-test/suite/rpl/r/rpl_io_thd_wait_for_disk_space.result +++ /dev/null @@ -1,15 +0,0 @@ -include/master-slave.inc -[connection master] -CREATE TABLE t1(a INT); -INSERT INTO t1 VALUES(1); -CALL mtr.add_suppression("Disk is full writing"); -CALL mtr.add_suppression("Retry in 60 secs"); -include/stop_slave_sql.inc -SET @@GLOBAL.DEBUG= 'd,simulate_io_thd_wait_for_disk_space'; -INSERT INTO t1 VALUES(2); -SET DEBUG_SYNC='now WAIT_FOR parked'; -SET @@GLOBAL.DEBUG= '$debug_saved'; -include/assert_grep.inc [Found the disk full error message on the slave] -include/start_slave_sql.inc -DROP TABLE t1; -include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test b/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test deleted file mode 100644 index 6076be60ebc..00000000000 --- a/mysql-test/suite/rpl/t/rpl_io_thd_wait_for_disk_space.test +++ /dev/null @@ -1,71 +0,0 @@ -# ==== Purpose ==== -# -# Check that the execution of SHOW SLAVE STATUS command is not blocked when IO -# thread is blocked waiting for disk space. -# -# ==== Implementation ==== -# -# Simulate a scenario where IO thread is waiting for disk space while writing -# into the relay log. Execute SHOW SLAVE STATUS command after IO thread is -# blocked waiting for space. The command should not be blocked. -# -# ==== References ==== -# -# Bug#21753696: MAKE SHOW SLAVE STATUS NON BLOCKING IF IO THREAD WAITS FOR -# DISK SPACE -# Bug#20685029: SLAVE IO THREAD SHOULD STOP WHEN DISK IS FULL -# -############################################################################### ---source include/have_debug.inc -# Inorder to grep a specific error pattern in error log a fresh error log -# needs to be generated. ---source include/force_restart.inc ---source include/master-slave.inc - -# Generate events to be replicated to the slave -CREATE TABLE t1(a INT); -INSERT INTO t1 VALUES(1); ---sync_slave_with_master - -# Those errors will only happen in the slave -CALL mtr.add_suppression("Disk is full writing"); -CALL mtr.add_suppression("Retry in 60 secs"); - -# Stop the SQL thread to avoid writing on disk ---source include/stop_slave_sql.inc - -# Set the debug option that will simulate disk full ---let $debug_saved= `SELECT @@GLOBAL.DEBUG` -SET @@GLOBAL.DEBUG= 'd,simulate_io_thd_wait_for_disk_space'; - -# Generate events to be replicated to the slave ---connection master -INSERT INTO t1 VALUES(2); - ---connection slave1 -SET DEBUG_SYNC='now WAIT_FOR parked'; - -# Get the relay log file name using SHOW SLAVE STATUS ---let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) - ---connection slave -# Restore the debug options to "simulate" freed space on disk -SET @@GLOBAL.DEBUG= '$debug_saved'; - -# There should be a message in the error log of the slave stating -# that it was waiting for space to write on the relay log. ---let $assert_file=$MYSQLTEST_VARDIR/log/mysqld.2.err -# Grep only after the message that the I/O thread has started ---let $assert_only_after= Slave I/O .* connected to master .*replication started in log .* at position ---let $assert_count= 1 ---let $assert_select=Disk is full writing .*$relay_log_file.* ---let $assert_text= Found the disk full error message on the slave ---source include/assert_grep.inc - -# Start the SQL thread to let the slave to sync and finish gracefully ---source include/start_slave_sql.inc - -# Cleanup ---connection master -DROP TABLE t1; ---source include/rpl_end.inc -- cgit v1.2.1 From a8422fa241db4779c68df219e48130b11ececc99 Mon Sep 17 00:00:00 2001 From: iangilfillan Date: Fri, 27 May 2016 18:25:14 +0200 Subject: Update sponsors --- mysql-test/r/contributors.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result index 1820c0a5f06..1e01ca81990 100644 --- a/mysql-test/r/contributors.result +++ b/mysql-test/r/contributors.result @@ -7,7 +7,7 @@ Visma http://visma.com Member of the MariaDB Foundation Nexedi http://www.nexedi.com Member of the MariaDB Foundation Acronis http://www.acronis.com Member of the MariaDB Foundation Verkkokauppa.com Finland Sponsor of the MariaDB Foundation -Webyog Bangalore Sponsor of the MariaDB Foundation +Virtuozzo https://virtuozzo.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 -- cgit v1.2.1 From 0f252702b15dfb5d90446fd49c9e28aa93424eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 8 Jun 2016 08:40:10 +0300 Subject: MDEV-7139: Sporadic failure in innodb.innodb_corrupt_bit on P8 Use direct persistent index corruption set on InnoDB dictionary for this test. Do not allow creating new indexes if one of the existing indexes is already marked as corrupted. --- .../suite/innodb/r/innodb_corrupt_bit.result | 90 +++++++--------------- mysql-test/suite/innodb/t/innodb_corrupt_bit.test | 84 +++++++------------- 2 files changed, 56 insertions(+), 118 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result index 2ba79ced75f..bc4334bd219 100644 --- a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result +++ b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result @@ -1,83 +1,49 @@ -set names utf8; -CREATE TABLE corrupt_bit_test_ā( -a INT AUTO_INCREMENT PRIMARY KEY, -b CHAR(100), -c INT, -z INT, -INDEX(b)) -ENGINE=InnoDB; -INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1); -CREATE UNIQUE INDEX idxā ON corrupt_bit_test_ā(c, b); -CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b); -SELECT * FROM corrupt_bit_test_ā; a b c z 1 x 1 1 -select @@unique_checks; -@@unique_checks -0 -select @@innodb_change_buffering_debug; -@@innodb_change_buffering_debug -1 -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+10,z+10 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+20,z+20 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+50,z+50 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+100,z+100 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+200,z+200 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+400,z+400 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+800,z+800 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1600,z+1600 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+4000,z+4000 FROM corrupt_bit_test_ā; -select count(*) from corrupt_bit_test_ā; count(*) -1024 -CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); -INSERT INTO corrupt_bit_test_ā VALUES(13000,'x',1,1); -CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); -check table corrupt_bit_test_ā; +2 Table Op Msg_type Msg_text -test.corrupt_bit_test_ā check Warning InnoDB: The B-tree of index "idxā" is corrupted. -test.corrupt_bit_test_ā check Warning InnoDB: The B-tree of index "idxē" is corrupted. +test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted +test.corrupt_bit_test_ā check Warning InnoDB: Index "idxā" is marked as corrupted +test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted test.corrupt_bit_test_ā check error Corrupt -select c from corrupt_bit_test_ā; ERROR HY000: Index corrupt_bit_test_ā is corrupted -select z from corrupt_bit_test_ā; ERROR HY000: Index corrupt_bit_test_ā is corrupted -show warnings; +ERROR HY000: Index corrupt_bit_test_ā is corrupted +ERROR HY000: Index corrupt_bit_test_ā is corrupted Level Code Message Warning 179 InnoDB: Index "idxē" for table "test"."corrupt_bit_test_ā" is marked as corrupted Warning 179 Got error 179 when reading table `test`.`corrupt_bit_test_ā` Error 1712 Index corrupt_bit_test_ā is corrupted -insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); -select * from corrupt_bit_test_ā use index(primary) where a = 10001; a b c z 10001 a 20001 20001 -begin; -insert into corrupt_bit_test_ā values (10002, "a", 20002, 20002); -delete from corrupt_bit_test_ā where a = 10001; -insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); -rollback; -drop index idxā on corrupt_bit_test_ā; -check table corrupt_bit_test_ā; Table Op Msg_type Msg_text +test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted test.corrupt_bit_test_ā check error Corrupt -set names utf8; -select z from corrupt_bit_test_ā; ERROR HY000: Index corrupt_bit_test_ā is corrupted -drop index idxē on corrupt_bit_test_ā; -select z from corrupt_bit_test_ā limit 10; +Table Create Table +corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` ( + `a` int(11) NOT NULL AUTO_INCREMENT, + `b` char(100) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `z` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `idxē` (`z`,`b`), + KEY `idx` (`b`) +) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1 +ERROR HY000: Index corrupt_bit_test_ā is corrupted +ERROR HY000: Index corrupt_bit_test_ā is corrupted +Table Create Table +corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` ( + `a` int(11) NOT NULL AUTO_INCREMENT, + `b` char(100) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `z` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `idx` (`b`) +) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1 z 20001 1 -1 2 -11 -12 -21 -22 -31 -32 -drop table corrupt_bit_test_ā; -DROP DATABASE pad; -SET GLOBAL innodb_change_buffering_debug = 0; diff --git a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test index 88da919bfaa..f67e2e7e047 100644 --- a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test +++ b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test @@ -2,45 +2,23 @@ # Test for persistent corrupt bit for corrupted index and table # -- source include/have_innodb.inc - -# Issues with innodb_change_buffering_debug on Windows, so the test scenario -# cannot be created on windows ---source include/not_windows.inc - +-- source include/not_embedded.inc # This test needs debug server ---source include/have_debug.inc +-- source include/have_debug.inc -- disable_query_log call mtr.add_suppression("Flagged corruption of idx.*in CHECK TABLE"); -# This test setup is extracted from bug56680.test: -# The flag innodb_change_buffering_debug is only available in debug builds. -# It instructs InnoDB to try to evict pages from the buffer pool when -# change buffering is possible, so that the change buffer will be used -# whenever possible. -SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug; -SET GLOBAL innodb_change_buffering_debug = 1; - -# Turn off Unique Check to create corrupted index with dup key -SET UNIQUE_CHECKS=0; - -CREATE DATABASE pad; -let $i=338; -while ($i) -{ ---eval CREATE TABLE pad.t$i(a INT PRIMARY KEY)ENGINE=InnoDB; - dec $i; -} - --- enable_query_log set names utf8; +SET UNIQUE_CHECKS=0; + CREATE TABLE corrupt_bit_test_ā( a INT AUTO_INCREMENT PRIMARY KEY, b CHAR(100), c INT, z INT, - INDEX(b)) + INDEX idx(b)) ENGINE=InnoDB; INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1); @@ -53,38 +31,21 @@ CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b); SELECT * FROM corrupt_bit_test_ā; -select @@unique_checks; -select @@innodb_change_buffering_debug; - -# Create enough rows for the table, so that the insert buffer will be -# used for modifying the secondary index page. There must be multiple -# index pages, because changes to the root page are never buffered. - INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+10,z+10 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+20,z+20 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+50,z+50 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+100,z+100 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+200,z+200 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+400,z+400 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+800,z+800 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1600,z+1600 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+4000,z+4000 FROM corrupt_bit_test_ā; select count(*) from corrupt_bit_test_ā; -CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); - -# Create a dup key error on index "idxē" and "idxā" by inserting a dup value -INSERT INTO corrupt_bit_test_ā VALUES(13000,'x',1,1); +# This will flag all secondary indexes corrupted +SET SESSION debug_dbug="+d,dict_set_index_corrupted"; +check table corrupt_bit_test_ā; +SET SESSION debug_dbug="-d,dict_set_index_corrupted"; -# creating an index should succeed even if other secondary indexes are corrupted +# Cannot create new indexes while corrupted indexes exist +--error ER_INDEX_CORRUPT +CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); +--error ER_INDEX_CORRUPT CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); -# Check table will find the unique indexes corrupted -# with dup key -check table corrupt_bit_test_ā; - # This selection intend to use the corrupted index. Expect to fail -- error ER_INDEX_CORRUPT select c from corrupt_bit_test_ā; @@ -108,7 +69,6 @@ delete from corrupt_bit_test_ā where a = 10001; insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); rollback; -# Drop one corrupted index before reboot drop index idxā on corrupt_bit_test_ā; check table corrupt_bit_test_ā; @@ -118,14 +78,26 @@ set names utf8; -- error ER_INDEX_CORRUPT select z from corrupt_bit_test_ā; +show create table corrupt_bit_test_ā; + # Drop the corrupted index drop index idxē on corrupt_bit_test_ā; +# Cannot create new indexes while a corrupt index exists. +--error ER_INDEX_CORRUPT +CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); +--error ER_INDEX_CORRUPT +CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); + +show create table corrupt_bit_test_ā; +drop index idx on corrupt_bit_test_ā; + +# Now that there exist no corrupted indexes, we can create new indexes. +CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); +CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); + # Now select back to normal select z from corrupt_bit_test_ā limit 10; # Drop table drop table corrupt_bit_test_ā; -DROP DATABASE pad; - -SET GLOBAL innodb_change_buffering_debug = 0; -- cgit v1.2.1 From a4848e975d2fe359ff354e767427c01dbe908037 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 8 Jun 2016 19:04:12 +0400 Subject: MDEV-9972 Least function retuns date in date time format --- mysql-test/r/type_date.result | 7 ++++--- mysql-test/t/type_date.test | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 7678f038862..ecbda1d13e6 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -442,6 +442,7 @@ select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1; drop table t1; # # MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null +# MDEV-9972 Least function retuns date in date time format # CREATE TABLE t1 ( id BIGINT NOT NULL, @@ -465,9 +466,9 @@ LEAST(IFNULL(t2.date_fin, IFNULL(t1.date_fin, NULL)), IFNULL(t1.date_fin, IFNULL(t2.date_fin, NULL))) AS date_fin FROM t1 LEFT JOIN t2 ON (t1.id=t2.id); id date_debut date_fin -1 2016-01-01 2016-01-31 00:00:00 -2 2016-02-01 2016-01-28 00:00:00 -3 2016-03-01 2016-03-31 00:00:00 +1 2016-01-01 2016-01-31 +2 2016-02-01 2016-01-28 +3 2016-03-01 2016-03-31 4 2016-04-01 NULL DROP TABLE t1,t2; SELECT diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 4b058171ad2..8b0c5dcf330 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -388,6 +388,7 @@ drop table t1; --echo # --echo # MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null +--echo # MDEV-9972 Least function retuns date in date time format --echo # CREATE TABLE t1 ( id BIGINT NOT NULL, -- cgit v1.2.1 From df1448801ceba4d8d8a02db83ba022fea9e6755d Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 10 Jun 2016 15:50:19 +0400 Subject: MDEV-10181 Illegal mix of collation for a field and an ASCII string as a view field --- mysql-test/r/ctype_recoding.result | 33 ++++++++++++++++++++++++++++++++- mysql-test/t/ctype_recoding.test | 28 +++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index c84da0d7496..2555749fa8c 100644 --- a/mysql-test/r/ctype_recoding.result +++ b/mysql-test/r/ctype_recoding.result @@ -277,9 +277,40 @@ CREATE TABLE t1 ( a VARCHAR(1) ); INSERT INTO t1 VALUES ('m'),('n'); CREATE VIEW v1 AS SELECT 'w' ; SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 ); -ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<=' +a +m +n drop view v1; drop table t1; SET character_set_connection = default; SET optimizer_switch= default; #End of 5.3 tests +# +# Start of 5.5 tests +# +# +# MDEV-10181 Illegal mix of collation for a field and an ASCII string as a view field +# +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('A'),('a'),('B'),('b'); +CREATE VIEW v1 AS SELECT 'a'; +SELECT * FROM v1,t1 where t1.a=v1.a; +a a +a A +a a +DROP VIEW v1; +DROP TABLE t1; +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('a'),('b'),('c'); +CREATE VIEW v1 AS SELECT 'a' AS a UNION SELECT 'b'; +SELECT * FROM v1,t1 WHERE t1.a=v1.a; +a a +a a +b b +DROP VIEW v1; +DROP TABLE t1; +# +# End of 5.5 tests +# diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test index ee07ef24def..81c04fc9c30 100644 --- a/mysql-test/t/ctype_recoding.test +++ b/mysql-test/t/ctype_recoding.test @@ -220,7 +220,6 @@ SET character_set_connection = utf8; CREATE TABLE t1 ( a VARCHAR(1) ); INSERT INTO t1 VALUES ('m'),('n'); CREATE VIEW v1 AS SELECT 'w' ; ---error ER_CANT_AGGREGATE_2COLLATIONS SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 ); drop view v1; drop table t1; @@ -228,3 +227,30 @@ SET character_set_connection = default; SET optimizer_switch= default; --echo #End of 5.3 tests + +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # MDEV-10181 Illegal mix of collation for a field and an ASCII string as a view field +--echo # +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('A'),('a'),('B'),('b'); +CREATE VIEW v1 AS SELECT 'a'; +SELECT * FROM v1,t1 where t1.a=v1.a; +DROP VIEW v1; +DROP TABLE t1; + +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('a'),('b'),('c'); +CREATE VIEW v1 AS SELECT 'a' AS a UNION SELECT 'b'; +SELECT * FROM v1,t1 WHERE t1.a=v1.a; +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # End of 5.5 tests +--echo # -- cgit v1.2.1 From 4155d0937b98e57a93adbe5b5dc20d06ceda59e7 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 10 Jun 2016 17:06:38 +0400 Subject: MDEV-8402 Bug #77473 Truncated data with subquery & UTF8 --- mysql-test/r/ctype_utf8.result | 39 +++++++++++++++++++++++++++++++++++++++ mysql-test/r/ctype_utf8mb4.result | 34 ++++++++++++++++++++++++++++++++++ mysql-test/t/ctype_utf8.test | 23 +++++++++++++++++++++++ mysql-test/t/ctype_utf8mb4.test | 20 ++++++++++++++++++++ 4 files changed, 116 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 217d3ca26d8..121168c2a2a 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -5830,5 +5830,44 @@ OCTET_LENGTH(a) a 255 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA DROP TABLE t1; # +# MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8 +# +# +SET NAMES utf8; +SELECT length(rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2)) AS data; +data +131072 +SELECT length(data) AS len FROM ( +SELECT rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2) AS data +) AS sub; +len +131072 +SELECT length(rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2)) AS data; +data +131070 +SELECT length(data) AS len FROM ( +SELECT rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2) AS data +) AS sub; +len +131070 +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36766) AS data) AS sub; +len +73532 +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36767) AS data) AS sub; +len +73534 +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36778) AS data) AS sub; +len +73556 +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65535) AS data) AS sub; +len +131070 +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65536) AS data) AS sub; +len +131072 +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub; +len +131074 +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result index 448645ebbae..17a1a2f787e 100644 --- a/mysql-test/r/ctype_utf8mb4.result +++ b/mysql-test/r/ctype_utf8mb4.result @@ -2622,6 +2622,40 @@ OCTET_LENGTH(a) a 252 😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎 DROP TABLE t1; # +# MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8 +# +# +SET NAMES utf8mb4; +SELECT length(repeat(_utf8mb4 0xE29883, 21844)) AS data; +data +65532 +SELECT length(data) AS len +FROM ( SELECT repeat(_utf8mb4 0xE29883, 21844) AS data ) AS sub; +len +65532 +SELECT length(repeat(_utf8mb4 0xE29883, 21846)) AS data; +data +65538 +SELECT length(data) AS len +FROM ( SELECT repeat(_utf8mb4 0xE29883, 21846) AS data ) AS sub; +len +65538 +SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21844) AS data ) AS sub; +len +65532 +SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21845) AS data ) AS sub; +len +65535 +SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21846) AS data ) AS sub; +len +65538 +SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65535) AS data ) AS sub; +len +196605 +SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65536) AS data ) AS sub; +len +196608 +# # End of 5.5 tests # # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index a9b5cee11ce..d6fdc6c6a2c 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1658,6 +1658,29 @@ ALTER TABLE t1 MODIFY a TINYTEXT CHARACTER SET utf8; SELECT OCTET_LENGTH(a),a FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8 +--echo # +--echo # + +SET NAMES utf8; +SELECT length(rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2)) AS data; +SELECT length(data) AS len FROM ( + SELECT rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2) AS data +) AS sub; + +SELECT length(rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2)) AS data; +SELECT length(data) AS len FROM ( + SELECT rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2) AS data +) AS sub; + +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36766) AS data) AS sub; +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36767) AS data) AS sub; +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36778) AS data) AS sub; +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65535) AS data) AS sub; +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65536) AS data) AS sub; +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub; + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test index 66f5a3ba5ac..c240f261af4 100644 --- a/mysql-test/t/ctype_utf8mb4.test +++ b/mysql-test/t/ctype_utf8mb4.test @@ -1838,6 +1838,26 @@ SELECT OCTET_LENGTH(a),a FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8 +--echo # +--echo # + +SET NAMES utf8mb4; +SELECT length(repeat(_utf8mb4 0xE29883, 21844)) AS data; +SELECT length(data) AS len +FROM ( SELECT repeat(_utf8mb4 0xE29883, 21844) AS data ) AS sub; + +SELECT length(repeat(_utf8mb4 0xE29883, 21846)) AS data; +SELECT length(data) AS len +FROM ( SELECT repeat(_utf8mb4 0xE29883, 21846) AS data ) AS sub; + +SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21844) AS data ) AS sub; +SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21845) AS data ) AS sub; +SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21846) AS data ) AS sub; +SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65535) AS data ) AS sub; +SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65536) AS data ) AS sub; + --echo # --echo # End of 5.5 tests --echo # -- cgit v1.2.1 From 87007dc2f71634cc460271eb277ad851ec69c04b Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 8 Jun 2016 15:03:18 +0400 Subject: MDEV-9994 - Aria service threads are not "joined" Aria service threads are created "joinable", but they're not "joined" on completion. This causes memory leaks around thread local storage. Fixed by joining service thread. Simplified relevant code and cleaned up relevant valgrind suppressions. --- mysql-test/valgrind.supp | 70 ------------------------------------------------ 1 file changed, 70 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 29897e4bd6c..16b59b8a06f 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -19,36 +19,6 @@ # Suppress some common (not fatal) errors in system libraries found by valgrind # -# -# Pthread doesn't free all thread specific memory before program exists -# -{ - pthread allocate_tls memory loss - Memcheck:Leak - fun:calloc - fun:_dl_allocate_tls - fun:allocate_stack - fun:pthread_create* -} - -{ - pthread allocate_tls memory loss - Memcheck:Leak - fun:calloc - fun:_dl_allocate_tls - fun:pthread_create* - -} - -{ - pthread allocate_tls memory loss - Memcheck:Leak - fun:calloc - obj:/lib*/ld*.so - fun:_dl_allocate_tls - fun:pthread_create* -} - { pthead_exit memory loss 1 Memcheck:Leak @@ -89,34 +59,6 @@ fun:_dl_map_object_from_fd } -{ - pthread allocate_dtv memory loss - Memcheck:Leak - fun:calloc - fun:allocate_dtv - fun:_dl_allocate_tls_storage - fun:__GI__dl_allocate_tls - fun:pthread_create -} - -{ - pthread allocate_dtv memory loss second - Memcheck:Leak - fun:calloc - fun:allocate_dtv - fun:_dl_allocate_tls - fun:pthread_create* -} - -{ - pthread memalign memory loss - Memcheck:Leak - fun:memalign - fun:_dl_allocate_tls_storage - fun:__GI__dl_allocate_tls - fun:pthread_create -} - { pthread pthread_key_create Memcheck:Leak @@ -972,18 +914,6 @@ fun:nptl_pthread_exit_hack_handler } -# -# Pthread doesn't free all thread specific memory before program exists -# -{ - pthread allocate_tls memory loss in 2.6.1. - Memcheck:Leak - fun:calloc - obj:*/ld-*.so - fun:_dl_allocate_tls - fun:pthread_create* -} - { memory "leak" in backtrace() of glibc 2.9 (not present in 2.13) Memcheck:Leak -- cgit v1.2.1 From 67b4a6f576db102d652b401c3d0150556826f641 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Sun, 12 Jun 2016 20:14:51 +0300 Subject: MDEV-8859 rpl.rpl_mdev382 sporadically fails to finish due to disappeared expect file The combination of --remove_file and --write_file on .expect file creates a race condition which can be hit by MTR which reads the file in a loop. Instead, .expect file should be changed with --append_file. It was fixed in 10.x, but in 5.5 the sporadic failure still affected buildbot. Fixed 3 test files which use the problematic combination --- mysql-test/suite/binlog/t/binlog_mdev342.test | 3 +-- mysql-test/suite/rpl/t/rpl_mdev382.test | 3 +-- mysql-test/suite/storage_engine/alter_tablespace.test | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/binlog/t/binlog_mdev342.test b/mysql-test/suite/binlog/t/binlog_mdev342.test index 02310b87a76..024fa884f91 100644 --- a/mysql-test/suite/binlog/t/binlog_mdev342.test +++ b/mysql-test/suite/binlog/t/binlog_mdev342.test @@ -44,8 +44,7 @@ connection con1; --error 2006,2013 reap; ---remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect restart-binlog_mdev342.test EOF diff --git a/mysql-test/suite/rpl/t/rpl_mdev382.test b/mysql-test/suite/rpl/t/rpl_mdev382.test index 21925e0e130..784617bd198 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev382.test +++ b/mysql-test/suite/rpl/t/rpl_mdev382.test @@ -209,8 +209,7 @@ EOF --shutdown_server 30 ---remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect restart-rpl_mdev382.test EOF diff --git a/mysql-test/suite/storage_engine/alter_tablespace.test b/mysql-test/suite/storage_engine/alter_tablespace.test index dec16e5a3ac..6318b410e6e 100644 --- a/mysql-test/suite/storage_engine/alter_tablespace.test +++ b/mysql-test/suite/storage_engine/alter_tablespace.test @@ -53,8 +53,7 @@ EOF --replace_result $datadir --copy_file $datadir/test/t1.ibd $datadir/test/t1.ibd.save - --remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect - --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect + --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect restart EOF -- cgit v1.2.1 From d6a1bae57f369d6d1781b94696b87e81e39be4ca Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Mon, 13 Jun 2016 17:10:31 +0400 Subject: MDEV-10218 - rpl.rpl_binlog_errors fails in buildbot with valgrind warnings - bytes are possibly lost Restored suppressions removed by MDEV-9994: they're needed for detached threads. --- mysql-test/valgrind.supp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 16b59b8a06f..b86cbd23408 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -1047,3 +1047,22 @@ fun:_nss_dns_gethostbyaddr_r fun:gethostbyaddr_r } + + +# +# Detached threads may not complete deiniitialization by the time shutdown +# thread calls exit. This is unfortunate property of detached threads, which +# we currently can only ignore. Unfortunately there is no way to distinguish +# between false positives generated by detached threads and real memory leaks +# generated by not joined joinable threads. So we hide both cases. +# +# To avoid enumeration of the whole variety of possible traces we ignore all +# "possibly lost" blocks allocated by pthread_create (and it's callees). +# +{ + Detached threads memory loss + Memcheck:Leak + match-leak-kinds:possible + ... + fun:pthread_create* +} -- cgit v1.2.1 From 1b50d599606244677215fbe7b05be1a891fecf18 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Tue, 14 Jun 2016 14:44:09 +0400 Subject: MDEV-9945 - main.kill_processlist-6619 fails sporadically SHOW PROCESSLIST output can be affected by not completed concurrent KILL QUERY. Filter out more column values to make output stable. --- mysql-test/r/kill_processlist-6619.result | 4 ++-- mysql-test/t/kill_processlist-6619.test | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/kill_processlist-6619.result b/mysql-test/r/kill_processlist-6619.result index a3d971e2115..f14727f1696 100644 --- a/mysql-test/r/kill_processlist-6619.result +++ b/mysql-test/r/kill_processlist-6619.result @@ -6,5 +6,5 @@ SHOW PROCESSLIST; ERROR 70100: Query execution was interrupted SHOW PROCESSLIST; Id User Host db Command Time State Info Progress -# root # test Sleep # # NULL 0.000 -# root # test Query # # SHOW PROCESSLIST 0.000 +# root # test # # # # 0.000 +# root # test # # # # 0.000 diff --git a/mysql-test/t/kill_processlist-6619.test b/mysql-test/t/kill_processlist-6619.test index d73859ce8cd..28f98bcbb24 100644 --- a/mysql-test/t/kill_processlist-6619.test +++ b/mysql-test/t/kill_processlist-6619.test @@ -11,5 +11,5 @@ eval KILL QUERY $con_id; --connection con1 --error ER_QUERY_INTERRUPTED SHOW PROCESSLIST; ---replace_column 1 # 3 # 6 # 7 # +--replace_column 1 # 3 # 5 # 6 # 7 # 8 # SHOW PROCESSLIST; -- cgit v1.2.1 From 90eb30266bd88f9b101054ceb67d30ed4eee76e6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 14 Jun 2016 13:57:49 +0200 Subject: fix main.ssl_ca from mysql-5.5.50 1. to work for OpenSSL 2. to work when $HOME can match in the middle of $MYSQL_TEST_DIR --- mysql-test/t/ssl_ca.test | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/t/ssl_ca.test b/mysql-test/t/ssl_ca.test index 92695de4b0d..e0a5fa9ad07 100644 --- a/mysql-test/t/ssl_ca.test +++ b/mysql-test/t/ssl_ca.test @@ -10,6 +10,7 @@ --exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/wrong-cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1 --echo # try to connect with correct '--ssl-ca' path : should connect +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA --exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" --echo # @@ -17,19 +18,19 @@ --echo # PATH SUBSTITUTION --echo # ---let $mysql_test_dir_path= `SELECT REPLACE('$MYSQL_TEST_DIR', '$HOME', '~')` +--let $mysql_test_dir_path= `SELECT REPLACE('=$MYSQL_TEST_DIR', '=$HOME', '=~')` --echo # try to connect with '--ssl-ca' option using tilde home directoy --echo # path substitution : should connect ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL --ssl-ca=$mysql_test_dir_path/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA +--exec $MYSQL --ssl-ca$mysql_test_dir_path/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" --echo # try to connect with '--ssl-key' option using tilde home directoy --echo # path substitution : should connect ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$mysql_test_dir_path/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key$mysql_test_dir_path/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" --echo # try to connect with '--ssl-cert' option using tilde home directoy --echo # path substitution : should connect ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$mysql_test_dir_path/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert$mysql_test_dir_path/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" -- cgit v1.2.1 From c73b987e73343d49c0b98666552d7aeb1a9799da Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 14 Jun 2016 13:18:05 +0200 Subject: MDEV-8328 Evaluation of two "!" operators depends on space in beetween fix the lexer to backtrack when parsing "<=", "<>", "!=", ">=", "<<", ">>", "<=>". --- mysql-test/r/parser.result | 20 ++++++++++++++++++++ mysql-test/suite/plugins/r/server_audit.result | 2 +- .../suite/plugins/r/thread_pool_server_audit.result | 2 +- mysql-test/t/parser.test | 12 ++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index 915ace0c1b4..25143f97d9a 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -643,3 +643,23 @@ CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW SET default_storage_engine = NEW.INNODB; ERROR 42S22: Unknown column 'INNODB' in 'NEW' DROP TABLE t1; +select 0==0; +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 '=0' at line 1 +select 1=!0, 1 = ! 0; +1=!0 1 = ! 0 +1 1 +select !!0, ! ! 0; +!!0 ! ! 0 +0 0 +select 2>!0, 2 > ! 0; +2>!0 2 > ! 0 +1 1 +select 0<=!0, 0 <= !0; +0<=!0 0 <= !0 +1 1 +select 1<; -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 '=' at line 1 +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 '' at line 1 CREATE USER u3 IDENTIFIED BY ''; drop user u1, u2, u3; select 2; diff --git a/mysql-test/suite/plugins/r/thread_pool_server_audit.result b/mysql-test/suite/plugins/r/thread_pool_server_audit.result index 67338506001..2dcfa107103 100644 --- a/mysql-test/suite/plugins/r/thread_pool_server_audit.result +++ b/mysql-test/suite/plugins/r/thread_pool_server_audit.result @@ -165,7 +165,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'); SET PASSWORD FOR u1=; -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 '=' at line 1 +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 '' at line 1 CREATE USER u3 IDENTIFIED BY ''; drop user u1, u2, u3; select 2; diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test index 6899e2876a6..c6aa8927848 100644 --- a/mysql-test/t/parser.test +++ b/mysql-test/t/parser.test @@ -758,3 +758,15 @@ CREATE TABLE t1 (s VARCHAR(100)); CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW SET default_storage_engine = NEW.INNODB; DROP TABLE t1; + +# +# MDEV-8328 Evaluation of two "!" operators depends on space in beetween +# +--error ER_PARSE_ERROR +select 0==0; +select 1=!0, 1 = ! 0; +select !!0, ! ! 0; +select 2>!0, 2 > ! 0; +select 0<=!0, 0 <= !0; +select 1< Date: Tue, 14 Jun 2016 14:52:43 +0200 Subject: main.openssl_1 failure don't test a cipher that was removed from recent openssl versions --- mysql-test/r/openssl_1.result | 2 -- mysql-test/t/openssl_1.test | 1 - 2 files changed, 3 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index 44ea5795a95..a49a12c230d 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -198,8 +198,6 @@ Ssl_cipher DHE-RSA-AES256-SHA Variable_name Value Ssl_cipher EDH-RSA-DES-CBC3-SHA Variable_name Value -Ssl_cipher EDH-RSA-DES-CBC-SHA -Variable_name Value Ssl_cipher RC4-SHA select 'is still running; no cipher request crashed the server' as result from dual; result diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 1b28c40c0bf..62b5c9c10e0 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -222,7 +222,6 @@ DROP TABLE t1; # Common ciphers to openssl and yassl --exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=DHE-RSA-AES256-SHA --exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC3-SHA ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC-SHA --exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=RC4-SHA --disable_query_log --disable_result_log -- cgit v1.2.1 From 05bb3b9f85d68cc0e99a7b43c8b40cc07d272d76 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 14 Jun 2016 16:28:07 +0200 Subject: fix main.ssl_ca test for windows where $HOME is the empty string --- mysql-test/t/ssl_ca.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/t/ssl_ca.test b/mysql-test/t/ssl_ca.test index e0a5fa9ad07..3652040dd0b 100644 --- a/mysql-test/t/ssl_ca.test +++ b/mysql-test/t/ssl_ca.test @@ -18,7 +18,7 @@ --echo # PATH SUBSTITUTION --echo # ---let $mysql_test_dir_path= `SELECT REPLACE('=$MYSQL_TEST_DIR', '=$HOME', '=~')` +--let $mysql_test_dir_path= `SELECT IF(LENGTH('$HOME'), REPLACE('=$MYSQL_TEST_DIR', '=$HOME', '=~'), '=$MYSQL_TEST_DIR')` --echo # try to connect with '--ssl-ca' option using tilde home directoy --echo # path substitution : should connect -- cgit v1.2.1 From cf721d23cc90e7848b0611180b9777d080a1faf6 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 10 Dec 2015 17:00:14 +1100 Subject: MDEV-9257: Increase limit on parallel workers in mysql-test-run Signed-off-by: Daniel Black --- mysql-test/mysql-test-run.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 26b31d34d3c..63b18c6bebd 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1801,9 +1801,12 @@ sub set_build_thread_ports($) { if ( lc($opt_build_thread) eq 'auto' ) { my $found_free = 0; $build_thread = 300; # Start attempts from here + my $build_thread_upper = $build_thread + ($opt_parallel > 1500 + ? 3000 + : 2 * $opt_parallel); while (! $found_free) { - $build_thread= mtr_get_unique_id($build_thread, 349); + $build_thread= mtr_get_unique_id($build_thread, $build_thread_upper); if ( !defined $build_thread ) { mtr_error("Could not get a unique build thread id"); } -- cgit v1.2.1 From 0e50b924820d365bcc1659eec2cad606f6887597 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Thu, 16 Jun 2016 12:35:14 +0400 Subject: MDEV-9969 mysql_install_db error processing ignore_db_dirs. Check for same directories in the list added. --- mysql-test/r/mysqld_option_err.result | 1 + mysql-test/t/mysqld_option_err.test | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/mysqld_option_err.result b/mysql-test/r/mysqld_option_err.result index 4afcc5e0cb1..1870ea85270 100644 --- a/mysql-test/r/mysqld_option_err.result +++ b/mysql-test/r/mysqld_option_err.result @@ -5,4 +5,5 @@ Test non-numeric value passed to number option. Test that bad value for plugin enum option is rejected correctly. Test that --help --verbose works Test that --not-known-option --help --verbose gives error +Test that specifying same directory several times handled properly. Done. diff --git a/mysql-test/t/mysqld_option_err.test b/mysql-test/t/mysqld_option_err.test index 0c38eba7ca9..6f1e089fbe4 100644 --- a/mysql-test/t/mysqld_option_err.test +++ b/mysql-test/t/mysqld_option_err.test @@ -56,4 +56,12 @@ mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; --error 2 --exec $MYSQLD_BOOTSTRAP_CMD --not-known-option --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 +# +# MDEV-9969 mysql_install_db error processing ignore_db_dirs. +# + +--echo Test that specifying same directory several times handled properly. + +--exec echo "" | $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --ignore-db-dirs='some_dir' --ignore-db-dirs='some_dir' >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 + --echo Done. -- cgit v1.2.1 From 0a50e43e9df2f1e005591e22388e6d20f82edf72 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 16 Jun 2016 14:57:32 +0400 Subject: MDEV-9374 having '2015-01-01 01:00:00.000001' > coalesce(NULL) returns true The problem was earlier fixed by the patch for MDEV-9521. Adding tests only. --- mysql-test/r/type_datetime.result | 8 ++++++++ mysql-test/t/type_datetime.test | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 82b64d30d96..e033fe48607 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -834,5 +834,13 @@ a b a b DEALLOCATE PREPARE stmt1; DROP TABLE t1,t2; # +# MDEV-9374 having '2015-01-01 01:00:00.000001' > coalesce(NULL) returns true +# +CREATE TABLE t1 (c1 DATETIME(0)); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1 HAVING '2015-01-01 01:00:00.000001' > COALESCE(c1); +c1 +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index e44b190def0..3f96673c43f 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -610,6 +610,14 @@ EXECUTE stmt1; DEALLOCATE PREPARE stmt1; DROP TABLE t1,t2; +--echo # +--echo # MDEV-9374 having '2015-01-01 01:00:00.000001' > coalesce(NULL) returns true +--echo # +CREATE TABLE t1 (c1 DATETIME(0)); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1 HAVING '2015-01-01 01:00:00.000001' > COALESCE(c1); +DROP TABLE t1; + --echo # --echo # End of 5.5 tests --echo # -- cgit v1.2.1 From c7eef029533d71d1c83c231dde065184589930f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Thu, 16 Jun 2016 22:00:16 +0300 Subject: Increase the number of default build thread ids possibilities When running mysql-test-run without a parallel parameter, it might be impossible to find a free port. --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 63b18c6bebd..a85bed88395 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1803,7 +1803,7 @@ sub set_build_thread_ports($) { $build_thread = 300; # Start attempts from here my $build_thread_upper = $build_thread + ($opt_parallel > 1500 ? 3000 - : 2 * $opt_parallel); + : 2 * $opt_parallel) + 300; while (! $found_free) { $build_thread= mtr_get_unique_id($build_thread, $build_thread_upper); -- cgit v1.2.1 From e24a1833701d358b98d294716c2c1d24850bf982 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Sat, 18 Jun 2016 10:46:55 +0400 Subject: MDEV-9969 mysql_install_db error processing ignore_db_dirs. test failed on Windows so fixed by testing slightly differently. --- mysql-test/r/mysqld_option_err.result | 1 - mysql-test/t/bootstrap.test | 10 ++++++++++ mysql-test/t/mysqld_option_err.test | 8 -------- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/mysqld_option_err.result b/mysql-test/r/mysqld_option_err.result index 1870ea85270..4afcc5e0cb1 100644 --- a/mysql-test/r/mysqld_option_err.result +++ b/mysql-test/r/mysqld_option_err.result @@ -5,5 +5,4 @@ Test non-numeric value passed to number option. Test that bad value for plugin enum option is rejected correctly. Test that --help --verbose works Test that --not-known-option --help --verbose gives error -Test that specifying same directory several times handled properly. Done. diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test index e2d21c0d990..f92b7c5b148 100644 --- a/mysql-test/t/bootstrap.test +++ b/mysql-test/t/bootstrap.test @@ -89,3 +89,13 @@ drop table t1; --replace_result .dll .so select * from mysql.plugin; truncate table mysql.plugin; + + +# +# MDEV-9969 mysql_install_db error processing ignore_db_dirs. +# +--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql +use test; +EOF +--exec $MYSQLD_BOOTSTRAP_CMD --ignore-db-dirs='some_dir' --ignore-db-dirs='some_dir' < $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql diff --git a/mysql-test/t/mysqld_option_err.test b/mysql-test/t/mysqld_option_err.test index 6f1e089fbe4..0c38eba7ca9 100644 --- a/mysql-test/t/mysqld_option_err.test +++ b/mysql-test/t/mysqld_option_err.test @@ -56,12 +56,4 @@ mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; --error 2 --exec $MYSQLD_BOOTSTRAP_CMD --not-known-option --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 -# -# MDEV-9969 mysql_install_db error processing ignore_db_dirs. -# - ---echo Test that specifying same directory several times handled properly. - ---exec echo "" | $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --ignore-db-dirs='some_dir' --ignore-db-dirs='some_dir' >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 - --echo Done. -- cgit v1.2.1 From 70ad689b11bfbd8a30a777f4893a5384628c00e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 20 Jun 2016 09:58:31 +0300 Subject: MDEV-8633: information_schema.index_statistics doesn't delete item when drop table indexes or drop table; Problem was that table and index statistics is removed from persistent tables but not from memory cache. Added functions to remove table and index statistics from memory cache. --- mysql-test/r/information_schema_stats.result | 70 ++++++++++++++++++++++++++++ mysql-test/r/status_user.result | 4 -- mysql-test/t/information_schema_stats.test | 44 +++++++++++++++++ 3 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 mysql-test/r/information_schema_stats.result create mode 100644 mysql-test/t/information_schema_stats.test (limited to 'mysql-test') diff --git a/mysql-test/r/information_schema_stats.result b/mysql-test/r/information_schema_stats.result new file mode 100644 index 00000000000..cd73636879c --- /dev/null +++ b/mysql-test/r/information_schema_stats.result @@ -0,0 +1,70 @@ +set global userstat=1; +create table just_a_test(id int,first_name varchar(10),last_name varchar(10),address varchar(100),phone bigint,email varchar(30), state varchar(30)); +insert into just_a_test values(1,'fa','la','china_a',11111111,'fa_la@163.com','California'), +(2,'fb','lb','china_b',22222222,'fb_lb@163.com','Arizona'), +(3,'fc','lc','china_c',33333333,'fc_lc@163.com','California'), +(4,'fd','ld','china_d',44444444,'fd_ld@163.com','Utah'), +(5,'fe','le','china_e',55555555,'fe_le@163.com','Arizona'); +alter table just_a_test add primary key (id); +alter table just_a_test add key IND_just_a_test_first_name_last_name(first_name,last_name); +alter table just_a_test add key IND_just_a_test_state(state); +select count(*) from just_a_test where first_name='fc' and last_name='lc'; +count(*) +1 +select count(*) from just_a_test where state = 'California'; +count(*) +2 +select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ +test just_a_test IND_just_a_test_state 2 +test just_a_test IND_just_a_test_first_name_last_name 1 +select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +test just_a_test 18 5 5 +alter table just_a_test drop key IND_just_a_test_first_name_last_name; +select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ +test just_a_test IND_just_a_test_state 2 +select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +test just_a_test 23 5 5 +alter table just_a_test drop column state; +select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ +select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +test just_a_test 28 5 5 +drop table just_a_test; +select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ +select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +create table just_a_test(id int not null primary key,first_name varchar(10),last_name varchar(10),address varchar(100),phone bigint,email varchar(30), state varchar(30),key(first_name,last_name),key(state)); +insert into just_a_test values(1,'fa','la','china_a',11111111,'fa_la@163.com','California'), +(2,'fb','lb','china_b',22222222,'fb_lb@163.com','Arizona'), +(3,'fc','lc','china_c',33333333,'fc_lc@163.com','California'), +(4,'fd','ld','china_d',44444444,'fd_ld@163.com','Utah'), +(5,'fe','le','china_e',55555555,'fe_le@163.com','Arizona'); +select count(*) from just_a_test where first_name='fc' and last_name='lc'; +count(*) +1 +select count(*) from just_a_test where state = 'California'; +count(*) +2 +select count(*) from just_a_test where id between 2 and 4; +count(*) +3 +select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ +test just_a_test first_name 1 +test just_a_test state 2 +test just_a_test PRIMARY 5 +select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +test just_a_test 8 5 15 +drop table just_a_test; +select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ +select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; +TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES +set global userstat=0; diff --git a/mysql-test/r/status_user.result b/mysql-test/r/status_user.result index 829c8abb634..c6248a85d3a 100644 --- a/mysql-test/r/status_user.result +++ b/mysql-test/r/status_user.result @@ -128,16 +128,12 @@ handler_read_key set @@global.userstat=0; select * from information_schema.index_statistics; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ -test t1 PRIMARY 2 select * from information_schema.table_statistics; TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES -test t1 6 13 13 show table_statistics; Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes -test t1 6 13 13 show index_statistics; Table_schema Table_name Index_name Rows_read -test t1 PRIMARY 2 select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;; TOTAL_CONNECTIONS 1 CONCURRENT_CONNECTIONS 0 diff --git a/mysql-test/t/information_schema_stats.test b/mysql-test/t/information_schema_stats.test new file mode 100644 index 00000000000..38248063d68 --- /dev/null +++ b/mysql-test/t/information_schema_stats.test @@ -0,0 +1,44 @@ +# +# MDEV-8633: information_schema.index_statistics doesn't delete item when drop table indexes or drop table; +# +set global userstat=1; +create table just_a_test(id int,first_name varchar(10),last_name varchar(10),address varchar(100),phone bigint,email varchar(30), state varchar(30)); +insert into just_a_test values(1,'fa','la','china_a',11111111,'fa_la@163.com','California'), +(2,'fb','lb','china_b',22222222,'fb_lb@163.com','Arizona'), +(3,'fc','lc','china_c',33333333,'fc_lc@163.com','California'), +(4,'fd','ld','china_d',44444444,'fd_ld@163.com','Utah'), +(5,'fe','le','china_e',55555555,'fe_le@163.com','Arizona'); +alter table just_a_test add primary key (id); +alter table just_a_test add key IND_just_a_test_first_name_last_name(first_name,last_name); +alter table just_a_test add key IND_just_a_test_state(state); +select count(*) from just_a_test where first_name='fc' and last_name='lc'; +select count(*) from just_a_test where state = 'California'; +select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; +alter table just_a_test drop key IND_just_a_test_first_name_last_name; +select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; +alter table just_a_test drop column state; +select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; +drop table just_a_test; +select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; +# +# Test direct drop table +# +create table just_a_test(id int not null primary key,first_name varchar(10),last_name varchar(10),address varchar(100),phone bigint,email varchar(30), state varchar(30),key(first_name,last_name),key(state)); +insert into just_a_test values(1,'fa','la','china_a',11111111,'fa_la@163.com','California'), +(2,'fb','lb','china_b',22222222,'fb_lb@163.com','Arizona'), +(3,'fc','lc','china_c',33333333,'fc_lc@163.com','California'), +(4,'fd','ld','china_d',44444444,'fd_ld@163.com','Utah'), +(5,'fe','le','china_e',55555555,'fe_le@163.com','Arizona'); +select count(*) from just_a_test where first_name='fc' and last_name='lc'; +select count(*) from just_a_test where state = 'California'; +select count(*) from just_a_test where id between 2 and 4; +select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; +drop table just_a_test; +select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; +select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; +set global userstat=0; -- cgit v1.2.1 From a80dbe068ca650ef1f4daee2263f0bc6e7aeb0e1 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 20 Jun 2016 14:11:01 +0400 Subject: MDEV-10020 InnoDB NOT IN Query Crash When One Item Is NULL The problem was that the loop in get_func_mm_tree() accessed improperly initialized instances of String, which resided in the bzero'ed part of the in_vector::base array. Strings in in_vector::base are originally initialized in Item_func_in::fix_length_and_dec(), in in_vector::in_vector() using sql_calloc, rather than using a String constructor, so their str_charset members are originally equal to NULL. Strings in in_vector::base are later initialized to good values in Item_func_in::fix_length_and_dec(), using array->set(), in this code: uint j=0; for (uint i=1 ; i < arg_count ; i++) { array->set(j,args[i]); if (!args[i]->null_value) // Skip NULL values j++; else have_null= 1; } if ((array->used_count= j)) array->sort(); NULLs are not taken into account, so at the end array->used_count can be smaller than array->count. This patch fixes the loop in opt_range.cc, in get_func_mm_tree(), to access only properly initialized elements in in_vector::base, preventing access to its bzero'ed non-initialized tail. --- mysql-test/r/func_in.result | 19 +++++++++++++++++++ mysql-test/t/func_in.test | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index fc56660ac62..210b0a9ef91 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -812,3 +812,22 @@ EXECUTE s; 1 DROP TABLE t1; # End of 5.3 tests +# +# Start of 10.0 tests +# +# +# MDEV-10020 InnoDB NOT IN Query Crash When One Item Is NULL +# +CREATE TABLE t1 +( +a INT(11), +b VARCHAR(10), +KEY (b) +); +INSERT INTO t1 VALUES (1,'x'),(2,'y'),(3,'z'); +SELECT * FROM t1 WHERE b NOT IN (NULL, '', 'A'); +a b +DROP TABLE t1; +# +# End of 10.0 tests +# diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 1e695142d90..17736ac40c6 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -606,3 +606,24 @@ EXECUTE s; DROP TABLE t1; --echo # End of 5.3 tests + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-10020 InnoDB NOT IN Query Crash When One Item Is NULL +--echo # +CREATE TABLE t1 +( + a INT(11), + b VARCHAR(10), + KEY (b) +); +INSERT INTO t1 VALUES (1,'x'),(2,'y'),(3,'z'); +SELECT * FROM t1 WHERE b NOT IN (NULL, '', 'A'); +DROP TABLE t1; + +--echo # +--echo # End of 10.0 tests +--echo # -- cgit v1.2.1 From a482e76e65a4fee70479e877929381c86b1ec62f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 20 Jun 2016 16:12:54 +0200 Subject: fix a mysql-5.5.50 merge: mysqlcheck quote identifiers correctly --- mysql-test/r/mysqlcheck.result | 5 +++++ mysql-test/t/mysqlcheck.test | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index c5ba3e7dc79..d2f4745c5f1 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -339,3 +339,8 @@ Repairing views test.v1 OK drop view v1; drop table t1; +create table `#mysql50#t1``1` (a int) engine=myisam; +show tables; +Tables_in_test +t1`1 +drop table `t1``1`; diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index ac42e1e184d..7da14e3742a 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -350,3 +350,8 @@ create table t1(a int); --exec $MYSQL_CHECK --process-views --check-upgrade --auto-repair test drop view v1; drop table t1; + +create table `#mysql50#t1``1` (a int) engine=myisam; +--exec $MYSQL_CHECK --fix-table-names --databases test +show tables; +drop table `t1``1`; -- cgit v1.2.1 From 82a96926a77b38a36a031e34b2c4ff3e36406f3d Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 15 Jun 2016 13:57:44 +0400 Subject: MDEV-9728 - Hard crash in metadata_lock_info metadata_lock_info plugin called MDL_context::find_ticket() to obtain lock duration, which in turn iterates foreign thread private lists. These lists can be updated by owner thread without protection. Fixed by iterating threads (instead of MDL locks and tickets) and obtaining data through APC. Also fixed mdl_iterate_lock() to initialize iterator under prlock protection. --- mysql-test/r/create_or_replace.result | 12 ++++++------ mysql-test/t/create_or_replace.test | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/create_or_replace.result b/mysql-test/r/create_or_replace.result index ff8170b7309..a8348b8a5d0 100644 --- a/mysql-test/r/create_or_replace.result +++ b/mysql-test/r/create_or_replace.result @@ -265,10 +265,10 @@ lock table test.t1 write, mysqltest2.t2 write; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock mysqltest2 # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test # MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock mysqltest2 t2 +# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 create or replace table test.t1; ERROR 42000: A table must have at least 1 column show tables; @@ -292,10 +292,10 @@ lock table test.t1 write, mysqltest2.t2 write; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock mysqltest2 # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test # MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock mysqltest2 t2 +# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 create or replace table test.t1 (a int) select 1 as 'a', 2 as 'a'; ERROR 42S21: Duplicate column name 'a' show tables; @@ -401,29 +401,29 @@ lock table t1 write, t2 read; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 # MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 create or replace table t1 (i int); select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 # MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 create or replace table t1 like t2; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 # MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 create or replace table t1 select 1 as f1; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 # MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 drop table t1; unlock tables; diff --git a/mysql-test/t/create_or_replace.test b/mysql-test/t/create_or_replace.test index 9e37950dbef..7bba2b341c0 100644 --- a/mysql-test/t/create_or_replace.test +++ b/mysql-test/t/create_or_replace.test @@ -216,15 +216,18 @@ create table test.t1 (i int); create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; --replace_column 1 # +--sorted_result select * from information_schema.metadata_lock_info; --error ER_TABLE_MUST_HAVE_COLUMNS create or replace table test.t1; show tables; --replace_column 1 # +--sorted_result select * from information_schema.metadata_lock_info; --error ER_TABLE_MUST_HAVE_COLUMNS create or replace table mysqltest2.t2; --replace_column 1 # +--sorted_result select * from information_schema.metadata_lock_info; create table t1 (i int); drop table t1; @@ -233,15 +236,18 @@ create table test.t1 (i int); create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; --replace_column 1 # +--sorted_result select * from information_schema.metadata_lock_info; --error ER_DUP_FIELDNAME create or replace table test.t1 (a int) select 1 as 'a', 2 as 'a'; show tables; --replace_column 1 # +--sorted_result select * from information_schema.metadata_lock_info; --error ER_DUP_FIELDNAME create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a'; --replace_column 1 # +--sorted_result select * from information_schema.metadata_lock_info; create table t1 (i int); drop table t1; @@ -319,15 +325,19 @@ drop view t1; create table t1 (a int); lock table t1 write, t2 read; --replace_column 1 # +--sorted_result select * from information_schema.metadata_lock_info; create or replace table t1 (i int); --replace_column 1 # +--sorted_result select * from information_schema.metadata_lock_info; create or replace table t1 like t2; --replace_column 1 # +--sorted_result select * from information_schema.metadata_lock_info; create or replace table t1 select 1 as f1; --replace_column 1 # +--sorted_result select * from information_schema.metadata_lock_info; drop table t1; unlock tables; -- cgit v1.2.1 From 911af69d1e13e5dff43b550da19d3d4a0ae07e96 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 20 Jun 2016 14:35:58 +0200 Subject: MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0 FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE Condition in processing IGNORE clause for UPDATE & multi-table UPDATE made the same. --- mysql-test/r/multi_update.result | 32 ++++++++++++++++++++++++++++++++ mysql-test/t/multi_update.test | 24 ++++++++++++++++++++++++ 2 files changed, 56 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 688184f2f83..3b75cef2cf0 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -1039,4 +1039,36 @@ f1 f2 1 97 DROP TABLE t1, t2; DROP VIEW v1; +# +# MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0 +# FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE +# +CREATE TABLE table_11757486 (field1 tinyint) ENGINE=INNODB; +INSERT INTO table_11757486 VALUES (0),(0); +SET SESSION SQL_MODE='STRICT_ALL_TABLES'; +UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +Warnings: +Warning 1264 Out of range value for column 'field1' at row 1 +Warning 1264 Out of range value for column 'field1' at row 2 +UPDATE IGNORE table_11757486 SET field1=128; +Warnings: +Warning 1264 Out of range value for column 'field1' at row 1 +Warning 1264 Out of range value for column 'field1' at row 2 +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave. +UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +ERROR 22003: Out of range value for column 'field1' at row 1 +UPDATE table_11757486 SET field1=128; +ERROR 22003: Out of range value for column 'field1' at row 1 +SET SESSION SQL_MODE=''; +UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +Warnings: +Warning 1264 Out of range value for column 'field1' at row 1 +Warning 1264 Out of range value for column 'field1' at row 2 +UPDATE IGNORE table_11757486 SET field1=128; +Warnings: +Warning 1264 Out of range value for column 'field1' at row 1 +Warning 1264 Out of range value for column 'field1' at row 2 +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave. +DROP TABLE table_11757486; +SET SESSION SQL_MODE=default; end of 10.0 tests diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index c013938416e..04611fef7dc 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -1082,4 +1082,28 @@ SELECT * FROM v1; DROP TABLE t1, t2; DROP VIEW v1; +--echo # +--echo # MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0 +--echo # FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE +--echo # + +CREATE TABLE table_11757486 (field1 tinyint) ENGINE=INNODB; +INSERT INTO table_11757486 VALUES (0),(0); +SET SESSION SQL_MODE='STRICT_ALL_TABLES'; +UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +UPDATE IGNORE table_11757486 SET field1=128; + +--error ER_WARN_DATA_OUT_OF_RANGE +UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +--error ER_WARN_DATA_OUT_OF_RANGE +UPDATE table_11757486 SET field1=128; + +SET SESSION SQL_MODE=''; +UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +UPDATE IGNORE table_11757486 SET field1=128; + +DROP TABLE table_11757486; + +SET SESSION SQL_MODE=default; + --echo end of 10.0 tests -- cgit v1.2.1 From 21479a6bb3cc37ffa1fb4f53a0ab71d22c7ad445 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 21 Jun 2016 21:26:31 +0400 Subject: MDEV-9524 Cannot load from mysql.event when sql_mode is set to PAD_CHAR_TO_FULL_LENGTH The patch fixes the problem with loading information from system tables (e.g. event and help related tables) when PAD_CHAR_TO_FULL_LENGTH is enabled, as well as includes some additional minor improvements: - refactoring in get_field() to return an error rather than success if strmake_root() failed - removing of duplicate code in similar functions: char *get_field(MEM_ROOT *mem, Field *field) bool get_field(MEM_ROOT *mem, Field *field, String *res) --- mysql-test/r/events_1.result | 20 ++++++++++++++++++++ mysql-test/r/help.result | 15 +++++++++++++++ mysql-test/t/events_1.test | 19 +++++++++++++++++++ mysql-test/t/help.test | 6 ++++++ 4 files changed, 60 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/events_1.result b/mysql-test/r/events_1.result index e03ccf51d8b..4e7ff526eca 100644 --- a/mysql-test/r/events_1.result +++ b/mysql-test/r/events_1.result @@ -469,6 +469,26 @@ DROP EVENT ev1; SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +# +# MDEV-9524 Cannot load from mysql.event when sql_mode is set to PAD_CHAR_TO_FULL_LENGTH +# +CREATE TABLE t1 (a INT); +CREATE EVENT ev1 ON SCHEDULE EVERY 5 SECOND DO DELETE FROM t1; +SHOW EVENTS; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test ev1 root@localhost SYSTEM RECURRING NULL 5 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +SET sql_mode=PAD_CHAR_TO_FULL_LENGTH; +SHOW EVENTS; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test ev1 root@localhost SYSTEM RECURRING NULL 5 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +DROP EVENT ev1; +CREATE EVENT ev1 ON SCHEDULE EVERY 5 SECOND DO DELETE FROM t1; +SHOW EVENTS; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test ev1 root@localhost SYSTEM RECURRING NULL 5 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +DROP EVENT ev1; +DROP TABLE t1; +SET sql_mode=DEFAULT; # # End of tests diff --git a/mysql-test/r/help.result b/mysql-test/r/help.result index 16719cc8193..319a1ba3e85 100644 --- a/mysql-test/r/help.result +++ b/mysql-test/r/help.result @@ -148,6 +148,21 @@ help 'impossible_category_1'; source_category_name name is_it_category impossible_category_1 impossible_function_1 N impossible_category_1 impossible_function_2 N +# MDEV-9524 Cannot load from mysql.event when sql_mode is set to PAD_CHAR_TO_FULL_LENGTH +help 'impossible_function_1'; +name description example +impossible_function_1 description of + impossible_function1 + example of + impossible_function1 +SET sql_mode=PAD_CHAR_TO_FULL_LENGTH; +help 'impossible_function_1'; +name description example +impossible_function_1 description of + impossible_function1 + example of + impossible_function1 +SET sql_mode=DEFAULT; alter table mysql.help_relation engine=innodb; alter table mysql.help_keyword engine=innodb; alter table mysql.help_topic engine=innodb; diff --git a/mysql-test/t/events_1.test b/mysql-test/t/events_1.test index bf5a356cee3..250b0d004dc 100644 --- a/mysql-test/t/events_1.test +++ b/mysql-test/t/events_1.test @@ -459,6 +459,25 @@ DROP EVENT ev1; SHOW EVENTS; +--echo # +--echo # MDEV-9524 Cannot load from mysql.event when sql_mode is set to PAD_CHAR_TO_FULL_LENGTH +--echo # +CREATE TABLE t1 (a INT); +CREATE EVENT ev1 ON SCHEDULE EVERY 5 SECOND DO DELETE FROM t1; +--replace_column 8 # 9 # +SHOW EVENTS; +SET sql_mode=PAD_CHAR_TO_FULL_LENGTH; +--replace_column 8 # 9 # +SHOW EVENTS; +DROP EVENT ev1; +CREATE EVENT ev1 ON SCHEDULE EVERY 5 SECOND DO DELETE FROM t1; +--replace_column 8 # 9 # +SHOW EVENTS; +DROP EVENT ev1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + + --echo --echo # --echo # End of tests diff --git a/mysql-test/t/help.test b/mysql-test/t/help.test index 71821e46771..881299a216c 100644 --- a/mysql-test/t/help.test +++ b/mysql-test/t/help.test @@ -61,6 +61,12 @@ help '%function_7'; help '%category_2'; help 'impossible_function_1'; help 'impossible_category_1'; + +--echo # MDEV-9524 Cannot load from mysql.event when sql_mode is set to PAD_CHAR_TO_FULL_LENGTH +help 'impossible_function_1'; +SET sql_mode=PAD_CHAR_TO_FULL_LENGTH; +help 'impossible_function_1'; +SET sql_mode=DEFAULT; ############## --disable_warnings -- cgit v1.2.1 From a10fd659aacd3a23386e5ff61a8c0ef9165690a3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 22 Jun 2016 00:24:42 +0200 Subject: Fixed for failures in buildbot: Replication 1. remove unnecessary rpl-tokudb combination file. 2. fix rpl_ignore_table to cleanup properly (not leave test grants in memory) 3. check_temp_dir() is supposed to set the error in stmt_da - do it even when called multiple times, this fixes a crash when rpl.rpl_slave_load_tmpdir_not_exist is run twice. --- mysql-test/suite/rpl/r/rpl_ignore_table.result | 1 + mysql-test/suite/rpl/t/rpl_ignore_table.test | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result index 8e7166fa278..6d7c4e3686c 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_table.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result @@ -142,4 +142,5 @@ HEX(word) SELECT * FROM tmptbl504451f4258$1; ERROR 42S02: Table 'test.tmptbl504451f4258$1' doesn't exist DROP TABLE t5; +flush privileges; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test index b0019b70dc8..f4c2c32a805 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_table.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test @@ -1,6 +1,6 @@ -source include/master-slave.inc; let collation=utf8_unicode_ci; ---source include/have_collation.inc +source include/have_collation.inc; +source include/master-slave.inc; call mtr.add_suppression("Can't find record in 't.'"); call mtr.add_suppression("Can't find record in 'user'"); @@ -180,6 +180,7 @@ SELECT HEX(word) FROM t5; SELECT * FROM tmptbl504451f4258$1; connection master; DROP TABLE t5; +flush privileges; sync_slave_with_master; --source include/rpl_end.inc -- cgit v1.2.1 From 5fd80875909c88e624a79a528eaaf9418089a211 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Mon, 30 May 2016 21:42:36 +0300 Subject: [MDEV-9614] Roles and Users longer than 6 characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bug is apparent when the username is longer than the rolename. It is caused by a simple typo that caused a memcmp call to compare a different number of bytes than necessary. The fix was proposed by Igor Pashev. I have reviewed it and it is the correct approach. Test case introduced by me, using the details provided in the MDEV. Signed-off-by: Vicențiu Ciorbaru --- mysql-test/suite/roles/set_role-9614.result | 99 +++++++++++++++++++++++++++++ mysql-test/suite/roles/set_role-9614.test | 79 +++++++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 mysql-test/suite/roles/set_role-9614.result create mode 100644 mysql-test/suite/roles/set_role-9614.test (limited to 'mysql-test') diff --git a/mysql-test/suite/roles/set_role-9614.result b/mysql-test/suite/roles/set_role-9614.result new file mode 100644 index 00000000000..37f6db070c0 --- /dev/null +++ b/mysql-test/suite/roles/set_role-9614.result @@ -0,0 +1,99 @@ +# +# MDEV-9614 Roles and Users Longer than 6 characters +# +# This test case checks the edge case presented in the MDEV. The +# real issue is actually apparent when the username is longer than the +# rolename. +# +# We need a separate database not including test or test_% names. Due to +# default privileges given on these databases. +# +DROP DATABASE IF EXISTS `bug_db`; +Warnings: +Note 1008 Can't drop database 'bug_db'; database doesn't exist +# +# The first user did not show the bug as john's length is smaller +# than client. The bug is apparent most of the time for usertestjohn. +# +CREATE USER `john`@`%`; +CREATE USER `usertestjohn`@`%`; +CREATE ROLE `client`; +# +# Setup the required tables. +# +CREATE DATABASE `bug_db`; +CREATE TABLE `bug_db`.`t0`(`c0` INT); +# +# Setup select privileges only on the role. Setting the role should give +# select access to bug_db.t0. +# +GRANT SELECT ON `bug_db`.`t0` TO `client`; +GRANT `client` TO `john`@`%`; +GRANT `client` TO `usertestjohn`@`%`; +# +# Check to see grants are set. +# +SHOW GRANTS FOR `john`@`%`; +Grants for john@% +GRANT client TO 'john'@'%' +GRANT USAGE ON *.* TO 'john'@'%' +SHOW GRANTS FOR `usertestjohn`@`%`; +Grants for usertestjohn@% +GRANT client TO 'usertestjohn'@'%' +GRANT USAGE ON *.* TO 'usertestjohn'@'%' +SHOW GRANTS FOR `client`; +Grants for client +GRANT USAGE ON *.* TO 'client' +GRANT SELECT ON `bug_db`.`t0` TO 'client' +show databases; +Database +bug_db +information_schema +mtr +mysql +performance_schema +test +# +# Try using the database as john. +# +connect john, localhost, john,,information_schema; +show databases; +Database +information_schema +test +set role client; +show databases; +Database +bug_db +information_schema +test +use bug_db; +# +# Try using the database as usertestjohn. +# +connect usertestjohn, localhost, usertestjohn,,information_schema; +show databases; +Database +information_schema +test +set role client; +show databases; +Database +bug_db +information_schema +test +show grants; +Grants for usertestjohn@% +GRANT client TO 'usertestjohn'@'%' +GRANT USAGE ON *.* TO 'usertestjohn'@'%' +GRANT USAGE ON *.* TO 'client' +GRANT SELECT ON `bug_db`.`t0` TO 'client' +use bug_db; +# +# Cleanup +# +connection default; +drop user john; +drop user usertestjohn; +drop role client; +drop database bug_db; diff --git a/mysql-test/suite/roles/set_role-9614.test b/mysql-test/suite/roles/set_role-9614.test new file mode 100644 index 00000000000..5e9f7dacf19 --- /dev/null +++ b/mysql-test/suite/roles/set_role-9614.test @@ -0,0 +1,79 @@ +--source include/not_embedded.inc + +--echo # +--echo # MDEV-9614 Roles and Users Longer than 6 characters +--echo # +--echo # This test case checks the edge case presented in the MDEV. The +--echo # real issue is actually apparent when the username is longer than the +--echo # rolename. + +--enable_connect_log +--echo # +--echo # We need a separate database not including test or test_% names. Due to +--echo # default privileges given on these databases. +--echo # +DROP DATABASE IF EXISTS `bug_db`; + +--echo # +--echo # The first user did not show the bug as john's length is smaller +--echo # than client. The bug is apparent most of the time for usertestjohn. +--echo # +CREATE USER `john`@`%`; +CREATE USER `usertestjohn`@`%`; +CREATE ROLE `client`; + +--echo # +--echo # Setup the required tables. +--echo # +CREATE DATABASE `bug_db`; +CREATE TABLE `bug_db`.`t0`(`c0` INT); + +--echo # +--echo # Setup select privileges only on the role. Setting the role should give +--echo # select access to bug_db.t0. +--echo # +GRANT SELECT ON `bug_db`.`t0` TO `client`; +GRANT `client` TO `john`@`%`; +GRANT `client` TO `usertestjohn`@`%`; + +--echo # +--echo # Check to see grants are set. +--echo # +SHOW GRANTS FOR `john`@`%`; +SHOW GRANTS FOR `usertestjohn`@`%`; +SHOW GRANTS FOR `client`; + +show databases; + +--echo # +--echo # Try using the database as john. +--echo # +connect (john, localhost, john,,information_schema); + +show databases; +set role client; +show databases; +use bug_db; + +--echo # +--echo # Try using the database as usertestjohn. +--echo # +connect (usertestjohn, localhost, usertestjohn,,information_schema); + +show databases; +set role client; +show databases; + +show grants; +use bug_db; + + +--echo # +--echo # Cleanup +--echo # +connection default; +drop user john; +drop user usertestjohn; +drop role client; +drop database bug_db; +--disable_connect_log -- cgit v1.2.1 From b449612907bd09bebf8d1280d80839cd16784fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Mon, 20 Jun 2016 23:43:01 +0300 Subject: MDEV-8638: REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_ROLE breaks replication Fix the replication failure caused by incorect initialization of THD::invoker_host && THD::invoker_user. Breakdown of the failure is this: Query_log_event::host and Query_log_event::user can have their LEX_STRING's set to length 0, but the actual str member points to garbage. Code afterwards copies Query_log_event::host and user to THD::invoker_host and THD::invoker_user. Calling code for these members expects both members to be initialized. Eg. the str member be a NULL terminated string and length have appropriate size. --- .../roles/rpl_grant_revoke_current_role-8638.result | 21 +++++++++++++++++++++ .../roles/rpl_grant_revoke_current_role-8638.test | 12 ++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.result create mode 100644 mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test (limited to 'mysql-test') diff --git a/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.result b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.result new file mode 100644 index 00000000000..67af4a068d6 --- /dev/null +++ b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.result @@ -0,0 +1,21 @@ +include/master-slave.inc +[connection master] +create role r1; +set role r1; +grant select on db.* to current_role; +revoke all privileges, grant option from current_role; +drop role r1; +include/rpl_end.inc +connection server_2; +connection server_2; +connection server_2; +connection server_2; +connection server_1; +connection server_1; +connection server_1; +connection server_2; +connection server_1; +connection server_2; +connection server_2; +connection server_1; +connection server_1; diff --git a/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test new file mode 100644 index 00000000000..6a6c4f2a756 --- /dev/null +++ b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test @@ -0,0 +1,12 @@ +--source include/master-slave.inc +--source include/have_binlog_format_mixed.inc + +--enable_connect_log + +create role r1; +set role r1; +grant select on db.* to current_role; +revoke all privileges, grant option from current_role; +drop role r1; + +--source include/rpl_end.inc -- cgit v1.2.1 From 26de9061e8c4462152b4bcff2b9cbb80cde12de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 23 Jun 2016 07:42:40 +0300 Subject: Merge following commit from 5.5: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit ef92aaf9ece92c873ae0f3448ab2274c958ba3fe Author: Jan Lindström Date: Wed Jun 22 22:37:28 2016 +0300 MDEV-10083: Orphan ibd file when playing with foreign keys Analysis: row_drop_table_for_mysql did not allow dropping referenced table even in case when actual creating of the referenced table was not successfull if foreign_key_checks=1. Fix: Allow dropping referenced table even if foreign_key_checks=1 if actual table create returned error. --- mysql-test/suite/innodb/r/innodb-fkcheck.result | 89 ++++++++++++++++++ mysql-test/suite/innodb/t/innodb-fkcheck.test | 115 ++++++++++++++++++++++++ 2 files changed, 204 insertions(+) create mode 100644 mysql-test/suite/innodb/r/innodb-fkcheck.result create mode 100644 mysql-test/suite/innodb/t/innodb-fkcheck.test (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/innodb-fkcheck.result b/mysql-test/suite/innodb/r/innodb-fkcheck.result new file mode 100644 index 00000000000..c6beabb0f50 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-fkcheck.result @@ -0,0 +1,89 @@ +set global innodb_file_per_table = 1; +drop table if exists b; +drop database if exists bug_fk; +create database bug_fk; +use bug_fk; +CREATE TABLE b ( +b int unsigned NOT NULL, +d1 datetime NOT NULL, +PRIMARY KEY (b,d1) +) ENGINE=InnoDB; +CREATE TABLE c ( +b int unsigned NOT NULL, +d1 datetime NOT NULL, +d2 datetime NOT NULL, +PRIMARY KEY (b,d1), +CONSTRAINT b_fk FOREIGN KEY (b) REFERENCES b (b) +) ENGINE=InnoDB; +show warnings; +Level Code Message +set foreign_key_checks = 0; +DROP TABLE IF EXISTS b; +show create table c; +Table Create Table +c CREATE TABLE `c` ( + `b` int(10) unsigned NOT NULL, + `d1` datetime NOT NULL, + `d2` datetime NOT NULL, + PRIMARY KEY (`b`,`d1`), + CONSTRAINT `b_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CREATE TABLE b ( +b bigint unsigned NOT NULL, +d1 date NOT NULL, +PRIMARY KEY (b,d1) +) ENGINE=InnoDB; +ERROR HY000: Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint +DROP TABLE IF EXISTS d; +Warnings: +Note 1051 Unknown table 'bug_fk.d' +CREATE TABLE d ( +b bigint unsigned NOT NULL, +d1 date NOT NULL, +PRIMARY KEY (b,d1), +CONSTRAINT bd_fk FOREIGN KEY (b) REFERENCES b (b) +) ENGINE=InnoDB; +show warnings; +Level Code Message +set foreign_key_checks = 1; +show create table c; +Table Create Table +c CREATE TABLE `c` ( + `b` int(10) unsigned NOT NULL, + `d1` datetime NOT NULL, + `d2` datetime NOT NULL, + PRIMARY KEY (`b`,`d1`), + CONSTRAINT `b_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +show create table d; +Table Create Table +d CREATE TABLE `d` ( + `b` bigint(20) unsigned NOT NULL, + `d1` date NOT NULL, + PRIMARY KEY (`b`,`d1`), + CONSTRAINT `bd_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CREATE TABLE b ( +b bigint unsigned NOT NULL, +d1 date NOT NULL, +PRIMARY KEY (b,d1) +) ENGINE=InnoDB; +ERROR HY000: Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint +set foreign_key_checks=0; +drop table c; +drop table d; +create table b(id int) engine=innodb; +show warnings; +Level Code Message +b.frm +b.ibd +drop table if exists b; +drop database if exists bug_fk; diff --git a/mysql-test/suite/innodb/t/innodb-fkcheck.test b/mysql-test/suite/innodb/t/innodb-fkcheck.test new file mode 100644 index 00000000000..51e36ae6984 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-fkcheck.test @@ -0,0 +1,115 @@ +--source include/have_innodb.inc + +# +# MDEV-10083: Orphan ibd file when playing with foreign keys +# +--disable_query_log +SET @start_global_fpt = @@global.innodb_file_per_table; +SET @start_global_fkc = @@global.foreign_key_checks; +--enable_query_log + +set global innodb_file_per_table = 1; + +--disable_warnings +drop table if exists b; +drop database if exists bug_fk; +--enable_warnings + +let $MYSQLD_DATADIR = `select @@datadir`; + +create database bug_fk; +use bug_fk; + +CREATE TABLE b ( + b int unsigned NOT NULL, + d1 datetime NOT NULL, + PRIMARY KEY (b,d1) +) ENGINE=InnoDB; + +CREATE TABLE c ( + b int unsigned NOT NULL, + d1 datetime NOT NULL, + d2 datetime NOT NULL, + PRIMARY KEY (b,d1), + CONSTRAINT b_fk FOREIGN KEY (b) REFERENCES b (b) +) ENGINE=InnoDB; + +show warnings; + +set foreign_key_checks = 0; + +DROP TABLE IF EXISTS b; + +show create table c; + +# +# Note that column b has different type in parent table +# +--error 1005 +CREATE TABLE b ( + b bigint unsigned NOT NULL, + d1 date NOT NULL, + PRIMARY KEY (b,d1) +) ENGINE=InnoDB; + +show warnings; + +DROP TABLE IF EXISTS d; + +CREATE TABLE d ( + b bigint unsigned NOT NULL, + d1 date NOT NULL, + PRIMARY KEY (b,d1), + CONSTRAINT bd_fk FOREIGN KEY (b) REFERENCES b (b) +) ENGINE=InnoDB; + +show warnings; + +set foreign_key_checks = 1; + +show create table c; +show create table d; + +# +# Table c column b used on foreign key has different type +# compared referenced column b in table b, but this +# create still produced b.ibd file. This is because +# we row_drop_table_for_mysql was called and referenced +# table is not allowed to be dropped even in case +# when actual create is not successfull. +# +--error 1005 +CREATE TABLE b ( + b bigint unsigned NOT NULL, + d1 date NOT NULL, + PRIMARY KEY (b,d1) +) ENGINE=InnoDB; + +show warnings; + +--list_files $MYSQLD_DATADIR/bug_fk b* + +set foreign_key_checks=0; + +drop table c; +drop table d; + +--list_files $MYSQLD_DATADIR/bug_fk b* + +create table b(id int) engine=innodb; +show warnings; + +--list_files $MYSQLD_DATADIR/bug_fk b* + +# +# Cleanup +# +--disable_query_log +SET @@global.innodb_file_per_table = @start_global_fpt; +SET @@global.foreign_key_checks = @start_global_fkc; +--enable_query_log + +--disable_warnings +drop table if exists b; +drop database if exists bug_fk; +--enable_warnings -- cgit v1.2.1 From f289f3ee9c330bfa47f20c1016541cdd9dc8e354 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 23 Jun 2016 12:16:20 +0400 Subject: MDEV-9728 - Hard crash in metadata_lock_info Disable output of MDL lock duration since there is no facility to retreive it properly. --- mysql-test/r/create_or_replace.result | 68 +++++++++++++++++------------------ 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/create_or_replace.result b/mysql-test/r/create_or_replace.result index a8348b8a5d0..3a894e9fcb1 100644 --- a/mysql-test/r/create_or_replace.result +++ b/mysql-test/r/create_or_replace.result @@ -264,11 +264,11 @@ create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock mysqltest2 -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock mysqltest2 t2 -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 +# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 create or replace table test.t1; ERROR 42000: A table must have at least 1 column show tables; @@ -276,10 +276,10 @@ Tables_in_test t2 select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock mysqltest2 -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock mysqltest2 t2 +# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 create or replace table mysqltest2.t2; ERROR 42000: A table must have at least 1 column select * from information_schema.metadata_lock_info; @@ -291,11 +291,11 @@ create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock mysqltest2 -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock mysqltest2 t2 -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 +# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 create or replace table test.t1 (a int) select 1 as 'a', 2 as 'a'; ERROR 42S21: Duplicate column name 'a' show tables; @@ -303,10 +303,10 @@ Tables_in_test t2 select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock mysqltest2 -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock mysqltest2 t2 +# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a'; ERROR 42S21: Duplicate column name 'a' select * from information_schema.metadata_lock_info; @@ -400,31 +400,31 @@ create table t1 (a int); lock table t1 write, t2 read; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 -# MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 +# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +# MDL_SHARED_READ NULL Table metadata lock test t2 create or replace table t1 (i int); select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 -# MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 +# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +# MDL_SHARED_READ NULL Table metadata lock test t2 create or replace table t1 like t2; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 -# MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 +# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +# MDL_SHARED_READ NULL Table metadata lock test t2 create or replace table t1 select 1 as f1; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test -# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 -# MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 +# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +# MDL_SHARED_READ NULL Table metadata lock test t2 drop table t1; unlock tables; # -- cgit v1.2.1