diff options
43 files changed, 278 insertions, 227 deletions
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 444a2d957b6..c7ae8941fd0 100644 --- a/configure.in +++ b/configure.in @@ -1952,6 +1952,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 <curses.h> +#elif HAVE_NCURSES_H +# include <ncurses.h> +#endif +#ifdef HAVE_TERM_H +# include <term.h> +#endif +]) + LIBEDIT_LOBJECTS="" AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"]) AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"]) 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/include/master-slave.inc b/mysql-test/include/master-slave.inc index ea09f4e842b..0c27a1d8225 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_log_bin.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/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/include/uses_vardir.inc b/mysql-test/include/uses_vardir.inc new file mode 100644 index 00000000000..950de698a43 --- /dev/null +++ b/mysql-test/include/uses_vardir.inc @@ -0,0 +1,14 @@ +# +# 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 +# + + +if (`select LOCATE('$MYSQLTEST_VARDIR', REPLACE(@@datadir, '\\\\', '/')) != 1`) +{ + skip Need mysqld in MYSQLTEST_VARDIR; +} diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 1d157ea3401..5e176dce109 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -596,6 +596,25 @@ 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 + { + 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"); + } + } + } } @@ -608,6 +627,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_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/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4514c8d23e4..7d8b89525db 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"); 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/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/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/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index 2c0712f80b1..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=9 */ +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=26 */ +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=38 */ +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=61 */ +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=67 */ +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=67 */ +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=69 */ +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=79 */ +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=95 */ +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=106 */ +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=106 */ +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=115 */ +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=116 */ +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=118 */ +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=133 */ +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/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/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/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/binlog.test b/mysql-test/t/binlog.test index 3bc6c6953ed..2a7df23a2f5 100644 --- a/mysql-test/t/binlog.test +++ b/mysql-test/t/binlog.test @@ -5,6 +5,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/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 diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test index a0a06022bf9..d8ffdeb8312 100644 --- a/mysql-test/t/blackhole.test +++ b/mysql-test/t/blackhole.test @@ -6,6 +6,10 @@ -- source include/have_blackhole.inc -- source include/have_log_bin.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 @@ -110,7 +114,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; diff --git a/mysql-test/t/ctype_cp932_notembedded.test b/mysql-test/t/ctype_cp932_notembedded.test deleted file mode 100644 index 7ae6275816e..00000000000 --- a/mysql-test/t/ctype_cp932_notembedded.test +++ /dev/null @@ -1,33 +0,0 @@ --- source include/not_embedded.inc --- source include/have_cp932.inc --- source include/have_log_bin.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/drop_temp_table.test b/mysql-test/t/drop_temp_table.test index 7c83a2919b7..b456e75576b 100644 --- a/mysql-test/t/drop_temp_table.test +++ b/mysql-test/t/drop_temp_table.test @@ -1,5 +1,3 @@ -# Embedded server doesn't support binlog --- source include/not_embedded.inc -- source include/have_log_bin.inc --disable_warnings diff --git a/mysql-test/t/flush_block_commit_notembedded.test b/mysql-test/t/flush_block_commit_notembedded.test index 25eb093226e..4a0300acf78 100644 --- a/mysql-test/t/flush_block_commit_notembedded.test +++ b/mysql-test/t/flush_block_commit_notembedded.test @@ -6,7 +6,7 @@ -- source include/have_log_bin.inc # 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/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); - -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'); + (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 + (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); 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/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/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test index 53de4d11b81..428aba92342 100644 --- a/mysql-test/t/mix_innodb_myisam_binlog.test +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -4,10 +4,8 @@ # slave is always with --skip-innodb in the testsuite. I (Guilhem) however # did some tests manually on a slave; tables are replicated fine and # Exec_Master_Log_Pos advances as expected. --- source include/have_log_bin.inc -# Embedded server doesn't support binlogging --- source include/not_embedded.inc +-- source include/have_log_bin.inc -- source include/have_innodb.inc --disable_warnings @@ -28,9 +26,7 @@ insert into t1 values(1); insert into t2 select * from t1; commit; ---replace_column 5 # ---replace_result "xid=15" "xid=9" -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -42,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; @@ -57,9 +52,7 @@ insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; ---replace_column 5 # ---replace_result "xid=48" "xid=26" -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -75,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=70" "xid=38" -show binlog events from 98; +source include/show_binlog_events.inc; # and when ROLLBACK is not explicit? delete from t1; @@ -97,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; @@ -108,9 +98,7 @@ reset master; insert into t1 values(9); insert into t2 select * from t1; ---replace_column 5 # ---replace_result "xid=118" "xid=61" -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. @@ -121,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=132" "xid=67" -show binlog events from 98; +source include/show_binlog_events.inc; insert into t1 values(11); commit; ---replace_column 5 # ---replace_result "xid=132" "xid=67" "xid=135" "xid=69" -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 @@ -146,9 +129,7 @@ insert into t1 values(12); insert into t2 select * from t1; commit; ---replace_column 5 # ---replace_result "xid=154" "xid=79" -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -159,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; @@ -174,9 +154,7 @@ insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; ---replace_column 5 # ---replace_result "xid=186" "xid=95" -show binlog events from 98; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -192,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=207" "xid=106" -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 @@ -253,9 +229,7 @@ insert into t2 values (3); disconnect con2; connection con3; select get_lock("lock1",60); ---replace_column 5 # ---replace_result "xid=207" "xid=106" "xid=225" "xid=115" "xid=228" "xid=116" "xid=232" "xid=118" "xid=259" "xid=133" -show binlog events from 98; +source include/show_binlog_events.inc; do release_lock("lock1"); drop table t0,t2; diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index cb1dad2bc85..ba161ddbb89 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -2,9 +2,6 @@ -- source include/have_log_bin.inc -# Embedded server doesn't support binlogging --- source include/not_embedded.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 6f9045b429b..c6869d67da1 100644 --- a/mysql-test/t/mysqlbinlog2.test +++ b/mysql-test/t/mysqlbinlog2.test @@ -3,9 +3,6 @@ -- source include/have_log_bin.inc -# Embedded server doesn't support binlogging --- source include/not_embedded.inc - --disable_warnings drop table if exists t1; --enable_warnings diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 3a3421bd672..30c241d4096 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 # Binlog is required --source include/have_log_bin.inc 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-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 <name>" # --- source include/is_debug_build.inc +-- source include/have_debug.inc --disable_warnings drop procedure if exists empty; diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test index 02e72db18d6..60f7e3326b4 100644 --- a/mysql-test/t/sp_trans.test +++ b/mysql-test/t/sp_trans.test @@ -555,34 +555,6 @@ 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 # #--disable_warnings 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 2b7f880d7fa..57bf9df2fb0 100644 --- a/mysql-test/t/user_var-binlog.test +++ b/mysql-test/t/user_var-binlog.test @@ -1,6 +1,4 @@ -# Embedded server does not support binlogging ---source include/not_embedded.inc ---source include/have_log_bin.inc +-- source include/have_log_bin.inc # Check that user variables are binlogged correctly (BUG#3875) create table t1 (a varchar(50)); 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. - 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. -*/ +#ifdef NPTL_PTHREAD_EXIT_BUG + /* + BUG#24507: Race conditions inside current NPTL pthread_exit() + implementation. - pthread_t dummy_thread; - pthread_attr_t dummy_thread_attr; + 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. - pthread_attr_init(&dummy_thread_attr); - pthread_attr_setdetachstate(&dummy_thread_attr,PTHREAD_CREATE_DETACHED); + 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_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 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) { diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ba6d03d6063..cae1f6eb243 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; } } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c9baecd9cf1..cf8209978a3 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1009,9 +1009,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; @@ -1697,11 +1700,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 incoming packet */ diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6bff302f7f8..36c0988021f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -9164,7 +9164,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &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; @@ -9187,12 +9187,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &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++); } @@ -9200,7 +9200,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &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) { @@ -9245,7 +9246,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &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)) @@ -9263,7 +9265,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &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)); @@ -9289,7 +9292,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &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; |