Commit 3383844c authored by Guangbao Ni's avatar Guangbao Ni

Auto merged

parents 58dfaa8b 39da9398
......@@ -9,6 +9,3 @@ select user();
user()
#
show processlist;
Id User Host db Command Time State Info
<id> root <host> test <command> <time> <state> <info>
<id> root <host> test <command> <time> <state> <info>
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
SET @old_sql_mode= @@global.sql_mode;
SET @old_binlog_format=@@session.binlog_format;
SET SESSION sql_mode=8;
Initialization
RESET MASTER;
CREATE TABLE t1 (id INT);
CREATE PROCEDURE testProc() SELECT * FROM t1;
CREATE VIEW testView as SELECT * from t1;
CREATE FUNCTION testFunc()
RETURNS INT
BEGIN
return 1;
END;|
CREATE TRIGGER testTrig BEFORE INSERT ON t1
FOR EACH ROW BEGIN
UPDATE t1 SET id = id +1;
END;|
CREATE EVENT testEvent ON SCHEDULE
EVERY 1 DAY
DO
BEGIN
UPDATE t1 SET id = id +1;
END;|
Chceck Result
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog"))
is not null;
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog"))
is not null
1
*** String sql_mode=0 is found: 0 ***
Clean Up
DROP PROCEDURE testProc;
DROP FUNCTION testFunc;
DROP TRIGGER testTrig;
DROP EVENT testEvent;
DROP VIEW testView;
DROP TABLE t1;
SET @@global.sql_mode= @old_sql_mode;
SET @@session.binlog_format=@old_binlog_format;
# ==== Purpose ====
#
# Test that sql_mode can correct restore before generating the binlog event
# when creating CREATEable objects.
#
# ==== Method ====
#
# Scan binlog file to check if the sql_mode is still set to 0 before generating binlog event
#
-- source include/master-slave.inc
-- source include/have_log_bin.inc
# BUG#39526 sql_mode not retained in binary log for CREATE PROCEDURE
SET @old_sql_mode= @@global.sql_mode;
SET @old_binlog_format=@@session.binlog_format;
let $MYSQLD_DATADIR= `select @@datadir`;
SET SESSION sql_mode=8;
--echo Initialization
RESET MASTER;
CREATE TABLE t1 (id INT);
CREATE PROCEDURE testProc() SELECT * FROM t1;
CREATE VIEW testView as SELECT * from t1;
DELIMITER |;
CREATE FUNCTION testFunc()
RETURNS INT
BEGIN
return 1;
END;|
DELIMITER ;|
DELIMITER |;
CREATE TRIGGER testTrig BEFORE INSERT ON t1
FOR EACH ROW BEGIN
UPDATE t1 SET id = id +1;
END;|
DELIMITER ;|
DELIMITER |;
CREATE EVENT testEvent ON SCHEDULE
EVERY 1 DAY
DO
BEGIN
UPDATE t1 SET id = id +1;
END;|
DELIMITER ;|
--echo Chceck Result
let $MYSQLD_DATADIR= `select @@datadir`;
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog"))
is not null;
let $s_mode_unsigned= `select @a like "%@@session.sql_mode=0%" /* must return 0 */`;
echo *** String sql_mode=0 is found: $s_mode_unsigned ***;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog
--echo Clean Up
DROP PROCEDURE testProc;
DROP FUNCTION testFunc;
DROP TRIGGER testTrig;
DROP EVENT testEvent;
DROP VIEW testView;
DROP TABLE t1;
SET @@global.sql_mode= @old_sql_mode;
SET @@session.binlog_format=@old_binlog_format;
......@@ -143,10 +143,12 @@ set names koi8r|
# - Dump mysqltest1;
--let $views_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.views.mysqltest1.sql
--echo
--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.views.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.views.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $views_dump1
# - Clean mysqltest1;
......@@ -161,7 +163,9 @@ DROP DATABASE mysqltest1|
--echo
--echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.views.mysqltest1.sql
--exec $MYSQL test < $views_dump1
--remove_file $views_dump1
#
# Third-round checks.
......@@ -398,6 +402,9 @@ set names koi8r|
# - Dump mysqltest1, mysqltest2;
--let $sp_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest1.sql
--let $sp_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest2.sql
--echo
--echo ---> Dump of mysqltest1
......@@ -406,7 +413,7 @@ set names koi8r|
--echo
--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.sp.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 > $sp_dump1
--echo
--echo ---> Dump of mysqltest2
......@@ -416,7 +423,7 @@ set names koi8r|
--echo
--echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.sp.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 > $sp_dump2
# - Clean mysqltest1, mysqltest2;
......@@ -432,10 +439,13 @@ DROP DATABASE mysqltest2|
--echo
--echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest1.sql
--exec $MYSQL test < $sp_dump1
--echo ---> Restoring mysqltest2...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest2.sql
--exec $MYSQL test < $sp_dump2
--remove_file $sp_dump1
--remove_file $sp_dump2
#
# Third-round checks.
......@@ -669,6 +679,9 @@ use mysqltest1|
# - Dump mysqltest1, mysqltest2;
--let $triggers_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest1.sql
--let $triggers_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest2.sql
--echo
--echo ---> Dump of mysqltest1
......@@ -677,7 +690,7 @@ use mysqltest1|
--echo
--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.triggers.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 > $triggers_dump1
--echo
--echo ---> Dump of mysqltest2
......@@ -687,7 +700,7 @@ use mysqltest1|
--echo
--echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.triggers.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 > $triggers_dump2
# - Clean mysqltest1, mysqltest2;
......@@ -703,10 +716,13 @@ DROP DATABASE mysqltest2|
--echo
--echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest1.sql
--exec $MYSQL test < $triggers_dump1
--echo ---> Restoring mysqltest2...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest2.sql
--exec $MYSQL test < $triggers_dump2
--remove_file $triggers_dump1
--remove_file $triggers_dump2
#
# Third-round checks.
......@@ -924,6 +940,9 @@ set names koi8r|
# - Dump mysqltest1, mysqltest2;
--let $events_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest1.sql
--let $events_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest2.sql
--echo
--echo ---> Dump of mysqltest1
......@@ -932,7 +951,7 @@ set names koi8r|
--echo
--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.events.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 > $events_dump1
--echo
--echo ---> Dump of mysqltest2
......@@ -942,7 +961,7 @@ set names koi8r|
--echo
--echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.events.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 > $events_dump2
# - Clean mysqltest1, mysqltest2;
......@@ -958,10 +977,13 @@ DROP DATABASE mysqltest2|
--echo
--echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest1.sql
--exec $MYSQL test < $events_dump1
--echo ---> Restoring mysqltest2...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest2.sql
--exec $MYSQL test < $events_dump2
--remove_file $events_dump1
--remove_file $events_dump2
#
# Third-round checks.
......
......@@ -143,10 +143,12 @@ set names utf8|
# - Dump mysqltest1;
--let $views_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8views.mysqltest1.sql
--echo
--echo ---> Dumping mysqltest1 to ddl_i18n_utf8views.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8views.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $views_dump1
# - Clean mysqltest1;
......@@ -161,7 +163,9 @@ DROP DATABASE mysqltest1|
--echo
--echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8views.mysqltest1.sql
--exec $MYSQL test < $views_dump1
--remove_file $views_dump1
#
# Third-round checks.
......@@ -398,6 +402,9 @@ set names utf8|
# - Dump mysqltest1, mysqltest2;
--let $sp_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest1.sql
--let $sp_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest2.sql
--echo
--echo ---> Dump of mysqltest1
......@@ -406,7 +413,7 @@ set names utf8|
--echo
--echo ---> Dumping mysqltest1 to ddl_i18n_utf8sp.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 > $sp_dump1
--echo
--echo ---> Dump of mysqltest2
......@@ -416,7 +423,7 @@ set names utf8|
--echo
--echo ---> Dumping mysqltest2 to ddl_i18n_utf8sp.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 > $sp_dump2
# - Clean mysqltest1, mysqltest2;
......@@ -432,10 +439,13 @@ DROP DATABASE mysqltest2|
--echo
--echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest1.sql
--exec $MYSQL test < $sp_dump1
--echo ---> Restoring mysqltest2...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest2.sql
--exec $MYSQL test < $sp_dump2
--remove_file $sp_dump1
--remove_file $sp_dump2
#
# Third-round checks.
......@@ -669,6 +679,9 @@ use mysqltest1|
# - Dump mysqltest1, mysqltest2;
--let $triggers_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest1.sql
--let $triggers_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest2.sql
--echo
--echo ---> Dump of mysqltest1
......@@ -677,7 +690,7 @@ use mysqltest1|
--echo
--echo ---> Dumping mysqltest1 to ddl_i18n_utf8triggers.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 > $triggers_dump1
--echo
--echo ---> Dump of mysqltest2
......@@ -687,7 +700,7 @@ use mysqltest1|
--echo
--echo ---> Dumping mysqltest2 to ddl_i18n_utf8triggers.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 > $triggers_dump2
# - Clean mysqltest1, mysqltest2;
......@@ -703,10 +716,13 @@ DROP DATABASE mysqltest2|
--echo
--echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest1.sql
--exec $MYSQL test < $triggers_dump1
--echo ---> Restoring mysqltest2...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest2.sql
--exec $MYSQL test < $triggers_dump2
--remove_file $triggers_dump1
--remove_file $triggers_dump2
#
# Third-round checks.
......@@ -924,6 +940,9 @@ set names utf8|
# - Dump mysqltest1, mysqltest2;
--let $events_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest1.sql
--let $events_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest2.sql
--echo
--echo ---> Dump of mysqltest1
......@@ -932,7 +951,7 @@ set names utf8|
--echo
--echo ---> Dumping mysqltest1 to ddl_i18n_utf8events.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest1.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 > $events_dump1
--echo
--echo ---> Dump of mysqltest2
......@@ -942,7 +961,7 @@ set names utf8|
--echo
--echo ---> Dumping mysqltest2 to ddl_i18n_utf8events.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest2.sql
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 > $events_dump2
# - Clean mysqltest1, mysqltest2;
......@@ -958,10 +977,13 @@ DROP DATABASE mysqltest2|
--echo
--echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest1.sql
--exec $MYSQL test < $events_dump1
--echo ---> Restoring mysqltest2...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest2.sql
--exec $MYSQL test < $events_dump2
--remove_file $events_dump1
--remove_file $events_dump2
#
# Third-round checks.
......
......@@ -150,17 +150,30 @@ DROP DATABASE IF EXISTS mysql_test;
CREATE DATABASE mysql_test;
let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm
--copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD
--copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI
--let $proc_frm = $MYSQLD_DATADIR/mysql/proc.frm
--let $proc_MYD = $MYSQLD_DATADIR/mysql/proc.MYD
--let $proc_MYI = $MYSQLD_DATADIR/mysql/proc.MYI
--let $copy_of_proc_frm = $MYSQLTEST_VARDIR/tmp/bug29958.copy.frm
--let $copy_of_proc_MYD = $MYSQLTEST_VARDIR/tmp/bug29958.copy.MYD
--let $copy_of_proc_MYI = $MYSQLTEST_VARDIR/tmp/bug29958.copy.MYI
--copy_file $proc_frm $copy_of_proc_frm
--copy_file $proc_MYD $copy_of_proc_MYD
--copy_file $proc_MYI $copy_of_proc_MYI
DROP TABLE mysql.proc;
DROP DATABASE mysql_test;
--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm $MYSQLD_DATADIR/mysql/proc.frm
--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD
--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI
--copy_file $copy_of_proc_frm $proc_frm
--copy_file $copy_of_proc_MYD $proc_MYD
--copy_file $copy_of_proc_MYI $proc_MYI
--remove_file $copy_of_proc_frm
--remove_file $copy_of_proc_MYD
--remove_file $copy_of_proc_MYI
--echo
--echo # --
......
......@@ -15,6 +15,9 @@ DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, );
--replace_column 1 #
select user();
--replace_column 1 <id> 3 <host> 5 <command> 6 <time> 7 <state> 8 <info>
# We are only interested in the fact that statement below doesn't
# crash server.
--disable_result_log
show processlist;
--enable_result_log
connection default;
......@@ -936,10 +936,12 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
ret= SP_INTERNAL_ERROR;
goto done;
}
/* restore sql_mode when binloging */
thd->variables.sql_mode= saved_mode;
/* Such a statement can always go directly to binlog, no trans cache */
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
log_query.c_ptr(), log_query.length(), FALSE, FALSE);
thd->variables.sql_mode= 0;
}
}
......
......@@ -4298,7 +4298,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM));
if (thd->main_da.is_error() &&
thd->main_da.sql_errno() == ER_NO_SUCH_TABLE)
(thd->main_da.sql_errno() == ER_NO_SUCH_TABLE ||
thd->main_da.sql_errno() == ER_FILE_NOT_FOUND))
/* A missing table is just issued as a failed command */
result_code= HA_ADMIN_FAILED;
else
......
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