summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatiana A. Nurnberg <azundris@mysql.com>2009-02-23 13:14:17 +0100
committerTatiana A. Nurnberg <azundris@mysql.com>2009-02-23 13:14:17 +0100
commitec3decf6108a72e2d198882bf9ece2555229ea9c (patch)
tree7b5c08e7a4dd6e1f5eb424f1feff3dd237b55020
parentc1d73f3350e7a9e4cfeb953f0d3c368ebe805979 (diff)
parentfb20a7d6d0b21d69ff0941f3c0c57c1ae24fbbef (diff)
downloadmariadb-git-ec3decf6108a72e2d198882bf9ece2555229ea9c.tar.gz
auto-merge
-rw-r--r--mysql-test/include/ndb_backup.inc7
-rw-r--r--mysql-test/include/wait_show_condition.inc78
-rw-r--r--mysql-test/r/innodb_bug42419.result17
-rw-r--r--mysql-test/r/innodb_mysql.result16
-rw-r--r--mysql-test/r/mysqlbinlog.result19
-rw-r--r--mysql-test/r/mysqltest.result2
-rw-r--r--mysql-test/r/trigger-compat.result4
-rw-r--r--mysql-test/t/innodb_bug42419.test77
-rw-r--r--mysql-test/t/innodb_mysql-master.opt2
-rw-r--r--mysql-test/t/innodb_mysql.test51
-rw-r--r--mysql-test/t/mysqlbinlog.test45
-rw-r--r--mysql-test/t/mysqltest.test108
-rw-r--r--mysql-test/t/ndb_autodiscover.test6
-rw-r--r--mysql-test/t/rpl_trigger.test3
-rw-r--r--mysql-test/t/trigger-compat.test24
-rw-r--r--sql/item.cc1
-rw-r--r--sql/log_event.cc2
17 files changed, 337 insertions, 125 deletions
diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc
index f0a883d4e11..3239030bb64 100644
--- a/mysql-test/include/ndb_backup.inc
+++ b/mysql-test/include/ndb_backup.inc
@@ -2,6 +2,13 @@
# By JBM 2006-02-16 So that the code is not repeated #
# in test cases and can be reused. #
######################################################
+
+# Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to
+# 'grep' call
+# This test is disabled on Windows via the next line until the above bug is
+# resolved
+--source include/not_windows.inc
+
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
# there is no neat way to find the backupid, this is a hack to find it...
diff --git a/mysql-test/include/wait_show_condition.inc b/mysql-test/include/wait_show_condition.inc
new file mode 100644
index 00000000000..253101d1e07
--- /dev/null
+++ b/mysql-test/include/wait_show_condition.inc
@@ -0,0 +1,78 @@
+# include/wait_show_condition.inc
+#
+# SUMMARY
+#
+# Waits until the show statement ($show_statement) has at least within one of
+# the rows of the result set for the field ($field) a value which fulfils
+# a condition ($condition), or the operation times out.
+#
+#
+# USAGE
+#
+# let $show_statement= SHOW PROCESSLIST;
+# let $field= State;
+# let $condition= = 'Updating';
+# --source include/wait_show_condition.inc
+#
+# OR
+#
+# let $wait_timeout= 60; # Override default of 30 seconds with 60.
+# let $show_statement= SHOW PROCESSLIST;
+# let $field= State;
+# let $condition= = 'Updating';
+# --source include/wait_show_condition.inc
+#
+# Please do not use this use routine if you can replace the SHOW statement
+# with a select. In such a case include/wait_condition.inc is recommended.
+#
+# Created: 2009-02-18 mleich
+#
+
+let $max_run_time= 30;
+if ($wait_timeout)
+{
+ let $max_run_time= $wait_timeout;
+}
+# Reset $wait_timeout so that its value won't be used on subsequent
+# calls, and default will be used instead.
+let $wait_timeout= 0;
+
+# The smallest timespan till UNIX_TIMESTAMP() gets incremented is ~0 seconds.
+# We add one second to avoid the case that somebody measures timespans on a
+# real clock with fractions of seconds, detects that n seconds are sufficient,
+# assigns n to this routine and suffers because he sometimes gets n - 1
+# seconds in reality.
+inc $max_run_time;
+
+let $found= 0;
+let $max_end_time= `SELECT UNIX_TIMESTAMP() + $max_run_time`;
+while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`)
+{
+ # Sleep a bit to avoid too heavy load.
+ real_sleep 0.2;
+ let $rowno= 1;
+ let $process_result= 1;
+ while (`SELECT $process_result = 1 AND $found = 0`)
+ {
+ let $field_value= query_get_value($show_statement, $field, $rowno);
+ if (`SELECT '$field_value' $condition`)
+ {
+ let $found= 1;
+ }
+ if (`SELECT '$field_value' = 'No such row'`)
+ {
+ # We are behind the last row of the result set.
+ let $process_result= 0;
+ }
+ inc $rowno;
+ }
+}
+if (!$found)
+{
+ echo # Timeout in include/wait_show_condition.inc for $wait_condition;
+ echo # show_statement : $show_statement;
+ echo # field : $field;
+ echo # condition : $condition;
+ echo # max_run_time : $max_run_time;
+}
+
diff --git a/mysql-test/r/innodb_bug42419.result b/mysql-test/r/innodb_bug42419.result
new file mode 100644
index 00000000000..f304bb634cb
--- /dev/null
+++ b/mysql-test/r/innodb_bug42419.result
@@ -0,0 +1,17 @@
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+COMMIT;
+SET AUTOCOMMIT = 0;
+CREATE TEMPORARY TABLE t1_tmp ( b INT );
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3;
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2;
+SET AUTOCOMMIT = 0;
+CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int );
+INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+Reap the server message for connection user2 UPDATE t1 ...
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
+DROP TABLE t1;
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index 78a56cddb08..682cc2e82e2 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -1267,20 +1267,4 @@ CREATE INDEX i1 on t1 (a(3));
SELECT * FROM t1 WHERE a = 'abcde';
a
DROP TABLE t1;
-CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT)
-ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
-SET AUTOCOMMIT = 0;
-CREATE TEMPORARY TABLE t1_tmp (b INT);
-INSERT INTO t1_tmp SELECT b FROM t1 WHERE a = 3;
-INSERT INTO t1_tmp SELECT b FROM t1 WHERE a = 2;
-SET AUTOCOMMIT = 0;
-CREATE TEMPORARY TABLE t2_tmp ( a INT, new_a INT);
-INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
-UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
-UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
-INSERT INTO t1_tmp SELECT b FROM t1 WHERE a = 1;
-ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
-UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
-DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 4fd87861ded..d263922e79d 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -353,7 +353,14 @@ flush logs;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
DROP TABLE t1;
-# Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED
+We expect this value to be 1
+The bug being tested was that 'Query' lines were not preceded by '#'
+If the line is in the table, it had to have been preceded by a '#'
+
+SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
+BUG#28293_expect_1
+1
+DROP TABLE patch;
flush logs;
create table t1(a int);
insert into t1 values(connection_id());
@@ -362,4 +369,14 @@ drop table t1;
1
drop table t1;
shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql
+set @@global.server_id= 4294967295;
+reset master;
+select
+(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
+is not null;
+(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
+is not null
+1
+*** Unsigned server_id 4294967295 is found: 1 ***
+set @@global.server_id= 1;
End of 5.0 tests
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index a7df1a523cf..e445bf3cc9b 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -210,7 +210,6 @@ source database
"MySQL: The world's most popular ;open source database"
echo message echo message
-mysqltest: At line 1: command "false" failed
mysqltest: At line 1: Missing argument in exec
MySQL
"MySQL"
@@ -378,7 +377,6 @@ mysqltest: At line 1: The argument to dec must be a variable (start with $)
mysqltest: At line 1: End of line junk detected: "1000"
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: Missing arguments to system, nothing to do!
-mysqltest: At line 1: system command 'false' failed
system command 'NonExistsinfComamdn 2> /dev/null' failed
test
test2
diff --git a/mysql-test/r/trigger-compat.result b/mysql-test/r/trigger-compat.result
index 6839cacab43..81c7a14c173 100644
--- a/mysql-test/r/trigger-compat.result
+++ b/mysql-test/r/trigger-compat.result
@@ -13,9 +13,7 @@ GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
---> connection: wl2818_definer_con
CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT);
-CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
-FOR EACH ROW
-INSERT INTO t2 VALUES(CURRENT_USER());
+CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
---> patching t1.TRG...
diff --git a/mysql-test/t/innodb_bug42419.test b/mysql-test/t/innodb_bug42419.test
new file mode 100644
index 00000000000..389093a8465
--- /dev/null
+++ b/mysql-test/t/innodb_bug42419.test
@@ -0,0 +1,77 @@
+#
+# Testcase for InnoDB
+# Bug#42419 Server crash with "Pure virtual method called" on two concurrent connections
+#
+
+--source include/have_innodb.inc
+
+let $innodb_lock_wait_timeout= query_get_value(SHOW VARIABLES LIKE 'innodb_lock_wait_timeout%', Value, 1);
+if (`SELECT $innodb_lock_wait_timeout < 10`)
+{
+ --echo # innodb_lock_wait_timeout must be >= 10 seconds
+ --echo # so that this test can work all time fine on an overloaded testing box
+ SHOW VARIABLES LIKE 'innodb_lock_wait_timeout';
+ exit;
+}
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+# First session
+connection default;
+
+
+--enable_warnings
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB;
+
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+COMMIT;
+SET AUTOCOMMIT = 0;
+
+CREATE TEMPORARY TABLE t1_tmp ( b INT );
+
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3;
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2;
+
+# Second session
+connect (user2,localhost,root,,,$MASTER_MYPORT,$MASTER_MYSOCK);
+
+SET AUTOCOMMIT = 0;
+
+CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int );
+INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
+
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
+send
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
+
+# The last update will wait for a lock held by the first session
+
+# First session
+connection default;
+
+# Poll till the UPDATE of the second session waits for lock
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'Updating';
+--source include/wait_show_condition.inc
+
+# If the testing box is overloadeded and innodb_lock_wait_timeout is too small
+# we might get here ER_LOCK_WAIT_TIMEOUT.
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1;
+
+# Second session
+connection user2;
+--echo Reap the server message for connection user2 UPDATE t1 ...
+reap;
+
+# The server crashed when executing this UPDATE or the succeeding SQL command.
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
+
+connection default;
+disconnect user2;
+DROP TABLE t1;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/innodb_mysql-master.opt b/mysql-test/t/innodb_mysql-master.opt
index c8613e0ccd5..205c733455d 100644
--- a/mysql-test/t/innodb_mysql-master.opt
+++ b/mysql-test/t/innodb_mysql-master.opt
@@ -1 +1 @@
---innodb-lock-wait-timeout=3
+--innodb-lock-wait-timeout=2
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index eb23739386e..b4fc425cb7c 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -1025,55 +1025,4 @@ CREATE INDEX i1 on t1 (a(3));
SELECT * FROM t1 WHERE a = 'abcde';
DROP TABLE t1;
-#
-# Bug #42419: Server crash with "Pure virtual method called" on two
-# concurrent connections
-#
-
-connect (c1, localhost, root,,);
-connect (c2, localhost, root,,);
-
-CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT)
- ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
-
-connection c1;
-
-SET AUTOCOMMIT = 0;
-
-CREATE TEMPORARY TABLE t1_tmp (b INT);
-
-INSERT INTO t1_tmp SELECT b FROM t1 WHERE a = 3;
-INSERT INTO t1_tmp SELECT b FROM t1 WHERE a = 2;
-
-connection c2;
-
-SET AUTOCOMMIT = 0;
-
-CREATE TEMPORARY TABLE t2_tmp ( a INT, new_a INT);
-INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
-
-UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
-
---send
-UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
-
---sleep 3
-
-connection c1;
-
---error ER_LOCK_DEADLOCK
-INSERT INTO t1_tmp SELECT b FROM t1 WHERE a = 1;
-
-connection c2;
-
---reap
-UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
-
-connection default;
-disconnect c1;
-disconnect c2;
-DROP TABLE t1;
-
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 5b4a43c8fe8..5904115d023 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -1,5 +1,4 @@
# We are using .opt file since we need small binlog size
-
-- source include/have_log_bin.inc
# we need this for getting fixed timestamps inside of this test
@@ -174,7 +173,8 @@ delimiter ;//
flush logs;
call p1();
drop procedure p1;
---error 1305
+--error ER_SP_DOES_NOT_EXIST
+
call p1();
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007
@@ -226,7 +226,26 @@ flush logs;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
DROP TABLE t1;
---exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
+
+# We create a table, patch, and load the output into it
+# By using LINES STARTING BY '#' + SELECT WHERE a LIKE 'Query'
+# We can easily see if a 'Query' line is missing the '#' character
+# as described in the original bug
+
+--disable_query_log
+CREATE TABLE patch (a blob);
+--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
+eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
+ INTO TABLE patch FIELDS TERMINATED by '' LINES STARTING BY '#';
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
+--enable_query_log
+
+--echo We expect this value to be 1
+--echo The bug being tested was that 'Query' lines were not preceded by '#'
+--echo If the line is in the table, it had to have been preceded by a '#'
+--echo
+SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
+DROP TABLE patch;
#
# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
@@ -253,4 +272,24 @@ echo shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql
error 1;
exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
+#
+# Bug #37313 BINLOG Contains Incorrect server id
+#
+
+let $save_server_id= `select @@global.server_id`;
+let $s_id_max=`select (1 << 32) - 1`;
+eval set @@global.server_id= $s_id_max;
+
+reset master;
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval select
+(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
+is not null;
+let $s_id_unsigned= `select @a like "%server id $s_id_max%" /* must return 1 */`;
+echo *** Unsigned server_id $s_id_max is found: $s_id_unsigned ***;
+
+eval set @@global.server_id= $save_server_id;
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index 5856bfff036..93528f81449 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -62,7 +62,8 @@ select otto from (select 1 as otto) as t1;
--exec echo "select friedrich from (select 1 as otto) as t1;" | $MYSQL_TEST 2>&1
# expectation = response
---error 1054
+--error ER_BAD_FIELD_ERROR
+
select friedrich from (select 1 as otto) as t1;
# The following unmasked unsuccessful statement must give
@@ -131,14 +132,16 @@ eval select $mysql_errno as "after_successful_stmt_errno" ;
#----------------------------------------------------------------------------
# check mysql_errno = 1064 after statement with wrong syntax
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
eval select $mysql_errno as "after_wrong_syntax_errno" ;
# ----------------------------------------------------------------------------
# check if let $my_var= 'abc' ; affects $mysql_errno
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
let $my_var= 'abc' ;
eval select $mysql_errno as "after_let_var_equal_value" ;
@@ -146,7 +149,8 @@ eval select $mysql_errno as "after_let_var_equal_value" ;
# ----------------------------------------------------------------------------
# check if set @my_var= 'abc' ; affects $mysql_errno
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
set @my_var= 'abc' ;
eval select $mysql_errno as "after_set_var_equal_value" ;
@@ -155,7 +159,8 @@ eval select $mysql_errno as "after_set_var_equal_value" ;
# check if the setting of --disable-warnings itself affects $mysql_errno
# (May be --<whatever> modifies $mysql_errno.)
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
--disable_warnings
eval select $mysql_errno as "after_disable_warnings_command" ;
@@ -166,7 +171,8 @@ eval select $mysql_errno as "after_disable_warnings_command" ;
# (May be disabled warnings affect $mysql_errno.)
# ----------------------------------------------------------------------------
drop table if exists t1 ;
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
drop table if exists t1 ;
eval select $mysql_errno as "after_disable_warnings" ;
@@ -175,21 +181,26 @@ eval select $mysql_errno as "after_disable_warnings" ;
# ----------------------------------------------------------------------------
# check if masked errors affect $mysql_errno
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
select 3 from t1 ;
eval select $mysql_errno as "after_minus_masked" ;
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
select 3 from t1 ;
eval select $mysql_errno as "after_!_masked" ;
# ----------------------------------------------------------------------------
# Will manipulations of $mysql_errno be possible and visible ?
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
let $mysql_errno= -1;
eval select $mysql_errno as "after_let_errno_equal_value" ;
@@ -198,50 +209,61 @@ eval select $mysql_errno as "after_let_errno_equal_value" ;
# How affect actions on prepared statements $mysql_errno ?
# ----------------------------------------------------------------------------
# failing prepare
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
prepare stmt from "select 3 from t1" ;
eval select $mysql_errno as "after_failing_prepare" ;
create table t1 ( f1 char(10));
# successful prepare
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
prepare stmt from "select 3 from t1" ;
eval select $mysql_errno as "after_successful_prepare" ;
# successful execute
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
execute stmt;
eval select $mysql_errno as "after_successful_execute" ;
# failing execute (table has been dropped)
drop table t1;
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
execute stmt;
eval select $mysql_errno as "after_failing_execute" ;
# failing execute (unknown statement)
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
---error 1243
+--error ER_UNKNOWN_STMT_HANDLER
+
execute __stmt_;
eval select $mysql_errno as "after_failing_execute" ;
# successful deallocate
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
deallocate prepare stmt;
eval select $mysql_errno as "after_successful_deallocate" ;
# failing deallocate ( statement handle does not exist )
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
---error 1243
+--error ER_UNKNOWN_STMT_HANDLER
+
deallocate prepare __stmt_;
eval select $mysql_errno as "after_failing_deallocate" ;
@@ -266,7 +288,8 @@ eval select $mysql_errno as "after_failing_deallocate" ;
# ----------------------------------------------------------------------------
# Switch off the abort on error and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
--disable_abort_on_error
eval select $mysql_errno as "after_--disable_abort_on_error" ;
@@ -280,9 +303,11 @@ select 3 from t1 ;
# masked failing statements
# ----------------------------------------------------------------------------
# expected error = response
---error 1146
+--error ER_NO_SUCH_TABLE
+
select 3 from t1 ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
select 3 from t1 ;
eval select $mysql_errno as "after_!errno_masked_error" ;
# expected error <> response
@@ -296,7 +321,8 @@ eval select $mysql_errno as "after_!errno_masked_error" ;
# ----------------------------------------------------------------------------
# Switch the abort on error on and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
--enable_abort_on_error
eval select $mysql_errno as "after_--enable_abort_on_error" ;
@@ -305,7 +331,8 @@ eval select $mysql_errno as "after_--enable_abort_on_error" ;
# masked failing statements
# ----------------------------------------------------------------------------
# expected error = response
---error 1146
+--error ER_NO_SUCH_TABLE
+
select 3 from t1 ;
# ----------------------------------------------------------------------------
@@ -569,9 +596,6 @@ echo ;
# Illegal use of exec
--error 1
---exec echo "--exec false" | $MYSQL_TEST 2>&1
-
---error 1
--exec echo "--exec " | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
@@ -951,8 +975,6 @@ system echo "hej" > /dev/null;
--exec echo "system;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "system false;" | $MYSQL_TEST 2>&1
--disable_abort_on_error
system NonExistsinfComamdn 2> /dev/null;
@@ -1370,7 +1392,8 @@ connection default;
let $num= 2;
while ($num)
{
- --error 1064
+ --error ER_PARSE_ERROR
+
failing_statement;
dec $num;
@@ -1429,7 +1452,7 @@ select "this will be executed";
#
# Test zero length result file. Should not pass
#
---exec touch $MYSQLTEST_VARDIR/tmp/zero_length_file.result
+--exec echo '' > $MYSQLTEST_VARDIR/tmp/zero_length_file.result
--exec echo "echo ok;" > $MYSQLTEST_VARDIR/tmp/query.sql
--error 1
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/zero_length_file.result > /dev/null 2>&1
@@ -1482,7 +1505,8 @@ drop table t1;
--error 1
--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
# The .out file should be non existent
---exec test ! -s $MYSQLTEST_VARDIR/tmp/bug11731.out
+--error 1
+--file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
drop table t1;
@@ -1503,7 +1527,7 @@ drop table t1;
--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
# The .out file should exist
---exec test -s $MYSQLTEST_VARDIR/tmp/bug11731.out
+--file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bug11731.out;
remove_file $MYSQLTEST_VARDIR/log/bug11731.log;
@@ -1515,14 +1539,17 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug11731.sql;
# It should be possible to use the command "query" to force mysqltest to
# send the command to the server although it's a builtin mysqltest command.
---error 1064
+--error ER_PARSE_ERROR
+
query sleep;
---error 1064
+--error ER_PARSE_ERROR
+
--query sleep
# Just an empty query command
---error 1065
+--error ER_EMPTY_QUERY
+
query ;
# test for replace_regex
@@ -1915,7 +1942,8 @@ eval $my_stmt;
# 8. Ensure that "sorted_result " does not change the semantics of
# "--error ...." or the protocol output after such an expected failure
--sorted_result
---error 1146
+--error ER_NO_SUCH_TABLE
+
SELECT '2' as "my_col1",2 as "my_col2"
UNION
SELECT '1',1 from t2;
diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
index dc450aeb9cf..73c04ad6764 100644
--- a/mysql-test/t/ndb_autodiscover.test
+++ b/mysql-test/t/ndb_autodiscover.test
@@ -1,6 +1,12 @@
-- source include/have_ndb.inc
-- source include/not_embedded.inc
+# Bug#41308: Test main.ndb_autodiscover.test doesn't work on Windows due
+# to 'grep' calls
+# Test is currently disabled on Windows via the next line until this bug
+# can be resolved.
+--source include/not_windows.inc
+
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
--enable_warnings
diff --git a/mysql-test/t/rpl_trigger.test b/mysql-test/t/rpl_trigger.test
index da6cea10698..d5472b47b7b 100644
--- a/mysql-test/t/rpl_trigger.test
+++ b/mysql-test/t/rpl_trigger.test
@@ -293,7 +293,8 @@ STOP SLAVE;
connection master;
FLUSH LOGS;
-exec cp $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001;
+--remove_file $MYSQLTEST_VARDIR/log/master-bin.000001
+--copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001
# Make the slave to replay the new binlog.
diff --git a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test
index f2e350cb161..db410ba2f18 100644
--- a/mysql-test/t/trigger-compat.test
+++ b/mysql-test/t/trigger-compat.test
@@ -50,9 +50,7 @@ GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT);
-CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
- FOR EACH ROW
- INSERT INTO t2 VALUES(CURRENT_USER());
+CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
#
# Remove definers from TRG file.
@@ -61,8 +59,24 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
--echo
--echo ---> patching t1.TRG...
---exec grep -v 'definers=' $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG
---exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
+# Here we remove definers. This is somewhat complex than the original test
+# Previously, the test only used grep -v 'definers=' t1.TRG, but grep is not
+# portable and we have to load the file into a table, exclude the definers line,
+# then load the data to an outfile to accomplish the same effect
+
+--disable_query_log
+--connection default
+CREATE TABLE patch (a blob);
+eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG' INTO TABLE patch;
+# remove original t1.TRG file so SELECT INTO OUTFILE won't fail
+--remove_file $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
+eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE
+ '$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG'
+FROM patch;
+DROP TABLE patch;
+--connection wl2818_definer_con
+--enable_query_log
+
#
# Create a new trigger.
diff --git a/sql/item.cc b/sql/item.cc
index 14422bd3e92..f32828629cf 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1726,7 +1726,6 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
bool agg_item_charsets(DTCollation &coll, const char *fname,
Item **args, uint nargs, uint flags, int item_sep)
{
- Item **arg, *safe_args[2];
if (agg_item_collations(coll, fname, args, nargs, flags, item_sep))
return TRUE;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index ef419aaee40..90805877502 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -976,7 +976,7 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info)
fputc('#', file);
print_timestamp(file);
- fprintf(file, " server id %d end_log_pos %s ", server_id,
+ fprintf(file, " server id %lu end_log_pos %s ", server_id,
llstr(log_pos,llbuff));
/* mysqlbinlog --hexdump */