Commit 8d7f2d26 authored by Bjorn Munch's avatar Bjorn Munch

merge from main

parents 2ba1012f 3f2865fa
This is a release of MySQL, a dual-license SQL database server.
MySQL is brought to you by the MySQL team at MySQL AB.
MySQL is brought to you by the MySQL team at Sun Microsystems, Inc.
License information can be found in these files:
- For GPL (free) distributions, see the COPYING file and
the EXCEPTIONS-CLIENT file.
- For commercial distributions, see the LICENSE.mysql file.
GPLv2 Disclaimer
For the avoidance of doubt, except that if any license choice
other than GPL or LGPL is available it will apply instead, Sun
elects to use only the General Public License version 2 (GPLv2)
at this time for any software where a choice of GPL license versions
is made available with the language indicating that GPLv2 or any
later version may be used, or where a choice of which version of
the GPL is applied is otherwise unspecified.
For further information about MySQL or additional documentation, see:
- The latest information about MySQL: http://www.mysql.com
......
......@@ -248,7 +248,7 @@ typedef struct {
static COMMANDS commands[] = {
{ "?", '?', com_help, 1, "Synonym for `help'." },
{ "clear", 'c', com_clear, 0, "Clear command."},
{ "clear", 'c', com_clear, 0, "Clear the current input statement."},
{ "connect",'r', com_connect,1,
"Reconnect to the server. Optional arguments are db and host." },
{ "delimiter", 'd', com_delimiter, 1,
......
......@@ -66,7 +66,7 @@ typedef KEYMAP_ENTRY *Keymap;
#ifndef CTRL
#include <sys/ioctl.h>
#if !defined(__sun) && !defined(__hpux) && !defined(_AIX)
#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) && !defined(__QNXNTO__) && !defined(__USLC__)
#include <sys/ttydefaults.h>
#endif
#ifndef CTRL
......
......@@ -61,7 +61,7 @@ static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95";
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#endif
/* Solaris's term.h does horrid things. */
/* Don't use Solaris's term.h. */
#if (defined(HAVE_TERM_H) && !defined(__SunOS))
#include <term.h>
#endif
......
......@@ -231,16 +231,19 @@ esac
AC_DEFUN([MYSQL_CHECK_LIB_TERMCAP],
[
AC_CACHE_VAL(mysql_cv_termcap_lib,
[AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses,
[AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses,
[AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap,
[AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo,
mysql_cv_termcap_lib=NOT_FOUND)])])])])
[AC_CHECK_LIB(ncursesw, tgetent, mysql_cv_termcap_lib=libncursesw,
[AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses,
[AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses,
[AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap,
[AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo,
mysql_cv_termcap_lib=NOT_FOUND)])])])])])
AC_MSG_CHECKING(for termcap functions library)
if test "$mysql_cv_termcap_lib" = "NOT_FOUND"; then
AC_MSG_ERROR([No curses/termcap library found])
elif test "$mysql_cv_termcap_lib" = "libtermcap"; then
TERMCAP_LIB=-ltermcap
elif test "$mysql_cv_termcap_lib" = "libncursesw"; then
TERMCAP_LIB=-lncursesw
elif test "$mysql_cv_termcap_lib" = "libncurses"; then
TERMCAP_LIB=-lncurses
elif test "$mysql_cv_termcap_lib" = "libtinfo"; then
......
......@@ -2085,6 +2085,27 @@ esac
AC_MSG_CHECKING(for isinf in <math.h>)
AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
AC_MSG_RESULT(yes)
AC_MSG_CHECKING(whether isinf() is safe to use in C code)
AC_TRY_RUN([
#include <math.h>
int main()
{
double a= 10.0;
double b= 1e308;
return !isinf(a * b);
}
],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
AC_DEFINE([HAVE_BROKEN_ISINF], [1],
[Define to 1 if isinf() uses 80-bit register for intermediate values])
],
[
# Let's be optimistic when cross-compiling, since the only compiler known
# to be affected by this isinf() bug is GCC 4.3 on 32-bit x86.
AC_MSG_RESULT([[cross-compiling, assuming 'yes']])
])
AC_MSG_CHECKING(whether isinf() can be used in C++ code)
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
......
......@@ -580,40 +580,6 @@ typedef unsigned short ushort;
#define test_all_bits(a,b) (((a) & (b)) == (b))
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
#ifndef HAVE_RINT
/**
All integers up to this number can be represented exactly as double precision
values (DBL_MANT_DIG == 53 for IEEE 754 hardware).
*/
#define MAX_EXACT_INTEGER ((1LL << DBL_MANT_DIG) - 1)
/**
rint(3) implementation for platforms that do not have it.
Always rounds to the nearest integer with ties being rounded to the nearest
even integer to mimic glibc's rint() behavior in the "round-to-nearest"
FPU mode. Hardware-specific optimizations are possible (frndint on x86).
Unlike this implementation, hardware will also honor the FPU rounding mode.
*/
static inline double rint(double x)
{
double f, i;
f = modf(x, &i);
/*
All doubles with absolute values > MAX_EXACT_INTEGER are even anyway,
no need to check it.
*/
if (x > 0.0)
i += (double) ((f > 0.5) || (f == 0.5 &&
i <= (double) MAX_EXACT_INTEGER &&
(longlong) i % 2));
else
i -= (double) ((f < -0.5) || (f == -0.5 &&
i >= (double) -MAX_EXACT_INTEGER &&
(longlong) i % 2));
return i;
}
#endif /* HAVE_RINT */
/* Define some general constants */
#ifndef TRUE
......@@ -905,10 +871,20 @@ typedef SOCKET_SIZE_TYPE size_socket;
#endif
#ifdef HAVE_ISINF
/* isinf() can be used in both C and C++ code */
#define my_isinf(X) isinf(X)
/* Check if C compiler is affected by GCC bug #39228 */
#if !defined(__cplusplus) && defined(HAVE_BROKEN_ISINF)
/* Force store/reload of the argument to/from a 64-bit double */
static inline double my_isinf(double x)
{
volatile double t= x;
return isinf(t);
}
#else
#define my_isinf(X) (!isfinite(X) && !isnan(X))
/* System-provided isinf() is available and safe to use */
#define my_isinf(X) isinf(X)
#endif
#else /* !HAVE_ISINF */
#define my_isinf(X) (!finite(X) && !isnan(X))
#endif
/* Define missing math constants. */
......@@ -1562,4 +1538,39 @@ inline void operator delete[](void*, void*) { /* Do nothing */ }
#define bool In_C_you_should_use_my_bool_instead()
#endif
#ifndef HAVE_RINT
/**
All integers up to this number can be represented exactly as double precision
values (DBL_MANT_DIG == 53 for IEEE 754 hardware).
*/
#define MAX_EXACT_INTEGER ((1LL << DBL_MANT_DIG) - 1)
/**
rint(3) implementation for platforms that do not have it.
Always rounds to the nearest integer with ties being rounded to the nearest
even integer to mimic glibc's rint() behavior in the "round-to-nearest"
FPU mode. Hardware-specific optimizations are possible (frndint on x86).
Unlike this implementation, hardware will also honor the FPU rounding mode.
*/
static inline double rint(double x)
{
double f, i;
f = modf(x, &i);
/*
All doubles with absolute values > MAX_EXACT_INTEGER are even anyway,
no need to check it.
*/
if (x > 0.0)
i += (double) ((f > 0.5) || (f == 0.5 &&
i <= (double) MAX_EXACT_INTEGER &&
(longlong) i % 2));
else
i -= (double) ((f < -0.5) || (f == -0.5 &&
i >= (double) -MAX_EXACT_INTEGER &&
(longlong) i % 2));
return i;
}
#endif /* HAVE_RINT */
#endif /* my_global_h */
......@@ -27,6 +27,10 @@ extern "C" {
struct st_thr_lock;
extern ulong locks_immediate,locks_waited ;
/*
Important: if a new lock type is added, a matching lock description
must be added to sql_test.cc's lock_descriptions array.
*/
enum thr_lock_type { TL_IGNORE=-1,
TL_UNLOCK, /* UNLOCK ANY LOCK */
/*
......
......@@ -7,125 +7,126 @@
# (Guilhem) have seen the test manage to provoke lock wait timeout
# error but not deadlock error; that is ok as code deals with the two
# errors in exactly the same way.
# We don't 'show status like 'slave_retried_transactions'' because this
# is not repeatable (depends on sleeps).
-- source include/master-slave.inc
--source include/master-slave.inc
# 0) Prepare tables and data
--echo *** Prepare tables and data ***
connection master;
eval CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
eval CREATE TABLE t2 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
# requiring 'unique' for the timeout part of the test
eval CREATE TABLE t3 (a INT UNIQUE) ENGINE=$engine_type;
eval CREATE TABLE t4 (a INT) ENGINE=$engine_type;
show variables like 'slave_transaction_retries';
eval CREATE TABLE t2 (a INT) ENGINE=$engine_type;
eval CREATE TABLE t3 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
sync_slave_with_master;
show create table t1;
show create table t2;
show variables like 'slave_transaction_retries';
stop slave;
# 1) Test deadlock
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
SHOW CREATE TABLE t3;
SHOW VARIABLES LIKE 'slave_transaction_retries';
--source include/stop_slave.inc
connection master;
begin;
# Let's keep BEGIN and the locked statement in two different relay logs.
insert into t2 values (0); # t2,t1 actors of deadlock in repl-ed ta
#insert into t3 select * from t2 for update;
let $1=10;
disable_query_log;
while ($1)
{
eval insert into t3 values( $1 );
dec $1;
}
enable_query_log;
insert into t1 values(1);
commit;
BEGIN;
INSERT INTO t1 VALUES (1);
# We make a long transaction here
INSERT INTO t2 VALUES (2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
INSERT INTO t3 VALUES (3);
COMMIT;
save_master_pos;
# Save BEGIN event into variable
let $master_pos_begin= query_get_value(SHOW BINLOG EVENTS, Pos, 5);
--echo
connection slave;
begin;
# Let's make our transaction large so that it's repl-ed msta that's victim
let $1=100;
disable_query_log;
while ($1)
{
eval insert into t4 values( $1 );
dec $1;
}
enable_query_log;
select * from t1 for update; # t1,t2 on local slave's
start slave;
# bad option, todo: replicate a non-transactional t_sync with the transaction
# and use wait_until_rows_count macro below
--real_sleep 3 # hope that slave is blocked now
#let $count=11;
#let $table=t_sync;
#--include wait_until_rows_count.inc
# 1) Test deadlock
# Block slave SQL thread, wait retries of transaction, unlock slave before lock timeout
--echo *** Test deadlock ***
select * from t2 for update /* dl */; # provoke deadlock, repl-ed should be victim
commit;
connection slave;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
# Save variable 'Slave_retried_transactions' before deadlock
let $slave_retried_transactions= query_get_value(SHOW GLOBAL STATUS LIKE 'Slave_retried_transactions', Value, 1);
START SLAVE;
# Wait until SQL thread blocked: variable 'Slave_retried_transactions' will incremented
let $status_var= Slave_retried_transactions;
let $status_var_value= $slave_retried_transactions;
let $status_type= GLOBAL;
let $status_var_comparsion= >;
--source include/wait_for_status_var.inc
SELECT COUNT(*) FROM t2;
COMMIT;
sync_with_master;
select * from t1; # check that repl-ed succeeded finally
select * from t2 /* must be 1 */;
# check that no error is reported
--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
--vertical_results
show slave status;
--horizontal_results
# Check the data
SELECT * FROM t1;
SELECT * FROM t3;
# Check that no error is reported
--source include/show_slave_status2.inc
--echo
# 2) Test lock wait timeout
# Block slave and wait lock timeout error
--echo *** Test lock wait timeout ***
stop slave;
delete from t3;
change master to master_log_pos=548; # the BEGIN log event
begin;
select * from t2 for update; # hold lock
start slave;
--real_sleep 10 # repl-ed should have blocked, and be retrying
select count(*) from t3 /* must be zero */; # replaying begins after rollback
commit;
connection slave;
--source include/stop_slave.inc
DELETE FROM t2;
# Set slave position to the BEGIN log event
--replace_result $master_pos_begin MASTER_POS_BEGIN
eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin;
BEGIN;
# Hold lock
SELECT * FROM t1 FOR UPDATE;
# Wait until slave stopped with error 'Lock wait timeout exceeded'
START SLAVE;
let $slave_sql_errno= 1205;
--source include/wait_for_slave_sql_error.inc
SELECT COUNT(*) FROM t2;
COMMIT;
--source include/start_slave.inc
sync_with_master;
select * from t1; # check that repl-ed succeeded finally
select * from t2;
# check that no error is reported
--replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
--vertical_results
show slave status;
--horizontal_results
# Check data from tables
SELECT * FROM t1;
SELECT * FROM t3;
# Check that no error is reported
--source include/show_slave_status2.inc
--echo
# Now we repeat 2), but with BEGIN in the same relay log as
# COMMIT (to see if seeking into hot log is ok).
set @my_max_relay_log_size= @@global.max_relay_log_size;
set global max_relay_log_size=0;
# 3) Test lock wait timeout and purged relay log
# Set max_relay_log_size=0, block slave and wait lock timeout error.
# Restart slave and check that no erros appear
--echo *** Test lock wait timeout and purged relay logs ***
# This is really copy-paste of 2) of above
stop slave;
delete from t3;
change master to master_log_pos=548;
begin;
select * from t2 for update;
start slave;
--real_sleep 10
select count(*) from t3 /* must be zero */; # replaying begins after rollback
commit;
connection slave;
SET @my_max_relay_log_size= @@global.max_relay_log_size;
SET global max_relay_log_size=0;
--source include/stop_slave.inc
DELETE FROM t2;
# Set slave position to the BEGIN log event
eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin;
BEGIN;
# Hold lock
SELECT * FROM t1 FOR UPDATE;
# Wait until slave stopped with error 'Lock wait timeout exceeded'
START SLAVE;
let $slave_sql_errno= 1205;
--source include/wait_for_slave_sql_error.inc
SELECT COUNT(*) FROM t2;
COMMIT;
--source include/start_slave.inc
sync_with_master;
select * from t1;
select * from t2;
--replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
--vertical_results
show slave status;
--horizontal_results
# Check data from tables
SELECT * FROM t1;
SELECT * FROM t3;
# Check that no error is reported
--source include/show_slave_status2.inc
--echo
# Clean up
--echo *** Clean up ***
connection master;
drop table t1,t2,t3,t4;
DROP TABLE t1,t2,t3;
sync_slave_with_master;
set global max_relay_log_size= @my_max_relay_log_size;
SET global max_relay_log_size= @my_max_relay_log_size;
--echo End of 5.1 tests
# ==== Purpose ====
#
# Diff the output of a statement on master and slave
#
# ==== Usage =====
#
# let $diff_statement= SELECT * FROM t1 WHERE a < 100;
# source include/diff_master_slave.inc;
--echo source include/diff_master_slave.inc;
disable_query_log;
disable_result_log;
exec $MYSQL test -e "$diff_statement" > $MYSQLTEST_VARDIR/tmp/diff_master.out;
sync_slave_with_master;
exec $MYSQL_SLAVE test -e "$diff_statement" > $MYSQLTEST_VARDIR/tmp/diff_slave.out;
diff_files $MYSQLTEST_VARDIR/tmp/diff_master.out $MYSQLTEST_VARDIR/tmp/diff_slave.out;
enable_result_log;
enable_query_log;
......@@ -720,3 +720,11 @@ connection con1;
drop table t1;
disconnect con1;
connection default;
#
# Bug#44151 using handler commands on information_schema tables crashes server
#
USE information_schema;
--error ER_WRONG_USAGE
HANDLER COLUMNS OPEN;
USE test;
# ==== Purpose ====
#
# Kill a query in the master connection, and then try to reap the
# result of the killed query.
#
# ==== Usage ====
#
# The following variables should be set before sourcing this file.
#
# $debug_lock: name of the debug user lock, if set, will release/lock
# the specified debug lock accordingly, and before
# sourcing this, connection 'master' should get the user
# lock and run a query in another thread, which will
# block before creating statement event.
#
# $connection_name: name of the connection that is waiting for the
# lock, this can not be 'master'
#
# $connection_id: id of the connection that is waiting for the lock
#
# Example:
# let $debug_lock=;
# connection master1;
# let $connection_name= master1;
# let $connection_id= `SELECT CONNECTION_ID()`;
# send CREATE TABLE t1;
# source kill_query.inc;
#
# let $debug_lock= "debug_lock.before_query_log_event";
# connection master;
# eval SELECT GET_LOCK($debug_lock, 10);
# connection master1;
# let $connection_name= master1;
# let $connection_id= `SELECT CONNECTION_ID()`;
# send CREATE TABLE t1;
# source kill_query.inc;
--echo source include/kill_query.inc;
disable_query_log;
disable_result_log;
connection master;
# kill the query that is waiting
eval kill query $connection_id;
if (`SELECT '$debug_lock' != ''`)
{
# release the lock to allow binlog continue
eval SELECT RELEASE_LOCK($debug_lock);
}
# reap the result of the waiting query
connection $connection_name;
error 0, 1317, 1307, 1306, 1334, 1305;
reap;
connection master;
if (`SELECT '$debug_lock' != ''`)
{
# get lock again to make the next query wait
eval SELECT GET_LOCK($debug_lock, 10);
}
connection $connection_name;
enable_query_log;
enable_result_log;
# ==== Purpose ====
#
# Kill a query, sync master with slave, and diff the output of a
# statement on master and slave to check if statement is correctly
# replicated.
#
# ==== Usage ====
#
# connection <CONNECTION>;
# let $connection_name=<CONNECTION>
# let $connection_id=`SELECT CONNECTION_ID()`;
# let $diff_statement=<SQL COMMAND>;
# send <SQL COMMAND>;
# source include/kill_query_and_diff_master_slave.inc;
#
# Note: <CONNECTION> must not be 'master'.
#
# See also kill_query.inc and diff_master_slave.inc for more
# information
source include/kill_query.inc;
# Release the debug lock if used, so that the statements in
# diff_master_slave.inc will not be blocked.
connection master;
disable_query_log;
disable_result_log;
if (`SELECT '$debug_lock' != ''`)
{
eval SELECT RELEASE_LOCK($debug_lock);
}
enable_result_log;
enable_query_log;
source include/diff_master_slave.inc;
# Acquire the debug lock again if used
connection master;
disable_query_log; disable_result_log; if (`SELECT '$debug_lock' !=
''`) { eval SELECT GET_LOCK($debug_lock, 10); } enable_result_log;
enable_query_log;
connection $connection_name;
......@@ -1122,6 +1122,46 @@ SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
DROP TABLE t1;
#
# Bug#37284 Crash in Field_string::type()
#
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
CREATE INDEX i1 on t1 (a(3));
SELECT * FROM t1 WHERE a = 'abcde';
DROP TABLE t1;
--echo #
--echo # BUG #26288: savepoint are not deleted on comit, if the transaction
--echo # was otherwise empty
--echo #
BEGIN;
SAVEPOINT s1;
COMMIT;
--error 1305
RELEASE SAVEPOINT s1;
BEGIN;
SAVEPOINT s2;
COMMIT;
--error 1305
ROLLBACK TO SAVEPOINT s2;
BEGIN;
SAVEPOINT s3;
ROLLBACK;
--error 1305
RELEASE SAVEPOINT s3;
BEGIN;
SAVEPOINT s4;
ROLLBACK;
--error 1305
ROLLBACK TO SAVEPOINT s4;
--echo End of 5.0 tests
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
......@@ -1368,6 +1408,7 @@ SELECT * FROM t1;
--echo # Switch to connection con2
connection con2;
--reap
SELECT * FROM t1;
connection default;
......
# ==== Purpose ====
#
# Waits until a variable from SHOW STATUS has returned a specified
# value, or until a timeout is reached.
#
# ==== Usage ====
#
# let $status_var= Threads_connected;
# let $status_var_value= 1;
# --source include/wait_for_status_var.inc
#
# Parameters:
#
# $status_var, $status_var_value
# This macro will wait until the variable of SHOW STATUS
# named $status_var gets the value $status_var_value. See
# the example above.
#
# $status_type= GLOBAL|SESSION
# To specify the type (attribute) of status variable and
# run either SHOW GLOBAL STATUS or SHOW SESSION STATUS.
#
# $status_var_comparsion
# By default, this file waits until $status_var becomes equal to
# $status_var_value. If you want to wait until $status_var
# becomes *unequal* to $status_var_value, set this parameter to the
# string '!=', like this:
# let $status_var_comparsion= !=;
#
# $status_timeout
# The default timeout is 1 minute. You can change the timeout by
# setting $status_timeout. The unit is tenths of seconds.
#
if (`SELECT STRCMP('$status_type', '') * STRCMP(UPPER('$status_type'), 'SESSION') * STRCMP(UPPER('$status_type'), 'GLOBAL')`)
{
--echo **** ERROR: Unknown type of variable status_type: allowed values are: SESSION or GLOBAL ****
exit;
}
let $_status_timeout_counter= $status_timeout;
if (!$_status_timeout_counter)
{
let $_status_timeout_counter= 600;
}
let $_status_var_comparsion= $status_var_comparsion;
if (`SELECT '$_status_var_comparsion' = ''`)
{
let $_status_var_comparsion= =;
}
let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE '$status_var'", Value, 1);
while (`SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_value')`)
{
if (!$_status_timeout_counter)
{
--echo **** ERROR: failed while waiting for $status_type $status_var $_status_var_comparison $status_var_value ****
--echo Note: the following output may have changed since the failure was detected
--echo **** Showing STATUS, PROCESSLIST ****
eval SHOW $status_type STATUS LIKE '$status_var';
SHOW PROCESSLIST;
exit;
}
dec $_status_timeout_counter;
sleep 0.1;
let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE '$status_var'", Value, 1);
}
......@@ -1616,14 +1616,22 @@ sub mysql_fix_arguments () {
}
sub client_arguments ($) {
sub client_arguments ($;$) {
my $client_name= shift;
my $group_suffix= shift;
my $client_exe= mtr_exe_exists("$path_client_bindir/$client_name");
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
client_debug_arg($args, $client_name);
if (defined($group_suffix)) {
mtr_add_arg($args, "--defaults-group-suffix=%s", $group_suffix);
client_debug_arg($args, "$client_name-$group_suffix");
}
else
{
client_debug_arg($args, $client_name);
}
return mtr_args2str($client_exe, @$args);
}
......@@ -1874,6 +1882,7 @@ sub environment_setup {
$ENV{'MYSQL_SHOW'}= client_arguments("mysqlshow");
$ENV{'MYSQL_BINLOG'}= client_arguments("mysqlbinlog");
$ENV{'MYSQL'}= client_arguments("mysql");
$ENV{'MYSQL_SLAVE'}= client_arguments("mysql", ".2");
$ENV{'MYSQL_UPGRADE'}= client_arguments("mysql_upgrade");
$ENV{'MYSQLADMIN'}= native_path($exe_mysqladmin);
$ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
......
......@@ -2,7 +2,8 @@ DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (id INTEGER, grp TINYINT, id_rev INTEGER);
SELECT COUNT(*) FROM t1;
COUNT(*)
4181000
4201000
SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
# Begin cleanup
SET session myisam_sort_buffer_size = @orig_myisam_sort_buffer_size;
DROP TABLE t1;
set @@read_buffer_size=default;
......@@ -535,3 +535,11 @@ CREATE TABLE t1(a TEXT);
SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
ERROR HY000: Incorrect arguments to AGAINST
DROP TABLE t1;
CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
SELECT * FROM t1 WHERE MATCH(a) AGAINST('+awrd bwrd* +cwrd*' IN BOOLEAN MODE);
a
awrd bwrd cwrd
awrd bwrd cwrd
awrd bwrd cwrd
DROP TABLE t1;
select des_encrypt('hello');
des_encrypt('hello')
€Ö2nV“Ø}
#
# Bug #11643: des_encrypt() causes server to die
#
CREATE TABLE t1 (des VARBINARY(200) NOT NULL DEFAULT '') ENGINE=MyISAM;
INSERT INTO t1 VALUES ('1234'), ('12345'), ('123456'), ('1234567');
UPDATE t1 SET des=DES_ENCRYPT('1234');
SELECT LENGTH(des) FROM t1;
LENGTH(des)
9
9
9
9
SELECT DES_DECRYPT(des) FROM t1;
DES_DECRYPT(des)
1234
1234
1234
1234
SELECT
LENGTH(DES_ENCRYPT('1234')),
LENGTH(DES_ENCRYPT('12345')),
LENGTH(DES_ENCRYPT('123456')),
LENGTH(DES_ENCRYPT('1234567'));
LENGTH(DES_ENCRYPT('1234')) LENGTH(DES_ENCRYPT('12345')) LENGTH(DES_ENCRYPT('123456')) LENGTH(DES_ENCRYPT('1234567'))
9 9 9 9
SELECT
DES_DECRYPT(DES_ENCRYPT('1234')),
DES_DECRYPT(DES_ENCRYPT('12345')),
DES_DECRYPT(DES_ENCRYPT('123456')),
DES_DECRYPT(DES_ENCRYPT('1234567'));
DES_DECRYPT(DES_ENCRYPT('1234')) DES_DECRYPT(DES_ENCRYPT('12345')) DES_DECRYPT(DES_ENCRYPT('123456')) DES_DECRYPT(DES_ENCRYPT('1234567'))
1234 12345 123456 1234567
DROP TABLE t1;
End of 5.0 tests
......@@ -183,3 +183,10 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select des_decrypt(des_encrypt('hello',4),'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt('hello','hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
drop table if exists t1;
create table t1 (f1 smallint(6) default null, f2 mediumtext character set utf8)
engine=myisam default charset=latin1;
insert into t1 values (null,'contraction\'s');
insert into t1 values (-15818,'requirement\'s');
select encrypt(f1,f2) as a from t1,(select encrypt(f1,f2) as b from t1) a;
drop table t1;
......@@ -329,6 +329,9 @@ SELECT * FROM t1 WHERE a = NAME_CONST('reportDate',
_binary'2009-01-09' COLLATE 'binary');
a
DROP TABLE t1;
select NAME_CONST('_id',1234) as id;
id
1234
End of 5.0 tests
select connection_id() > 0;
connection_id() > 0
......
......@@ -103,3 +103,46 @@ CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL))
8
End of 5.0 tests
drop table if exists t1;
create table t1 (f1 set('test1','test2','test3') character set utf8 default null)
engine=myisam default charset=latin1;
insert into t1 values (''),(null),(null),(''),(''),('');
select find_in_set(f1,f1) as a from t1,(select find_in_set(f1,f1) as b from t1) a;
a
0
NULL
NULL
0
0
0
0
NULL
NULL
0
0
0
0
NULL
NULL
0
0
0
0
NULL
NULL
0
0
0
0
NULL
NULL
0
0
0
0
NULL
NULL
0
0
0
drop table t1;
......@@ -2526,3 +2526,17 @@ h i
31.12.2008 AAAAAA, aaaaaa
DROP TABLE t1;
End of 5.0 tests
drop table if exists t1;
create table t1(f1 tinyint default null)engine=myisam;
insert into t1 values (-1),(null);
explain select 1 as a from t1,(select decode(f1,f1) as b from t1) a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using join buffer
2 DERIVED t1 ALL NULL NULL NULL NULL 2
explain select 1 as a from t1,(select encode(f1,f1) as b from t1) a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using join buffer
2 DERIVED t1 ALL NULL NULL NULL NULL 2
drop table t1;
This diff is collapsed.
......@@ -47,26 +47,26 @@ INSERT INTO gis_point VALUES
INSERT INTO gis_line VALUES
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10))));
(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
INSERT INTO gis_polygon VALUES
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))));
(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
INSERT INTO gis_multi_point VALUES
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10))));
(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
INSERT INTO gis_multi_line VALUES
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))));
(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
INSERT INTO gis_multi_polygon VALUES
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))));
(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
INSERT INTO gis_geometrycollection VALUES
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))));
(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))));
INSERT into gis_geometry SELECT * FROM gis_point;
INSERT into gis_geometry SELECT * FROM gis_line;
INSERT into gis_geometry SELECT * FROM gis_polygon;
......
......@@ -739,3 +739,7 @@ handler t1 read a next;
ERROR HY000: Table storage engine for 't1' doesn't have this option
handler t1 close;
drop table t1;
USE information_schema;
HANDLER COLUMNS OPEN;
ERROR HY000: Incorrect usage of HANDLER OPEN and information_schema
USE test;
......@@ -737,3 +737,7 @@ handler t1 read a next;
ERROR HY000: Table storage engine for 't1' doesn't have this option
handler t1 close;
drop table t1;
USE information_schema;
HANDLER COLUMNS OPEN;
ERROR HY000: Incorrect usage of HANDLER OPEN and information_schema
USE test;
......@@ -38,3 +38,10 @@ a
11
7
drop table t1;
create table t1 (a int, b int) engine=myisam;
create table t2 (c int, d int, key (c)) engine=innodb;
insert into t1 values (1,1);
insert into t2 values (1,2);
set session transaction isolation level read committed;
delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1);
drop table t1, t2;
......@@ -1736,36 +1736,36 @@ select count(*) from t1 where x = 18446744073709551601;
count(*)
1
drop table t1;
show status like "Innodb_buffer_pool_pages_total";
Variable_name Value
Innodb_buffer_pool_pages_total 512
show status like "Innodb_page_size";
Variable_name Value
Innodb_page_size 16384
show status like "Innodb_rows_deleted";
Variable_name Value
Innodb_rows_deleted 71
show status like "Innodb_rows_inserted";
Variable_name Value
Innodb_rows_inserted 1084
show status like "Innodb_rows_updated";
Variable_name Value
Innodb_rows_updated 885
show status like "Innodb_row_lock_waits";
Variable_name Value
Innodb_row_lock_waits 0
show status like "Innodb_row_lock_current_waits";
Variable_name Value
Innodb_row_lock_current_waits 0
show status like "Innodb_row_lock_time";
Variable_name Value
Innodb_row_lock_time 0
show status like "Innodb_row_lock_time_max";
Variable_name Value
Innodb_row_lock_time_max 0
show status like "Innodb_row_lock_time_avg";
Variable_name Value
Innodb_row_lock_time_avg 0
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
variable_value
512
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
variable_value
16384
SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';
variable_value - @innodb_rows_deleted_orig
71
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
variable_value - @innodb_rows_inserted_orig
1084
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
variable_value - @innodb_rows_updated_orig
885
SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
variable_value - @innodb_row_lock_waits_orig
0
SELECT variable_value - @innodb_row_lock_current_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits';
variable_value - @innodb_row_lock_current_waits_orig
0
SELECT variable_value - @innodb_row_lock_time_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time';
variable_value - @innodb_row_lock_time_orig
0
SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max';
variable_value - @innodb_row_lock_time_max_orig
0
SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
variable_value - @innodb_row_lock_time_avg_orig
0
show variables like "innodb_sync_spin_loops";
Variable_name Value
innodb_sync_spin_loops 20
......
......@@ -1378,6 +1378,36 @@ a b c
5 1 1
4 1 1
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
CREATE INDEX i1 on t1 (a(3));
SELECT * FROM t1 WHERE a = 'abcde';
a
DROP TABLE t1;
#
# BUG #26288: savepoint are not deleted on comit, if the transaction
# was otherwise empty
#
BEGIN;
SAVEPOINT s1;
COMMIT;
RELEASE SAVEPOINT s1;
ERROR 42000: SAVEPOINT s1 does not exist
BEGIN;
SAVEPOINT s2;
COMMIT;
ROLLBACK TO SAVEPOINT s2;
ERROR 42000: SAVEPOINT s2 does not exist
BEGIN;
SAVEPOINT s3;
ROLLBACK;
RELEASE SAVEPOINT s3;
ERROR 42000: SAVEPOINT s3 does not exist
BEGIN;
SAVEPOINT s4;
ROLLBACK;
ROLLBACK TO SAVEPOINT s4;
ERROR 42000: SAVEPOINT s4 does not exist
End of 5.0 tests
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
......@@ -1846,4 +1876,149 @@ id
TRUNCATE TABLE t2;
DROP TABLE t2;
DROP TABLE t1;
#
# Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0
#
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE t2 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
aid INT UNSIGNED NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (aid) REFERENCES t1 (id)
) ENGINE=InnoDB;
CREATE TABLE t3 (
bid INT UNSIGNED NOT NULL,
FOREIGN KEY (bid) REFERENCES t2 (id)
) ENGINE=InnoDB;
CREATE TABLE t4 (
a INT
) ENGINE=InnoDB;
CREATE TABLE t5 (
a INT
) ENGINE=InnoDB;
INSERT INTO t1 (id) VALUES (1);
INSERT INTO t2 (id, aid) VALUES (1, 1),(2,1),(3,1),(4,1);
INSERT INTO t3 (bid) VALUES (1);
INSERT INTO t4 VALUES (1),(2),(3),(4),(5);
INSERT INTO t5 VALUES (1);
DELETE t5 FROM t4 LEFT JOIN t5 ON t4.a= t5.a;
DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`bid`) REFERENCES `t2` (`id`))
DELETE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`bid`) REFERENCES `t2` (`id`))
DELETE IGNORE t2, t1 FROM t2 INNER JOIN t1 ON (t2.aid = t1.id) WHERE t2.id = 1;
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
DROP TABLES t4,t5;
# Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0
# Testing for any side effects of IGNORE on AFTER DELETE triggers used with
# transactional tables.
#
CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (a VARCHAR(100)) ENGINE=InnoDB;
CREATE TABLE t3 (i INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t4 (i INT NOT NULL PRIMARY KEY, t1i INT,
FOREIGN KEY (t1i) REFERENCES t1(i))
ENGINE=InnoDB;
CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW
BEGIN
SET @b:='EXECUTED TRIGGER';
INSERT INTO t2 VALUES (@b);
SET @a:= error_happens_here;
END||
SET @b:="";
SET @a:="";
INSERT INTO t1 VALUES (1),(2),(3),(4);
INSERT INTO t3 SELECT * FROM t1;
** An error in a trigger causes rollback of the statement.
DELETE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
ERROR 42S22: Unknown column 'error_happens_here' in 'field list'
SELECT @a,@b;
@a @b
EXECUTED TRIGGER
SELECT * FROM t2;
a
SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;
i i
1 1
2 2
3 3
4 4
** Same happens with the IGNORE option
DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
ERROR 42S22: Unknown column 'error_happens_here' in 'field list'
SELECT * FROM t2;
a
SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;
i i
1 1
2 2
3 3
4 4
**
** The following is an attempt to demonstrate
** error handling inside a row iteration.
**
DROP TRIGGER trg;
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
TRUNCATE TABLE t3;
INSERT INTO t1 VALUES (1),(2),(3),(4);
INSERT INTO t3 VALUES (1),(2),(3),(4);
INSERT INTO t4 VALUES (3,3),(4,4);
CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW
BEGIN
SET @b:= CONCAT('EXECUTED TRIGGER FOR ROW ',CAST(OLD.i AS CHAR));
INSERT INTO t2 VALUES (@b);
END||
** DELETE is prevented by foreign key constrains but errors are silenced.
** The AFTER trigger isn't fired.
DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
** Tables are modified by best effort:
SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;
i i
3 3
4 4
** The AFTER trigger was only executed on successful rows:
SELECT * FROM t2;
a
EXECUTED TRIGGER FOR ROW 1
EXECUTED TRIGGER FOR ROW 2
DROP TRIGGER trg;
**
** Induce an error midway through an AFTER-trigger
**
TRUNCATE TABLE t4;
TRUNCATE TABLE t1;
TRUNCATE TABLE t3;
INSERT INTO t1 VALUES (1),(2),(3),(4);
INSERT INTO t3 VALUES (1),(2),(3),(4);
CREATE TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW
BEGIN
SET @a:= @a+1;
IF @a > 2 THEN
INSERT INTO t4 VALUES (5,5);
END IF;
END||
SET @a:=0;
** Errors in the trigger causes the statement to abort.
DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`t1i`) REFERENCES `t1` (`i`))
SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;
i i
1 1
2 2
3 3
4 4
SELECT * FROM t4;
i t1i
DROP TRIGGER trg;
DROP TABLE t4;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
End of 5.1 tests
......@@ -633,4 +633,9 @@ SELECT * FROM t2;
c1
15449237462
DROP TABLE t1, t2;
CREATE TABLE t1(f1 FLOAT);
INSERT INTO t1 VALUES (1.23);
CREATE TABLE t2(f1 CHAR(1));
INSERT INTO t2 SELECT f1 FROM t1;
DROP TABLE t1, t2;
End of 5.0 tests.
......@@ -96,6 +96,61 @@ alter table t1 auto_increment=0;
alter table t1 auto_increment=0;
unlock tables;
drop table t1;
create table t1 (a int);
create table t2 like t1;
# con1
lock tables t1 write;
# con2
flush tables with read lock;
# con5
# global read lock is taken
# con3
select * from t2 for update;
# waiting for release of read lock
# con4
# would hang and later cause a deadlock
flush tables t2;
# clean up
unlock tables;
unlock tables;
a
drop table t1,t2;
#
# Lightweight version:
# Ensure that the wait for a GRL is done before opening tables.
#
create table t1 (a int);
create table t2 like t1;
#
# UPDATE
#
# default
flush tables with read lock;
# con1
update t2 set a = 1;
# default
# statement is waiting for release of read lock
# con2
flush table t2;
# default
unlock tables;
# con1
#
# LOCK TABLES .. WRITE
#
# default
flush tables with read lock;
# con1
lock tables t2 write;
# default
# statement is waiting for release of read lock
# con2
flush table t2;
# default
unlock tables;
# con1
unlock tables;
drop table t1,t2;
End of 5.0 tests
create table t1 (i int);
lock table t1 read;
......
......@@ -2115,4 +2115,16 @@ insert into m1 (col1) values (1);
insert into m1 (col1) values (1);
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
drop table m1, t1;
CREATE TABLE t1 (
col1 INT(10)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE VIEW v1 as SELECT * FROM t1;
CREATE TABLE m1 (
col1 INT(10)
)ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(v1);
#Select should detect that the child table is a view and fail.
SELECT * FROM m1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP VIEW v1;
DROP TABLE m1, t1;
End of 5.1 tests
......@@ -2226,4 +2226,30 @@ Key Start Len Index Type
1 2 30 multip. varchar
2 33 30 multip. char NULL
DROP TABLE t1;
CREATE TABLE t1 (
c INT,
d bit(1),
e INT,
f VARCHAR(1),
g BIT(1),
h BIT(1),
KEY (h, d, e, g)
);
INSERT INTO t1 VALUES
( 3, 1, 1, 'a', 0, 0 ),
( 3, 1, 5, 'a', 0, 0 ),
( 10, 1, 2, 'a', 0, 1 ),
( 10, 1, 3, 'a', 0, 1 ),
( 10, 1, 4, 'a', 0, 1 );
SELECT f FROM t1 WHERE d = 1 AND e = 2 AND g = 0 AND h = 1;
f
a
SELECT h+0, d + 0, e, g + 0 FROM t1;
h+0 d + 0 e g + 0
0 1 1 0
0 1 5 0
1 1 2 0
1 1 3 0
1 1 4 0
DROP TABLE t1;
End of 5.1 tests
#
# BUG#41330 - Myisam table open count set to zero before index blocks are written.
#
# Don't test this under valgrind, memory leaks will occur
# Binary must be compiled with debug for crash to occur
SET GLOBAL delay_key_write=ALL;
CREATE TABLE t1(a INT,
b INT,
PRIMARY KEY(a , b),
KEY(b)) ENGINE=MyISAM DELAY_KEY_WRITE = 1;
INSERT INTO t1 VALUES (1,2),(2,3),(3,4),(4,5),(5,6);
# Setup the mysqld to crash at certain point
SET SESSION debug="d,crash_before_flush_keys";
# Write file to make mysql-test-run.pl expect crash
# Run the crashing query
FLUSH TABLE t1;
ERROR HY000: Lost connection to MySQL server during query
# Run MYISAMCHK tool to check the table t1 and repair
myisamchk: MyISAM file MYSQLD_DATADIR/test/t1
myisamchk: warning: 1 client is using or hasn't closed the table properly
myisamchk: error: Size of indexfile is: 1024 Should be: 3072
MYISAMCHK: Unknown error 126
myisamchk: error: Can't read indexpage from filepos: 1024
MyISAM-table 'MYSQLD_DATADIR/test/t1' is corrupted
Fix it using switch "-r" or "-o"
# Write file to make mysql-test-run.pl start the server
# Turn on reconnect
# Call script that will poll the server waiting for
# it to be back online again
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL DEFAULT '0',
`b` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`a`,`b`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
SELECT * FROM t1 FORCE INDEX (PRIMARY);
a b
1 2
2 3
3 4
4 5
5 6
DROP TABLE t1;
#
# BUG#40827 - Killing insert-select to MyISAM can cause table corruption
#
CREATE TABLE `t1` (
`id` BIGINT(20) ,
`id1` BIGINT(20) AUTO_INCREMENT,
KEY(id1), KEY(id)
) ENGINE=MyISAM;
CREATE TABLE `t2` (
`id` BIGINT(20) ,
`id1` BIGINT(20) AUTO_INCREMENT,
KEY (id1), KEY(id)
) ENGINE=MyISAM;
INSERT INTO t2 (id) VALUES (123);
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
# Switch to insert Connection
SET SESSION debug='+d,wait_in_enable_indexes';
# Send insert data
INSERT INTO t1(id) SELECT id FROM t2;
# Switch to default Connection
# Wait for insert data to reach the debug point
SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE = 'wait_in_enable_indexes' AND
INFO = "INSERT INTO t1(id) SELECT id FROM t2"
INTO @thread_id;
KILL QUERY @thread_id;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1,t2;
......@@ -54,3 +54,36 @@ test.t1 repair error Table 'test.t1' is read only
Warnings:
Error 1036 Table 't1' is read only
drop table t1;
#
# BUG#41541 - Valgrind warnings on packed MyISAM table
#
CREATE TABLE t1(f1 VARCHAR(200), f2 TEXT);
INSERT INTO t1 VALUES ('foo', 'foo1'), ('bar', 'bar1');
FLUSH TABLE t1;
# Compress the table using MYISAMPACK tool
SELECT COUNT(*) FROM t1;
COUNT(*)
1024
DROP TABLE t1;
#
# Bug #43973 - backup_myisam.test fails on 6.0-bugteam
#
CREATE DATABASE mysql_db1;
CREATE TABLE mysql_db1.t1 (c1 VARCHAR(5), c2 int);
CREATE INDEX i1 ON mysql_db1.t1 (c1, c2);
INSERT INTO mysql_db1.t1 VALUES ('A',1);
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
FLUSH TABLE mysql_db1.t1;
# Compress the table using MYISAMPACK tool
# Run MYISAMCHK tool on the compressed table
SELECT COUNT(*) FROM mysql_db1.t1 WHERE c2 < 5;
COUNT(*)
128
DROP TABLE mysql_db1.t1;
DROP DATABASE mysql_db1;
......@@ -9,7 +9,17 @@ SET timestamp=1000000000;
#
# We need big packets.
#
# Capture initial value to reset at the end of the test
# Now adjust max_allowed_packet
SET @@global.max_allowed_packet= 1024*1024*1024;
max_allowed_packet is a global variable.
In order for the preceding change in max_allowed_packets' value
to be seen and used, we must start a new connection.
The change does not take effect with the current one.
For simplicity, we just disconnect / reconnect connection default here.
Disconnecting default connection...
Reconnecting default connection...
default connection established, continuing with the test
#
# Delete all existing binary logs.
#
......@@ -21,40 +31,56 @@ CREATE TABLE t1 (
c1 LONGTEXT
) ENGINE=MyISAM DEFAULT CHARSET latin1;
#
# Show how much rows are affected by each statement.
# Show how many rows are affected by each statement.
#
#
# Insert a big row.
# Insert some big rows.
#
256MB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 16777216));
affected rows: 1
32MB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
affected rows: 1
4MB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 262144));
affected rows: 1
512KB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 32768));
affected rows: 1
#
# Show what we have in the table.
# Do not display the column value itself, just its length.
#
SELECT LENGTH(c1) FROM t1;
LENGTH(c1) 268435456
LENGTH(c1) 33554432
affected rows: 1
LENGTH(c1) 4194304
LENGTH(c1) 524288
affected rows: 4
#
# Grow the row by updating.
# Grow the rows by updating.
#
UPDATE t1 SET c1 = CONCAT(c1, c1);
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
affected rows: 4
info: Rows matched: 4 Changed: 4 Warnings: 0
#
# Show what we have in the table.
# Do not display the column value itself, just its length.
#
SELECT LENGTH(c1) FROM t1;
LENGTH(c1) 536870912
LENGTH(c1) 1048576
LENGTH(c1) 67108864
affected rows: 1
LENGTH(c1) 8388608
affected rows: 4
#
# Delete the row.
# Delete the rows.
#
DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck';
affected rows: 1
affected rows: 4
#
# Hide how much rows are affected by each statement.
# Hide how many rows are affected by each statement.
#
#
# Flush all log buffers to the log file.
......@@ -70,5 +96,7 @@ FLUSH LOGS;
#
# Cleanup.
#
# reset variable value to pass testcase checks
SET @@global.max_allowed_packet = 1048576;
DROP TABLE t1;
remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out
......@@ -3815,7 +3815,6 @@ DROP TABLE t1,t2;
-- Dump completed on DATE
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
#
# Bug #42635: mysqldump includes views that were excluded using
# the --ignore-table option
......
select 1;
1
1
SHOW VARIABLES like 'slave_skip_errors';
Variable_name Value
slave_skip_errors OFF
......@@ -615,3 +615,6 @@ UPDATE t3 SET a4={d '1789-07-14'} WHERE a1=0;
SELECT a1, a4 FROM t2 WHERE a4 LIKE {fn UCASE('1789-07-14')};
a1 a4
DROP TABLE t1, t2, t3;
#
# End of 5.1 tests
#
#
# Bug#39559: dump of stored procedures / functions with C-style
# comment can't be read back
#
+----------+--------+
| expected | result |
+----------+--------+
| 2 | 2 |
+----------+--------+
+----------+--------+
| expected | result |
+----------+--------+
| 1 | 1 |
+----------+--------+
+----------+--------+
| expected | result |
+----------+--------+
| 3 | 3 |
+----------+--------+
+----------+--------+
| expected | result |
+----------+--------+
| 2 | 2 |
+----------+--------+
+----------+--------+
| expected | result |
+----------+--------+
| 7 | 7 |
+----------+--------+
+----------+--------+
| expected | result |
+----------+--------+
| 8 | 8 |
+----------+--------+
+----------+--------+
| expected | result |
+----------+--------+
| 7 | 7 |
+----------+--------+
+----------+--------+
| expected | result |
+----------+--------+
| 4 | 4 |
+----------+--------+
+----------+--------+
| expected | result |
+----------+--------+
| 4 | 4 |
+----------+--------+
......@@ -1911,5 +1911,18 @@ select count(*) from t1;
count(*)
288
drop table t1;
#
# Bug#42944: partition not pruned correctly
#
CREATE TABLE t1 (a int) PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION p2 VALUES LESS THAN (300),
PARTITION p3 VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (10), (100), (200), (300), (400);
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a>=200;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 3 Using where
DROP TABLE t1;
End of 5.1 tests
SET @@global.general_log= @old_general_log;
......@@ -53,7 +53,14 @@ CREATE TABLE t1 (a INT)
of multi-line
comment */
PARTITIONS 5 */;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/' at line 6
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (a)
PARTITIONS 5 */
DROP TABLE t1;
CREATE TABLE t1 (a INT)
/*!50100 PARTITION BY HASH (a)
-- with a single line comment embedded
......
......@@ -400,16 +400,16 @@ prepare stmt3 from ' lock tables t1 read ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' unlock tables ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' load data infile ''data.txt''
into table t1 fields terminated by ''\t'' ';
prepare stmt1 from ' load data infile ''<MYSQLTEST_VARDIR>/tmp/data.txt''
into table t1 fields terminated by ''\t'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
prepare stmt1 from ' select * into outfile ''<MYSQLTEST_VARDIR>/tmp/data.txt'' from t1 ';
execute stmt1 ;
prepare stmt1 from ' optimize table t1 ' ;
prepare stmt1 from ' analyze table t1 ' ;
prepare stmt1 from ' checksum table t1 ' ;
prepare stmt1 from ' repair table t1 ' ;
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
prepare stmt1 from ' restore table t1 from ''<MYSQLTEST_VARDIR>/tmp/data.txt'' ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' handler t1 open ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
......
......@@ -126,7 +126,7 @@ id
# Run CHECK TABLE, it should indicate table need a REPAIR TABLE
CHECK TABLE t1 FOR UPGRADE;
Table Op Msg_type Msg_text
test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" to fix it!
test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
# REPAIR old table USE_FRM should fail
REPAIR TABLE t1 USE_FRM;
Table Op Msg_type Msg_text
......
......@@ -4373,6 +4373,19 @@ f3 f4 count
1 abc 1
1 def 2
drop table t1, t2, t3;
CREATE TABLE t1 (a INT KEY, b INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` > 1)) limit 2
DROP TABLE t1;
End of 5.0 tests
create table t1(a INT, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
......
......@@ -2152,4 +2152,11 @@ Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous
drop table t1;
mysqld is alive
SET @max_allowed_packet= @@global.max_allowed_packet;
SET @net_buffer_length= @@global.net_buffer_length;
SET GLOBAL max_allowed_packet= 1024;
SET GLOBAL net_buffer_length= 1024;
ERROR 1153 (08S01) at line 1: Got a packet bigger than 'max_allowed_packet' bytes
SET GLOBAL max_allowed_packet= @max_allowed_packet;
SET GLOBAL net_buffer_length= @net_buffer_length;
End of 5.0 tests.
......@@ -4342,9 +4342,9 @@ drop procedure if exists bug13012|
create procedure bug13012()
BEGIN
REPAIR TABLE t1;
BACKUP TABLE t1 to '../../tmp';
BACKUP TABLE t1 to '<MYSQLTEST_VARDIR>/tmp/';
DROP TABLE t1;
RESTORE TABLE t1 FROM '../../tmp';
RESTORE TABLE t1 FROM '<MYSQLTEST_VARDIR>/tmp/';
END|
call bug13012()|
Table Op Msg_type Msg_text
......@@ -6994,6 +6994,21 @@ select name from mysql.proc where name = 'p' and sql_mode = @full_mode;
name
p
drop procedure p;
CREATE DEFINER = 'root'@'localhost' PROCEDURE p1()
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
SHOW TABLE STATUS like 't1';
END;//
CREATE TABLE t1 (f1 INT);
CALL p1();
CALL p1();
CALL p1();
CALL p1();
DROP PROCEDURE p1;
DROP TABLE t1;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
......@@ -1960,6 +1960,26 @@ select * from t2;
s1
drop table t1;
drop temporary table t2;
#------------------------------------------------------------------------
# Bug#39953 Triggers are not working properly with multi table updates
#------------------------------------------------------------------------
DROP TABLE IF EXISTS t1;
DROP TRIGGER IF EXISTS t_insert;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (a int, date_insert timestamp, PRIMARY KEY (a));
INSERT INTO t1 (a) VALUES (2),(5);
CREATE TABLE t2 (a int, b int, PRIMARY KEY (a));
CREATE TRIGGER t_insert AFTER INSERT ON t2 FOR EACH ROW BEGIN UPDATE t1,t2 SET
date_insert=NOW() WHERE t1.a=t2.b AND t2.a=NEW.a; END |
INSERT INTO t2 (a,b) VALUES (1,2);
DROP TRIGGER t_insert;
CREATE TRIGGER t_insert AFTER INSERT ON t2 FOR EACH ROW BEGIN UPDATE t1,t2 SET
date_insert=NOW(),b=b+1 WHERE t1.a=t2.b AND t2.a=NEW.a; END |
INSERT INTO t2 (a,b) VALUES (3,5);
ERROR HY000: Can't update table 't2' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
DROP TABLE t1;
DROP TRIGGER t_insert;
DROP TABLE t2;
End of 5.0 tests
drop table if exists table_25411_a;
drop table if exists table_25411_b;
......
......@@ -1562,4 +1562,16 @@ DESC t6;
Field Type Null Key Default Extra
NULL int(11) YES NULL
DROP TABLE t1, t2, t3, t4, t5, t6;
CREATE TABLE t1 (f FLOAT(9,6));
CREATE TABLE t2 AS SELECT f FROM t1 UNION SELECT f FROM t1;
SHOW FIELDS FROM t2;
Field Type Null Key Default Extra
f float(9,6) YES NULL
DROP TABLE t1, t2;
CREATE TABLE t1(d DOUBLE(9,6));
CREATE TABLE t2 AS SELECT d FROM t1 UNION SELECT d FROM t1;
SHOW FIELDS FROM t2;
Field Type Null Key Default Extra
d double(9,6) YES NULL
DROP TABLE t1, t2;
End of 5.0 tests
......@@ -57,6 +57,18 @@ s1
1
drop table `txu@0023p@0023p1`;
drop table `txu#p#p1`;
#
# Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
#
# copy table created using mysql4.0 into the data dir
# check the table created using mysql 4.0
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
# query the table created using mysql 4.0
SELECT * FROM t1;
c1 c2 c3
DROP TABLE t1;
truncate t1;
drop table t1;
drop database if exists `tabc`;
......@@ -84,3 +96,23 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin2
drop database `a-b-c`;
drop database `tabc`;
use `#mysql50#a-b-c`;
create table t1(f1 char(10));
show databases like '%a-b-c%';
Database (%a-b-c%)
#mysql50#a-b-c
ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
show databases like '%a-b-c%';
Database (%a-b-c%)
a-b-c
show create view `a-b-c`.v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `a`.`f1` AS `f1` from (`a-b-c`.`t1` `a` join `information_schema`.`tables` `b`) where (convert(`a`.`f1` using utf8) = `b`.`TABLE_NAME`) utf8 utf8_general_ci
Warnings:
Note 1600 Creation context of view `a-b-c`.`v1' is invalid
select * from `a-b-c`.v1;
f1
Warnings:
Note 1600 Creation context of view `a-b-c`.`v1' is invalid
drop database `a-b-c`;
use test;
......@@ -38,7 +38,7 @@ length(a) length(b)
255 3
CHECK TABLE t1 FOR UPGRADE;
Table Op Msg_type Msg_text
test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" to fix it!
test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
......
set session transaction_prealloc_size=1024*1024*1024*1;
show processlist;
SET SESSION transaction_prealloc_size=1024*1024*1024*1;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
1 root localhost test Query 0 NULL show processlist
set session transaction_prealloc_size=1024*1024*1024*2;
show processlist;
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*2;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
1 root localhost test Query 0 NULL show processlist
set session transaction_prealloc_size=1024*1024*1024*3;
show processlist;
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*3;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
1 root localhost test Query 0 NULL show processlist
set session transaction_prealloc_size=1024*1024*1024*4;
show processlist;
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*4;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
1 root localhost test Query 0 NULL show processlist
set session transaction_prealloc_size=1024*1024*1024*5;
show processlist;
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*5;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
1 root localhost test Query 0 NULL show processlist
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
......@@ -11,7 +11,7 @@ Variable_name Value
slave_load_tmpdir SLAVE_LOAD_TMPDIR
show variables like 'slave_skip_errors';
Variable_name Value
slave_skip_errors 3,100,137,643,1752
slave_skip_errors 0,3,100,137,643,1752
---- Clean Up ----
set global slave_net_timeout=default;
set global sql_slave_skip_counter= 0;
......@@ -98,12 +98,12 @@ ERROR HY000: Variable 'slave_load_tmpdir' is a read only variable
#
SHOW VARIABLES like 'slave_skip_errors';
Variable_name Value
slave_skip_errors 3,100,137,643,1752
slave_skip_errors 0,3,100,137,643,1752
SELECT @@session.slave_skip_errors;
ERROR HY000: Variable 'slave_skip_errors' is a GLOBAL variable
SELECT @@global.slave_skip_errors;
@@global.slave_skip_errors
3,100,137,643,1752
0,3,100,137,643,1752
SET @@session.slave_skip_errors= 7;
ERROR HY000: Variable 'slave_skip_errors' is a read only variable
SET @@global.slave_skip_errors= 7;
......
......@@ -1064,4 +1064,33 @@ select extractvalue('<a></a>','"b"/a');
ERROR HY000: XPATH syntax error: '/a'
select extractvalue('<a></a>','(1)/a');
ERROR HY000: XPATH syntax error: '/a'
CREATE TABLE IF NOT EXISTS t1 (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
xml text,
PRIMARY KEY (id)
) ENGINE=MyISAM;
INSERT INTO t1 (id, xml) VALUES
(15, '<?xml version="1.0"?><bla name="blubb"></bla>'),
(14, '<xml version="kaputt">');
SELECT
extractvalue( xml, '/bla/@name' ),
extractvalue( xml, '/bla/@name' )
FROM t1 ORDER BY t1.id;
extractvalue( xml, '/bla/@name' ) extractvalue( xml, '/bla/@name' )
NULL NULL
blubb blubb
Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
SELECT
UpdateXML(xml, '/bla/@name', 'test'),
UpdateXML(xml, '/bla/@name', 'test')
FROM t1 ORDER BY t1.id;
UpdateXML(xml, '/bla/@name', 'test') UpdateXML(xml, '/bla/@name', 'test')
NULL NULL
<?xml version="1.0"?><bla test></bla> <?xml version="1.0"?><bla test></bla>
Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
DROP TABLE t1;
End of 5.1 tests
......@@ -11,7 +11,7 @@ prepare s from "insert into t1 select 100 limit ?";
set @a=100;
execute s using @a;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
Note 1592 Statement is not safe to log in statement format.
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (a int)
......
......@@ -46,6 +46,7 @@
# BUG#34732: mysqlbinlog does not print default values for auto_increment variables
# BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed
# BUG#41980, SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0
# BUG#42640: mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLES mode)
#
# ==== Related test cases ====
#
......@@ -369,4 +370,22 @@ DROP FUNCTION func7;
DROP TRIGGER trig;
DROP TABLE t1, t2, t3, trigger_table;
set @@SESSION.SQL_LOG_BIN = @save_log_bin;
#
# For BUG#42640: mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLES mode)
#
SET @save_sql_mode = @@SESSION.SQL_MODE;
SET @@SESSION.SQL_MODE = STRICT_ALL_TABLES;
CREATE TABLE t1(i INT PRIMARY KEY);
CREATE TABLE t2(i INT PRIMARY KEY);
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
INSERT INTO t1 VALUES(@@global.sync_binlog);
UPDATE t1 SET i = 999 LIMIT 1;
DELETE FROM t1 LIMIT 1;
DROP TABLE t1, t2;
SET @@SESSION.SQL_MODE = @save_sql_mode;
--echo "End of tests"
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1i(n int primary key) engine=innodb;
create table t2m(n int primary key) engine=myisam;
begin;
insert into t1i values (1);
insert into t1i values (2);
insert into t1i values (3);
commit;
begin;
insert into t1i values (5);
begin;
insert into t1i values (4);
insert into t2m values (1);
update t1i set n = 5 where n = 4;
commit;
zero
0
*** kill sql thread ***
rollback;
*** sql thread is *not* running: No ***
*** the prove: the killed slave has not finished the current transaction ***
three
3
one
1
zero
0
delete from t2m;
start slave sql_thread;
delete from t1i;
delete from t2m;
begin;
insert into t1i values (5);
begin;
insert into t1i values (4);
update t1i set n = 5 where n = 4;
commit;
zero
0
stop slave sql_thread;
rollback;
*** sql thread is *not* running: No ***
*** the prove: the stopped slave has rolled back the current transaction ***
zero
0
zero
0
one
1
start slave sql_thread;
drop table t1i, t2m;
#
# Bug #38205 Row-based Replication (RBR) causes inconsistencies: HA_ERR_FOUND_DUPP_KEY
# Bug#319 if while a non-transactional slave is replicating a transaction possible problem
#
# Verifying the fact that STOP SLAVE in the middle of a group execution waits
# for the end of the group before the slave sql thread will stop.
# The patch refines STOP SLAVE to not interrupt a transaction or other type of
# the replication events group (the part I).
# Killing the sql thread continues to provide a "hard" stop (the part II).
#
# Non-deterministic tests
#
source include/master-slave.inc;
source include/have_innodb.inc;
#
# Part II, killed sql slave leaves instantly
#
# A. multi-statement transaction as the replication group
connection master;
create table t1i(n int primary key) engine=innodb;
create table t2m(n int primary key) engine=myisam;
sync_slave_with_master;
connection master;
begin;
insert into t1i values (1);
insert into t1i values (2);
insert into t1i values (3);
commit;
sync_slave_with_master;
#
# todo: first challenge is to find out the SQL thread id
# the following is not fully reliable
#
let $id=`SELECT id from information_schema.processlist where user like 'system user' and state like '%Has read all relay log%' or user like 'system user' and state like '%Reading event from the relay log%'`;
connection slave;
begin;
insert into t1i values (5);
connection master;
let $pos0_master= query_get_value(SHOW MASTER STATUS, Position, 1);
begin;
insert into t1i values (4);
insert into t2m values (1); # non-ta update
update t1i set n = 5 where n = 4; # to block at. can't be played with killed
commit;
let $pos1_master= query_get_value(SHOW MASTER STATUS, Position, 1);
connection slave;
# slave sql thread must be locked out by the conn `slave' explicit lock
let $pos0_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
--disable_query_log
eval select $pos0_master - $pos0_slave as zero;
--enable_query_log
connection slave1;
let $count= 1;
let $table= t2m;
source include/wait_until_rows_count.inc;
#
# todo: may fail as said above
#
--echo *** kill sql thread ***
--disable_query_log
eval kill connection $id;
--enable_query_log
connection slave;
rollback; # release the sql thread
connection slave1;
source include/wait_for_slave_sql_to_stop.inc;
let $sql_status= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1);
--echo *** sql thread is *not* running: $sql_status ***
let $pos1_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
connection slave;
--echo *** the prove: the killed slave has not finished the current transaction ***
--disable_query_log
select count(*) as three from t1i;
eval select $pos1_master > $pos1_slave as one;
eval select $pos1_slave - $pos0_slave as zero;
--enable_query_log
delete from t2m; # remove the row to be able to replay
start slave sql_thread;
#
# Part I: B The homogenous transaction remains interuptable in between
#
connection master;
delete from t1i;
delete from t2m;
sync_slave_with_master;
begin;
insert into t1i values (5);
connection master;
let $pos0_master= query_get_value(SHOW MASTER STATUS, Position, 1);
begin;
insert into t1i values (4);
update t1i set n = 5 where n = 4; # to block at. not to be played
commit;
let $pos1_master= query_get_value(SHOW MASTER STATUS, Position, 1);
connection slave1;
# slave sql can't advance as must be locked by the conn `slave' trans
let $pos0_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
--disable_query_log
eval select $pos0_master - $pos0_slave as zero;
--enable_query_log
#
# the replicated trans is blocked by the slave's local.
# However, it's not easy to catch the exact moment when it happens.
# The test issues sleep which makes the test either non-deterministic or
# wasting too much time.
#
--sleep 3
send stop slave sql_thread;
connection slave;
rollback; # release the sql thread
connection slave1;
reap;
source include/wait_for_slave_sql_to_stop.inc;
let $sql_status= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1);
--echo *** sql thread is *not* running: $sql_status ***
let $pos1_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
--echo *** the prove: the stopped slave has rolled back the current transaction ***
--disable_query_log
select count(*) as zero from t1i;
eval select $pos0_master - $pos0_slave as zero;
eval select $pos1_master > $pos0_slave as one;
--enable_query_log
start slave sql_thread;
# clean-up
connection master;
drop table t1i, t2m;
sync_slave_with_master;
......@@ -10,4 +10,7 @@
#
##############################################################################
ndb_trig_1011ext: Bug#32656 NDB: Duplicate key error aborts transaction in handler. Doesn't talk back to SQL
\ No newline at end of file
ndb_trig_1011ext: Bug#32656 NDB: Duplicate key error aborts transaction in handler. Doesn't talk back to SQL
charset_collation_1: Bug#38346, Bug#40209, Bug#40545, Bug#40618
charset_collation_2: Bug#38346, Bug#40209, Bug#40545, Bug#40618
charset_collation_3: Bug#38346, Bug#40209, Bug#40545, Bug#40618
......@@ -86,6 +86,15 @@ let $check_std_csets= 1;
let $check_ucs2_csets= 1;
let $check_utf8_csets= 1;
# Bug#32784: Timeout in test "innodb_charset": InnoDB much slower
# than other handlers
# NOTE: We turn autocommit off to improve the performance of the innodb variant
# of this test. Per Innobase's recommendation.
--disable_query_log
SET autocommit=0;
--enable_query_log
#
# Check all charsets/collation combinations
#
......
# Check for IBM i 6.1 or later
--disable_query_log
system uname -rv > $MYSQLTEST_VARDIR/tmp/version;
--disable_warnings
drop table if exists uname_vr;
--enable_warnings
create temporary table uname_vr (r int, v int);
--disable_warnings
eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/version" into table uname_vr fields terminated by ' ';
--enable_warnings
let $ok = `select count(*) from uname_vr where v > 5`;
drop table uname_vr;
remove_file $MYSQLTEST_VARDIR/tmp/version;
--enable_query_log
if (!$ok)
{
skip "Need IBM i 6.1 or later";
}
if (!`SELECT count(*) FROM information_schema.engines WHERE
(support = 'YES' OR support = 'DEFAULT') AND
engine = 'ibmdb2i'`)
{
skip Need ibmdb2i engine;
}
create schema `A12345_@$#`;
create table `A12345_@$#`.t1 (i int) engine=ibmdb2i;
show create table `A12345_@$#`.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=IBMDB2I DEFAULT CHARSET=latin1
select * from `A12345_@$#`.t1;
i
drop table `A12345_@$#`.t1;
drop schema `A12345_@$#`;
create table t1 (c char(10) collate utf8_swedish_ci, index(c)) engine=ibmdb2i;
drop table t1;
create table t1 (c char(10) collate ucs2_swedish_ci, index(c)) engine=ibmdb2i;
drop table t1;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source include/have_case_sensitive_file_system.inc;
create schema `A12345_@$#`;
create table `A12345_@$#`.t1 (i int) engine=ibmdb2i;
show create table `A12345_@$#`.t1;
select * from `A12345_@$#`.t1;
drop table `A12345_@$#`.t1;
drop schema `A12345_@$#`;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source suite/ibmdb2i/include/have_i61.inc;
create table t1 (c char(10) collate utf8_swedish_ci, index(c)) engine=ibmdb2i;
drop table t1;
create table t1 (c char(10) collate ucs2_swedish_ci, index(c)) engine=ibmdb2i;
drop table t1;
......@@ -83,4 +83,4 @@ sync_slave_with_master;
# will be created. You will need to go to the mysql-test dir and diff
# the files your self to see what is not matching
--exec diff $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
--diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
reset master;
call mtr.add_suppression("Failed during slave.*thread initialization");
call mtr.add_suppression("Failed during slave thread initialization");
stop slave;
reset slave;
SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
......@@ -23,8 +23,8 @@ Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Last_Errno #
Last_Error Failed during slave thread initialization
Skip_Counter 0
Exec_Master_Log_Pos 0
Relay_Log_Space #
......@@ -41,6 +41,6 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
Last_SQL_Errno #
Last_SQL_Error Failed during slave thread initialization
SET GLOBAL debug="";
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
......@@ -4,51 +4,57 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
*** Prepare tables and data ***
CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=innodb;
CREATE TABLE t2 (a INT NOT NULL, KEY(a)) ENGINE=innodb;
CREATE TABLE t3 (a INT UNIQUE) ENGINE=innodb;
CREATE TABLE t4 (a INT) ENGINE=innodb;
show variables like 'slave_transaction_retries';
Variable_name Value
slave_transaction_retries 10
show create table t1;
CREATE TABLE t2 (a INT) ENGINE=innodb;
CREATE TABLE t3 (a INT NOT NULL, KEY(a)) ENGINE=innodb;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
KEY `a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
show create table t2;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL,
KEY `a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
show variables like 'slave_transaction_retries';
SHOW VARIABLES LIKE 'slave_transaction_retries';
Variable_name Value
slave_transaction_retries 2
stop slave;
begin;
insert into t2 values (0);
insert into t1 values(1);
commit;
begin;
select * from t1 for update;
include/stop_slave.inc
BEGIN;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
INSERT INTO t3 VALUES (3);
COMMIT;
*** Test deadlock ***
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a
start slave;
select * from t2 for update /* dl */;
a
commit;
select * from t1;
START SLAVE;
SELECT COUNT(*) FROM t2;
COUNT(*)
0
COMMIT;
SELECT * FROM t1;
a
1
select * from t2 /* must be 1 */;
SELECT * FROM t3;
a
0
show slave status;
3
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_MYPORT
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -83,38 +89,41 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
stop slave;
delete from t3;
change master to master_log_pos=548;
begin;
select * from t2 for update;
*** Test lock wait timeout ***
include/stop_slave.inc
DELETE FROM t2;
CHANGE MASTER TO MASTER_LOG_POS=MASTER_POS_BEGIN;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a
1
START SLAVE;
SELECT COUNT(*) FROM t2;
COUNT(*)
0
start slave;
select count(*) from t3 /* must be zero */;
count(*)
0
commit;
select * from t1;
COMMIT;
include/start_slave.inc
SELECT * FROM t1;
a
1
1
select * from t2;
SELECT * FROM t3;
a
0
0
show slave status;
3
3
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_MYPORT
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running #
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
......@@ -138,47 +147,50 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
set @my_max_relay_log_size= @@global.max_relay_log_size;
set global max_relay_log_size=0;
stop slave;
delete from t3;
change master to master_log_pos=548;
begin;
select * from t2 for update;
*** Test lock wait timeout and purged relay logs ***
SET @my_max_relay_log_size= @@global.max_relay_log_size;
SET global max_relay_log_size=0;
include/stop_slave.inc
DELETE FROM t2;
CHANGE MASTER TO MASTER_LOG_POS=440;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a
1
1
START SLAVE;
SELECT COUNT(*) FROM t2;
COUNT(*)
0
0
start slave;
select count(*) from t3 /* must be zero */;
count(*)
0
commit;
select * from t1;
COMMIT;
include/start_slave.inc
SELECT * FROM t1;
a
1
1
1
select * from t2;
SELECT * FROM t3;
a
0
0
0
show slave status;
3
3
3
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_MYPORT
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running #
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
......@@ -206,6 +218,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
drop table t1,t2,t3,t4;
set global max_relay_log_size= @my_max_relay_log_size;
*** Clean up ***
DROP TABLE t1,t2,t3;
SET global max_relay_log_size= @my_max_relay_log_size;
End of 5.1 tests
......@@ -141,9 +141,9 @@ select * from ti1 order by b /* must be (2),(3) */;
b
2
3
*** slave must stop
*** slave must stop (Trying to delete a referenced foreing key)
Last_SQL_Error
0
1451
select * from ti1 order by b /* must be (1),(2),(3) - not deleted */;
b
1
......@@ -159,7 +159,7 @@ set global slave_exec_mode='STRICT';
*** conspire future problem
delete from ti1 where b=3;
insert into ti2 set a=3, b=3 /* offending write event */;
*** slave must stop
*** slave must stop (Trying to insert an invalid foreign key)
Last_SQL_Error
1452
select * from ti2 order by b /* must be (2,2) */;
......@@ -179,7 +179,7 @@ a b
*** conspiring query
insert into ti1 set b=1;
insert into ti1 set b=1 /* offending write event */;
*** slave must stop
*** slave must stop (Trying to insert a dupliacte key)
Last_SQL_Error
1062
set foreign_key_checks= 0;
......@@ -195,32 +195,32 @@ INSERT INTO t2 VALUES (-1),(-2),(-3);
DELETE FROM t1 WHERE a = -2;
DELETE FROM t2 WHERE a = -2;
DELETE FROM t1 WHERE a = -2;
*** slave must stop
*** slave must stop (Key was not found)
Last_SQL_Error
1032
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
set global slave_exec_mode='STRICT';
DELETE FROM t2 WHERE a = -2;
*** slave must stop
*** slave must stop (Key was not found)
Last_SQL_Error
0
1032
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
set global slave_exec_mode='STRICT';
UPDATE t1 SET a = 1 WHERE a = -1;
UPDATE t2 SET a = 1 WHERE a = -1;
UPDATE t1 SET a = 1 WHERE a = -1;
*** slave must stop
*** slave must stop (Key was not found)
Last_SQL_Error
1032
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
set global slave_exec_mode='STRICT';
UPDATE t2 SET a = 1 WHERE a = -1;
*** slave must stop
*** slave must stop (Key was not found)
Last_SQL_Error
0
1032
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
SET @@global.slave_exec_mode= @old_slave_exec_mode;
......
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
reset slave;
SET GLOBAL debug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
Reporting the following error: Failed during slave thread initialization
SET GLOBAL debug= "";
stop slave;
reset slave;
SET GLOBAL init_slave= "garbage";
start slave;
Reporting the following error: Slave SQL thread aborted. Can't execute init_slave query
SET GLOBAL init_slave= "";
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP DATABASE IF EXISTS d1;
DROP DATABASE IF EXISTS d2;
DROP DATABASE IF EXISTS d3;
DROP DATABASE IF EXISTS d4;
DROP EVENT IF EXISTS e1;
DROP EVENT IF EXISTS e2;
DROP EVENT IF EXISTS e3;
DROP EVENT IF EXISTS e4;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP FUNCTION IF EXISTS f3;
DROP FUNCTION IF EXISTS f4;
DROP SERVER IF EXISTS s1;
DROP SERVER IF EXISTS s2;
DROP SERVER IF EXISTS s3;
DROP SERVER IF EXISTS s4;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
DROP TABLE IF EXISTS t4;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
DROP PROCEDURE IF EXISTS p3;
DROP PROCEDURE IF EXISTS p4;
DROP TRIGGER IF EXISTS tr1;
DROP TRIGGER IF EXISTS tr2;
DROP TRIGGER IF EXISTS tr3;
DROP TRIGGER IF EXISTS tr4;
CREATE DATABASE d1;
CREATE EVENT e1
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
DO INSERT INTO test.t1 VALUES (1);
CREATE FUNCTION f1 () RETURNS INT DETERMINISTIC
RETURN 1;
CREATE PROCEDURE p1 (OUT rows INT)
BEGIN
SELECT COUNT(*) INTO rows FROM t1;
END;
//
CREATE SERVER s1
FOREIGN DATA WRAPPER mysql
OPTIONS (USER 'user1', HOST '192.168.1.106', DATABASE 'test');
CREATE TABLE t1 (a int);
CREATE TABLE t3 (a int);
CREATE TRIGGER tr1 BEFORE INSERT ON t1
FOR EACH ROW BEGIN
DELETE FROM t4 WHERE a=NEW.a;
END;
//
CREATE INDEX i1 ON t1 (a);
CREATE VIEW v1 AS SELECT a FROM t1 WHERE a < 100;
[on master]
[on master1]
CREATE DATABASE d2;
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP DATABASE d1;
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP DATABASE d2;
source include/kill_query.inc;
source include/diff_master_slave.inc;
CREATE EVENT e2
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
DO INSERT INTO test.t1 VALUES (2);
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP EVENT e1;
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP EVENT IF EXISTS e2;
source include/kill_query.inc;
source include/diff_master_slave.inc;
CREATE FUNCTION f2 () RETURNS INT DETERMINISTIC
RETURN 1;
source include/kill_query.inc;
source include/diff_master_slave.inc;
ALTER FUNCTION f1 SQL SECURITY INVOKER;
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP FUNCTION f1;
source include/kill_query.inc;
source include/diff_master_slave.inc;
CREATE PROCEDURE p2 (OUT rows INT)
BEGIN
SELECT COUNT(*) INTO rows FROM t2;
END;
//
source include/kill_query.inc;
source include/diff_master_slave.inc;
ALTER PROCEDURE p1 SQL SECURITY INVOKER COMMENT 'return rows of table t1';
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP PROCEDURE p1;
source include/kill_query.inc;
source include/diff_master_slave.inc;
CREATE TABLE t2 (b int);
source include/kill_query.inc;
source include/diff_master_slave.inc;
ALTER TABLE t1 ADD (d int);
source include/kill_query.inc;
source include/diff_master_slave.inc;
RENAME TABLE t3 TO t4;
source include/kill_query.inc;
source include/diff_master_slave.inc;
CREATE INDEX i2 on t1 (a);
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP INDEX i1 on t1;
source include/kill_query.inc;
source include/diff_master_slave.inc;
CREATE TRIGGER tr2 BEFORE INSERT ON t4
FOR EACH ROW BEGIN
DELETE FROM t1 WHERE a=NEW.a;
END;
//
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP TRIGGER tr1;
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP TRIGGER IF EXISTS tr2;
source include/kill_query.inc;
source include/diff_master_slave.inc;
CREATE VIEW v2 AS SELECT a FROM t1 WHERE a > 100;
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP VIEW v1;
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP VIEW IF EXISTS v2;
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP TABLE t1;
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP TABLE IF EXISTS t2;
source include/kill_query.inc;
source include/diff_master_slave.inc;
DROP DATABASE IF EXISTS d1;
DROP DATABASE IF EXISTS d2;
DROP DATABASE IF EXISTS d3;
DROP DATABASE IF EXISTS d4;
DROP EVENT IF EXISTS e1;
DROP EVENT IF EXISTS e2;
DROP EVENT IF EXISTS e3;
DROP EVENT IF EXISTS e4;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP FUNCTION IF EXISTS f3;
DROP FUNCTION IF EXISTS f4;
DROP SERVER IF EXISTS s1;
DROP SERVER IF EXISTS s2;
DROP SERVER IF EXISTS s3;
DROP SERVER IF EXISTS s4;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
DROP TABLE IF EXISTS t4;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
DROP PROCEDURE IF EXISTS p3;
DROP PROCEDURE IF EXISTS p4;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
==== Initialize ====
[on master]
create table t1 (id int);
==== create a procedure that has a column aliase in a subquery ====
drop procedure if exists test_procedure;
create procedure test_procedure(_id int)
begin
insert into t1 (id)
select a.id
from
( select _id as id ) a;
end;$$
==== enable the binary log, then call the procedure ====
call test_procedure(1234);
[on slave]
select * from t1 order by id;
id
1234
==== Clean up ====
[on master]
drop table t1;
drop procedure test_procedure;
......@@ -74,19 +74,16 @@ Last_SQL_Error
drop table t1;
create table t1(a int primary key);
insert into t1 values (1),(2);
delete from t1 where @@server_id=1;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
SET SQL_LOG_BIN=0;
delete from t1;
SET SQL_LOG_BIN=1;
set sql_mode=strict_trans_tables;
insert into t1 values (7), (8), (9);
insert into t1 values (1), (2), (3);
[on slave]
select * from t1;
a
1
2
7
8
9
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
......@@ -128,3 +125,66 @@ Last_SQL_Errno 0
Last_SQL_Error
==== Clean Up ====
drop table t1;
==== Using Innodb ====
SET SQL_LOG_BIN=0;
CREATE TABLE t1(id INT NOT NULL PRIMARY KEY, data INT) Engine=InnoDB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`data` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SET SQL_LOG_BIN=1;
CREATE TABLE t1(id INT NOT NULL PRIMARY KEY, data INT) Engine=InnoDB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`data` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(1, 1);
INSERT INTO t1 VALUES(2, 1);
INSERT INTO t1 VALUES(3, 1);
INSERT INTO t1 VALUES(4, 1);
SET SQL_LOG_BIN=0;
DELETE FROM t1 WHERE id = 4;
SET SQL_LOG_BIN=1;
UPDATE t1 SET id= id + 3, data = 2;
**** We cannot execute a select as there are differences in the
**** behavior between STMT and RBR.
==== Using MyIsam ====
SET SQL_LOG_BIN=0;
CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL,
`data` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET SQL_LOG_BIN=1;
CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL,
`data` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t2 VALUES(1, 1);
INSERT INTO t2 VALUES(2, 1);
INSERT INTO t2 VALUES(3, 1);
INSERT INTO t2 VALUES(5, 1);
SET SQL_LOG_BIN=0;
DELETE FROM t2 WHERE id = 5;
SET SQL_LOG_BIN=1;
UPDATE t2 SET id= id + 3, data = 2;
**** We cannot execute a select as there are differences in the
**** behavior between STMT and RBR.
==== Clean Up ====
DROP TABLE t1;
DROP TABLE t2;
......@@ -10,3 +10,31 @@ start slave;
stop slave io_thread;
start slave io_thread;
drop table t1;
create table t1i(n int primary key) engine=innodb;
create table t2m(n int primary key) engine=myisam;
begin;
insert into t1i values (1);
insert into t1i values (2);
insert into t1i values (3);
commit;
begin;
insert into t1i values (5);
begin;
insert into t1i values (4);
insert into t2m values (1);
insert into t1i values (5);
commit;
zero
0
stop slave;
rollback;
*** sql thread is *not* running: No ***
*** the prove: the stopped slave has finished the current transaction ***
five
5
zero
0
one
1
include/start_slave.inc
drop table t1i, t2m;
......@@ -10,7 +10,7 @@ CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
INSERT INTO test.t1 VALUES(1,'test');
UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
Note 1592 Statement is not safe to log in statement format.
create procedure test.p1()
begin
INSERT INTO test.t1 VALUES(2,'test');
......@@ -18,7 +18,7 @@ UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2;
end|
CALL test.p1();
Warnings:
Warning 1592 Statement is not safe to log in statement format.
Note 1592 Statement is not safe to log in statement format.
SELECT * FROM test.t1 ORDER BY blob_column;
a blob_column
1 abase
......
......@@ -182,19 +182,19 @@ CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
affected rows: 0
INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
Warnings:
Warning 1592 Statement is not safe to log in statement format.
Note 1592 Statement is not safe to log in statement format.
affected rows: 1
INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
Warnings:
Warning 1592 Statement is not safe to log in statement format.
Note 1592 Statement is not safe to log in statement format.
affected rows: 1
INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
Warnings:
Warning 1592 Statement is not safe to log in statement format.
Note 1592 Statement is not safe to log in statement format.
affected rows: 1
INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
Warnings:
Warning 1592 Statement is not safe to log in statement format.
Note 1592 Statement is not safe to log in statement format.
affected rows: 1
SELECT * FROM t1 ORDER BY sum;
sum price
......
......@@ -10,6 +10,4 @@
#
##############################################################################
rpl_binlog_corruption : BUG#41793 2008-12-30 sven rpl_binlog_corruption disabled in main (needs new mtr)
rpl_temp_table_mix_row : BUG#43440 2009-03-23 joro rpl.rpl_temp_table_mix_row fails sporadicly
rpl_cross_version : BUG#42311 2009-03-27 joro rpl_cross_version fails on macosx
rm -f $MYSQLTEST_VARDIR/slave-data/master.info
......@@ -34,6 +34,7 @@ source include/setup_fake_relay_log.inc;
--echo ==== Test ====
START SLAVE SQL_THREAD;
let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE
source include/wait_for_slave_sql_error.inc;
let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
--echo Last_SQL_Error = $error
......
......@@ -15,7 +15,7 @@ reset master;
connection slave;
# Add suppression for expected warnings in slaves error log
call mtr.add_suppression("Failed during slave.*thread initialization");
call mtr.add_suppression("Failed during slave thread initialization");
--disable_warnings
stop slave;
......@@ -37,8 +37,8 @@ connection slave;
#
source include/wait_for_slave_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 19 # 23 # 33 # 37 #
query_vertical show slave status;
#
......
--loose-debug=d,simulate_slave_delay_at_terminate_bug38694
# Testing replication threads stopping concurrency issue
# at the server shutdown
# Related bugs: bug#38694, bug#29968, bug#25306
# The test checks if a delay at the termination phase of slave threads
# DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
# could cause any issue.
source include/master-slave.inc;
# End of tests
......@@ -208,7 +208,7 @@ select * from ti1 order by b /* must be (2),(3) */;
# foreign key: row is referenced
--echo *** slave must stop
--echo *** slave must stop (Trying to delete a referenced foreing key)
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
......@@ -242,7 +242,7 @@ delete from ti1 where b=3;
connection master;
insert into ti2 set a=3, b=3 /* offending write event */;
--echo *** slave must stop
--echo *** slave must stop (Trying to insert an invalid foreign key)
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
......@@ -281,7 +281,7 @@ insert into ti1 set b=1;
connection master;
insert into ti1 set b=1 /* offending write event */;
--echo *** slave must stop
--echo *** slave must stop (Trying to insert a dupliacte key)
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
......@@ -316,7 +316,7 @@ DELETE FROM t2 WHERE a = -2;
connection master;
DELETE FROM t1 WHERE a = -2;
--echo *** slave must stop
--echo *** slave must stop (Key was not found)
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
......@@ -333,8 +333,8 @@ sync_slave_with_master;
set global slave_exec_mode='STRICT';
connection master;
DELETE FROM t2 WHERE a = -2;
--echo *** slave must stop
DELETE FROM t2 WHERE a = -2;
--echo *** slave must stop (Key was not found)
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
......@@ -356,7 +356,7 @@ UPDATE t2 SET a = 1 WHERE a = -1;
connection master;
UPDATE t1 SET a = 1 WHERE a = -1;
--echo *** slave must stop
--echo *** slave must stop (Key was not found)
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
......@@ -376,7 +376,7 @@ set global slave_exec_mode='STRICT';
connection master;
UPDATE t2 SET a = 1 WHERE a = -1;
--echo *** slave must stop
--echo *** slave must stop (Key was not found)
connection slave;
source include/wait_for_slave_sql_to_stop.inc;
......
######################################################################
# Some errors that cause the slave SQL thread to stop are not shown in
# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error
# is only in the server's error log.
#
# Two failures and their respective reporting are verified:
#
# 1 - Failures during slave thread initialization
# 2 - Failures while processing queries passed through the init_slave
# option.
#
# In order to check the first type of failure, we inject a fault in the
# SQL/IO Threads through SET GLOBAL debug.
#
# To check the second type, we set @@global.init_slave to an invalid
# command thus preventing the initialization of the SQL Thread.
#
# Obs:
# 1 - Note that testing failures while initializing the relay log position
# is hard as the same function is called before the code reaches the point
# that we want to test.
#
# 2 - This test does not target failures that are reported while applying
# events such as duplicate keys, errors while reading the relay-log.bin*,
# etc. Such errors are already checked on other tests.
######################################################################
######################################################################
# Configuring the Environment
######################################################################
source include/have_debug.inc;
source include/master-slave.inc;
source include/have_log_bin.inc;
connection slave;
--disable_warnings
stop slave;
--enable_warnings
reset slave;
######################################################################
# Injecting faults in the threads' initialization
######################################################################
connection slave;
# Set debug flags on slave to force errors to occur
SET GLOBAL debug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
#
# slave is going to stop because of emulated failures
# but there won't be any crashes nor asserts hit.
#
source include/wait_for_slave_to_stop.inc;
let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1);
echo Reporting the following error: $error;
SET GLOBAL debug= "";
######################################################################
# Injecting faults in the init_slave option
######################################################################
connection slave;
--disable_warnings
stop slave;
--enable_warnings
source include/wait_for_slave_to_stop.inc;
reset slave;
SET GLOBAL init_slave= "garbage";
start slave;
source include/wait_for_slave_sql_to_stop.inc;
let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1);
echo Reporting the following error: $error;
######################################################################
# Clean up
######################################################################
SET GLOBAL init_slave= "";
--debug=d,debug_lock_before_query_log_event
# ==== Purpose ====
#
# This test check if DDL statements are correctly binlogged when the
# thread is killed
#
# ==== Method ====
#
# Start a DDL query and kill it, check if the error code of the binlog
# event is correct.
#
# DDL statements tested:
# CREATE/ALTER/RENAME/DROP DATABASE
# CREATE/ALTER/DROP EVENT
# CREATE/ALTER/DROP FUNCTION
# CREATE/ALTER/DROP PROCEDURE
# CREATE/ALTER/DROP SERVER
# CREATE/ALTER/RENAME/DROP TABLE
# CREATE/DROP TRIGGER
# CREATE/ALTER/DROP VIEW
#
# ==== Bugs =====
#
# BUG#37145
#
# ==== TODO ====
#
# There are some part of the test are temporarily disabled because of
# the following bugs, please enable then once they get fixed:
# - BUG#44041
# - BUG#43353
# - BUG#25705
# - BUG#44171
source include/have_debug.inc;
source include/master-slave.inc;
# Use the DBUG_SYNC_POINT to make sure the thread running the DDL is
# waiting before creating the query log event
let $debug_lock= "debug_lock.before_query_log_event";
######## INITIALIZATION ########
disable_warnings;
DROP DATABASE IF EXISTS d1;
DROP DATABASE IF EXISTS d2;
DROP DATABASE IF EXISTS d3;
DROP DATABASE IF EXISTS d4;
DROP EVENT IF EXISTS e1;
DROP EVENT IF EXISTS e2;
DROP EVENT IF EXISTS e3;
DROP EVENT IF EXISTS e4;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP FUNCTION IF EXISTS f3;
DROP FUNCTION IF EXISTS f4;
DROP SERVER IF EXISTS s1;
DROP SERVER IF EXISTS s2;
DROP SERVER IF EXISTS s3;
DROP SERVER IF EXISTS s4;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
DROP TABLE IF EXISTS t4;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
DROP PROCEDURE IF EXISTS p3;
DROP PROCEDURE IF EXISTS p4;
DROP TRIGGER IF EXISTS tr1;
DROP TRIGGER IF EXISTS tr2;
DROP TRIGGER IF EXISTS tr3;
DROP TRIGGER IF EXISTS tr4;
enable_warnings;
CREATE DATABASE d1;
CREATE EVENT e1
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
DO INSERT INTO test.t1 VALUES (1);
CREATE FUNCTION f1 () RETURNS INT DETERMINISTIC
RETURN 1;
DELIMITER //;
CREATE PROCEDURE p1 (OUT rows INT)
BEGIN
SELECT COUNT(*) INTO rows FROM t1;
END;
//
DELIMITER ;//
CREATE SERVER s1
FOREIGN DATA WRAPPER mysql
OPTIONS (USER 'user1', HOST '192.168.1.106', DATABASE 'test');
CREATE TABLE t1 (a int);
CREATE TABLE t3 (a int);
DELIMITER //;
CREATE TRIGGER tr1 BEFORE INSERT ON t1
FOR EACH ROW BEGIN
DELETE FROM t4 WHERE a=NEW.a;
END;
//
DELIMITER ;//
CREATE INDEX i1 ON t1 (a);
CREATE VIEW v1 AS SELECT a FROM t1 WHERE a < 100;
sync_slave_with_master;
connection master1;
let $connection_name= master1;
let $connection_id= `SELECT CONNECTION_ID()`;
connection master;
echo [on master];
# This will block the execution of a statement at the DBUG_SYNC_POINT
# with given lock name
if (`SELECT '$debug_lock' != ''`)
{
disable_query_log;
disable_result_log;
eval SELECT IS_FREE_LOCK($debug_lock);
eval SELECT GET_LOCK($debug_lock, 10);
eval SELECT IS_FREE_LOCK($debug_lock);
enable_query_log;
enable_result_log;
}
######## START TEST ########
connection master1;
echo [on master1];
disable_warnings;
######## DATABASE ########
let $diff_statement= SHOW DATABASES LIKE 'd%';
send CREATE DATABASE d2;
source include/kill_query_and_diff_master_slave.inc;
# Temporarily disabled, see BUG#44041, the ALTER DATABASE can affect the
# collation of other database on slave
#send ALTER DATABASE d1
# DEFAULT CHARACTER SET = 'utf8';
#source include/kill_query_and_diff_master_slave.inc;
send DROP DATABASE d1;
source include/kill_query_and_diff_master_slave.inc;
send DROP DATABASE d2;
source include/kill_query_and_diff_master_slave.inc;
######## EVENT ########
let $diff_statement= SELECT event_name, event_body, execute_at
FROM information_schema.events where event_name like 'e%';
send CREATE EVENT e2
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
DO INSERT INTO test.t1 VALUES (2);
source include/kill_query_and_diff_master_slave.inc;
# Temporarily disabled because of BUG#44171, killing ALTER EVENT can
# crash the server
#send ALTER EVENT e1
# ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 2 DAY;
#source include/kill_query_and_diff_master_slave.inc;
send DROP EVENT e1;
source include/kill_query_and_diff_master_slave.inc;
send DROP EVENT IF EXISTS e2;
source include/kill_query_and_diff_master_slave.inc;
######## FUNCTION ########
let $diff_statement= SHOW FUNCTION STATUS LIKE 'f%';
send CREATE FUNCTION f2 () RETURNS INT DETERMINISTIC
RETURN 1;
source include/kill_query_and_diff_master_slave.inc;
send ALTER FUNCTION f1 SQL SECURITY INVOKER;
source include/kill_query_and_diff_master_slave.inc;
# function f1 probably does not exist because the ALTER query was
# killed
send DROP FUNCTION f1;
source include/kill_query_and_diff_master_slave.inc;
# function f2 probably does not exist because the CREATE query was
# killed
#
# Temporarily disabled. Because of BUG#43353, KILL the query may
# result in function not found, and for 5.1, DROP statements will be
# logged if the function is not found on master, so the following DROP
# FUNCTION statement may be interrupted and not drop the function on
# master, but still get logged and executed on slave and cause
# inconsistence. Also disable the following DROP PROCEDURE IF EXITS
# below.
#send DROP FUNCTION IF EXISTS f2;
#source include/kill_query_and_diff_master_slave.inc;
######## PROCEDURE ########
let $diff_statement= SHOW PROCEDURE STATUS LIKE 'p%';
DELIMITER //;
send CREATE PROCEDURE p2 (OUT rows INT)
BEGIN
SELECT COUNT(*) INTO rows FROM t2;
END;
//
DELIMITER ;//
source include/kill_query_and_diff_master_slave.inc;
send ALTER PROCEDURE p1 SQL SECURITY INVOKER COMMENT 'return rows of table t1';
source include/kill_query_and_diff_master_slave.inc;
send DROP PROCEDURE p1;
source include/kill_query_and_diff_master_slave.inc;
# Temporarily disabled, see comment above for DROP FUNCTION IF EXISTS
#send DROP PROCEDURE IF EXISTS p2;
#source include/kill_query_and_diff_master_slave.inc;
######## TABLE ########
let $diff_statement= SHOW TABLES LIKE 't%';
send CREATE TABLE t2 (b int);
source include/kill_query_and_diff_master_slave.inc;
send ALTER TABLE t1 ADD (d int);
source include/kill_query_and_diff_master_slave.inc;
send RENAME TABLE t3 TO t4;
source include/kill_query_and_diff_master_slave.inc;
######## INDEX ########
let $diff_statement= SHOW INDEX FROM t1;
send CREATE INDEX i2 on t1 (a);
source include/kill_query_and_diff_master_slave.inc;
send DROP INDEX i1 on t1;
source include/kill_query_and_diff_master_slave.inc;
######## SERVER ########
# Tempoarily disabled, see bug#25705
# let $diff_statement= SELECT * FROM mysql.server WHERE name like 's%';
# send CREATE SERVER s2
# FOREIGN DATA WRAPPER mysql
# OPTIONS (USER 'user2', HOST '192.168.1.108', DATABASE 'test');
# source include/kill_query_and_diff_master_slave.inc;
# send ALTER SERVER s1
# OPTIONS (DATABASE 'test1');
# source include/kill_query_and_diff_master_slave.inc;
# send DROP SERVER s1;
# source include/kill_query_and_diff_master_slave.inc;
# send DROP SERVER IF EXIST s1;
# source include/kill_query_and_diff_master_slave.inc;
######## TRIGGER ########
let $diff_statement= SHOW TRIGGERS LIKE 'v%';
DELIMITER //;
send CREATE TRIGGER tr2 BEFORE INSERT ON t4
FOR EACH ROW BEGIN
DELETE FROM t1 WHERE a=NEW.a;
END;
//
DELIMITER ;//
source include/kill_query_and_diff_master_slave.inc;
send DROP TRIGGER tr1;
source include/kill_query_and_diff_master_slave.inc;
send DROP TRIGGER IF EXISTS tr2;
source include/kill_query_and_diff_master_slave.inc;
######## VIEW ########
let $diff_statement= SHOW TABLES LIKE 'v%';
send CREATE VIEW v2 AS SELECT a FROM t1 WHERE a > 100;
source include/kill_query_and_diff_master_slave.inc;
send DROP VIEW v1;
source include/kill_query_and_diff_master_slave.inc;
send DROP VIEW IF EXISTS v2;
source include/kill_query_and_diff_master_slave.inc;
######## DROP TABLE ########
let $diff_statement= SHOW TABLES LIKE 't%';
send DROP TABLE t1;
source include/kill_query_and_diff_master_slave.inc;
send DROP TABLE IF EXISTS t2;
source include/kill_query_and_diff_master_slave.inc;
######## CLEAN UP ########
connection master;
# The DROP statements above are killed during the process, so they
# does not make sure the objects are dropped.
disable_warnings;
DROP DATABASE IF EXISTS d1;
DROP DATABASE IF EXISTS d2;
DROP DATABASE IF EXISTS d3;
DROP DATABASE IF EXISTS d4;
DROP EVENT IF EXISTS e1;
DROP EVENT IF EXISTS e2;
DROP EVENT IF EXISTS e3;
DROP EVENT IF EXISTS e4;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP FUNCTION IF EXISTS f3;
DROP FUNCTION IF EXISTS f4;
DROP SERVER IF EXISTS s1;
DROP SERVER IF EXISTS s2;
DROP SERVER IF EXISTS s3;
DROP SERVER IF EXISTS s4;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
DROP TABLE IF EXISTS t4;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
DROP PROCEDURE IF EXISTS p3;
DROP PROCEDURE IF EXISTS p4;
enable_warnings;
# ==== Purpose ====
#
# Test that aliases of variables in binary log aren't ignored with NAME_CONST.
#
# ==== Method ====
#
# Create a procedure with aliases of variables, then replicate it to slave.
# BUG#35515 Aliases of variables in binary log are ignored with NAME_CONST.
#
source include/master-slave.inc;
--echo ==== Initialize ====
--echo [on master]
--connection master
create table t1 (id int);
--echo ==== create a procedure that has a column aliase in a subquery ====
--disable_warnings
drop procedure if exists test_procedure;
--enable_warnings
delimiter $$;
create procedure test_procedure(_id int)
begin
insert into t1 (id)
select a.id
from
( select _id as id ) a;
end;$$
delimiter ;$$
--echo ==== enable the binary log, then call the procedure ====
call test_procedure(1234);
--echo [on slave]
sync_slave_with_master;
select * from t1 order by id;
--echo ==== Clean up ====
--echo [on master]
connection master;
drop table t1;
drop procedure test_procedure;
......@@ -244,7 +244,7 @@ connection master;
# We should be gold by the time, so I will get rid of our file.
--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql
--remove_file $MYSQLTEST_VARDIR/tmp/remote.sql
################### End Bug 17654 ######################
# What is the point of this test? It seems entirely pointless. It
......@@ -349,9 +349,9 @@ FLUSH LOGS;
--diff_files $MYSQLTEST_VARDIR/tmp/local.sql $MYSQLTEST_VARDIR/tmp/remote.sql
--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql
--remove_file $MYSQLTEST_VARDIR/tmp/remote.sql
--exec rm $MYSQLTEST_VARDIR/tmp/local.sql
--remove_file $MYSQLTEST_VARDIR/tmp/local.sql
DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5;
sync_slave_with_master;
......
......@@ -8,18 +8,23 @@
# ==== Method ====
#
# We run the slave with --slave-skip-errors=1062 (the code for
# duplicate key). On slave, we insert value 1 in a table, and then,
# on master, we insert value 1 in the table. The error should be
# ignored on slave.
#
# duplicate key). Then we have two set of tests. In the first
# set, we insert value 1 in a table on the slave, and then, on
# master, we insert value 1 in the table. In the second set, we
# insert several values on the master, disable the binlog and
# delete one of the values and re-enable the binlog. Right after,
# we perform an update on the set of values in order to generate
# a duplicate key on the slave. The errors should be ignored on
# the slave.
#
# ==== Related bugs ====
#
# BUG#28839: Errors in strict mode silently stop SQL thread if --slave-skip-errors exists
# bug in this test: BUG#30594: rpl.rpl_skip_error is nondeterministic
# bug in this test: BUG#30594: rpl.rpl_skip_error is nondeterministic:
# BUG#39393: slave-skip-errors does not work when using ROW based replication
source include/master-slave.inc;
source include/have_binlog_format_statement.inc;
source include/have_innodb.inc;
--echo ==== Test Without sql_mode=strict_trans_tables ====
......@@ -64,9 +69,11 @@ sync_slave_with_master;
connection master;
create table t1(a int primary key);
insert into t1 values (1),(2);
delete from t1 where @@server_id=1;
SET SQL_LOG_BIN=0;
delete from t1;
SET SQL_LOG_BIN=1;
set sql_mode=strict_trans_tables;
insert into t1 values (7), (8), (9);
insert into t1 values (1), (2), (3);
--echo [on slave]
sync_slave_with_master;
......@@ -80,3 +87,83 @@ connection master;
drop table t1;
sync_slave_with_master;
# End of 5.0 tests
#
# BUG#39393: slave-skip-errors does not work when using ROW based replication
#
--echo ==== Using Innodb ====
connection master;
SET SQL_LOG_BIN=0;
CREATE TABLE t1(id INT NOT NULL PRIMARY KEY, data INT) Engine=InnoDB;
SHOW CREATE TABLE t1;
SET SQL_LOG_BIN=1;
connection slave;
CREATE TABLE t1(id INT NOT NULL PRIMARY KEY, data INT) Engine=InnoDB;
SHOW CREATE TABLE t1;
connection master;
INSERT INTO t1 VALUES(1, 1);
INSERT INTO t1 VALUES(2, 1);
INSERT INTO t1 VALUES(3, 1);
INSERT INTO t1 VALUES(4, 1);
SET SQL_LOG_BIN=0;
DELETE FROM t1 WHERE id = 4;
SET SQL_LOG_BIN=1;
UPDATE t1 SET id= id + 3, data = 2;
sync_slave_with_master;
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
echo $error;
--echo **** We cannot execute a select as there are differences in the
--echo **** behavior between STMT and RBR.
--echo ==== Using MyIsam ====
connection master;
SET SQL_LOG_BIN=0;
CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam;
SHOW CREATE TABLE t2;
SET SQL_LOG_BIN=1;
connection slave;
CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam;
SHOW CREATE TABLE t2;
connection master;
INSERT INTO t2 VALUES(1, 1);
INSERT INTO t2 VALUES(2, 1);
INSERT INTO t2 VALUES(3, 1);
INSERT INTO t2 VALUES(5, 1);
SET SQL_LOG_BIN=0;
DELETE FROM t2 WHERE id = 5;
SET SQL_LOG_BIN=1;
UPDATE t2 SET id= id + 3, data = 2;
sync_slave_with_master;
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
echo $error;
--echo **** We cannot execute a select as there are differences in the
--echo **** behavior between STMT and RBR.
--echo ==== Clean Up ====
connection master;
DROP TABLE t1;
DROP TABLE t2;
sync_slave_with_master;
source include/master-slave.inc;
source include/have_innodb.inc;
#
# Bug#6148 ()
......@@ -35,4 +36,88 @@ save_master_pos;
connection slave;
sync_with_master;
# End of 4.1 tests
#
# Bug#38205 Row-based Replication (RBR) causes inconsistencies...
# Bug#319 if while a non-transactional slave is replicating a transaction...
#
# Verifying that STOP SLAVE does not interrupt excution of a group
# execution of events if the group can not roll back.
# Killing the sql thread continues to provide a "hard" stop (the
# part II, moved to the bugs suite as it's hard to make it
# deterministic with KILL).
#
#
# Part I. The being stopped sql thread finishes first the current group of
# events if the group contains an event on a non-transaction table.
connection master;
create table t1i(n int primary key) engine=innodb;
create table t2m(n int primary key) engine=myisam;
begin;
insert into t1i values (1);
insert into t1i values (2);
insert into t1i values (3);
commit;
sync_slave_with_master;
connection slave;
begin;
insert into t1i values (5);
connection master;
let $pos0_master= query_get_value(SHOW MASTER STATUS, Position, 1);
begin;
insert into t1i values (4);
insert into t2m values (1); # non-ta update to process
insert into t1i values (5); # to block at. to be played with stopped
commit;
connection slave;
# slave sql thread must be locked out by the conn `slave' explicit lock
let $pos0_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
--disable_query_log
eval select $pos0_master - $pos0_slave as zero;
--enable_query_log
connection slave1;
let $count= 1;
let $table= t2m;
source include/wait_until_rows_count.inc;
send stop slave;
connection slave;
rollback; # release the sql thread
connection slave1;
reap;
source include/wait_for_slave_to_stop.inc;
let $sql_status= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1);
--echo *** sql thread is *not* running: $sql_status ***
connection master;
let $pos1_master= query_get_value(SHOW MASTER STATUS, Position, 1);
connection slave;
let $pos1_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
--echo *** the prove: the stopped slave has finished the current transaction ***
--disable_query_log
select count(*) as five from t1i;
eval select $pos1_master - $pos1_slave as zero;
eval select $pos1_slave > $pos0_slave as one;
--enable_query_log
source include/start_slave.inc;
# clean-up
connection master;
drop table t1i, t2m;
sync_slave_with_master;
# End of tests
......@@ -33,6 +33,10 @@ SHOW STATUS LIKE "Slave_open_temp_tables";
disconnect master;
--connection master1
# waiting DROP TEMPORARY TABLE event to be written into binlog
let $wait_binlog_event= DROP;
source include/wait_for_binlog_event.inc;
--echo [on slave]
sync_slave_with_master;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment