From 1bf52d4735fded85e3412c1fff6f393c6fc50c36 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 4 Jun 2007 16:42:42 +0200 Subject: [PATCH 01/17] Bug#10218 Command line recall rolls into Segmentation Fault(coredump)' - Declare 'tgoto' if not already declared in system header files. cmd-line-utils/libedit/el_term.h: Declare 'tgoto' if not already declared in system header files. Failing to declare it will cause the pointer returned to be truncated to 32-bit integer which is no a valid pointer - in most cases. configure.in: Add check to see if 'tgoto' is declared in system header files --- cmd-line-utils/libedit/el_term.h | 10 ++++++++++ configure.in | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/cmd-line-utils/libedit/el_term.h b/cmd-line-utils/libedit/el_term.h index 9e5588ee96f..00ca48e38e2 100644 --- a/cmd-line-utils/libedit/el_term.h +++ b/cmd-line-utils/libedit/el_term.h @@ -90,6 +90,16 @@ extern char* tgoto(const char*, int, int); extern char* tgetstr(char*, char**); #endif + +#if !HAVE_DECL_TGOTO +/* + 'tgoto' is not declared in the system header files, this causes + problems on 64-bit systems. The function returns a 64 bit pointer + but caller see it as "int" and it's thus truncated to 32-bit +*/ +extern char* tgoto(const char*, int, int); +#endif + protected void term_move_to_line(EditLine *, int); protected void term_move_to_char(EditLine *, int); protected void term_clear_EOL(EditLine *, int); diff --git a/configure.in b/configure.in index b9f84086e28..dd3b449f9c8 100644 --- a/configure.in +++ b/configure.in @@ -1954,6 +1954,19 @@ else fi AC_SUBST(TERMCAP_LIB) +# Check if the termcap function 'tgoto' is already declared in +# system header files or if it need to be declared locally +AC_CHECK_DECLS(tgoto,,,[ +#ifdef HAVE_CURSES_H +# include +#elif HAVE_NCURSES_H +# include +#endif +#ifdef HAVE_TERM_H +# include +#endif +]) + LIBEDIT_LOBJECTS="" AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"]) AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"]) From 3ac87034ca389be09ce80d982f0e13f653f98cb4 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 5 Jun 2007 22:18:07 +0400 Subject: [PATCH 02/17] Fix for bug #28895 "Test 'information_schema_db' fails on i5/OS 32 bit". In acl_getroot_no_password(), use a separate variable for traversing the acl_users list so that the last entry is not used when no matching entries are found. mysql-test/r/view_grant.result: Fixed the testcase for bug #14875 which relied on broken behavior. sctx->master_access and sctx->priv_user were being set to the last entry in the acl_users list. That does not happen after the patch for bug #28895, so we get a different warning message. sql/sql_acl.cc: In acl_getroot_no_password(), use a separate variable for traversing the acl_users list so that the last entry is not used when no matching entries are found. --- mysql-test/r/view_grant.result | 4 ++-- sql/sql_acl.cc | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 32dffa305e5..0f9ce47dec6 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -601,9 +601,9 @@ Warnings: Note 1449 There is no 'no-such-user'@'localhost' registered SHOW CREATE VIEW v; View Create View -v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `t1`.`a` AS `a` from `t1` +v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `test`.`t1`.`a` AS `a` from `t1` Warnings: -Note 1449 There is no 'no-such-user'@'localhost' registered +Warning 1356 View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them SELECT * FROM v; ERROR HY000: There is no 'no-such-user'@'localhost' registered DROP VIEW v; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ebf9385d177..5069d415d30 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -978,14 +978,15 @@ bool acl_getroot_no_password(Security_context *sctx, char *user, char *host, */ for (i=0 ; i < acl_users.elements ; i++) { - acl_user= dynamic_element(&acl_users,i,ACL_USER*); - if ((!acl_user->user && !user[0]) || - (acl_user->user && strcmp(user, acl_user->user) == 0)) + ACL_USER *acl_user_tmp= dynamic_element(&acl_users,i,ACL_USER*); + if ((!acl_user_tmp->user && !user[0]) || + (acl_user_tmp->user && strcmp(user, acl_user_tmp->user) == 0)) { - if (compare_hostname(&acl_user->host, host, ip)) + if (compare_hostname(&acl_user_tmp->host, host, ip)) { - res= 0; - break; + acl_user= acl_user_tmp; + res= 0; + break; } } } From bfb7b5690185c025548d076af5077cb2f5ab573c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Jun 2007 09:48:37 +0200 Subject: [PATCH 03/17] Bug#28690 mysql-enterprise-gpl-5.0.40-linux-i686-glibc won't start on Debian Sarge - Only use the "hack for bug in NTPL" if using NTPL, by dynamically checking the thd_lib_detected flag mysys/my_thr_init.c: Only start the "dummy thread hack for bug in NPTL" - if using NPTL. If the system uses LinuxThreads it's not needed, it actually causes the "pthread manager" to be started as root and thus all subsequent threads will also run as root although mysqld drops root privileges, this in turns causes mysqld to deadlock since the mysqlds main thread running as can't send signals to a process owned by root. --- mysys/my_thr_init.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 07a92e34dd3..cf7ea0a800f 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -87,27 +87,31 @@ my_bool my_thread_global_init(void) fprintf(stderr,"Can't initialize threads: error %d\n", pth_ret); return 1; } - + #ifdef NPTL_PTHREAD_EXIT_BUG + /* + BUG#24507: Race conditions inside current NPTL pthread_exit() + implementation. -/* - BUG#24507: Race conditions inside current NPTL pthread_exit() implementation. + To avoid a possible segmentation fault during concurrent + executions of pthread_exit(), a dummy thread is spawned which + initializes internal variables of pthread lib. See bug description + for a full explanation. - To avoid a possible segmentation fault during concurrent executions of - pthread_exit(), a dummy thread is spawned which initializes internal variables - of pthread lib. See bug description for thoroughfull explanation. - - TODO: Remove this code when fixed versions of glibc6 are in common use. -*/ + TODO: Remove this code when fixed versions of glibc6 are in common + use. + */ + if (thd_lib_detected == THD_LIB_NPTL) + { + pthread_t dummy_thread; + pthread_attr_t dummy_thread_attr; - pthread_t dummy_thread; - pthread_attr_t dummy_thread_attr; - - pthread_attr_init(&dummy_thread_attr); - pthread_attr_setdetachstate(&dummy_thread_attr,PTHREAD_CREATE_DETACHED); - - pthread_create(&dummy_thread,&dummy_thread_attr,nptl_pthread_exit_hack_handler,NULL); + pthread_attr_init(&dummy_thread_attr); + pthread_attr_setdetachstate(&dummy_thread_attr, PTHREAD_CREATE_DETACHED); + pthread_create(&dummy_thread,&dummy_thread_attr, + nptl_pthread_exit_hack_handler, NULL); + } #endif #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP From 47559994b14d52e20c53b669875887363c33903d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Jun 2007 14:25:17 +0200 Subject: [PATCH 04/17] Bug#28718 Running backup testcase fails in mysql testsuite - Skip test if the mysqld to test is not started from MYSQLTEST_VARDIR mysql-test/t/backup.test: Skip test if the mysqld to test is not started from MYSQLTEST_VARDIR mysql-test/t/blackhole.test: Skip test if the mysqld to test is not started from MYSQLTEST_VARDIR mysql-test/include/uses_vardir.inc: New BitKeeper file ``mysql-test/include/uses_vardir.inc'' --- mysql-test/include/uses_vardir.inc | 15 +++++++++++++++ mysql-test/t/backup.test | 5 +++++ mysql-test/t/blackhole.test | 6 +++++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 mysql-test/include/uses_vardir.inc diff --git a/mysql-test/include/uses_vardir.inc b/mysql-test/include/uses_vardir.inc new file mode 100644 index 00000000000..a5095c3e139 --- /dev/null +++ b/mysql-test/include/uses_vardir.inc @@ -0,0 +1,15 @@ +# +# Some tests uses LOAD DATA with a relative path +# and need to see for example ../std_data +# +# Also if an absolute path was used, the server might be started +# with --secure-file-priv and wouldn't be allowed to LOAD a file +# outside of it's vardir anyway +# + +let $datadir= + query_get_value("SHOW VARIABLES LIKE 'datadir'", Value, 1); +if (`select LOCATE("$MYSQLTEST_VARDIR", "$datadir") != 1`) +{ + skip Need mysqld in MYSQLTEST_VARDIR; +} diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test index a3339ecce69..6ff4144aaf2 100644 --- a/mysql-test/t/backup.test +++ b/mysql-test/t/backup.test @@ -1,3 +1,8 @@ + +# The server need to be started in $MYSQLTEST_VARDIR since it +# uses ../std_data_ln/ +-- source include/uses_vardir.inc + # # This test is a bit tricky as we can't use backup table to overwrite an old # table diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test index 51cc663d6bc..0abe5ae063a 100644 --- a/mysql-test/t/blackhole.test +++ b/mysql-test/t/blackhole.test @@ -5,6 +5,10 @@ -- source include/not_embedded.inc -- source include/have_blackhole.inc +# The server need to be started in $MYSQLTEST_VARDIR since it +# uses ../std_data_ln/ +-- source include/uses_vardir.inc + --disable_warnings drop table if exists t1,t2; --enable_warnings @@ -109,7 +113,7 @@ insert into t1 values(1); insert ignore into t1 values(1); replace into t1 values(100); create table t2 (a varchar(200)) engine=blackhole; -load data infile '../std_data_ln/words.dat' into table t2; +eval load data infile '../std_data_ln/words.dat' into table t2; alter table t1 add b int; alter table t1 drop b; create table t3 like t1; From 33525fd3d53343e02cc0906017a33ad33bbb1283 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Jun 2007 09:13:56 -0500 Subject: [PATCH 05/17] Bug #24731 Shared memory connections do not work with MySql ran as service on Vista The events were not being opened in the global namespace. sql-common/client.c: Add Global\\ to the event names so they are opened in the global namespace --- sql-common/client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql-common/client.c b/sql-common/client.c index 40512da0492..3e5ceb1a738 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -416,7 +416,7 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout) shared_memory_base_name is unique value for each server unique_part is uniquel value for each object (events and file-mapping) */ - suffix_pos = strxmov(tmp,shared_memory_base_name,"_",NullS); + suffix_pos = strxmov(tmp, "Global\\", shared_memory_base_name, "_", NullS); strmov(suffix_pos, "CONNECT_REQUEST"); if (!(event_connect_request= OpenEvent(event_access_rights, FALSE, tmp))) { @@ -470,8 +470,8 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout) unique_part is uniquel value for each object (events and file-mapping) number_of_connection is number of connection between server and client */ - suffix_pos = strxmov(tmp,shared_memory_base_name,"_",connect_number_char, - "_",NullS); + suffix_pos = strxmov(tmp, "Global\\", shared_memory_base_name, "_", connect_number_char, + "_", NullS); strmov(suffix_pos, "DATA"); if ((handle_file_map = OpenFileMapping(FILE_MAP_WRITE,FALSE,tmp)) == NULL) { From ffeda16ebe8df2bb1b277e6f92ea894cf03d71aa Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Jun 2007 10:14:47 -0500 Subject: [PATCH 06/17] setting pre-commit to be Unix only line endings so it will work on Windows BitKeeper/triggers/pre-commit: Turn off EOLN_NATIVE flag From 33df97dfa42ee5f7c502789565a070007401436b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Jun 2007 19:18:01 +0200 Subject: [PATCH 07/17] Bug#28369 rpl test cases fail with binlog disabled - Turn on binlog only for tests that need it - Skip those tests if --skip-binlog is used BitKeeper/deleted/.del-ctype_cp932_notembedded.result: Rename: mysql-test/r/ctype_cp932_notembedded.result -> BitKeeper/deleted/.del-ctype_cp932_notembedded.result BitKeeper/deleted/.del-ctype_cp932_notembedded.test: Rename: mysql-test/t/ctype_cp932_notembedded.test -> BitKeeper/deleted/.del-ctype_cp932_notembedded.test mysql-test/include/master-slave.inc: Need binlog mysql-test/lib/mtr_cases.pl: Turn on binlog only for tests that need it Skip those tests if --skip-binlog is used mysql-test/r/sp_trans.result: Moved to "sp_binlog" mysql-test/t/binlog.test: Need binlog mysql-test/t/blackhole.test: Need binlog mysql-test/t/ctype_cp932_binlog.test: Need binlog mysql-test/t/ctype_ucs_binlog.test: Need binlog mysql-test/t/drop_temp_table.test: Need binlog mysql-test/t/flush_block_commit_notembedded.test: Need binlog mysql-test/t/innodb.test: Need binlog mysql-test/t/insert_select-binlog.test: Need binlog mysql-test/t/mix_innodb_myisam_binlog.test: Need binlog mysql-test/t/mysqlbinlog-cp932.test: Need binlog mysql-test/t/mysqlbinlog.test: Need binlog mysql-test/t/mysqlbinlog2.test: Need binlog mysql-test/t/mysqldump.test: Need binlog mysql-test/t/rpl000015.test: Need binlog mysql-test/t/rpl000017.test: Need binlog mysql-test/t/rpl_rotate_logs.test: Need binlog mysql-test/t/sp_trans.test: Moved to "sp_binlog" mysql-test/t/user_var-binlog.test: Need binlog mysql-test/r/sp_trans_log.result: New BitKeeper file ``mysql-test/r/sp_trans_log.result'' mysql-test/t/sp_trans_log.test: New BitKeeper file ``mysql-test/t/sp_trans_log.test'' --- mysql-test/include/master-slave.inc | 3 ++ mysql-test/lib/mtr_cases.pl | 17 ++++++++++ mysql-test/r/ctype_cp932_notembedded.result | 16 --------- mysql-test/r/sp_trans.result | 20 ----------- mysql-test/r/sp_trans_log.result | 20 +++++++++++ mysql-test/t/binlog.test | 1 + mysql-test/t/blackhole.test | 1 + mysql-test/t/ctype_cp932_binlog.test | 1 + mysql-test/t/ctype_cp932_notembedded.test | 32 ------------------ mysql-test/t/ctype_ucs_binlog.test | 1 + mysql-test/t/drop_temp_table.test | 4 +-- .../t/flush_block_commit_notembedded.test | 2 +- mysql-test/t/innodb.test | 1 + mysql-test/t/insert_select-binlog.test | 1 + mysql-test/t/mix_innodb_myisam_binlog.test | 4 +-- mysql-test/t/mysqlbinlog-cp932.test | 1 + mysql-test/t/mysqlbinlog.test | 3 +- mysql-test/t/mysqlbinlog2.test | 3 +- mysql-test/t/mysqldump.test | 1 + mysql-test/t/rpl000015.test | 2 ++ mysql-test/t/rpl000017.test | 2 ++ mysql-test/t/rpl_rotate_logs.test | 2 ++ mysql-test/t/sp_trans.test | 28 ---------------- mysql-test/t/sp_trans_log.test | 33 +++++++++++++++++++ mysql-test/t/user_var-binlog.test | 3 +- 25 files changed, 94 insertions(+), 108 deletions(-) delete mode 100644 mysql-test/r/ctype_cp932_notembedded.result create mode 100644 mysql-test/r/sp_trans_log.result delete mode 100644 mysql-test/t/ctype_cp932_notembedded.test create mode 100644 mysql-test/t/sp_trans_log.test diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index ea09f4e842b..6b5a508a949 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -1,3 +1,6 @@ +# Replication tests need binlog +source include/have_binlog.inc; + connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 1d157ea3401..6650a7b9b90 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -596,6 +596,22 @@ sub collect_one_test_case($$$$$$$) { } } + if ( $tinfo->{'need_binlog'} ) + { + if (grep(/^--skip-log-bin/, @::opt_extra_mysqld_opt) ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "Test need binlog"; + return; + } + } + else + { + # Test does not need binlog, add --skip-binlog to + # the options used when starting it + push(@{$tinfo->{'master_opt'}}, "--skip-log-bin"); + } + } } @@ -608,6 +624,7 @@ our @tags= ["include/have_binlog_format_row.inc", "binlog_format", "row"], ["include/have_binlog_format_statement.inc", "binlog_format", "stmt"], ["include/have_binlog_format_mixed.inc", "binlog_format", "mixed"], + ["include/have_binlog.inc", "need_binlog", 1], ["include/big_test.inc", "big_test", 1], ["include/have_debug.inc", "need_debug", 1], ["include/have_ndb.inc", "ndb_test", 1], diff --git a/mysql-test/r/ctype_cp932_notembedded.result b/mysql-test/r/ctype_cp932_notembedded.result deleted file mode 100644 index 241fa0d1db7..00000000000 --- a/mysql-test/r/ctype_cp932_notembedded.result +++ /dev/null @@ -1,16 +0,0 @@ -drop table if exists t1; -set names cp932; -set character_set_database = cp932; -RESET MASTER; -CREATE TABLE t1(f1 blob); -PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)'; -SET @var1= x'8300'; -EXECUTE stmt1 USING @var1; -SHOW BINLOG EVENTS FROM 98; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 188 use `test`; CREATE TABLE t1(f1 blob) -master-bin.000001 188 Query 1 283 use `test`; INSERT INTO t1 VALUES(0x8300) -SELECT HEX(f1) FROM t1; -HEX(f1) -8300 -DROP table t1; diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result index c74909e7e8f..564e31c9e32 100644 --- a/mysql-test/r/sp_trans.result +++ b/mysql-test/r/sp_trans.result @@ -530,23 +530,3 @@ count(*) drop table t3, t4| drop procedure bug14210| set @@session.max_heap_table_size=default| -CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM| -CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB| -insert into t2 values (1,1)| -create function bug23333() -RETURNS int(11) -DETERMINISTIC -begin -insert into t1 values (null); -select count(*) from t1 into @a; -return @a; -end| -reset master| -insert into t2 values (bug23333(),1)| -ERROR 23000: Duplicate entry '1' for key 1 -show binlog events from 98 /* with fixes for #23333 will show there is the query */| -Log_name Pos Event_type Server_id End_log_pos Info -select count(*),@a from t1 /* must be 1,1 */| -count(*) @a -1 1 -drop table t1, t2| diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result new file mode 100644 index 00000000000..96e6f76b23c --- /dev/null +++ b/mysql-test/r/sp_trans_log.result @@ -0,0 +1,20 @@ +CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM| +CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB| +insert into t2 values (1,1)| +create function bug23333() +RETURNS int(11) +DETERMINISTIC +begin +insert into t1 values (null); +select count(*) from t1 into @a; +return @a; +end| +reset master| +insert into t2 values (bug23333(),1)| +ERROR 23000: Duplicate entry '1' for key 1 +show binlog events from 98 /* with fixes for #23333 will show there is the query */| +Log_name Pos Event_type Server_id End_log_pos Info +select count(*),@a from t1 /* must be 1,1 */| +count(*) @a +1 1 +drop table t1, t2| diff --git a/mysql-test/t/binlog.test b/mysql-test/t/binlog.test index 1063940d378..49369470d42 100644 --- a/mysql-test/t/binlog.test +++ b/mysql-test/t/binlog.test @@ -4,6 +4,7 @@ -- source include/not_embedded.inc -- source include/have_bdb.inc -- source include/have_innodb.inc +-- source include/have_log_bin.inc --disable_warnings drop table if exists t1, t2; diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test index 4bafad2d777..af319d37dd0 100644 --- a/mysql-test/t/blackhole.test +++ b/mysql-test/t/blackhole.test @@ -4,6 +4,7 @@ # -- source include/not_embedded.inc -- source include/have_blackhole.inc +-- source include/have_log_bin.inc --disable_warnings drop table if exists t1,t2; diff --git a/mysql-test/t/ctype_cp932_binlog.test b/mysql-test/t/ctype_cp932_binlog.test index 443036910d0..7db8f311800 100644 --- a/mysql-test/t/ctype_cp932_binlog.test +++ b/mysql-test/t/ctype_cp932_binlog.test @@ -1,5 +1,6 @@ -- source include/not_embedded.inc -- source include/have_cp932.inc +-- source include/have_log_bin.inc --character_set cp932 --disable_warnings diff --git a/mysql-test/t/ctype_cp932_notembedded.test b/mysql-test/t/ctype_cp932_notembedded.test deleted file mode 100644 index 52e7acc3f01..00000000000 --- a/mysql-test/t/ctype_cp932_notembedded.test +++ /dev/null @@ -1,32 +0,0 @@ --- source include/not_embedded.inc --- source include/have_cp932.inc - ---character_set cp932 ---disable_warnings -drop table if exists t1; ---enable_warnings - -set names cp932; -set character_set_database = cp932; - -# Test prepared statement with 0x8300 sequence in parameter while -# running with cp932 client character set. -RESET MASTER; -CREATE TABLE t1(f1 blob); -PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)'; -SET @var1= x'8300'; -# TODO: Note that this doesn't actually test the code which was added for -# bug#11338 because this syntax for prepared statements causes the PS to -# be replicated differently than if we executed the PS from C or Java. -# Using this syntax, variable names are inserted into the binlog instead -# of values. The real goal of this test is to check the code that was -# added to Item_param::query_val_str() in order to do hex encoding of -# PS parameters when the client character set is cp932; -# Bug#11338 has an example java program which can be used to verify this -# code (and I have used it to test the fix) until there is some way to -# exercise this code from mysql-test-run. -EXECUTE stmt1 USING @var1; -SHOW BINLOG EVENTS FROM 98; -SELECT HEX(f1) FROM t1; -DROP table t1; -# end test for bug#11338 diff --git a/mysql-test/t/ctype_ucs_binlog.test b/mysql-test/t/ctype_ucs_binlog.test index 2467d34386c..92d4458a9c2 100644 --- a/mysql-test/t/ctype_ucs_binlog.test +++ b/mysql-test/t/ctype_ucs_binlog.test @@ -1,5 +1,6 @@ --source include/not_embedded.inc --source include/have_ucs2.inc +--source include/have_log_bin.inc # # Check correct binlogging of UCS2 user variables (BUG#3875) diff --git a/mysql-test/t/drop_temp_table.test b/mysql-test/t/drop_temp_table.test index bc06de4096c..86bdc0eeecc 100644 --- a/mysql-test/t/drop_temp_table.test +++ b/mysql-test/t/drop_temp_table.test @@ -1,5 +1,5 @@ -# Embedded server doesn't support binlog --- source include/not_embedded.inc +--source include/have_log_bin.inc + --disable_warnings drop database if exists `drop-temp+table-test`; diff --git a/mysql-test/t/flush_block_commit_notembedded.test b/mysql-test/t/flush_block_commit_notembedded.test index 4650a5a15a8..e3b59e0fc45 100644 --- a/mysql-test/t/flush_block_commit_notembedded.test +++ b/mysql-test/t/flush_block_commit_notembedded.test @@ -4,7 +4,7 @@ # This is intended to mimick how mysqldump and innobackup work. # And it requires InnoDB --- source include/not_embedded.inc +-- source include/have_log_bin.inc -- source include/have_innodb.inc connect (con1,localhost,root,,); diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index f7fa7366101..b7f264578f2 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -12,6 +12,7 @@ ####################################################################### -- source include/have_innodb.inc +-- source include/have_log_bin.inc # # Small basic test with ignore diff --git a/mysql-test/t/insert_select-binlog.test b/mysql-test/t/insert_select-binlog.test index d4041f86ab5..4bff09577a7 100644 --- a/mysql-test/t/insert_select-binlog.test +++ b/mysql-test/t/insert_select-binlog.test @@ -1,5 +1,6 @@ # Embedded server doesn't support binlog -- source include/not_embedded.inc +-- source include/have_log_bin.inc # Check if a partly-completed INSERT SELECT in a MyISAM table goes into the # binlog diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test index 8bced9f069c..893c93153dd 100644 --- a/mysql-test/t/mix_innodb_myisam_binlog.test +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -5,9 +5,7 @@ # did some tests manually on a slave; tables are replicated fine and # Exec_Master_Log_Pos advances as expected. -# Embedded server doesn't support binlogging --- source include/not_embedded.inc - +-- source include/have_log_bin.inc -- source include/have_innodb.inc --disable_warnings diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test index 1487606a6c2..ca938be7d76 100644 --- a/mysql-test/t/mysqlbinlog-cp932.test +++ b/mysql-test/t/mysqlbinlog-cp932.test @@ -1,6 +1,7 @@ # disabled in embedded until tools running is fixed with embedded --source include/not_embedded.inc -- source include/have_cp932.inc +-- source include/have_log_bin.inc # Bug#16217 (mysql client did not know how not switch its internal charset) flush logs; diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index a7b3f413f23..ba161ddbb89 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -1,7 +1,6 @@ # We are using .opt file since we need small binlog size -# Embedded server doesn't support binlogging --- source include/not_embedded.inc +-- source include/have_log_bin.inc # we need this for getting fixed timestamps inside of this test set timestamp=1000000000; diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test index 14b213cd9cc..c6869d67da1 100644 --- a/mysql-test/t/mysqlbinlog2.test +++ b/mysql-test/t/mysqlbinlog2.test @@ -1,8 +1,7 @@ # Test for the new options --start-datetime, stop-datetime, # and a few others. -# Embedded server doesn't support binlogging --- source include/not_embedded.inc +-- source include/have_log_bin.inc --disable_warnings drop table if exists t1; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 4c4690520c6..d2a6d7014ec 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1,5 +1,6 @@ # Embedded server doesn't support external clients --source include/not_embedded.inc +--source include/have_log_bin.inc --disable_warnings DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3; diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test index d05e4df66b1..e103d40943f 100644 --- a/mysql-test/t/rpl000015.test +++ b/mysql-test/t/rpl000015.test @@ -1,3 +1,5 @@ +-- source include/have_log_bin.inc + connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK); connection master; diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test index c1d36d53501..4488cbad230 100644 --- a/mysql-test/t/rpl000017.test +++ b/mysql-test/t/rpl000017.test @@ -1,3 +1,5 @@ +-- source include/have_log_bin.inc + connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK); connection master; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index 01f556c3c8f..69614b45693 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -1,6 +1,8 @@ # This test uses chmod, can't be run with root permissions -- source include/not_as_root.inc +-- source include/have_log_bin.inc + # # Test is run with max_binlog_size=2048 to force automatic rotation of the # binary log diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test index 8eccaafcf0e..1ea32316f1e 100644 --- a/mysql-test/t/sp_trans.test +++ b/mysql-test/t/sp_trans.test @@ -553,34 +553,6 @@ drop procedure bug14210| set @@session.max_heap_table_size=default| -# -# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog -# Bug #23333 stored function + non-transac table + transac table = -# breaks stmt-based binlog -# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF() -# -CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM| -CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB| - -insert into t2 values (1,1)| - -create function bug23333() -RETURNS int(11) -DETERMINISTIC -begin - insert into t1 values (null); - select count(*) from t1 into @a; - return @a; -end| - -reset master| ---error ER_DUP_ENTRY -insert into t2 values (bug23333(),1)| ---replace_column 2 # 5 # 6 # -show binlog events from 98 /* with fixes for #23333 will show there is the query */| -select count(*),@a from t1 /* must be 1,1 */| -drop table t1, t2| - # # BUG#NNNN: New bug synopsis # diff --git a/mysql-test/t/sp_trans_log.test b/mysql-test/t/sp_trans_log.test new file mode 100644 index 00000000000..3e440b3ccc1 --- /dev/null +++ b/mysql-test/t/sp_trans_log.test @@ -0,0 +1,33 @@ +-- source include/have_innodb.inc +-- source include/have_log_bin.inc + +delimiter |; + +# +# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog +# Bug #23333 stored function + non-transac table + transac table = +# breaks stmt-based binlog +# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF() +# +CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM| +CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB| + +insert into t2 values (1,1)| + +create function bug23333() +RETURNS int(11) +DETERMINISTIC +begin + insert into t1 values (null); + select count(*) from t1 into @a; + return @a; +end| + +reset master| +--error ER_DUP_ENTRY +insert into t2 values (bug23333(),1)| +--replace_column 2 # 5 # 6 # +show binlog events from 98 /* with fixes for #23333 will show there is the query */| +select count(*),@a from t1 /* must be 1,1 */| +drop table t1, t2| + diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test index 12a5e616fa2..57bf9df2fb0 100644 --- a/mysql-test/t/user_var-binlog.test +++ b/mysql-test/t/user_var-binlog.test @@ -1,5 +1,4 @@ -# Embedded server does not support binlogging ---source include/not_embedded.inc +-- source include/have_log_bin.inc # Check that user variables are binlogged correctly (BUG#3875) create table t1 (a varchar(50)); From 4935813cd05527fc53460142a97f07bdb6f7395e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Jun 2007 20:25:22 +0200 Subject: [PATCH 08/17] Fix typo Mark one more test as needing binlog mysql-test/include/master-slave.inc: Fix typo mysql-test/lib/mtr_cases.pl: Fix typo mysql-test/r/have_log_bin.require: Fix typo mysql-test/t/binlog_killed.test: Need binlog --- mysql-test/include/master-slave.inc | 2 +- mysql-test/lib/mtr_cases.pl | 2 +- mysql-test/r/have_log_bin.require | 2 +- mysql-test/t/binlog_killed.test | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index 6b5a508a949..0c27a1d8225 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -1,5 +1,5 @@ # Replication tests need binlog -source include/have_binlog.inc; +source include/have_log_bin.inc; connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 6650a7b9b90..6313733de4e 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -624,7 +624,7 @@ our @tags= ["include/have_binlog_format_row.inc", "binlog_format", "row"], ["include/have_binlog_format_statement.inc", "binlog_format", "stmt"], ["include/have_binlog_format_mixed.inc", "binlog_format", "mixed"], - ["include/have_binlog.inc", "need_binlog", 1], + ["include/have_log_bin.inc", "need_binlog", 1], ["include/big_test.inc", "big_test", 1], ["include/have_debug.inc", "need_debug", 1], ["include/have_ndb.inc", "ndb_test", 1], diff --git a/mysql-test/r/have_log_bin.require b/mysql-test/r/have_log_bin.require index cacdf8df0ce..d4fd77e4f8d 100644 --- a/mysql-test/r/have_log_bin.require +++ b/mysql-test/r/have_log_bin.require @@ -1,2 +1,2 @@ Variable_name Value -have_log_bin ON +log_bin ON diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test index 1c4f1272691..034895f17cb 100644 --- a/mysql-test/t/binlog_killed.test +++ b/mysql-test/t/binlog_killed.test @@ -1,5 +1,6 @@ -- source include/have_innodb.inc --source include/not_embedded.inc +--source include/have_log_bin.inc ### ### bug#22725 : incorrect killed error in binlogged query From 14b95f511b23b884e95d14e00499fe9bc382884c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Jun 2007 22:23:47 +0200 Subject: [PATCH 09/17] Remove "is_debug_build.inc" and use already existing "have-debug.inc" BitKeeper/deleted/.del-is_debug_build.inc: Rename: mysql-test/include/is_debug_build.inc -> BitKeeper/deleted/.del-is_debug_build.inc --- mysql-test/include/is_debug_build.inc | 4 ---- mysql-test/t/sp-code.test | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 mysql-test/include/is_debug_build.inc diff --git a/mysql-test/include/is_debug_build.inc b/mysql-test/include/is_debug_build.inc deleted file mode 100644 index 23a2814e2bb..00000000000 --- a/mysql-test/include/is_debug_build.inc +++ /dev/null @@ -1,4 +0,0 @@ --- require r/is_debug_build.require ---disable_query_log -select instr(version(), "debug") > 0; ---enable_query_log diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test index 0f249c95172..10755f2bf8a 100644 --- a/mysql-test/t/sp-code.test +++ b/mysql-test/t/sp-code.test @@ -2,7 +2,7 @@ # Test the debugging feature "show procedure/function code " # --- source include/is_debug_build.inc +-- source include/have_debug.inc --disable_warnings drop procedure if exists empty; From 20a6f54651677eecd83fff6e7d78aa46311952b0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Jun 2007 23:18:19 +0200 Subject: [PATCH 10/17] Bug#28718 Running backup testcase fails in mysql testsuite of MySQL-enterprise-5.0.40 - Fix test to work on OS where backslashes are forward mysql-test/include/uses_vardir.inc: Make the test work on windows too --- mysql-test/include/uses_vardir.inc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mysql-test/include/uses_vardir.inc b/mysql-test/include/uses_vardir.inc index a5095c3e139..950de698a43 100644 --- a/mysql-test/include/uses_vardir.inc +++ b/mysql-test/include/uses_vardir.inc @@ -7,9 +7,8 @@ # outside of it's vardir anyway # -let $datadir= - query_get_value("SHOW VARIABLES LIKE 'datadir'", Value, 1); -if (`select LOCATE("$MYSQLTEST_VARDIR", "$datadir") != 1`) + +if (`select LOCATE('$MYSQLTEST_VARDIR', REPLACE(@@datadir, '\\\\', '/')) != 1`) { skip Need mysqld in MYSQLTEST_VARDIR; } From 44626a6de8d1d7d907ade133c7f9481376134621 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Jun 2007 07:16:36 +0200 Subject: [PATCH 11/17] Bug#28369 rpl test cases fail with binlog disabled mysql-test/lib/mtr_cases.pl: Don't turn off binlog in versions prior to 5.0 mysql-test/r/binlog.result: Update result after adding "one more select" mysql-test/t/binlog.test: Update result after adding "one more select" --- mysql-test/lib/mtr_cases.pl | 9 ++++++--- mysql-test/r/binlog.result | 4 ++-- mysql-test/t/binlog.test | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 6313733de4e..5e176dce109 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -607,9 +607,12 @@ sub collect_one_test_case($$$$$$$) { } else { - # Test does not need binlog, add --skip-binlog to - # the options used when starting it - push(@{$tinfo->{'master_opt'}}, "--skip-log-bin"); + if ( $::mysql_version_id >= 50100 ) + { + # Test does not need binlog, add --skip-binlog to + # the options used when starting it + push(@{$tinfo->{'master_opt'}}, "--skip-log-bin"); + } } } diff --git a/mysql-test/r/binlog.result b/mysql-test/r/binlog.result index 25930c31735..4ed6c50c7f6 100644 --- a/mysql-test/r/binlog.result +++ b/mysql-test/r/binlog.result @@ -17,7 +17,7 @@ master-bin.000001 # Query 1 # use `test`; insert t1 values (5) master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Query 1 # use `test`; insert t2 values (5) -master-bin.000001 # Xid 1 # COMMIT /* xid=12 */ +master-bin.000001 # Xid 1 # COMMIT /* xid=13 */ drop table t1,t2; reset master; create table t1 (n int) engine=innodb; @@ -128,7 +128,7 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values(4 + 4) master-bin.000001 # Query 1 # use `test`; insert into t1 values(3 + 4) master-bin.000001 # Query 1 # use `test`; insert into t1 values(2 + 4) master-bin.000001 # Query 1 # use `test`; insert into t1 values(1 + 4) -master-bin.000001 # Xid 1 # COMMIT /* xid=19 */ +master-bin.000001 # Xid 1 # COMMIT /* xid=20 */ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 show binlog events in 'master-bin.000002' from 98; Log_name Pos Event_type Server_id End_log_pos Info diff --git a/mysql-test/t/binlog.test b/mysql-test/t/binlog.test index 49369470d42..7c307cb3f94 100644 --- a/mysql-test/t/binlog.test +++ b/mysql-test/t/binlog.test @@ -20,7 +20,7 @@ begin; insert t2 values (5); commit; # first COMMIT must be Query_log_event, second - Xid_log_event ---replace_result "xid=21" "xid=12" +--replace_result "xid=22" "xid=13" --replace_column 2 # 5 # show binlog events from 98; drop table t1,t2; @@ -42,7 +42,7 @@ while ($1) --enable_query_log commit; drop table t1; ---replace_result "xid=32" "xid=19" +--replace_result "xid=33" "xid=20" --replace_column 2 # 5 # show binlog events in 'master-bin.000001' from 98; --replace_column 2 # 5 # From 928e00b8d860fd55d60bd4f38336220af30c121f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Jun 2007 11:30:03 +0200 Subject: [PATCH 12/17] Bug#28369 rpl test cases fail with binlog disabled - Backport include/show_binlog_events.inc from 5.1 and use it to make the test output consistent results mysql-test/r/mix_innodb_myisam_binlog.result: Backport include/show_binlog_events.inc from 5.1 and use it to make the test output consistent results mysql-test/t/mix_innodb_myisam_binlog.test: Backport include/show_binlog_events.inc from 5.1 and use it to make the test output consistent results mysql-test/include/show_binlog_events.inc: New BitKeeper file ``mysql-test/include/show_binlog_events.inc'' --- mysql-test/include/show_binlog_events.inc | 4 ++ mysql-test/r/mix_innodb_myisam_binlog.result | 30 ++++++------ mysql-test/t/mix_innodb_myisam_binlog.test | 50 +++++--------------- 3 files changed, 32 insertions(+), 52 deletions(-) create mode 100644 mysql-test/include/show_binlog_events.inc diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc new file mode 100644 index 00000000000..5d60fb19cb5 --- /dev/null +++ b/mysql-test/include/show_binlog_events.inc @@ -0,0 +1,4 @@ +--let $binlog_start=98 +--replace_column 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// +--eval show binlog events from $binlog_start diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index a8b132ae927..8fc5bfca3ef 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -11,7 +11,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 166 Query 1 # use `test`; insert into t1 values(1) master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 347 Xid 1 # COMMIT /* xid=8 */ +master-bin.000001 347 Xid 1 # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -47,7 +47,7 @@ master-bin.000001 253 Query 1 # use `test`; savepoint my_savepoint master-bin.000001 338 Query 1 # use `test`; insert into t1 values(4) master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint -master-bin.000001 616 Xid 1 # COMMIT /* xid=25 */ +master-bin.000001 616 Xid 1 # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -74,7 +74,7 @@ master-bin.000001 338 Query 1 # use `test`; insert into t1 values(6) master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint master-bin.000001 616 Query 1 # use `test`; insert into t1 values(7) -master-bin.000001 703 Xid 1 # COMMIT /* xid=37 */ +master-bin.000001 703 Xid 1 # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -101,7 +101,7 @@ insert into t2 select * from t1; show binlog events from 98; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; insert into t1 values(9) -master-bin.000001 185 Xid 1 # COMMIT /* xid=60 */ +master-bin.000001 185 Xid 1 # COMMIT /* XID */ master-bin.000001 212 Query 1 # use `test`; insert into t2 select * from t1 delete from t1; delete from t2; @@ -112,18 +112,18 @@ insert into t2 select * from t1; show binlog events from 98; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10) -master-bin.000001 186 Xid 1 # COMMIT /* xid=66 */ +master-bin.000001 186 Xid 1 # COMMIT /* XID */ master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1 insert into t1 values(11); commit; show binlog events from 98; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10) -master-bin.000001 186 Xid 1 # COMMIT /* xid=66 */ +master-bin.000001 186 Xid 1 # COMMIT /* XID */ master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 307 Query 1 # use `test`; BEGIN master-bin.000001 375 Query 1 # use `test`; insert into t1 values(11) -master-bin.000001 463 Xid 1 # COMMIT /* xid=68 */ +master-bin.000001 463 Xid 1 # COMMIT /* XID */ alter table t2 engine=INNODB; delete from t1; delete from t2; @@ -137,7 +137,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 166 Query 1 # use `test`; insert into t1 values(12) master-bin.000001 254 Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 348 Xid 1 # COMMIT /* xid=78 */ +master-bin.000001 348 Xid 1 # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -161,7 +161,7 @@ show binlog events from 98; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 166 Query 1 # use `test`; insert into t1 values(14) -master-bin.000001 254 Xid 1 # COMMIT /* xid=94 */ +master-bin.000001 254 Xid 1 # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -182,7 +182,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16) master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18) -master-bin.000001 342 Xid 1 # COMMIT /* xid=105 */ +master-bin.000001 342 Xid 1 # COMMIT /* XID */ delete from t1; delete from t2; alter table t2 type=MyISAM; @@ -234,19 +234,19 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16) master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18) -master-bin.000001 342 Xid 1 # COMMIT /* xid=105 */ +master-bin.000001 342 Xid 1 # COMMIT /* XID */ master-bin.000001 369 Query 1 # use `test`; delete from t1 -master-bin.000001 446 Xid 1 # COMMIT /* xid=114 */ +master-bin.000001 446 Xid 1 # COMMIT /* XID */ master-bin.000001 473 Query 1 # use `test`; delete from t2 -master-bin.000001 550 Xid 1 # COMMIT /* xid=115 */ +master-bin.000001 550 Xid 1 # COMMIT /* XID */ master-bin.000001 577 Query 1 # use `test`; alter table t2 type=MyISAM master-bin.000001 666 Query 1 # use `test`; insert into t1 values (1) -master-bin.000001 754 Xid 1 # COMMIT /* xid=117 */ +master-bin.000001 754 Xid 1 # COMMIT /* XID */ master-bin.000001 781 Query 1 # use `test`; insert into t2 values (20) master-bin.000001 870 Query 1 # use `test`; drop table t1,t2 master-bin.000001 949 Query 1 # use `test`; create temporary table ti (a int) engine=innodb master-bin.000001 1059 Query 1 # use `test`; insert into ti values(1) -master-bin.000001 1146 Xid 1 # COMMIT /* xid=132 */ +master-bin.000001 1146 Xid 1 # COMMIT /* XID */ master-bin.000001 1173 Query 1 # use `test`; create temporary table t1 (a int) engine=myisam master-bin.000001 1283 Query 1 # use `test`; insert t1 values (1) master-bin.000001 1366 Query 1 # use `test`; create table t0 (n int) diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test index 893c93153dd..428aba92342 100644 --- a/mysql-test/t/mix_innodb_myisam_binlog.test +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -26,9 +26,7 @@ insert into t1 values(1); insert into t2 select * from t1; commit; ---replace_column 5 # ---replace_result "xid=14" "xid=8" -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -40,8 +38,7 @@ insert into t2 select * from t1; # should say some changes to non-transact1onal tables couldn't be rolled back rollback; ---replace_column 5 # -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -55,9 +52,7 @@ insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; ---replace_column 5 # ---replace_result "xid=47" "xid=25" -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -73,9 +68,7 @@ insert into t1 values(7); commit; select a from t1 order by a; # check that savepoints work :) ---replace_column 5 # ---replace_result "xid=69" "xid=37" -show binlog events from 98; +source include/show_binlog_events.inc; # and when ROLLBACK is not explicit? delete from t1; @@ -95,8 +88,7 @@ connection con2; # so SHOW BINLOG EVENTS may come before con1 does the loggin. To be sure that # logging has been done, we use a user lock. select get_lock("a",10); ---replace_column 5 # -show binlog events from 98; +source include/show_binlog_events.inc; # and when not in a transact1on? delete from t1; @@ -106,9 +98,7 @@ reset master; insert into t1 values(9); insert into t2 select * from t1; ---replace_column 5 # ---replace_result "xid=117" "xid=60" -show binlog events from 98; +source include/show_binlog_events.inc; # Check that when the query updat1ng the MyISAM table is the first in the # transaction, we log it immediately. @@ -119,16 +109,11 @@ reset master; insert into t1 values(10); # first make t1 non-empty begin; insert into t2 select * from t1; ---replace_column 5 # ---replace_result "xid=131" "xid=66" -show binlog events from 98; +source include/show_binlog_events.inc; insert into t1 values(11); commit; ---replace_column 5 # ---replace_result "xid=131" "xid=66" "xid=134" "xid=68" -show binlog events from 98; - +source include/show_binlog_events.inc; # Check that things work like before this BEGIN/ROLLBACK code was added, # when t2 is INNODB @@ -144,9 +129,7 @@ insert into t1 values(12); insert into t2 select * from t1; commit; ---replace_column 5 # ---replace_result "xid=153" "xid=78" -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -157,8 +140,7 @@ insert into t1 values(13); insert into t2 select * from t1; rollback; ---replace_column 5 # -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -172,9 +154,7 @@ insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; ---replace_column 5 # ---replace_result "xid=185" "xid=94" -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -190,9 +170,7 @@ insert into t1 values(18); commit; select a from t1 order by a; # check that savepoints work :) ---replace_column 5 # ---replace_result "xid=206" "xid=105" -show binlog events from 98; +source include/show_binlog_events.inc; # Test for BUG#5714, where a MyISAM update in the transaction used to # release row-level locks in InnoDB @@ -251,9 +229,7 @@ insert into t2 values (3); disconnect con2; connection con3; select get_lock("lock1",60); ---replace_column 5 # ---replace_result "xid=206" "xid=105" "xid=224" "xid=114" "xid=227" "xid=115" "xid=231" "xid=117" "xid=258" "xid=132" -show binlog events from 98; +source include/show_binlog_events.inc; do release_lock("lock1"); drop table t0,t2; From 6bb66c75daf9366ca8e376b8104eb8d0084a2ce3 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Jun 2007 16:20:24 +0200 Subject: [PATCH 13/17] Turn off use of bin log when running with embedded server --- mysql-test/mysql-test-run.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 24931955867..2304a40978c 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -903,6 +903,9 @@ sub command_line_setup () { $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster $opt_skip_ssl= 1; # Turn off use of SSL + # Turn off use of bin log + push(@opt_extra_mysqld_opt, "--skip-log-bin"); + if ( $opt_extern ) { mtr_error("Can't use --extern with --embedded-server"); From c1585aea567d50565d7a972c622da4da5c529296 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Jun 2007 16:10:53 -0400 Subject: [PATCH 14/17] Bug #28984: crasher on connect with out of range password length in \ protocol One could send a malformed packet that caused the server to SEGV. In recent versions of the password protocol, the client tells the server what length the ciphertext is (almost always 20). If that length was large enough to overflow a signed char, then the number would jump to very large after being casted to unsigned int. Instead, cast the *passwd char to uchar. sql/sql_parse.cc: Cast *passwd to get rid of the sign, so that sign extension doesn't cause the sequence 125, 126, 127, 4294967169, 4294967170. --- sql/sql_parse.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 659926bdea3..4e84bc9d046 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -909,9 +909,12 @@ static int check_connection(THD *thd) Old clients send null-terminated string as password; new clients send the size (1 byte) + string (not null-terminated). Hence in case of empty password both send '\0'. + + Cast *passwd to an unsigned char, so that it doesn't extend the sign for + *passwd > 127 and become 2**32-127 after casting to uint. */ uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? - *passwd++ : strlen(passwd); + (uchar)(*passwd++) : strlen(passwd); db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ? db + passwd_len + 1 : 0; uint db_len= db ? strlen(db) : 0; From 7a86568318a13491d4e81c832835f32d39ff03e7 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 9 Jun 2007 17:13:33 +0500 Subject: [PATCH 15/17] Fix for bug #28748: "Select" returning one value too few Problem: we may get unexpected results comparing [u]longlong values as doubles. Fix: adjust the test to use integer comparators. Note: it's not a real fix, we have to implement some new comparators to completely solve the original problem (see my comment in the bug report). mysql-test/r/func_in.result: Fix for bug #28748: "Select" returning one value too few - result adjusted. mysql-test/t/func_in.test: Fix for bug #28748: "Select" returning one value too few - test adjusted to use integer comparisons. --- mysql-test/r/func_in.result | 27 ++++++++++++++++++--------- mysql-test/t/func_in.test | 29 +++++++++++++++++++---------- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index a3e0773649f..99b16d29eb9 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -431,15 +431,17 @@ insert into t2 values(13491727406643098568), (0x8000000400000001), (0x8000004000000001), (0x8000040000000001); -SELECT HEX(a) FROM t2 WHERE a IN (0xBB3C3E98175D33C8, 42); +SELECT HEX(a) FROM t2 WHERE a IN +(CAST(0xBB3C3E98175D33C8 AS UNSIGNED), +42); HEX(a) BB3C3E98175D33C8 SELECT HEX(a) FROM t2 WHERE a IN -(0xBB3C3E98175D33C8, -0x7fffffffffffffff, -0x8000000000000000, -0x8000000000000400, -0x8000000000000401, +(CAST(0xBB3C3E98175D33C8 AS UNSIGNED), +CAST(0x7fffffffffffffff AS UNSIGNED), +CAST(0x8000000000000000 AS UNSIGNED), +CAST(0x8000000000000400 AS UNSIGNED), +CAST(0x8000000000000401 AS UNSIGNED), 42); HEX(a) BB3C3E98175D33C8 @@ -447,15 +449,22 @@ BB3C3E98175D33C8 8000000000000000 8000000000000400 8000000000000401 -SELECT HEX(a) FROM t2 WHERE a IN (0x7fffffffffffffff,0x8000000000000001); +SELECT HEX(a) FROM t2 WHERE a IN +(CAST(0x7fffffffffffffff AS UNSIGNED), +CAST(0x8000000000000001 AS UNSIGNED)); HEX(a) 7FFFFFFFFFFFFFFF 8000000000000001 -SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe,0x7fffffffffffffff); +SELECT HEX(a) FROM t2 WHERE a IN +(CAST(0x7ffffffffffffffe AS UNSIGNED), +CAST(0x7fffffffffffffff AS UNSIGNED)); HEX(a) 7FFFFFFFFFFFFFFE 7FFFFFFFFFFFFFFF -SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe,0x7fffffffffffffff,'abc'); +SELECT HEX(a) FROM t2 WHERE a IN +(0x7ffffffffffffffe, +0x7fffffffffffffff, +'abc'); HEX(a) 7FFFFFFFFFFFFFFE 7FFFFFFFFFFFFFFF diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 77592d015eb..a84ffada1ee 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -335,19 +335,28 @@ insert into t2 values(13491727406643098568), (0x8000004000000001), (0x8000040000000001); -SELECT HEX(a) FROM t2 WHERE a IN (0xBB3C3E98175D33C8, 42); +SELECT HEX(a) FROM t2 WHERE a IN + (CAST(0xBB3C3E98175D33C8 AS UNSIGNED), + 42); SELECT HEX(a) FROM t2 WHERE a IN -(0xBB3C3E98175D33C8, - 0x7fffffffffffffff, - 0x8000000000000000, - 0x8000000000000400, - 0x8000000000000401, - 42); + (CAST(0xBB3C3E98175D33C8 AS UNSIGNED), + CAST(0x7fffffffffffffff AS UNSIGNED), + CAST(0x8000000000000000 AS UNSIGNED), + CAST(0x8000000000000400 AS UNSIGNED), + CAST(0x8000000000000401 AS UNSIGNED), + 42); -SELECT HEX(a) FROM t2 WHERE a IN (0x7fffffffffffffff,0x8000000000000001); -SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe,0x7fffffffffffffff); -SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe,0x7fffffffffffffff,'abc'); +SELECT HEX(a) FROM t2 WHERE a IN + (CAST(0x7fffffffffffffff AS UNSIGNED), + CAST(0x8000000000000001 AS UNSIGNED)); +SELECT HEX(a) FROM t2 WHERE a IN + (CAST(0x7ffffffffffffffe AS UNSIGNED), + CAST(0x7fffffffffffffff AS UNSIGNED)); +SELECT HEX(a) FROM t2 WHERE a IN + (0x7ffffffffffffffe, + 0x7fffffffffffffff, + 'abc'); CREATE TABLE t3 (a BIGINT UNSIGNED); INSERT INTO t3 VALUES (9223372036854775551); From 1c4ab3106e7b640e5a277ee03e5f275c1699ca17 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Jun 2007 23:06:20 +0400 Subject: [PATCH 16/17] Fix for bug #29015 "Stack overflow in processing temporary table name when tmpdir path is long" In create_tmp_table() don't set full table path as a table name. Other code assumes table names to not exceed NAME_LEN bytes. sql/sql_select.cc: In create_tmp_table() don't set full table path as a table name. Other code assumes table names to not exceed NAME_LEN bytes. mysql-test/r/long_tmpdir.result: Added testcase for bug #29015 "Stack overflow in processing temporary table name when tmpdir path is long" mysql-test/t/long_tmpdir-master.opt: Added testcase for bug #29015 "Stack overflow in processing temporary table name when tmpdir path is long" mysql-test/t/long_tmpdir-master.sh: Added testcase for bug #29015 "Stack overflow in processing temporary table name when tmpdir path is long" mysql-test/t/long_tmpdir.test: Added testcase for bug #29015 "Stack overflow in processing temporary table name when tmpdir path is long" --- mysql-test/r/long_tmpdir.result | 3 +++ mysql-test/t/long_tmpdir-master.opt | 1 + mysql-test/t/long_tmpdir-master.sh | 3 +++ mysql-test/t/long_tmpdir.test | 9 +++++++++ sql/sql_select.cc | 20 ++++++++++++-------- 5 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 mysql-test/r/long_tmpdir.result create mode 100644 mysql-test/t/long_tmpdir-master.opt create mode 100644 mysql-test/t/long_tmpdir-master.sh create mode 100644 mysql-test/t/long_tmpdir.test diff --git a/mysql-test/r/long_tmpdir.result b/mysql-test/r/long_tmpdir.result new file mode 100644 index 00000000000..7e6dd34ced1 --- /dev/null +++ b/mysql-test/r/long_tmpdir.result @@ -0,0 +1,3 @@ +create view v1 as select table_name from information_schema.tables; +drop view v1; +End of 5.0 tests diff --git a/mysql-test/t/long_tmpdir-master.opt b/mysql-test/t/long_tmpdir-master.opt new file mode 100644 index 00000000000..398abfc4632 --- /dev/null +++ b/mysql-test/t/long_tmpdir-master.opt @@ -0,0 +1 @@ +--tmpdir=$MYSQLTEST_VARDIR/tmp/long_temporary_directory_path_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789 diff --git a/mysql-test/t/long_tmpdir-master.sh b/mysql-test/t/long_tmpdir-master.sh new file mode 100644 index 00000000000..318955fbcca --- /dev/null +++ b/mysql-test/t/long_tmpdir-master.sh @@ -0,0 +1,3 @@ +d="$MYSQLTEST_VARDIR/tmp/long_temporary_directory_path_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789" +test -d "$d" || mkdir "$d" +rm -f "$d"/* diff --git a/mysql-test/t/long_tmpdir.test b/mysql-test/t/long_tmpdir.test new file mode 100644 index 00000000000..cf0bed29918 --- /dev/null +++ b/mysql-test/t/long_tmpdir.test @@ -0,0 +1,9 @@ +# +# Bug #29015: Stack overflow in processing temporary table name when tmpdir path +# is long +# + +create view v1 as select table_name from information_schema.tables; +drop view v1; + +--echo End of 5.0 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b7ac2130784..dcffbe250e2 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -9102,7 +9102,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, bool using_unique_constraint= 0; bool use_packed_rows= 0; bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS); - char *tmpname,path[FN_REFLEN]; + char *tmpname, *tmppath, path[FN_REFLEN], table_name[NAME_LEN+1]; byte *pos,*group_buff; uchar *null_flags; Field **reg_field, **from_field, **default_field; @@ -9125,12 +9125,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, temp_pool_slot = bitmap_set_next(&temp_pool); if (temp_pool_slot != MY_BIT_NONE) // we got a slot - sprintf(path, "%s_%lx_%i", tmp_file_prefix, - current_pid, temp_pool_slot); + sprintf(table_name, "%s_%lx_%i", tmp_file_prefix, + current_pid, temp_pool_slot); else { /* if we run out of slots or we are not using tempool */ - sprintf(path,"%s%lx_%lx_%x", tmp_file_prefix,current_pid, + sprintf(table_name, "%s%lx_%lx_%x", tmp_file_prefix,current_pid, thd->thread_id, thd->tmp_table++); } @@ -9138,7 +9138,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, No need to change table name to lower case as we are only creating MyISAM or HEAP tables here */ - fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME); + fn_format(path, table_name, mysql_tmpdir, "", + MY_REPLACE_EXT|MY_UNPACK_FILENAME); if (group) { @@ -9183,7 +9184,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, sizeof(*key_part_info)*(param->group_parts+1), ¶m->start_recinfo, sizeof(*param->recinfo)*(field_count*2+4), - &tmpname, (uint) strlen(path)+1, + &tmppath, (uint) strlen(path)+1, + &tmpname, (uint) strlen(table_name)+1, &group_buff, group && ! using_unique_constraint ? param->group_length : 0, NullS)) @@ -9201,7 +9203,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, DBUG_RETURN(NULL); /* purecov: inspected */ } param->items_to_copy= copy_func; - strmov(tmpname,path); + strmov(tmppath, path); + strmov(tmpname, table_name); /* make table according to fields */ bzero((char*) table,sizeof(*table)); @@ -9227,7 +9230,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, table->s= &table->share_not_to_be_used; table->s->blob_field= blob_field; - table->s->table_name= table->s->path= tmpname; + table->s->table_name= tmpname; + table->s->path= tmppath; table->s->db= ""; table->s->blob_ptr_size= mi_portable_sizeof_char_ptr; table->s->tmp_table= NON_TRANSACTIONAL_TMP_TABLE; From 3a364d517246d6d571a3c5eecac99dbee6dac7db Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Jun 2007 08:47:36 -0400 Subject: [PATCH 17/17] Bug#28984: crasher on connect with out of range password length in \ protocol Fixed duplicated code, same as last commit. One could send a malformed packet that caused the server to SEGV. In recent versions of the password protocol, the client tells the server what length the ciphertext is (almost always 20). If that length was large enough to overflow a signed char, then the number would jump to very large after being casted to unsigned int. Instead, cast the *passwd char to uchar. sql/sql_parse.cc: Additional location of signed-char casted to uint. --- sql/sql_parse.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4e84bc9d046..24f9ef30569 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1445,11 +1445,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd, Old clients send null-terminated string ('\0' for empty string) for password. New clients send the size (1 byte) + string (not null terminated, so also '\0' for empty string). + + Cast *passwd to an unsigned char, so that it doesn't extend the sign + for *passwd > 127 and become 2**32-127 after casting to uint. */ char db_buff[NAME_LEN+1]; // buffer to store db in utf8 char *db= passwd; uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? - *passwd++ : strlen(passwd); + (uchar)(*passwd++) : strlen(passwd); db+= passwd_len + 1; #ifndef EMBEDDED_LIBRARY /* Small check for incomming packet */