diff options
author | unknown <mikael@c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se> | 2006-04-21 09:30:19 -0400 |
---|---|---|
committer | unknown <mikael@c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se> | 2006-04-21 09:30:19 -0400 |
commit | ec0789353360958d1db000c582bb1a73bed69dd3 (patch) | |
tree | 3339db78538bb6460acbe9b5f921a17b228744fd /mysql-test | |
parent | 54b54faada2d3d7f50cd12f7c368fe4979b00685 (diff) | |
parent | f0a6d276e569c0768cdf01f5adab8d6615cf458a (diff) | |
download | mariadb-git-ec0789353360958d1db000c582bb1a73bed69dd3.tar.gz |
Merge mronstrom@bk-internal.mysql.com:/home/bk/bugs/bug18198
into c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/bug18198
sql/item_timefunc.h:
Auto merged
sql/partition_info.cc:
Auto merged
sql/share/errmsg.txt:
manual merge
Diffstat (limited to 'mysql-test')
95 files changed, 2255 insertions, 4668 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 067435f0189..8ddf7668844 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -27,14 +27,12 @@ EXTRA_DIST = $(EXTRA_SCRIPTS) GENSCRIPTS = mysql-test-run install_test_db PRESCRIPTS = mysql-test-run.pl test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS) -test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem \ - std_data/server-cert.pem std_data/server-key.pem -CLEANFILES = $(GENSCRIPTS) $(test_DATA) +test_DATA = std_data/client-key.pem std_data/client-cert.pem \ + std_data/cacert.pem std_data/server-cert.pem \ + std_data/server-key.pem +CLEANFILES = $(GENSCRIPTS) INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I.. -EXTRA_PROGRAMS = mysql_test_run_new -noinst_HEADERS = my_manage.h -mysql_test_run_new_SOURCES= mysql_test_run_new.c my_manage.c my_create_tables.c dist-hook: @@ -106,17 +104,6 @@ install-data-local: uninstall-local: @RM@ -f -r $(DESTDIR)$(testdir) -std_data/client-key.pem: - @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data -std_data/client-cert.pem: - @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data -std_data/cacert.pem: - @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data -std_data/server-cert.pem: - @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data -std_data/server-key.pem: - @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data - SUFFIXES = .sh .sh: diff --git a/mysql-test/extra/rpl_tests/rpl_ddl.test b/mysql-test/extra/rpl_tests/rpl_ddl.test index 0d9f390531f..4aab45db18b 100644 --- a/mysql-test/extra/rpl_tests/rpl_ddl.test +++ b/mysql-test/extra/rpl_tests/rpl_ddl.test @@ -507,4 +507,5 @@ DROP DATABASE IF EXISTS mysqltest2; DROP DATABASE IF EXISTS mysqltest3; --enable_warnings +-- source include/master-slave-end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index 0c638281ecb..116bdd1028e 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -77,6 +77,11 @@ connection slave; # to go into the relay log (the master always sends a fake one when replication # starts). start slave; +# +# This is timing out in pushbuild and should be changed to use +# wait_slave_status.inc +# +sleep 2; sync_with_master; flush logs; stop slave; diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_2multi_eng.test b/mysql-test/extra/rpl_tests/rpl_ndb_2multi_eng.test index 014a72db30e..7f19245c0b9 100644 --- a/mysql-test/extra/rpl_tests/rpl_ndb_2multi_eng.test +++ b/mysql-test/extra/rpl_tests/rpl_ndb_2multi_eng.test @@ -51,8 +51,8 @@ SHOW CREATE TABLE t1; # Okay lets see how it holds up to table changes --echo --- Check that simple Alter statements are replicated correctly -- -ALTER TABLE t1 MODIFY vc TEXT; ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); +ALTER TABLE t1 MODIFY vc TEXT; --echo --- Show the new improved table on the master --- @@ -117,6 +117,7 @@ SHOW CREATE TABLE t1; --echo --- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(t,id); ALTER TABLE t1 MODIFY vc TEXT; --echo --- Show the new improved table on the master --- @@ -183,6 +184,7 @@ SHOW CREATE TABLE t1; --echo --- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(id); ALTER TABLE t1 MODIFY vc TEXT; --echo --- Show the new improved table on the master --- @@ -239,6 +241,7 @@ SHOW CREATE TABLE t1; --echo --- Check that simple Alter statements are replicated correctly --- +ALTER TABLE t1 ADD PRIMARY KEY(t,id); ALTER TABLE t1 MODIFY vc TEXT; --echo --- Show the new improved table on the master --- diff --git a/mysql-test/extra/rpl_tests/rpl_row_UUID.test b/mysql-test/extra/rpl_tests/rpl_row_UUID.test index d1d6178773b..962572d3aec 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_UUID.test +++ b/mysql-test/extra/rpl_tests/rpl_row_UUID.test @@ -80,3 +80,4 @@ DROP TABLE test.t2; # be removed at next testsuite run. # End of 5.0 test case +-- source include/master-slave-end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_row_blob.test b/mysql-test/extra/rpl_tests/rpl_row_blob.test index 14449e0a018..75a2dc2cf9e 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_blob.test +++ b/mysql-test/extra/rpl_tests/rpl_row_blob.test @@ -183,3 +183,9 @@ connection master; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; +# ensure cleanup on slave as well: +# ndb blob tables consist of several tables +# if cluster is shutdown while not all tables are +# properly dropped, the table becomes inconsistent +# and wrecks later test cases +--sync_slave_with_master diff --git a/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test index 57b74c80b58..3b6fe7a0ef4 100644 --- a/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test +++ b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test @@ -14,20 +14,22 @@ source include/master-slave.inc; # SHOW VARIABLES LIKE 'relay_log_space_limit'; +# Matz says: I have no idea what this is supposed to test, but it has +# potential for generating different results with some storage engines +# that process rows in an order not dependent on the insertion order. +# For instance, I would assume that distributed storage engines (like +# NDB) could process rows based on locality. + eval CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=$engine_type; -INSERT INTO t1 SET name='Andy', age=31; -INSERT t1 SET name='Jacob', age=2; -INSERT into t1 SET name='Caleb', age=1; +INSERT INTO t1 SET name='Andy', age=31; +INSERT INTO t1 SET name='Jacob', age=2; +INSERT INTO t1 SET name='Caleb', age=1; ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY; SELECT * FROM t1 ORDER BY id; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; SELECT * FROM t1 ORDER BY id; connection master; -drop table t1; -save_master_pos; -connection slave; -sync_with_master; +DROP TABLE t1; +sync_slave_with_master; # End of 4.1 tests diff --git a/mysql-test/include/drop-on-restart.inc b/mysql-test/include/drop-on-restart.inc deleted file mode 100644 index af1d0d893e0..00000000000 --- a/mysql-test/include/drop-on-restart.inc +++ /dev/null @@ -1,467 +0,0 @@ -# -# Stupid temporary way of cleaning up when restarting the server -# - ---disable_warnings ---disable_query_log - -drop database if exists BANK; -drop database if exists MySQLTest; -drop database if exists MySQLtesT; -drop database if exists TEST_DB; -drop database if exists `#mysql50#testdb-1`; -drop database if exists `TEST_$1`; -drop database if exists `drop-temp+table-test`; -drop database if exists `test_$1`; -drop database if exists `testdb-1`; -drop database if exists `testdb1`; -drop database if exists client_test_db; -drop database if exists d1; -drop database if exists d2; -drop database if exists db1; -drop database if exists db1_secret; -drop database if exists db2; -drop database if exists federated; -drop database if exists mysqldump_test_db; -drop database if exists mysqlslap; -drop database if exists mysqltest1; -drop database if exists mysqltest2; -drop database if exists mysqltest3; -drop database if exists mysqltest; -drop database if exists mysqltest; -drop database if exists mysqltest_1; -drop database if exists mysqltest_LC2; -drop database if exists mysqltest_bob; -drop database if exists mysqltest_db1; -drop database if exists mysqltest_prometheus; -drop database if exists mysqltest_sisyfos; -drop database if exists ndbsynctest; -drop database if exists ndbtest1; -drop database if exists rewrite; -drop database if exists test2; -drop database if exists test_only_ndb_tables; -drop database if exists test_test; -drop database if exists testdb1; -drop database if exists testtets; - -drop function if exists append; -drop function if exists bug10015_1; -drop function if exists bug10015_2; -drop function if exists bug10015_3; -drop function if exists bug10015_4; -drop function if exists bug10015_5; -drop function if exists bug10015_6; -drop function if exists bug10015_7; -drop function if exists bug10055; -drop function if exists bug10100f; -drop function if exists bug11394; -drop function if exists bug11394_1; -drop function if exists bug11394_2; -drop function if exists bug11554; -drop function if exists bug11555_1; -drop function if exists bug11555_2; -drop function if exists bug11834_1; -drop function if exists bug11834_2; -drop function if exists bug12379; -drop function if exists bug12712; -drop function if exists bug12812; -drop function if exists bug12953; -drop function if exists bug12995; -drop function if exists bug13012; -drop function if exists bug131333; -drop function if exists bug13825_0; -drop function if exists bug13825_1; -drop function if exists bug13825_2; -drop function if exists bug13825_3; -drop function if exists bug13825_4; -drop function if exists bug13825_5; -drop function if exists bug13941; -drop function if exists bug14233; -drop function if exists bug14270; -drop function if exists bug14723; -drop function if exists bug2267_4; -drop function if exists bug2564_3; -drop function if exists bug2564_4; -drop function if exists bug2674; -drop function if exists bug2772; -drop function if exists bug3132; -drop function if exists bug4487; -drop function if exists bug5240; -drop function if exists bug5278; -drop function if exists bug5893; -drop function if exists bug6022; -drop function if exists bug7049_1; -drop function if exists bug7049_2; -drop function if exists bug7648; -drop function if exists bug8408_f; -drop function if exists bug8409; -drop function if exists bug8861; -drop function if exists bug9048; -drop function if exists bug9056_func1; -drop function if exists bug9056_func2; -drop function if exists bug9102; -drop function if exists bug9559; -drop function if exists bug9775; -drop function if exists bug_13627_f; -drop function if exists bug_9503; -drop function if exists chistics; -drop function if exists e; -drop function if exists f0; -drop function if exists f10; -drop function if exists f11; -drop function if exists f12_1; -drop function if exists f12_2; -drop function if exists f1; -drop function if exists f2; -drop function if exists f3; -drop function if exists f4; -drop function if exists f5; -drop function if exists f6; -drop function if exists f7; -drop function if exists f8; -drop function if exists f9; -drop function if exists f_bug11247; -drop function if exists fac; -drop function if exists foo; -drop function if exists fun; -drop function if exists inc; -drop function if exists mul; -drop function if exists sp_vars_check_ret1; -drop function if exists sp_vars_check_ret2; -drop function if exists sp_vars_check_ret3; -drop function if exists sp_vars_check_ret4; -drop function if exists sub1; -drop function if exists sub2; -drop function if exists test.f1; - -drop procedure if exists BUG3259_2 ; -drop procedure if exists Bug3259_3 ; -drop procedure if exists ` bug15658`; -drop procedure if exists `a'b`; -drop procedure if exists a0; -drop procedure if exists a; -drop procedure if exists avg; -drop procedure if exists b2; -drop procedure if exists b; -drop procedure if exists bar; -drop procedure if exists bug10015_8; -drop procedure if exists bug10100p; -drop procedure if exists bug10100pc; -drop procedure if exists bug10100pd; -drop procedure if exists bug10100pt; -drop procedure if exists bug10100pv; -drop procedure if exists bug10100t; -drop procedure if exists bug10136; -drop procedure if exists bug10537; -drop procedure if exists bug10961; -drop procedure if exists bug10969; -drop procedure if exists bug11158; -drop procedure if exists bug11333; -drop procedure if exists bug11394; -drop procedure if exists bug11529; -drop procedure if exists bug11587; -drop procedure if exists bug12168; -drop procedure if exists bug12297; -drop procedure if exists bug12379_1; -drop procedure if exists bug12379_2; -drop procedure if exists bug12379_3; -drop procedure if exists bug12589_1; -drop procedure if exists bug12589_2; -drop procedure if exists bug12589_3; -drop procedure if exists bug12712; -drop procedure if exists bug12849_1; -drop procedure if exists bug12849_2; -drop procedure if exists bug12979_1; -drop procedure if exists bug12979_2; -drop procedure if exists bug13012; -drop procedure if exists bug13037_p1; -drop procedure if exists bug13037_p2; -drop procedure if exists bug13037_p3; -drop procedure if exists bug13095; -drop procedure if exists bug13124; -drop procedure if exists bug131333; -drop procedure if exists bug13510_1; -drop procedure if exists bug13510_2; -drop procedure if exists bug13510_3; -drop procedure if exists bug13510_4; -drop procedure if exists bug13549_1; -drop procedure if exists bug13549_2; -drop procedure if exists bug13729; -drop procedure if exists bug13825_0; -drop procedure if exists bug13825_1; -drop procedure if exists bug13825_2; -drop procedure if exists bug13941; -drop procedure if exists bug14210; -drop procedure if exists bug14233; -drop procedure if exists bug14304; -drop procedure if exists bug14376; -drop procedure if exists bug14498_1; -drop procedure if exists bug14498_2; -drop procedure if exists bug14498_3; -drop procedure if exists bug14498_4; -drop procedure if exists bug14498_5; -drop procedure if exists bug14643_1; -drop procedure if exists bug14643_2; -drop procedure if exists bug14723; -drop procedure if exists bug14840_1; -drop procedure if exists bug14840_2; -drop procedure if exists bug1495; -drop procedure if exists bug15011; -drop procedure if exists bug15091; -drop procedure if exists bug15231_1; -drop procedure if exists bug15231_2; -drop procedure if exists bug15231_3; -drop procedure if exists bug15231_4; -drop procedure if exists bug15441; -drop procedure if exists bug1547; -drop procedure if exists bug1656; -drop procedure if exists bug1862; -drop procedure if exists bug1863; -drop procedure if exists bug1874; -drop procedure if exists bug2227; -drop procedure if exists bug2260; -drop procedure if exists bug2267_1; -drop procedure if exists bug2267_2; -drop procedure if exists bug2267_3; -drop procedure if exists bug2267_4; -drop procedure if exists bug2460_1; -drop procedure if exists bug2460_2; -drop procedure if exists bug2564_1; -drop procedure if exists bug2564_2; -drop procedure if exists bug2614; -drop procedure if exists bug2656_1; -drop procedure if exists bug2656_2; -drop procedure if exists bug2773; -drop procedure if exists bug2776_1; -drop procedure if exists bug2776_2; -drop procedure if exists bug2780; -drop procedure if exists bug3157; -drop procedure if exists bug3259_1 ; -drop procedure if exists bug3294; -drop procedure if exists bug3368; -drop procedure if exists bug336; -drop procedure if exists bug3426; -drop procedure if exists bug3448; -drop procedure if exists bug3583; -drop procedure if exists bug3734 ; -drop procedure if exists bug3788; -drop procedure if exists bug3843; -drop procedure if exists bug3863; -drop procedure if exists bug4318; -drop procedure if exists bug4579_1; -drop procedure if exists bug4579_2; -drop procedure if exists bug4726; -drop procedure if exists bug4902; -drop procedure if exists bug4902_2; -drop procedure if exists bug4904; -drop procedure if exists bug4905; -drop procedure if exists bug4941; -drop procedure if exists bug5251; -drop procedure if exists bug5258; -drop procedure if exists bug5258_aux; -drop procedure if exists bug5287; -drop procedure if exists bug5307; -drop procedure if exists bug5963; -drop procedure if exists bug5967; -drop procedure if exists bug6029; -drop procedure if exists bug6063; -drop procedure if exists bug6127; -drop procedure if exists bug6129; -drop procedure if exists bug6642; -drop procedure if exists bug6807; -drop procedure if exists bug6857; -drop procedure if exists bug6866; -drop procedure if exists bug6898; -drop procedure if exists bug6900; -drop procedure if exists bug6900_9074; -drop procedure if exists bug7013; -drop procedure if exists bug7049_1; -drop procedure if exists bug7049_2; -drop procedure if exists bug7049_3; -drop procedure if exists bug7049_4; -drop procedure if exists bug7088_1; -drop procedure if exists bug7088_2; -drop procedure if exists bug7293; -drop procedure if exists bug7299; -drop procedure if exists bug7743; -drop procedure if exists bug8116; -drop procedure if exists bug822; -drop procedure if exists bug8408_p; -drop procedure if exists bug8540; -drop procedure if exists bug8692; -drop procedure if exists bug8757; -drop procedure if exists bug8762; -drop procedure if exists bug8776_1; -drop procedure if exists bug8776_2; -drop procedure if exists bug8776_3; -drop procedure if exists bug8776_4; -drop procedure if exists bug8849; -drop procedure if exists bug8850; -drop procedure if exists bug8937; -drop procedure if exists bug9004_1; -drop procedure if exists bug9004_2; -drop procedure if exists bug9056_proc1; -drop procedure if exists bug9056_proc2; -drop procedure if exists bug9073; -drop procedure if exists bug9074; -drop procedure if exists bug9367; -drop procedure if exists bug9486; -drop procedure if exists bug9538; -drop procedure if exists bug9565; -drop procedure if exists bug9565_sub; -drop procedure if exists bug9566; -drop procedure if exists bug9598_1; -drop procedure if exists bug9598_2; -drop procedure if exists bug9674_1; -drop procedure if exists bug9674_2; -drop procedure if exists bug9841; -drop procedure if exists bug9856; -drop procedure if exists bug9902; -drop procedure if exists c1; -drop procedure if exists c2; -drop procedure if exists c3; -drop procedure if exists c4; -drop procedure if exists c; -drop procedure if exists cbv1; -drop procedure if exists cbv2; -drop procedure if exists chistics; -drop procedure if exists code_sample; -drop procedure if exists create_select; -drop procedure if exists cur1; -drop procedure if exists cur2; -drop procedure if exists d; -drop procedure if exists dummy; -drop procedure if exists e; -drop procedure if exists empty; -drop procedure if exists f1; -drop procedure if exists f; -drop procedure if exists fib; -drop procedure if exists fn3; -drop procedure if exists foo42; -drop procedure if exists g; -drop procedure if exists goto1; -drop procedure if exists goto2; -drop procedure if exists goto3; -drop procedure if exists goto4; -drop procedure if exists goto5; -drop procedure if exists goto6; -drop procedure if exists h; -drop procedure if exists hndlr1; -drop procedure if exists hndlr2; -drop procedure if exists hndlr3; -drop procedure if exists hndlr4; -drop procedure if exists i; -drop procedure if exists ifac; -drop procedure if exists inc2; -drop procedure if exists inc; -drop procedure if exists incr; -drop procedure if exists into_dumpfile; -drop procedure if exists into_outfile; -drop procedure if exists into_tes2; -drop procedure if exists into_test3; -drop procedure if exists into_test4; -drop procedure if exists into_test; -drop procedure if exists iotest; -drop procedure if exists ip; -drop procedure if exists locset; -drop procedure if exists mixset; -drop procedure if exists modes; -drop procedure if exists mysqltest1.p1; -drop procedure if exists mysqltest1.p2; -drop procedure if exists nullset; -drop procedure if exists opp; -drop procedure if exists p1; -drop procedure if exists p2; -drop procedure if exists p3; -drop procedure if exists p4; -drop procedure if exists p5; -drop procedure if exists p6; -drop procedure if exists p; -drop procedure if exists p_bug11247; -drop procedure if exists rc; -drop procedure if exists scope; -drop procedure if exists sel1; -drop procedure if exists sel2; -drop procedure if exists setcontext; -drop procedure if exists sp1; -drop procedure if exists sp2; -drop procedure if exists sp3; -drop procedure if exists sp4; -drop procedure if exists sp_vars_check_assignment; -drop procedure if exists sp_vars_check_dflt; -drop procedure if exists sub1; -drop procedure if exists sub2; -drop procedure if exists sub3; -drop procedure if exists sudoku_solve; -drop procedure if exists test.longprocedure; -drop procedure if exists test.p1; -drop procedure if exists test.p2; -drop procedure if exists test.p3; -drop procedure if exists test.p4; -drop procedure if exists test.p5; -drop procedure if exists test.p6; -drop procedure if exists test.p7; -drop procedure if exists two; -drop procedure if exists zap; -drop procedure if exists zip; - -drop table if exists T1; -drop table if exists `"t"1`,t1aa,t2aa; -drop table if exists ```a`; -drop table if exists `t1 test`; -drop table if exists `t1a``b`,v1,v2,v3,v4,v5,v6; -drop table if exists `t2 test`; -drop table if exists a; -drop table if exists bug13095_t1; -drop table if exists bug13894; -drop table if exists bug14672; -drop table if exists federated.alter_me; -drop table if exists federated.archive_table; -drop table if exists federated.bug_13118_table; -drop table if exists federated.normal_table; -drop table if exists federated.t1; -drop table if exists gis_point,gis_line,gis_polygon,gis_multi_point,gis_multi_line,gis_multi_polygon,gis_geometrycollection,gis_geometry; -drop table if exists mysqltest1.t1; -drop table if exists mysqltest1.t2; -drop table if exists mysqltest1.t3; -drop table if exists mysqltest1.t4; -drop table if exists mysqltest_bar; -drop table if exists mysqltest_foo; -drop table if exists new_t2; -drop table if exists not_exist; -drop table if exists r1; -drop table if exists t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t21,t70; -drop table if exists t00,t03,t04; -drop table if exists t0_template; -drop table if exists t1Aa,t2Aa,v1Aa,v2Aa; -drop table if exists t1_1,t1_2,t9_1,t9_2,t1aa,t2aa; -drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; -drop table if exists t1aa,t2aa; -drop table if exists t2aA,t1Aa; -drop table if exists test,test1,test2; -drop table if exists v1,v2,v3; - -drop temporary table if exists test.t1; - -# This doesn't work -#drop trigger if exists `test trig`; -#drop trigger if exists test.t1_bd; -#drop trigger if exists test.t1_bi; -#drop trigger if exists test.t1_bi_t2; -#drop trigger if exists test.t1_bu; -#drop trigger if exists test.t2_ad; -#drop trigger if exists test.t2_ai; -#drop trigger if exists test.t2_au; -#drop trigger if exists test.t3_bi_t2; - -drop view if exists bug13095_v1; -drop view if exists mysqltest1.v1; -drop view if exists mysqltest1.v2; -drop view if exists mysqltest1.v3; -drop view if exists mysqltest1.v4; -drop view if exists t1,t2,`t1a``b`; -drop view if exists t1Aa,t2Aa,v1Aa,v2Aa; -drop view if exists v0,v1,v2,v3,v4,v5,v6; - ---enable_query_log ---enable_warnings diff --git a/mysql-test/include/get_binlog_dump_thread_id.inc b/mysql-test/include/get_binlog_dump_thread_id.inc new file mode 100644 index 00000000000..830a88b5db6 --- /dev/null +++ b/mysql-test/include/get_binlog_dump_thread_id.inc @@ -0,0 +1,9 @@ +--exec $MYSQL test -e 'show processlist' | grep 'Binlog Dump' | cut -f1 > $MYSQLTEST_VARDIR/tmp/bl_dump_thread_id +--disable_warnings +drop table if exists t999; +--enable_warnings +create temporary table t999 (f int); +--replace_result $MYSQLTEST_VARDIR "." +eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/bl_dump_thread_id" into table t999; +let $id = `select f from t999`; +drop table t999; diff --git a/mysql-test/include/master-slave-end.inc b/mysql-test/include/master-slave-end.inc new file mode 100644 index 00000000000..74e4c7b608a --- /dev/null +++ b/mysql-test/include/master-slave-end.inc @@ -0,0 +1,6 @@ +--connection master +--sync_slave_with_master +--connection slave +--disable_query_log +STOP SLAVE; +--enable_query_log diff --git a/mysql-test/include/ndb_setup_slave.inc b/mysql-test/include/ndb_setup_slave.inc new file mode 100644 index 00000000000..b1efeded90b --- /dev/null +++ b/mysql-test/include/ndb_setup_slave.inc @@ -0,0 +1,27 @@ +# +# now setup replication to continue from last epoch +# 1. get apply_status epoch from slave +# 2. get corresponding _next_ binlog postition from master +# 3. change master on slave + +# 1. +--connection slave +--replace_column 1 <the_epoch> +SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status; +--let $the_epoch= `select @the_epoch` + +# 2. +--connection master +--replace_result $the_epoch <the_epoch> +--replace_column 1 <the_pos> +eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) + FROM cluster.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1; +--let $the_pos= `SELECT @the_pos` +--let $the_file= `SELECT @the_file` + +# 3. +--connection slave +--replace_result $the_pos <the_pos> +eval CHANGE MASTER TO + master_log_file = '$the_file', + master_log_pos = $the_pos ; diff --git a/mysql-test/include/rpl_multi_engine3.inc b/mysql-test/include/rpl_multi_engine3.inc index be89c1907f3..cc1b3f13025 100644 --- a/mysql-test/include/rpl_multi_engine3.inc +++ b/mysql-test/include/rpl_multi_engine3.inc @@ -41,7 +41,7 @@ SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; # Must give injector thread a little time to get update # into the binlog other wise we will miss the update. -sleep 3; +sleep 10; sync_slave_with_master; --echo --- Check Update on slave --- diff --git a/mysql-test/init_db.sql b/mysql-test/init_db.sql deleted file mode 100644 index 63483af00d6..00000000000 --- a/mysql-test/init_db.sql +++ /dev/null @@ -1,58 +0,0 @@ -CREATE DATABASE mysql; -CREATE DATABASE test; - -USE mysql; - - -CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,PRIMARY KEY Host (Host,Db,User),KEY User (User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges'; - -INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); -INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); - - -CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,PRIMARY KEY Host (Host,Db)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges'; - -CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Password char(41) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,File_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,ssl_cipher BLOB NOT NULL,x509_issuer BLOB NOT NULL,x509_subject BLOB NOT NULL,max_questions int(11) unsigned DEFAULT 0 NOT NULL,max_updates int(11) unsigned DEFAULT 0 NOT NULL,max_connections int(11) unsigned DEFAULT 0 NOT NULL,PRIMARY KEY Host (Host,User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; - -INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); -INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); -INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0); - -CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL,ret tinyint(1) DEFAULT '0' NOT NULL,dl char(128) DEFAULT '' NOT NULL,type enum ('function','aggregate') NOT NULL,PRIMARY KEY (name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; - -CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Table_name char(64) binary DEFAULT '' NOT NULL,Grantor char(77) DEFAULT '' NOT NULL,Timestamp timestamp(14),Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,PRIMARY KEY (Host,Db,User,Table_name),KEY Grantor (Grantor)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; - -CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Table_name char(64) binary DEFAULT '' NOT NULL,Column_name char(64) binary DEFAULT '' NOT NULL,Timestamp timestamp(14),Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,PRIMARY KEY (Host,Db,User,Table_name,Column_name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; - -CREATE TABLE help_topic (help_topic_id int unsigned not null,name varchar(64) not null,help_category_id smallint unsigned not null,description text not null,example text not null,url varchar(128) not null,primary key (help_topic_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help topics'; - -CREATE TABLE help_category (help_category_id smallint unsigned not null,name varchar(64) not null,parent_category_id smallint unsigned null,url varchar(128) not null,primary key (help_category_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help categories'; - -CREATE TABLE help_keyword (help_keyword_id int unsigned not null,name varchar(64) not null,primary key (help_keyword_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help keywords'; - -CREATE TABLE help_relation (help_topic_id int unsigned not null references help_topic,help_keyword_id int unsigned not null references help_keyword,primary key (help_keyword_id, help_topic_id)) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation'; - -CREATE TABLE time_zone_name (Name char(64) NOT NULL,Time_zone_id int unsigned NOT NULL,PRIMARY KEY Name (Name)) engine=MyISAM CHARACTER SET utf8 comment='Time zone names'; - -INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES ('MET', 1), ('UTC', 2), ('Universal', 2), ('Europe/Moscow',3), ('leap/Europe/Moscow',4), ('Japan', 5); - - -CREATE TABLE time_zone (Time_zone_id int unsigned NOT NULL auto_increment,Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,PRIMARY KEY TzId (Time_zone_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zones'; - -INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N'); - - -CREATE TABLE time_zone_transition (Time_zone_id int unsigned NOT NULL,Transition_time bigint signed NOT NULL,Transition_type_id int unsigned NOT NULL,PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions'; - -INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES (1, -1693706400, 0) ,(1, -1680483600, 1),(1, -1663455600, 2) ,(1, -1650150000, 3),(1, -1632006000, 2) ,(1, -1618700400, 3),(1, -938905200, 2) ,(1, -857257200, 3),(1, -844556400, 2) ,(1, -828226800, 3),(1, -812502000, 2) ,(1, -796777200, 3),(1, 228877200, 2) ,(1, 243997200, 3),(1, 260326800, 2) ,(1, 276051600, 3),(1, 291776400, 2) ,(1, 307501200, 3),(1, 323830800, 2) ,(1, 338950800, 3),(1, 354675600, 2) ,(1, 370400400, 3),(1, 386125200, 2) ,(1, 401850000, 3),(1, 417574800, 2) ,(1, 433299600, 3),(1, 449024400, 2) ,(1, 465354000, 3),(1, 481078800, 2) ,(1, 496803600, 3),(1, 512528400, 2) ,(1, 528253200, 3),(1, 543978000, 2) ,(1, 559702800, 3),(1, 575427600, 2) ,(1, 591152400, 3),(1, 606877200, 2) ,(1, 622602000, 3),(1, 638326800, 2) ,(1, 654656400, 3),(1, 670381200, 2) ,(1, 686106000, 3),(1, 701830800, 2) ,(1, 717555600, 3),(1, 733280400, 2) ,(1, 749005200, 3),(1, 764730000, 2) ,(1, 780454800, 3),(1, 796179600, 2) ,(1, 811904400, 3),(1, 828234000, 2) ,(1, 846378000, 3),(1, 859683600, 2) ,(1, 877827600, 3),(1, 891133200, 2) ,(1, 909277200, 3),(1, 922582800, 2) ,(1, 941331600, 3),(1, 954032400, 2) ,(1, 972781200, 3),(1, 985482000, 2) ,(1, 1004230800, 3),(1, 1017536400, 2) ,(1, 1035680400, 3),(1, 1048986000, 2) ,(1, 1067130000, 3),(1, 1080435600, 2) ,(1, 1099184400, 3),(1, 1111885200, 2) ,(1, 1130634000, 3),(1, 1143334800, 2) ,(1, 1162083600, 3),(1, 1174784400, 2) ,(1, 1193533200, 3),(1, 1206838800, 2) ,(1, 1224982800, 3),(1, 1238288400, 2) ,(1, 1256432400, 3),(1, 1269738000, 2) ,(1, 1288486800, 3),(1, 1301187600, 2) ,(1, 1319936400, 3),(1, 1332637200, 2) ,(1, 1351386000, 3),(1, 1364691600, 2) ,(1, 1382835600, 3),(1, 1396141200, 2) ,(1, 1414285200, 3),(1, 1427590800, 2) ,(1, 1445734800, 3),(1, 1459040400, 2) ,(1, 1477789200, 3),(1, 1490490000, 2) ,(1, 1509238800, 3),(1, 1521939600, 2) ,(1, 1540688400, 3),(1, 1553994000, 2) ,(1, 1572138000, 3),(1, 1585443600, 2) ,(1, 1603587600, 3),(1, 1616893200, 2) ,(1, 1635642000, 3),(1, 1648342800, 2) ,(1, 1667091600, 3),(1, 1679792400, 2) ,(1, 1698541200, 3),(1, 1711846800, 2) ,(1, 1729990800, 3),(1, 1743296400, 2) ,(1, 1761440400, 3),(1, 1774746000, 2) ,(1, 1792890000, 3),(1, 1806195600, 2) ,(1, 1824944400, 3),(1, 1837645200, 2) ,(1, 1856394000, 3),(1, 1869094800, 2) ,(1, 1887843600, 3),(1, 1901149200, 2) ,(1, 1919293200, 3),(1, 1932598800, 2) ,(1, 1950742800, 3),(1, 1964048400, 2) ,(1, 1982797200, 3),(1, 1995498000, 2) ,(1, 2014246800, 3),(1, 2026947600, 2) ,(1, 2045696400, 3),(1, 2058397200, 2) ,(1, 2077146000, 3),(1, 2090451600, 2) ,(1, 2108595600, 3),(1, 2121901200, 2) ,(1, 2140045200, 3),(3, -1688265000, 2) ,(3, -1656819048, 1),(3, -1641353448, 2) ,(3, -1627965048, 3),(3, -1618716648, 1) ,(3, -1596429048, 3),(3, -1593829848, 5) ,(3, -1589860800, 4),(3, -1542427200, 5) ,(3, -1539493200, 6),(3, -1525323600, 5) ,(3, -1522728000, 4),(3, -1491188400, 7) ,(3, -1247536800, 4),(3, 354920400, 5) ,(3, 370728000, 4),(3, 386456400, 5) ,(3, 402264000, 4),(3, 417992400, 5) ,(3, 433800000, 4),(3, 449614800, 5) ,(3, 465346800, 8),(3, 481071600, 9) ,(3, 496796400, 8),(3, 512521200, 9) ,(3, 528246000, 8),(3, 543970800, 9) ,(3, 559695600, 8),(3, 575420400, 9) ,(3, 591145200, 8),(3, 606870000, 9) ,(3, 622594800, 8),(3, 638319600, 9) ,(3, 654649200, 8),(3, 670374000, 10) ,(3, 686102400, 11),(3, 695779200, 8) ,(3, 701812800, 5),(3, 717534000, 4) ,(3, 733273200, 9),(3, 748998000, 8) ,(3, 764722800, 9),(3, 780447600, 8) ,(3, 796172400, 9),(3, 811897200, 8) ,(3, 828226800, 9),(3, 846370800, 8) ,(3, 859676400, 9),(3, 877820400, 8) ,(3, 891126000, 9),(3, 909270000, 8) ,(3, 922575600, 9),(3, 941324400, 8) ,(3, 954025200, 9),(3, 972774000, 8) ,(3, 985474800, 9),(3, 1004223600, 8) ,(3, 1017529200, 9),(3, 1035673200, 8) ,(3, 1048978800, 9),(3, 1067122800, 8) ,(3, 1080428400, 9),(3, 1099177200, 8) ,(3, 1111878000, 9),(3, 1130626800, 8) ,(3, 1143327600, 9),(3, 1162076400, 8) ,(3, 1174777200, 9),(3, 1193526000, 8) ,(3, 1206831600, 9),(3, 1224975600, 8) ,(3, 1238281200, 9),(3, 1256425200, 8) ,(3, 1269730800, 9),(3, 1288479600, 8) ,(3, 1301180400, 9),(3, 1319929200, 8) ,(3, 1332630000, 9),(3, 1351378800, 8) ,(3, 1364684400, 9),(3, 1382828400, 8) ,(3, 1396134000, 9),(3, 1414278000, 8) ,(3, 1427583600, 9),(3, 1445727600, 8) ,(3, 1459033200, 9),(3, 1477782000, 8) ,(3, 1490482800, 9),(3, 1509231600, 8) ,(3, 1521932400, 9),(3, 1540681200, 8) ,(3, 1553986800, 9),(3, 1572130800, 8) ,(3, 1585436400, 9),(3, 1603580400, 8) ,(3, 1616886000, 9),(3, 1635634800, 8) ,(3, 1648335600, 9),(3, 1667084400, 8) ,(3, 1679785200, 9),(3, 1698534000, 8) ,(3, 1711839600, 9),(3, 1729983600, 8) ,(3, 1743289200, 9),(3, 1761433200, 8) ,(3, 1774738800, 9),(3, 1792882800, 8) ,(3, 1806188400, 9),(3, 1824937200, 8) ,(3, 1837638000, 9),(3, 1856386800, 8) ,(3, 1869087600, 9),(3, 1887836400, 8) ,(3, 1901142000, 9),(3, 1919286000, 8) ,(3, 1932591600, 9),(3, 1950735600, 8) ,(3, 1964041200, 9),(3, 1982790000, 8) ,(3, 1995490800, 9),(3, 2014239600, 8) ,(3, 2026940400, 9),(3, 2045689200, 8) ,(3, 2058390000, 9),(3, 2077138800, 8) ,(3, 2090444400, 9),(3, 2108588400, 8) ,(3, 2121894000, 9),(3, 2140038000, 8),(4, -1688265000, 2) ,(4, -1656819048, 1),(4, -1641353448, 2) ,(4, -1627965048, 3),(4, -1618716648, 1) ,(4, -1596429048, 3),(4, -1593829848, 5) ,(4, -1589860800, 4),(4, -1542427200, 5) ,(4, -1539493200, 6),(4, -1525323600, 5) ,(4, -1522728000, 4),(4, -1491188400, 7) ,(4, -1247536800, 4),(4, 354920409, 5) ,(4, 370728010, 4),(4, 386456410, 5) ,(4, 402264011, 4),(4, 417992411, 5) ,(4, 433800012, 4),(4, 449614812, 5) ,(4, 465346812, 8),(4, 481071612, 9) ,(4, 496796413, 8),(4, 512521213, 9) ,(4, 528246013, 8),(4, 543970813, 9) ,(4, 559695613, 8),(4, 575420414, 9) ,(4, 591145214, 8),(4, 606870014, 9) ,(4, 622594814, 8),(4, 638319615, 9) ,(4, 654649215, 8),(4, 670374016, 10) ,(4, 686102416, 11),(4, 695779216, 8) ,(4, 701812816, 5),(4, 717534017, 4) ,(4, 733273217, 9),(4, 748998018, 8) ,(4, 764722818, 9),(4, 780447619, 8) ,(4, 796172419, 9),(4, 811897219, 8) ,(4, 828226820, 9),(4, 846370820, 8) ,(4, 859676420, 9),(4, 877820421, 8) ,(4, 891126021, 9),(4, 909270021, 8) ,(4, 922575622, 9),(4, 941324422, 8) ,(4, 954025222, 9),(4, 972774022, 8) ,(4, 985474822, 9),(4, 1004223622, 8) ,(4, 1017529222, 9),(4, 1035673222, 8) ,(4, 1048978822, 9),(4, 1067122822, 8) ,(4, 1080428422, 9),(4, 1099177222, 8) ,(4, 1111878022, 9),(4, 1130626822, 8) ,(4, 1143327622, 9),(4, 1162076422, 8) ,(4, 1174777222, 9),(4, 1193526022, 8) ,(4, 1206831622, 9),(4, 1224975622, 8) ,(4, 1238281222, 9),(4, 1256425222, 8) ,(4, 1269730822, 9),(4, 1288479622, 8) ,(4, 1301180422, 9),(4, 1319929222, 8) ,(4, 1332630022, 9),(4, 1351378822, 8) ,(4, 1364684422, 9),(4, 1382828422, 8) ,(4, 1396134022, 9),(4, 1414278022, 8) ,(4, 1427583622, 9),(4, 1445727622, 8) ,(4, 1459033222, 9),(4, 1477782022, 8) ,(4, 1490482822, 9),(4, 1509231622, 8) ,(4, 1521932422, 9),(4, 1540681222, 8) ,(4, 1553986822, 9),(4, 1572130822, 8) ,(4, 1585436422, 9),(4, 1603580422, 8) ,(4, 1616886022, 9),(4, 1635634822, 8) ,(4, 1648335622, 9),(4, 1667084422, 8) ,(4, 1679785222, 9),(4, 1698534022, 8) ,(4, 1711839622, 9),(4, 1729983622, 8) ,(4, 1743289222, 9),(4, 1761433222, 8) ,(4, 1774738822, 9),(4, 1792882822, 8) ,(4, 1806188422, 9),(4, 1824937222, 8) ,(4, 1837638022, 9),(4, 1856386822, 8) ,(4, 1869087622, 9),(4, 1887836422, 8) ,(4, 1901142022, 9),(4, 1919286022, 8) ,(4, 1932591622, 9),(4, 1950735622, 8) ,(4, 1964041222, 9),(4, 1982790022, 8) ,(4, 1995490822, 9),(4, 2014239622, 8) ,(4, 2026940422, 9),(4, 2045689222, 8) ,(4, 2058390022, 9),(4, 2077138822, 8) ,(4, 2090444422, 9),(4, 2108588422, 8) ,(4, 2121894022, 9),(4, 2140038022, 8); - - -CREATE TABLE time_zone_transition_type (Time_zone_id int unsigned NOT NULL,Transition_type_id int unsigned NOT NULL,Offset int signed DEFAULT 0 NOT NULL,Is_DST tinyint unsigned DEFAULT 0 NOT NULL,Abbreviation char(8) DEFAULT '' NOT NULL,PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types'; - -INSERT INTO time_zone_transition_type (Time_zone_id,Transition_type_id, Offset, Is_DST, Abbreviation) VALUES (1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET') ,(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET') ,(2, 0, 0, 0, 'UTC') ,(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST') ,(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST') ,(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD') ,(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET') ,(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD') ,(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET') ,(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST') ,(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST') ,(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD') ,(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET') ,(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD') ,(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET') ,(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST'); - -CREATE TABLE time_zone_leap_second (Transition_time bigint signed NOT NULL,Correction int signed NOT NULL,PRIMARY KEY TranTime (Transition_time)) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones'; - -INSERT INTO time_zone_leap_second (Transition_time, Correction) VALUES (78796800, 1) ,(94694401, 2) ,(126230402, 3) ,(157766403, 4) ,(189302404, 5) ,(220924805, 6) ,(252460806, 7) ,(283996807, 8) ,(315532808, 9) ,(362793609, 10) ,(394329610, 11) ,(425865611, 12) ,(489024012, 13) ,(567993613, 14) ,(631152014, 15) ,(662688015, 16) ,(709948816, 17) ,(741484817, 18) ,(773020818, 19) ,(820454419, 20) ,(867715220, 21) ,(915148821, 22); - - diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 58652960e36..779be3d7081 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -144,17 +144,6 @@ sub spawn_impl ($$$$$$$$) { $SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't - if ( $::glob_cygwin_shell and $mode eq 'test' ) - { - # Programs started from mysqltest under Cygwin, are to - # execute them within Cygwin. Else simple things in test - # files like - # --system "echo 1 > file" - # will fail. - # FIXME not working :-( -# $ENV{'COMSPEC'}= "$::glob_cygwin_shell -c"; - } - my $log_file_open_mode = '>'; if ($spawn_opts and $spawn_opts->{'append_log_file'}) @@ -164,7 +153,15 @@ sub spawn_impl ($$$$$$$$) { if ( $output ) { - if ( ! open(STDOUT,$log_file_open_mode,$output) ) + if ( $::glob_win32_perl ) + { + # Don't redirect stdout on ActiveState perl since this is + # just another thread in the same process. + # Should be fixed so that the thread that is created with fork + # executes the exe in another process and wait's for it to return. + # In the meanwhile, we get all the output from mysqld's to screen + } + elsif ( ! open(STDOUT,$log_file_open_mode,$output) ) { mtr_child_error("can't redirect STDOUT to \"$output\": $!"); } @@ -216,8 +213,7 @@ sub spawn_parent_impl { { # Simple run of command, we wait for it to return my $ret_pid= waitpid($pid,0); - - if ( $ret_pid <= 0 ) + if ( $ret_pid != $pid ) { mtr_error("$path ($pid) got lost somehow"); } @@ -245,7 +241,6 @@ sub spawn_parent_impl { # Someone terminated, don't know who. Collect # status info first before $? is lost, # but not $exit_value, this is flagged from - # my $timer_name= mtr_timer_timeout($::glob_timers, $ret_pid); if ( $timer_name ) @@ -310,7 +305,7 @@ sub spawn_parent_impl { $ret_pid= waitpid($pid,0); - if ( $ret_pid == -1 ) + if ( $ret_pid != $pid ) { mtr_error("$path ($pid) got lost somehow"); } @@ -361,7 +356,6 @@ sub mtr_kill_leftovers () { # First, kill all masters and slaves that would conflict with # this run. Make sure to remove the PID file, if any. # FIXME kill IM manager first, else it will restart the servers, how?! - my @args; for ( my $idx; $idx < 2; $idx++ ) @@ -650,22 +644,10 @@ sub mtr_mysqladmin_shutdown { my $adm_shutdown_tmo= shift; my %mysql_admin_pids; - my @to_kill_specs; + # Start one "mysqladmin shutdown" for each server foreach my $srv ( @$spec ) { - if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) ) - { - push(@to_kill_specs, $srv); - } - } - - - foreach my $srv ( @to_kill_specs ) - { - # FIXME wrong log..... - # FIXME, stderr..... - # Shutdown time must be high as slave may be in reconnect my $args; mtr_init_args(\$args); @@ -673,6 +655,7 @@ sub mtr_mysqladmin_shutdown { mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--user=%s", $::opt_user); mtr_add_arg($args, "--password="); + mtr_add_arg($args, "--silent"); if ( -e $srv->{'sockfile'} ) { mtr_add_arg($args, "--socket=%s", $srv->{'sockfile'}); @@ -686,26 +669,27 @@ sub mtr_mysqladmin_shutdown { mtr_add_arg($args, "--protocol=tcp"); # Needed if no --socket } mtr_add_arg($args, "--connect_timeout=5"); + # Shutdown time must be high as slave may be in reconnect mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo"); mtr_add_arg($args, "shutdown"); - # We don't wait for termination of mysqladmin + # Start mysqladmin in paralell and wait for termination later my $pid= mtr_spawn($::exe_mysqladmin, $args, "", $::path_manager_log, $::path_manager_log, "", { append_log_file => 1 }); + # Save the pid of the mysqladmin process $mysql_admin_pids{$pid}= 1; } + # Wait for all the started mysqladmin to exit # As mysqladmin is such a simple program, we trust it to terminate. # I.e. we wait blocking, and wait wait for them all before we go on. - while (keys %mysql_admin_pids) + foreach my $pid (keys %mysql_admin_pids) { - foreach my $pid (keys %mysql_admin_pids) - { - if ( waitpid($pid,0) > 0 ) - { - delete $mysql_admin_pids{$pid}; - } - } + my $ret_pid= waitpid($pid,0); + + # If this was any of the mysqladmin's we waited for, delete its + # pid from list + delete $mysql_admin_pids{$ret_pid} if exists $mysql_admin_pids{$ret_pid}; } # If we trusted "mysqladmin --shutdown_timeout= ..." we could just @@ -720,7 +704,7 @@ sub mtr_mysqladmin_shutdown { TIME: while ( $timeout-- ) { - foreach my $srv ( @to_kill_specs ) + foreach my $srv ( @$spec ) { $res= 1; # We are optimistic if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) ) @@ -753,9 +737,9 @@ sub mtr_record_dead_children () { my $ret_pid; - # FIXME the man page says to wait for -1 to terminate, - # but on OS X we get '0' all the time... - while ( ($ret_pid= waitpid(-1,&WNOHANG)) > 0 ) + # Wait without blockinng to see if any processes had died + # -1 or 0 means there are no more procesess to wait for + while ( ($ret_pid= waitpid(-1,&WNOHANG)) != 0 and $ret_pid != -1) { mtr_debug("waitpid() catched exit of child $ret_pid"); foreach my $idx (0..1) @@ -788,7 +772,11 @@ sub start_reap_all { # here. If a process terminated before setting $SIG{CHLD} (but after # any attempt to waitpid() it), it will still be a zombie. So we # have to handle any such process here. - while(waitpid(-1, &WNOHANG) > 0) { }; + my $pid; + while(($pid= waitpid(-1, &WNOHANG)) != 0 and $pid != -1) + { + print "start_reap_all: pid: $pid.\n"; + }; } sub stop_reap_all { @@ -842,7 +830,7 @@ sub sleep_until_file_created ($$$) { } # Check if it died after the fork() was successful - if ( $pid > 0 && waitpid($pid,&WNOHANG) == $pid ) + if ( $pid != 0 && waitpid($pid,&WNOHANG) == $pid ) { return 0; } @@ -904,8 +892,8 @@ sub mtr_exit ($) { # set ourselves as the group leader at startup (with # POSIX::setpgrp(0,0)), but then care must be needed to always do # proper child process cleanup. - kill('HUP', -$$) if $$ == getpgrp(); - sleep 2; + kill('HUP', -$$) if !$::glob_win32_perl and $$ == getpgrp(); + exit($code); } diff --git a/mysql-test/my_create_tables.c b/mysql-test/my_create_tables.c deleted file mode 100644 index 06a6fabf022..00000000000 --- a/mysql-test/my_create_tables.c +++ /dev/null @@ -1,673 +0,0 @@ -#include <stdio.h> -#include <errno.h> -#ifndef __WIN__ -#include <dirent.h> -#endif -#include <string.h> -#ifdef __NETWARE__ -#include <screen.h> -#include <proc.h> -#else -#include <sys/types.h> -#ifndef __WIN__ -#include <sys/wait.h> -#include <unistd.h> -#else -#include <direct.h> -#include <stdlib.h> -#include <stdio.h> -#endif -#endif -#include <ctype.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <assert.h> -#include "my_manage.h" - -/* - Synopsis: - This function testes a exist file - -Arguments: - mdata: path to data - file_name: name of file -Output: - A zero value indicates that file is exist. -*/ -bool test_sys_file(const char *mdata,const char *file_name) -{ - struct stat file; - char path_file_name[PATH_MAX]; - snprintf(path_file_name, PATH_MAX, "%s/%s", mdata, file_name); - return(stat(path_file_name,&file)); -} - -/* - Synopsis: - This function creates a file with sql requstes for creating - system data files. - -Arguments: - mdata: path to data - output_file: file name for output file - test: to create system files with test data -Output: - A zero value indicates a success. -*/ -bool create_system_files(const char *mdata,const char *output_file, bool test) -{ - FILE *out; - - out = fopen(output_file, "w+"); - - if (!out) - return 1; - - if (test_sys_file(mdata,"mysql")) - { - fprintf(out,"CREATE DATABASE mysql;\n"); - } - - if (test && test_sys_file(mdata,"test")) - { - fprintf(out,"CREATE DATABASE test;\n"); - } - - fprintf(out,"USE mysql;\n"); - - if (test_sys_file(mdata,"mysql/db.frm")) - { - fprintf(out, - "CREATE TABLE db (" - "Host char(60) binary DEFAULT '' NOT NULL," - "Db char(64) binary DEFAULT '' NOT NULL," - "User char(16) binary DEFAULT '' NOT NULL," - "Select_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Update_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Create_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "References_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Index_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "PRIMARY KEY Host (Host,Db,User)," - "KEY User (User))" - "engine=MyISAM " - "CHARACTER SET utf8 COLLATE utf8_bin " - "comment='Database privileges';\n"); - - if (test) - { - fprintf(out,"INSERT INTO db VALUES ('%%','test','','Y','Y','Y','Y'" - ",'Y','Y','N','Y','Y','Y','Y','Y');\n"); - fprintf(out,"INSERT INTO db VALUES ('%%','test\\_%%','','Y','Y','Y'" - ",'Y','Y','Y','N','Y','Y','Y','Y','Y');\n"); - } - } - - if (test_sys_file(mdata,"mysql/host.frm")) - { - fprintf(out, - "CREATE TABLE host (" - "Host char(60) binary DEFAULT '' NOT NULL," - "Db char(64) binary DEFAULT '' NOT NULL," - "Select_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Update_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Create_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "References_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Index_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "PRIMARY KEY Host (Host,Db))" - "engine=MyISAM " - "CHARACTER SET utf8 COLLATE utf8_bin " - "comment='Host privileges; Merged with database privileges';\n"); - } - - - if (test_sys_file(mdata,"mysql/user.frm")) - { -#ifdef __WIN__ - WSADATA wsa_data; -#endif - char hostname[FN_REFLEN]; - -#ifdef __WIN__ - if (WSAStartup(MAKEWORD( 2, 2 ),&wsa_data)) - return 1; -#endif - if (gethostname(hostname, FN_REFLEN)) - return 1; -#ifdef __WIN__ - WSACleanup( ); -#endif - - if (strchr(hostname, '.') == NULL) - strcat(hostname, "%"); - - fprintf(out, - "CREATE TABLE user (" - "Host char(60) binary DEFAULT '' NOT NULL," - "User char(16) binary DEFAULT '' NOT NULL," - "Password char(41) binary DEFAULT '' NOT NULL," - "Select_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Update_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Create_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Process_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "File_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "References_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Index_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Super_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL," - "ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL," - "ssl_cipher BLOB NOT NULL," - "x509_issuer BLOB NOT NULL," - "x509_subject BLOB NOT NULL," - "max_questions int(11) unsigned DEFAULT 0 NOT NULL," - "max_updates int(11) unsigned DEFAULT 0 NOT NULL," - "max_connections int(11) unsigned DEFAULT 0 NOT NULL," - "PRIMARY KEY Host (Host,User)" - ") engine=MyISAM " - "CHARACTER SET utf8 COLLATE utf8_bin " - "comment='Users and global privileges';\n"); - - - if (test) - { - fprintf(out, - "INSERT INTO user VALUES ('localhost','root',''" - ",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'" - ",'Y','Y','Y','Y','Y','','','','',0,0,0);\n"); - fprintf(out, - "INSERT INTO user VALUES ('%s','root','','Y','Y'," - "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'," - "'Y','Y','Y','Y','','','','',0,0,0);\n",hostname); - fprintf(out, - "REPLACE INTO user VALUES ('127.0.0.1','root',''," - "'Y','Y','Y','Y','Y','Y'," - "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'" - ",'Y','','','','',0,0,0);\n"); - fprintf(out,"INSERT INTO user (host,user) values ('localhost','');\n"); - fprintf(out,"INSERT INTO user (host,user) values ('%s','');\n",hostname); - } - else - { - fprintf(out, - "INSERT INTO user VALUES ('localhost','root',''," - "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'," - "'Y','Y','Y','Y','','','','',0,0,0);\n"); -#ifndef __WIN__ - fprintf(out, - "INSERT INTO user VALUES ('%s','root','','Y','Y'," - "'Y','Y','Y','Y','Y','Y'" - "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','',''" - ",'','',0,0,0);\n",hostname); - fprintf(out,"INSERT INTO user (host,user) values ('%s','');\n",hostname); - fprintf(out,"INSERT INTO user (host,user) values ('localhost','');\n"); -#else - fprintf(out, - "INSERT INTO user VALUES ('localhost','','','Y','Y','Y'" - ",'Y','Y','Y','Y','Y','Y'" - ",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','',''," - "'','',0,0,0);\n"); -#endif - } - } - - - if (test_sys_file(mdata,"mysql/func.frm")) - { - fprintf(out, - "CREATE TABLE func (" - "name char(64) binary DEFAULT '' NOT NULL," - "ret tinyint(1) DEFAULT '0' NOT NULL," - "dl char(128) DEFAULT '' NOT NULL," - "type enum ('function','aggregate') NOT NULL," - "PRIMARY KEY (name)" - ") engine=MyISAM " - "CHARACTER SET utf8 COLLATE utf8_bin " - "comment='User defined functions';\n"); - } - - if (test_sys_file(mdata,"mysql/tables_priv.frm")) - { - fprintf(out, - "CREATE TABLE tables_priv (" - "Host char(60) binary DEFAULT '' NOT NULL," - "Db char(64) binary DEFAULT '' NOT NULL," - "User char(16) binary DEFAULT '' NOT NULL," - "Table_name char(64) binary DEFAULT '' NOT NULL," - "Grantor char(77) DEFAULT '' NOT NULL," - "Timestamp timestamp(14)," - "Table_priv set('Select','Insert','Update','Delete'," - "'Create','Drop','Grant','References','Index','Alter')" - " DEFAULT '' NOT NULL," - "Column_priv set('Select','Insert','Update','References')" - " DEFAULT '' NOT NULL," - "PRIMARY KEY (Host,Db,User,Table_name)," - "KEY Grantor (Grantor)" - ") engine=MyISAM " - "CHARACTER SET utf8 COLLATE utf8_bin " - "comment='Table privileges';\n"); - } - - if (test_sys_file(mdata,"mysql/columns_priv.frm")) - { - fprintf(out, - "CREATE TABLE columns_priv (" - "Host char(60) binary DEFAULT '' NOT NULL," - "Db char(64) binary DEFAULT '' NOT NULL," - "User char(16) binary DEFAULT '' NOT NULL," - "Table_name char(64) binary DEFAULT '' NOT NULL," - "Column_name char(64) binary DEFAULT '' NOT NULL," - "Timestamp timestamp(14)," - "Column_priv set('Select','Insert','Update','References')" - " DEFAULT '' NOT NULL," - "PRIMARY KEY (Host,Db,User,Table_name,Column_name)" - ") engine=MyISAM " - "CHARACTER SET utf8 COLLATE utf8_bin " - "comment='Column privileges';\n"); - } - - if (test_sys_file(mdata,"mysql/help_topic.frm")) - { - fprintf(out, - "CREATE TABLE help_topic (" - "help_topic_id int unsigned not null," - "name varchar(64) not null," - "help_category_id smallint unsigned not null," - "description text not null," - "example text not null," - "url varchar(128) not null," - "primary key (help_topic_id)," - "unique index (name)" - ") engine=MyISAM " - "CHARACTER SET utf8 " - "comment='help topics';\n"); - } - - if (test_sys_file(mdata,"mysql/help_category.frm")) - { - fprintf(out, - "CREATE TABLE help_category (" - "help_category_id smallint unsigned not null," - "name varchar(64) not null," - "parent_category_id smallint unsigned null," - "url varchar(128) not null," - "primary key (help_category_id)," - "unique index (name)" - ") engine=MyISAM " - "CHARACTER SET utf8 " - "comment='help categories';\n"); - } - - if (test_sys_file(mdata,"mysql/help_keyword.frm")) - { - fprintf(out, - "CREATE TABLE help_keyword (" - "help_keyword_id int unsigned not null," - "name varchar(64) not null," - "primary key (help_keyword_id)," - "unique index (name)" - ") engine=MyISAM " - "CHARACTER SET utf8 " - "comment='help keywords';\n"); - } - - if (test_sys_file(mdata,"mysql/help_relation.frm")) - { - fprintf(out, - "CREATE TABLE help_relation (" - "help_topic_id int unsigned not null references help_topic," - "help_keyword_id int unsigned not null references help_keyword," - "primary key (help_keyword_id, help_topic_id)" - ") engine=MyISAM " - "CHARACTER SET utf8 " - "comment='keyword-topic relation';\n"); - } - - if (test_sys_file(mdata,"mysql/time_zone_name.frm")) - { - fprintf(out, - "CREATE TABLE time_zone_name (" - "Name char(64) NOT NULL," - "Time_zone_id int unsigned NOT NULL," - "PRIMARY KEY Name (Name)" - ") engine=MyISAM CHARACTER SET utf8 " - "comment='Time zone names';\n"); - - if (test) - { - fprintf(out, - "INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES" - "('MET', 1), ('UTC', 2), ('Universal', 2), " - "('Europe/Moscow',3), ('leap/Europe/Moscow',4)," - "('Japan', 5);\n"); - - } - } - - - if (test_sys_file(mdata,"mysql/time_zone.frm")) - { - fprintf(out, - "CREATE TABLE time_zone (" - "Time_zone_id int unsigned NOT NULL auto_increment," - "Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL," - "PRIMARY KEY TzId (Time_zone_id)" - ") engine=MyISAM CHARACTER SET utf8 " - "comment='Time zones';\n"); - - if (test) - { - fprintf(out,"INSERT INTO time_zone (Time_zone_id, Use_leap_seconds)" - "VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N');\n"); - } - } - - if (test_sys_file(mdata,"mysql/time_zone_transition.frm")) - { - fprintf(out, - "CREATE TABLE time_zone_transition (" - "Time_zone_id int unsigned NOT NULL," - "Transition_time bigint signed NOT NULL," - "Transition_type_id int unsigned NOT NULL," - "PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)" - ") engine=MyISAM CHARACTER SET utf8 " - "comment='Time zone transitions';\n"); - - if (test) - { - fprintf(out, - "INSERT INTO time_zone_transition" - "(Time_zone_id, Transition_time, Transition_type_id)" - "VALUES" - " (1, -1693706400, 0) ,(1, -1680483600, 1)" - ",(1, -1663455600, 2) ,(1, -1650150000, 3)" - ",(1, -1632006000, 2) ,(1, -1618700400, 3)" - ",(1, -938905200, 2) ,(1, -857257200, 3)" - ",(1, -844556400, 2) ,(1, -828226800, 3)" - ",(1, -812502000, 2) ,(1, -796777200, 3)" - ",(1, 228877200, 2) ,(1, 243997200, 3)" - ",(1, 260326800, 2) ,(1, 276051600, 3)" - ",(1, 291776400, 2) ,(1, 307501200, 3)" - ",(1, 323830800, 2) ,(1, 338950800, 3)" - ",(1, 354675600, 2) ,(1, 370400400, 3)" - ",(1, 386125200, 2) ,(1, 401850000, 3)" - ",(1, 417574800, 2) ,(1, 433299600, 3)" - ",(1, 449024400, 2) ,(1, 465354000, 3)" - ",(1, 481078800, 2) ,(1, 496803600, 3)" - ",(1, 512528400, 2) ,(1, 528253200, 3)" - ",(1, 543978000, 2) ,(1, 559702800, 3)" - ",(1, 575427600, 2) ,(1, 591152400, 3)" - ",(1, 606877200, 2) ,(1, 622602000, 3)" - ",(1, 638326800, 2) ,(1, 654656400, 3)" - ",(1, 670381200, 2) ,(1, 686106000, 3)" - ",(1, 701830800, 2) ,(1, 717555600, 3)" - ",(1, 733280400, 2) ,(1, 749005200, 3)" - ",(1, 764730000, 2) ,(1, 780454800, 3)" - ",(1, 796179600, 2) ,(1, 811904400, 3)" - ",(1, 828234000, 2) ,(1, 846378000, 3)" - ",(1, 859683600, 2) ,(1, 877827600, 3)" - ",(1, 891133200, 2) ,(1, 909277200, 3)" - ",(1, 922582800, 2) ,(1, 941331600, 3)" - ",(1, 954032400, 2) ,(1, 972781200, 3)" - ",(1, 985482000, 2) ,(1, 1004230800, 3)" - ",(1, 1017536400, 2) ,(1, 1035680400, 3)" - ",(1, 1048986000, 2) ,(1, 1067130000, 3)" - ",(1, 1080435600, 2) ,(1, 1099184400, 3)" - ",(1, 1111885200, 2) ,(1, 1130634000, 3)" - ",(1, 1143334800, 2) ,(1, 1162083600, 3)" - ",(1, 1174784400, 2) ,(1, 1193533200, 3)" - ",(1, 1206838800, 2) ,(1, 1224982800, 3)" - ",(1, 1238288400, 2) ,(1, 1256432400, 3)" - ",(1, 1269738000, 2) ,(1, 1288486800, 3)" - ",(1, 1301187600, 2) ,(1, 1319936400, 3)" - ",(1, 1332637200, 2) ,(1, 1351386000, 3)" - ",(1, 1364691600, 2) ,(1, 1382835600, 3)" - ",(1, 1396141200, 2) ,(1, 1414285200, 3)" - ",(1, 1427590800, 2) ,(1, 1445734800, 3)" - ",(1, 1459040400, 2) ,(1, 1477789200, 3)" - ",(1, 1490490000, 2) ,(1, 1509238800, 3)" - ",(1, 1521939600, 2) ,(1, 1540688400, 3)" - ",(1, 1553994000, 2) ,(1, 1572138000, 3)" - ",(1, 1585443600, 2) ,(1, 1603587600, 3)" - ",(1, 1616893200, 2) ,(1, 1635642000, 3)" - ",(1, 1648342800, 2) ,(1, 1667091600, 3)" - ",(1, 1679792400, 2) ,(1, 1698541200, 3)" - ",(1, 1711846800, 2) ,(1, 1729990800, 3)" - ",(1, 1743296400, 2) ,(1, 1761440400, 3)" - ",(1, 1774746000, 2) ,(1, 1792890000, 3)" - ",(1, 1806195600, 2) ,(1, 1824944400, 3)" - ",(1, 1837645200, 2) ,(1, 1856394000, 3)" - ",(1, 1869094800, 2) ,(1, 1887843600, 3)" - ",(1, 1901149200, 2) ,(1, 1919293200, 3)" - ",(1, 1932598800, 2) ,(1, 1950742800, 3)" - ",(1, 1964048400, 2) ,(1, 1982797200, 3)" - ",(1, 1995498000, 2) ,(1, 2014246800, 3)" - ",(1, 2026947600, 2) ,(1, 2045696400, 3)" - ",(1, 2058397200, 2) ,(1, 2077146000, 3)" - ",(1, 2090451600, 2) ,(1, 2108595600, 3)" - ",(1, 2121901200, 2) ,(1, 2140045200, 3)" - ",(3, -1688265000, 2) ,(3, -1656819048, 1)" - ",(3, -1641353448, 2) ,(3, -1627965048, 3)" - ",(3, -1618716648, 1) ,(3, -1596429048, 3)" - ",(3, -1593829848, 5) ,(3, -1589860800, 4)" - ",(3, -1542427200, 5) ,(3, -1539493200, 6)" - ",(3, -1525323600, 5) ,(3, -1522728000, 4)" - ",(3, -1491188400, 7) ,(3, -1247536800, 4)" - ",(3, 354920400, 5) ,(3, 370728000, 4)" - ",(3, 386456400, 5) ,(3, 402264000, 4)" - ",(3, 417992400, 5) ,(3, 433800000, 4)" - ",(3, 449614800, 5) ,(3, 465346800, 8)" - ",(3, 481071600, 9) ,(3, 496796400, 8)" - ",(3, 512521200, 9) ,(3, 528246000, 8)" - ",(3, 543970800, 9) ,(3, 559695600, 8)" - ",(3, 575420400, 9) ,(3, 591145200, 8)" - ",(3, 606870000, 9) ,(3, 622594800, 8)" - ",(3, 638319600, 9) ,(3, 654649200, 8)" - ",(3, 670374000, 10) ,(3, 686102400, 11)" - ",(3, 695779200, 8) ,(3, 701812800, 5)" - ",(3, 717534000, 4) ,(3, 733273200, 9)" - ",(3, 748998000, 8) ,(3, 764722800, 9)" - ",(3, 780447600, 8) ,(3, 796172400, 9)" - ",(3, 811897200, 8) ,(3, 828226800, 9)" - ",(3, 846370800, 8) ,(3, 859676400, 9)" - ",(3, 877820400, 8) ,(3, 891126000, 9)" - ",(3, 909270000, 8) ,(3, 922575600, 9)" - ",(3, 941324400, 8) ,(3, 954025200, 9)" - ",(3, 972774000, 8) ,(3, 985474800, 9)" - ",(3, 1004223600, 8) ,(3, 1017529200, 9)" - ",(3, 1035673200, 8) ,(3, 1048978800, 9)" - ",(3, 1067122800, 8) ,(3, 1080428400, 9)" - ",(3, 1099177200, 8) ,(3, 1111878000, 9)" - ",(3, 1130626800, 8) ,(3, 1143327600, 9)" - ",(3, 1162076400, 8) ,(3, 1174777200, 9)" - ",(3, 1193526000, 8) ,(3, 1206831600, 9)" - ",(3, 1224975600, 8) ,(3, 1238281200, 9)" - ",(3, 1256425200, 8) ,(3, 1269730800, 9)" - ",(3, 1288479600, 8) ,(3, 1301180400, 9)" - ",(3, 1319929200, 8) ,(3, 1332630000, 9)" - ",(3, 1351378800, 8) ,(3, 1364684400, 9)" - ",(3, 1382828400, 8) ,(3, 1396134000, 9)" - ",(3, 1414278000, 8) ,(3, 1427583600, 9)" - ",(3, 1445727600, 8) ,(3, 1459033200, 9)" - ",(3, 1477782000, 8) ,(3, 1490482800, 9)" - ",(3, 1509231600, 8) ,(3, 1521932400, 9)" - ",(3, 1540681200, 8) ,(3, 1553986800, 9)" - ",(3, 1572130800, 8) ,(3, 1585436400, 9)" - ",(3, 1603580400, 8) ,(3, 1616886000, 9)" - ",(3, 1635634800, 8) ,(3, 1648335600, 9)" - ",(3, 1667084400, 8) ,(3, 1679785200, 9)" - ",(3, 1698534000, 8) ,(3, 1711839600, 9)" - ",(3, 1729983600, 8) ,(3, 1743289200, 9)" - ",(3, 1761433200, 8) ,(3, 1774738800, 9)" - ",(3, 1792882800, 8) ,(3, 1806188400, 9)" - ",(3, 1824937200, 8) ,(3, 1837638000, 9)" - ",(3, 1856386800, 8) ,(3, 1869087600, 9)" - ",(3, 1887836400, 8) ,(3, 1901142000, 9)" - ",(3, 1919286000, 8) ,(3, 1932591600, 9)" - ",(3, 1950735600, 8) ,(3, 1964041200, 9)" - ",(3, 1982790000, 8) ,(3, 1995490800, 9)" - ",(3, 2014239600, 8) ,(3, 2026940400, 9)" - ",(3, 2045689200, 8) ,(3, 2058390000, 9)" - ",(3, 2077138800, 8) ,(3, 2090444400, 9)" - ",(3, 2108588400, 8) ,(3, 2121894000, 9)" - ",(3, 2140038000, 8)" - ",(4, -1688265000, 2) ,(4, -1656819048, 1)" - ",(4, -1641353448, 2) ,(4, -1627965048, 3)" - ",(4, -1618716648, 1) ,(4, -1596429048, 3)" - ",(4, -1593829848, 5) ,(4, -1589860800, 4)" - ",(4, -1542427200, 5) ,(4, -1539493200, 6)" - ",(4, -1525323600, 5) ,(4, -1522728000, 4)" - ",(4, -1491188400, 7) ,(4, -1247536800, 4)" - ",(4, 354920409, 5) ,(4, 370728010, 4)" - ",(4, 386456410, 5) ,(4, 402264011, 4)" - ",(4, 417992411, 5) ,(4, 433800012, 4)" - ",(4, 449614812, 5) ,(4, 465346812, 8)" - ",(4, 481071612, 9) ,(4, 496796413, 8)" - ",(4, 512521213, 9) ,(4, 528246013, 8)" - ",(4, 543970813, 9) ,(4, 559695613, 8)" - ",(4, 575420414, 9) ,(4, 591145214, 8)" - ",(4, 606870014, 9) ,(4, 622594814, 8)" - ",(4, 638319615, 9) ,(4, 654649215, 8)" - ",(4, 670374016, 10) ,(4, 686102416, 11)" - ",(4, 695779216, 8) ,(4, 701812816, 5)" - ",(4, 717534017, 4) ,(4, 733273217, 9)" - ",(4, 748998018, 8) ,(4, 764722818, 9)" - ",(4, 780447619, 8) ,(4, 796172419, 9)" - ",(4, 811897219, 8) ,(4, 828226820, 9)" - ",(4, 846370820, 8) ,(4, 859676420, 9)" - ",(4, 877820421, 8) ,(4, 891126021, 9)" - ",(4, 909270021, 8) ,(4, 922575622, 9)" - ",(4, 941324422, 8) ,(4, 954025222, 9)" - ",(4, 972774022, 8) ,(4, 985474822, 9)" - ",(4, 1004223622, 8) ,(4, 1017529222, 9)" - ",(4, 1035673222, 8) ,(4, 1048978822, 9)" - ",(4, 1067122822, 8) ,(4, 1080428422, 9)" - ",(4, 1099177222, 8) ,(4, 1111878022, 9)" - ",(4, 1130626822, 8) ,(4, 1143327622, 9)" - ",(4, 1162076422, 8) ,(4, 1174777222, 9)" - ",(4, 1193526022, 8) ,(4, 1206831622, 9)" - ",(4, 1224975622, 8) ,(4, 1238281222, 9)" - ",(4, 1256425222, 8) ,(4, 1269730822, 9)" - ",(4, 1288479622, 8) ,(4, 1301180422, 9)" - ",(4, 1319929222, 8) ,(4, 1332630022, 9)" - ",(4, 1351378822, 8) ,(4, 1364684422, 9)" - ",(4, 1382828422, 8) ,(4, 1396134022, 9)" - ",(4, 1414278022, 8) ,(4, 1427583622, 9)" - ",(4, 1445727622, 8) ,(4, 1459033222, 9)" - ",(4, 1477782022, 8) ,(4, 1490482822, 9)" - ",(4, 1509231622, 8) ,(4, 1521932422, 9)" - ",(4, 1540681222, 8) ,(4, 1553986822, 9)" - ",(4, 1572130822, 8) ,(4, 1585436422, 9)" - ",(4, 1603580422, 8) ,(4, 1616886022, 9)" - ",(4, 1635634822, 8) ,(4, 1648335622, 9)" - ",(4, 1667084422, 8) ,(4, 1679785222, 9)" - ",(4, 1698534022, 8) ,(4, 1711839622, 9)" - ",(4, 1729983622, 8) ,(4, 1743289222, 9)" - ",(4, 1761433222, 8) ,(4, 1774738822, 9)" - ",(4, 1792882822, 8) ,(4, 1806188422, 9)" - ",(4, 1824937222, 8) ,(4, 1837638022, 9)" - ",(4, 1856386822, 8) ,(4, 1869087622, 9)" - ",(4, 1887836422, 8) ,(4, 1901142022, 9)" - ",(4, 1919286022, 8) ,(4, 1932591622, 9)" - ",(4, 1950735622, 8) ,(4, 1964041222, 9)" - ",(4, 1982790022, 8) ,(4, 1995490822, 9)" - ",(4, 2014239622, 8) ,(4, 2026940422, 9)" - ",(4, 2045689222, 8) ,(4, 2058390022, 9)" - ",(4, 2077138822, 8) ,(4, 2090444422, 9)" - ",(4, 2108588422, 8) ,(4, 2121894022, 9)" - ",(4, 2140038022, 8), (5, -1009875600, 1);\n"); - - - } - } - - if (test_sys_file(mdata,"mysql/time_zone_transition_type.frm")) - { - fprintf(out, - "CREATE TABLE time_zone_transition_type (" - "Time_zone_id int unsigned NOT NULL," - "Transition_type_id int unsigned NOT NULL," - "Offset int signed DEFAULT 0 NOT NULL," - "Is_DST tinyint unsigned DEFAULT 0 NOT NULL," - "Abbreviation char(8) DEFAULT '' NOT NULL," - "PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)" - ") engine=MyISAM CHARACTER SET utf8 " - "comment='Time zone transition types';\n"); - - if (test) - { - fprintf(out, - "INSERT INTO time_zone_transition_type (Time_zone_id," - "Transition_type_id, Offset, Is_DST, Abbreviation) VALUES" - "(1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET')" - ",(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET')" - ",(2, 0, 0, 0, 'UTC')" - ",(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST')" - ",(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST')" - ",(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD')" - ",(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET')" - ",(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD')" - ",(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET')" - ",(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST')" - ",(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST')" - ",(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD')" - ",(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET')" - ",(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD')" - ",(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET')" - ",(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST');\n"); - - } - } - - if (test_sys_file(mdata,"mysql/time_zone_leap_second.frm")) - { - fprintf(out, - "CREATE TABLE time_zone_leap_second (" - "Transition_time bigint signed NOT NULL," - "Correction int signed NOT NULL," - "PRIMARY KEY TranTime (Transition_time)" - ") engine=MyISAM CHARACTER SET utf8 " - "comment='Leap seconds information for time zones';\n"); - - if (test) - { - fprintf(out, - "INSERT INTO time_zone_leap_second " - "(Transition_time, Correction) VALUES " - "(78796800, 1) ,(94694401, 2) ,(126230402, 3)" - ",(157766403, 4) ,(189302404, 5) ,(220924805, 6)" - ",(252460806, 7) ,(283996807, 8) ,(315532808, 9)" - ",(362793609, 10) ,(394329610, 11) ,(425865611, 12)" - ",(489024012, 13) ,(567993613, 14) ,(631152014, 15)" - ",(662688015, 16) ,(709948816, 17) ,(741484817, 18)" - ",(773020818, 19) ,(820454419, 20) ,(867715220, 21)" - ",(915148821, 22);\n"); - } - } - - return fclose(out); -} diff --git a/mysql-test/my_manage.c b/mysql-test/my_manage.c deleted file mode 100644 index e5d1be42f95..00000000000 --- a/mysql-test/my_manage.c +++ /dev/null @@ -1,887 +0,0 @@ -/* - Copyright (c) 2003 Novell, Inc. All Rights Reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <stdio.h> -#include <errno.h> -#ifndef __WIN__ -#include <dirent.h> -#endif -#include <string.h> -#ifdef __NETWARE__ -#include <screen.h> -#include <proc.h> -#else -#include <sys/types.h> -#ifndef __WIN__ -#include <sys/wait.h> -#include <unistd.h> -#include <signal.h> -#include <fnmatch.h> /* FIXME HAVE_FNMATCH_H or something */ -#else -#include <direct.h> -#include <stdlib.h> -#include <stdio.h> -#endif -#endif -#include <ctype.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <assert.h> - -#include "my_manage.h" - -#ifndef __NETWARE__ -#define ASSERT assert -extern char **environ; -#endif - - - -/****************************************************************************** - - macros - -******************************************************************************/ - -/****************************************************************************** - - global variables - -******************************************************************************/ - -/****************************************************************************** - - functions - -******************************************************************************/ - -/****************************************************************************** - - init_args() - - Init an argument list. - -******************************************************************************/ - -void init_args(arg_list_t *al) -{ - ASSERT(al != NULL); - - al->argc= 0; - al->size= ARG_BUF; - al->argv= malloc(al->size * sizeof(char *)); - ASSERT(al->argv != NULL); - - return; -} - -/****************************************************************************** - - add_arg() - - Add an argument to a list. - -******************************************************************************/ - -void add_arg(arg_list_t *al, const char *format, ...) -{ - va_list ap; - char temp[FN_REFLEN]; - - ASSERT(al != NULL); - - /* increase size */ - if (al->argc >= (int)al->size) - { - al->size+= ARG_BUF; - al->argv= realloc(al->argv, al->size * sizeof(char *)); - ASSERT(al->argv != NULL); - } - - if (format) - { - va_start(ap, format); - vsprintf(temp, format, ap); - va_end(ap); - - al->argv[al->argc]= malloc(strlen(temp)+1); - ASSERT(al->argv[al->argc] != NULL); - strcpy(al->argv[al->argc], temp); - - ++(al->argc); - } - else - { - al->argv[al->argc]= NULL; - } - - return; -} - -/****************************************************************************** - - free_args() - - Free an argument list. - -******************************************************************************/ - -void free_args(arg_list_t *al) -{ - int i; - - ASSERT(al != NULL); - - for (i= 0; i < al->argc; i++) - { - ASSERT(al->argv[i] != NULL); - free(al->argv[i]); - al->argv[i]= NULL; - } - - free(al->argv); - al->argc= 0; - al->argv= NULL; - - return; -} - -/****************************************************************************** - - sleep_until_file_deleted() - - Sleep until the given file is no longer found. - -******************************************************************************/ - -#ifndef __WIN__ -int sleep_until_file_deleted(char *pid_file) -#else -int sleep_until_file_deleted(HANDLE pid_file) -#endif -{ - int err= 0; /* Initiate to supress warning */ -#ifndef __WIN__ - struct stat buf; - int i; - - for (i= 0; (i < TRY_MAX) && (err= !stat(pid_file, &buf)); i++) sleep(1); - - if (err != 0) err= errno; -#else - err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT); -#endif - return err; -} - -/****************************************************************************** - - sleep_until_file_exists() - - Sleep until the given file exists. - -******************************************************************************/ - -#ifndef __WIN__ -int sleep_until_file_exists(char *pid_file) -#else -int sleep_until_file_exists(HANDLE pid_file) -#endif -{ - int err= 0; /* Initiate to supress warning */ -#ifndef __WIN__ - struct stat buf; - int i; - - for (i= 0; (i < TRY_MAX) && (err= stat(pid_file, &buf)); i++) sleep(1); - - if (err != 0) err= errno; -#else - err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT); -#endif - return err; -} - -/****************************************************************************** - - wait_for_server_start() - - Wait for the server on the given port to start. - -******************************************************************************/ - -int wait_for_server_start(char *bin_dir __attribute__((unused)), - char *mysqladmin_file, - char *user, char *password, int port,char *tmp_dir) -{ - arg_list_t al; - int err= 0; - char trash[FN_REFLEN]; - - /* mysqladmin file */ - snprintf(trash, FN_REFLEN, "%s/trash.out",tmp_dir); - - /* args */ - init_args(&al); - add_arg(&al, "%s", mysqladmin_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--port=%u", port); - add_arg(&al, "--user=%s", user); - add_arg(&al, "--password=%s", password); - add_arg(&al, "--silent"); - add_arg(&al, "--host=localhost"); - -#ifndef __NETWARE__ - add_arg(&al, "--connect_timeout=10"); - add_arg(&al, "-w"); - add_arg(&al, "--protocol=tcp"); -#endif - add_arg(&al, "ping"); - - /* - NetWare does not support the connect timeout in the TCP/IP stack - -- we will try the ping multiple times - */ -#ifndef __WIN__ - { - int i; - for (i= 0; - (i < TRY_MAX) && (err= spawn(mysqladmin_file, &al, TRUE, NULL, - trash, NULL, NULL)); - i++) - sleep(1); - } -#else - err= spawn(mysqladmin_file, &al, TRUE, NULL,trash, NULL, NULL); -#endif - - /* free args */ - free_args(&al); - - return err; -} - -/****************************************************************************** - - spawn() - - Spawn the given path with the given arguments. - -******************************************************************************/ - -#ifdef __NETWARE__ -int spawn(char *path, arg_list_t *al, int join, char *input, - char *output, char *error, char *pid_file) -{ - pid_t pid; - int result= 0; - wiring_t wiring= { FD_UNUSED, FD_UNUSED, FD_UNUSED }; - unsigned long flags= PROC_CURRENT_SPACE | PROC_INHERIT_CWD; - - /* open wiring */ - if (input) - wiring.infd= open(input, O_RDONLY); - - if (output) - wiring.outfd= open(output, O_WRONLY | O_CREAT | O_TRUNC); - - if (error) - wiring.errfd= open(error, O_WRONLY | O_CREAT | O_TRUNC); - - /* procve requires a NULL */ - add_arg(al, NULL); - - /* go */ - pid= procve(path, flags, NULL, &wiring, NULL, NULL, 0, - NULL, (const char **)al->argv); - - /* close wiring */ - if (wiring.infd != -1) - close(wiring.infd); - - if (wiring.outfd != -1) - close(wiring.outfd); - - if (wiring.errfd != -1) - close(wiring.errfd); - - return result; -} -#elif __WIN__ - -int spawn(char *path, arg_list_t *al, int join, char *input, - char *output, char *error, HANDLE *pid) -{ - bool result; - int i; - STARTUPINFO startup_info; - PROCESS_INFORMATION process_information; - DWORD exit_code; - char win_args[1024]= ""; - - /* Skip the first parameter */ - for (i= 1; i < al->argc; i++) - { - ASSERT(al->argv[i] != NULL); - strcat(win_args,al->argv[i]); - strcat(win_args," "); - } - - memset(&startup_info,0,sizeof(STARTUPINFO)); - startup_info.cb= sizeof(STARTUPINFO); - - if (input) - freopen(input, "rb", stdin); - - if (output) - freopen(output, "wb", stdout); - - if (error) - freopen(error, "wb", stderr); - - result= CreateProcess( - path, - (LPSTR)&win_args, - NULL, - NULL, - TRUE, - 0, - NULL, - NULL, - &startup_info, - &process_information - ); - - if (result && process_information.hProcess) - { - if (join) - { - if (WaitForSingleObject(process_information.hProcess, mysqld_timeout) - == WAIT_TIMEOUT) - { - exit_code= -1; - } - else - { - GetExitCodeProcess(process_information.hProcess, &exit_code); - } - CloseHandle(process_information.hProcess); - } - else - { - exit_code= 0; - } - if (pid != NULL) - *pid= process_information.hProcess; - } - else - { - exit_code= -1; - } - if (input) - freopen("CONIN$","rb",stdin); - if (output) - freopen("CONOUT$","wb",stdout); - if (error) - freopen("CONOUT$","wb",stderr); - - return exit_code; -} -#else -int spawn(char *path, arg_list_t *al, int join, char *input, - char *output, char *error, char *pid_file __attribute__((unused))) -{ - pid_t pid; - int res_exec= 0; - int result= 0; - - pid= fork(); - - if (pid == -1) - { - fprintf(stderr, "fork was't created\n"); - /* We can't create the fork...exit with error */ - return EXIT_FAILURE; - } - - if (pid > 0) - { - /* The parent process is waiting for child process if join is not zero */ - if (join) - { - waitpid(pid, &result, 0); - if (WIFEXITED(result) != 0) - { - result= WEXITSTATUS(result); - } - else - { - result= EXIT_FAILURE; - } - } - } - else - { - - /* Child process */ - add_arg(al, NULL); - - /* Reassign streams */ - if (input) - freopen(input, "r", stdin); - - if (output) - freopen(output, "w", stdout); - - if (error) - freopen(error, "w", stderr); - - /* Spawn the process */ - if ((res_exec= execve(path, al->argv, environ)) < 0) - exit(EXIT_FAILURE); - - /* Restore streams */ - if (input) - freopen("/dev/tty", "r", stdin); - - if (output) - freopen("/dev/tty", "w", stdout); - - if (error) - freopen("/dev/tty", "w", stderr); - - exit(0); - } - - return result; -} -#endif -/****************************************************************************** - - stop_server() - - Stop the server with the given port and pid file. - -******************************************************************************/ - -int stop_server(char *bin_dir __attribute__((unused)), char *mysqladmin_file, - char *user, char *password, int port, -#ifndef __WIN__ - char *pid_file, -#else - HANDLE pid_file, -#endif - char *tmp_dir) -{ - arg_list_t al; - int err= 0; - char trash[FN_REFLEN]; - - snprintf(trash, FN_REFLEN, "%s/trash.out",tmp_dir); - - /* args */ - init_args(&al); - add_arg(&al, "%s", mysqladmin_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--port=%u", port); - add_arg(&al, "--user=%s", user); - add_arg(&al, "--password=%s", password); - add_arg(&al, "-O"); - add_arg(&al, "shutdown_timeout=20"); -#ifndef __NETWARE__ - add_arg(&al, "--protocol=tcp"); -#endif - add_arg(&al, "shutdown"); - - /* spawn */ - if ((err= spawn(mysqladmin_file, &al, TRUE, NULL, - trash, NULL, NULL)) == 0) - { - sleep_until_file_deleted(pid_file); - } - else - { -#ifndef __WIN__ - pid_t pid= get_server_pid(pid_file); - - /* shutdown failed - kill server */ - kill_server(pid); - - sleep(TRY_MAX); - - /* remove pid file if possible */ - err= remove(pid_file); -#else - TerminateProcess(pid_file,err); -#endif - } - - /* free args */ - free_args(&al); - - return err; -} - -/****************************************************************************** - - get_server_pid() - - Get the VM id with the given pid file. - -******************************************************************************/ - -#ifndef __WIN__ -pid_t get_server_pid(char *pid_file) -{ - char buf[FN_REFLEN]; - int fd, err; - char *p; - pid_t id= 0; - - /* discover id */ - fd= open(pid_file, O_RDONLY); - - err= read(fd, buf, FN_REFLEN); - - close(fd); - - if (err > 0) - { - /* terminate string */ - if ((p= strchr(buf, '\n')) != NULL) - { - *p= '\0'; - - /* check for a '\r' */ - if ((p= strchr(buf, '\r')) != NULL) - { - *p= '\0'; - } - } - else - { - buf[err]= '\0'; - } - - id= strtol(buf, NULL, 0); - } - - return id; -} - -/****************************************************************************** - - kill_server() - - Force a kill of the server with the given pid. - -******************************************************************************/ - -void kill_server(pid_t pid) -{ - if (pid > 0) - { -#if !defined(__NETWARE__) - /* Send SIGTERM to pid */ - kill(pid, SIGTERM); -#else /* __NETWARE__ */ - /* destroy vm */ - NXVmDestroy(pid); -#endif - } -} -#endif -/****************************************************************************** - - del_tree() - - Delete the directory and subdirectories. - -******************************************************************************/ - -void del_tree(char *dir) -{ -#ifndef __WIN__ - DIR *parent= opendir(dir); - struct dirent *entry; - char temp[FN_REFLEN]; - - if (parent == NULL) - { - return; - } - - while ((entry= readdir(parent)) != NULL) - { - /* create long name */ - snprintf(temp, FN_REFLEN, "%s/%s", dir, entry->d_name); - - if (entry->d_name[0] == '.') - { - /* Skip */ - } - else - { -/* FIXME missing test in acinclude.m4 */ -#ifndef STRUCT_DIRENT_HAS_D_TYPE - struct stat st; - - if (lstat(entry->d_name, &st) == -1) - { - /* FIXME error */ - return; - } - if (S_ISDIR(st.st_mode)) -#else - if (S_ISDIR(entry->d_type)) -#endif - { - /* delete subdirectory */ - del_tree(temp); - } - else - { - /* remove file */ - remove(temp); - } - } - } - /* remove directory */ - rmdir(dir); -#else - struct _finddata_t parent; -#if defined(_MSC_VER) && _MSC_VER > 1200 - intptr_t handle; -#else - long handle; -#endif /* _MSC_VER && _MSC_VER > 1200 */ - char temp[FN_REFLEN]; - char mask[FN_REFLEN]; - - snprintf(mask,FN_REFLEN,"%s/*.*",dir); - - if ((handle=_findfirst(mask,&parent)) == -1L) - { - return; - } - - do - { - /* create long name */ - snprintf(temp, FN_REFLEN, "%s/%s", dir, parent.name); - if (parent.name[0] == '.') - { - /* Skip */ - } - else - if (parent.attrib & _A_SUBDIR) - { - /* delete subdirectory */ - del_tree(temp); - } - else - { - /* remove file */ - remove(temp); - } - } while (_findnext(handle,&parent) == 0); - - _findclose(handle); - - /* remove directory */ - _rmdir(dir); -#endif -} - -/****************************************************************************** - - removef() - -******************************************************************************/ - -int removef(const char *format, ...) -{ -#ifdef __NETWARE__ - va_list ap; - char path[FN_REFLEN]; - - va_start(ap, format); - - vsnprintf(path, FN_REFLEN, format, ap); - - va_end(ap); - return remove(path); - -#elif __WIN__ - { - va_list ap; - char path[FN_REFLEN]; - struct _finddata_t parent; -#if defined(_MSC_VER) && _MSC_VER > 1200 - intptr_t handle; -#else - long handle; -#endif /* _MSC_VER && _MSC_VER > 1200 */ - char temp[FN_REFLEN]; - char *p; - - va_start(ap, format); - - vsnprintf(path, FN_REFLEN, format, ap); - - va_end(ap); - - p= path + strlen(path); - while (*p != '\\' && *p != '/' && p > path) p--; - - if ((handle=_findfirst(path,&parent)) == -1L) - { - /* if there is not files....it's ok */ - return 0; - } - - *p= '\0'; - - do - { - if (! (parent.attrib & _A_SUBDIR)) - { - snprintf(temp, FN_REFLEN, "%s/%s", path, parent.name); - remove(temp); - } - }while (_findnext(handle,&parent) == 0); - - _findclose(handle); - } -#else - DIR *parent; - struct dirent *entry; - char temp[FN_REFLEN]; - va_list ap; - char path[FN_REFLEN]; - char *p; - /* Get path with mask */ - va_start(ap, format); - - vsnprintf(path, FN_REFLEN, format, ap); - - va_end(ap); - - p= path + strlen(path); - while (*p != '\\' && *p != '/' && p > path) p--; - *p= '\0'; - p++; - - parent= opendir(path); - - if (parent == NULL) - { - return 1; /* Error, directory missing */ - } - - while ((entry= readdir(parent)) != NULL) - { - /* entry is not directory and entry matches with mask */ -#ifndef STRUCT_DIRENT_HAS_D_TYPE - struct stat st; - - /* create long name */ - snprintf(temp, FN_REFLEN, "%s/%s", path, entry->d_name); - - if (lstat(temp, &st) == -1) - { - return 1; /* Error couldn't lstat file */ - } - - if (!S_ISDIR(st.st_mode) && !fnmatch(p, entry->d_name,0)) -#else - if (!S_ISDIR(entry->d_type) && !fnmatch(p, entry->d_name,0)) -#endif - { - /* create long name */ - snprintf(temp, FN_REFLEN, "%s/%s", path, entry->d_name); - /* Delete only files */ - remove(temp); - } - } -#endif - return 0; -} - -/****************************************************************************** - - get_basedir() - -******************************************************************************/ - -void get_basedir(char *argv0, char *basedir) -{ - char temp[FN_REFLEN]; - char *p; - int position; - - ASSERT(argv0 != NULL); - ASSERT(basedir != NULL); - - strcpy(temp, strlwr(argv0)); - while ((p= strchr(temp, '\\')) != NULL) *p= '/'; - - if ((position= strinstr(temp, "/bin/")) != 0) - { - p= temp + position; - *p= '\0'; - strcpy(basedir, temp); - } -} - -uint strinstr(reg1 const char *str,reg4 const char *search) -{ - reg2 my_string i,j; - my_string start= (my_string) str; - - skipp: - while (*str != '\0') - { - if (*str++ == *search) - { - i=(my_string) str; - j= (my_string) search+1; - while (*j) - if (*i++ != *j++) goto skipp; - return ((uint) (str - start)); - } - } - return (0); -} - -/****************************************************************************** - - remove_empty_file() - -******************************************************************************/ - -void remove_empty_file(const char *file_name) -{ - struct stat file; - - if (!stat(file_name,&file)) - { - if (!file.st_size) - remove(file_name); - } -} diff --git a/mysql-test/my_manage.h b/mysql-test/my_manage.h deleted file mode 100644 index 5df77b01af8..00000000000 --- a/mysql-test/my_manage.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - Copyright (c) 2002 Novell, Inc. All Rights Reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef _MY_MANAGE -#define _MY_MANAGE - -/****************************************************************************** - - includes - -******************************************************************************/ - -#include <stdlib.h> -#ifndef __WIN__ -#include <unistd.h> -#endif -#ifndef __NETWARE__ -#include <string.h> -#include <my_global.h> -#include <m_string.h> - -#ifndef __WIN__ -#define strnicmp strncasecmp -#define strlwr(STRARG) (STRARG) -#else -int my_vsnprintf_(char *to, size_t n, const char* value, ...); -#endif -#endif - -/****************************************************************************** - - macros - -******************************************************************************/ - -#define ARG_BUF 10 -#define TRY_MAX 5 - -#ifdef __WIN__ -#define PATH_MAX _MAX_PATH -#define NAME_MAX _MAX_FNAME -#define kill(A,B) TerminateProcess((HANDLE)A,0) -#define NOT_NEED_PID 0 -#define MASTER_PID 1 -#define SLAVE_PID 2 -#define mysqld_timeout 60000 - -int pid_mode; -bool run_server; -bool skip_first_param; - -#define snprintf _snprintf -#define vsnprintf _vsnprintf -#endif - - -/****************************************************************************** - - structures - -******************************************************************************/ - -typedef struct -{ - - int argc; - char **argv; - - size_t size; - -} arg_list_t; - -#ifdef __WIN__ -typedef int pid_t; -#endif -/****************************************************************************** - - global variables - -******************************************************************************/ - -/****************************************************************************** - - prototypes - -******************************************************************************/ - -void init_args(arg_list_t *); -void add_arg(arg_list_t *, const char *, ...); -void free_args(arg_list_t *); - -#ifndef __WIN__ -int sleep_until_file_exists(char *); -int sleep_until_file_deleted(char *); -#else -int sleep_until_file_exists(HANDLE); -int sleep_until_file_deleted(HANDLE); -#endif -int wait_for_server_start(char *, char *, char *, char *, int,char *); - -#ifndef __WIN__ -int spawn(char *, arg_list_t *, int, char *, char *, char *, char *); -#else -int spawn(char *, arg_list_t *, int , char *, char *, char *, HANDLE *); -#endif - -#ifndef __WIN__ -int stop_server(char *, char *, char *, char *, int, char *,char *); -pid_t get_server_pid(char *); -void kill_server(pid_t pid); -#else -int stop_server(char *, char *, char *, char *, int, HANDLE,char *); -#endif -void del_tree(char *); -int removef(const char *, ...); - -void get_basedir(char *, char *); -void remove_empty_file(const char *file_name); - -bool create_system_files(const char *mdata,const char *output_file, bool test); - -#endif /* _MY_MANAGE */ diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c2e2ed8bf98..a9a1d46079c 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -144,7 +144,6 @@ our $glob_use_running_server= 0; our $glob_use_running_ndbcluster= 0; our $glob_use_running_ndbcluster_slave= 0; our $glob_use_embedded_server= 0; -our $glob_mysqld_restart= 0; our @glob_test_mode; our $using_ndbcluster_master= 0; @@ -285,7 +284,7 @@ our $opt_start_from; our $opt_strace_client; -our $opt_timer; +our $opt_timer= 1; our $opt_user; our $opt_user_test; @@ -503,7 +502,9 @@ sub initial_setup () { chomp($glob_cygwin_shell); } $glob_basedir= dirname($glob_mysql_test_dir); - $glob_mysql_bench_dir= "$glob_basedir/mysql-bench"; # FIXME make configurable + # Expect mysql-bench to be located adjacent to the source tree, by default + $glob_mysql_bench_dir= "$glob_basedir/../mysql-bench" + unless defined $glob_mysql_bench_dir; # needs to be same length to test logging (FIXME what???) $path_slave_load_tmpdir= "../../var/tmp"; @@ -531,10 +532,10 @@ sub command_line_setup () { my $opt_master_myport= 9306; my $opt_slave_myport= 9308; - $opt_ndbcluster_port= 9350; - $opt_ndbcluster_port_slave= 9358; - my $im_port= 9310; - my $im_mysqld1_port= 9312; + $opt_ndbcluster_port= 9310; + $opt_ndbcluster_port_slave= 9311; + my $im_port= 9312; + my $im_mysqld1_port= 9313; my $im_mysqld2_port= 9314; # @@ -609,7 +610,7 @@ sub command_line_setup () { # Specify ports 'master_port=i' => \$opt_master_myport, 'slave_port=i' => \$opt_slave_myport, - 'ndbcluster-port=i' => \$opt_ndbcluster_port, + 'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port, 'ndbcluster-port-slave=i' => \$opt_ndbcluster_port_slave, 'manager-port=i' => \$opt_manager_port, # Currently not used 'im-port=i' => \$im_port, # Instance Manager port. @@ -665,6 +666,7 @@ sub command_line_setup () { # Directories 'tmpdir=s' => \$opt_tmpdir, 'vardir=s' => \$opt_vardir, + 'benchdir=s' => \$glob_mysql_bench_dir, # Misc 'comment=s' => \$opt_comment, @@ -680,7 +682,7 @@ sub command_line_setup () { 'socket=s' => \$opt_socket, 'start-dirty' => \$opt_start_dirty, 'start-and-exit' => \$opt_start_and_exit, - 'timer' => \$opt_timer, + 'timer!' => \$opt_timer, 'unified-diff|udiff' => \$opt_udiff, 'user-test=s' => \$opt_user_test, 'user=s' => \$opt_user, @@ -1683,8 +1685,8 @@ sub run_benchmarks ($) { mtr_add_arg($args, "--create-options=TYPE=ndb"); } - my $benchdir= "$glob_basedir/sql-bench"; - chdir($benchdir); # FIXME check error + chdir($glob_mysql_bench_dir) + or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!"); # FIXME write shorter.... @@ -2562,7 +2564,7 @@ sub mysqld_arguments ($$$$$$) { mtr_add_arg($args, "%s--server-id=%d", $prefix, $id); mtr_add_arg($args, "%s--socket=%s", $prefix, $master->[$idx]->{'path_mysock'}); - mtr_add_arg($args, "%s--innodb_data_file_path=ibdata1:128M:autoextend", $prefix); + mtr_add_arg($args, "%s--innodb_data_file_path=ibdata1:10M:autoextend", $prefix); mtr_add_arg($args, "%s--local-infile", $prefix); mtr_add_arg($args, "%s--datadir=%s", $prefix, $master->[$idx]->{'path_myddir'}); @@ -2941,6 +2943,12 @@ sub im_start($$) { mtr_add_arg($args, "--defaults-file=%s", $instance_manager->{'defaults_file'}); + if ( $opt_debug ) + { + mtr_add_arg($args, "--debug=d:t:i:A,%s/log/im.trace", + $opt_vardir_trace); + } + foreach my $opt (@{$opts}) { mtr_add_arg($args, $opt); @@ -3194,11 +3202,6 @@ sub run_mysqltest ($) { mtr_init_args(\$args); - if ( $opt_valgrind_mysqltest ) - { - valgrind_arguments($args, \$exe); - } - mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--silent"); mtr_add_arg($args, "-v"); @@ -3314,6 +3317,17 @@ sub run_mysqltest ($) { # Add arguments that should not go into the MYSQL_TEST env var # ---------------------------------------------------------------------- + if ( $opt_valgrind_mysqltest ) + { + # Prefix the Valgrind options to the argument list. + # We do this here, since we do not want to Valgrind the nested invocations + # of mysqltest; that would mess up the stderr output causing test failure. + my @args_saved = @$args; + mtr_init_args(\$args); + valgrind_arguments($args, \$exe); + mtr_add_arg($args, "%s", $_) for @args_saved; + } + mtr_add_arg($args, "--test-file"); mtr_add_arg($args, $tinfo->{'path'}); @@ -3581,15 +3595,17 @@ Options to control what engine/variation to run compress Use the compressed protocol between client and server ssl Use ssl protocol between client and server skip-ssl Dont start server with support for ssl connections - bench Run the benchmark suite FIXME - small-bench FIXME + bench Run the benchmark suite + small-bench Run the benchmarks with --small-tests --small-tables Options to control directories to use - vardir=DIR The directory where files generated from the test run - is stored(default: ./var). Specifying a ramdisk or tmpfs - will speed up tests. + benchdir=DIR The directory where the benchmark suite is stored + (default: ../../mysql-bench) tmpdir=DIR The directory where temporary files are stored (default: ./var/tmp). + vardir=DIR The directory where files generated from the test run + is stored (default: ./var). Specifying a ramdisk or + tmpfs will speed up tests. Options to control what test suites or cases to run @@ -3604,8 +3620,9 @@ Options to control what test suites or cases to run skip-rpl Skip the replication test cases. skip-im Don't start IM, and skip the IM test cases skip-test=PREFIX Skip test cases which name are prefixed with PREFIX - big-test Pass "--big-test" to mysqltest which will set the environment - variable BIG_TEST, which can be checked from test cases. + big-test Pass "--big-test" to mysqltest which will set the + environment variable BIG_TEST, which can be checked + from test cases. Options that specify ports @@ -3631,25 +3648,29 @@ Options to run test on running server Options for debugging the product - gdb Start the mysqld(s) in gdb - manual-gdb Let user manually start mysqld in gdb, before running test(s) - manual-debug Let user manually start mysqld in debugger, before running test(s) + client-ddd Start mysqltest client in ddd + client-debugger=NAME Start mysqltest in the selected debugger client-gdb Start mysqltest client in gdb ddd Start mysqld in ddd - client-ddd Start mysqltest client in ddd + debug Dump trace output for all servers and client programs debugger=NAME Start mysqld in the selected debugger - client-debugger=NAME Start mysqltest in the selected debugger - strace-client FIXME + gdb Start the mysqld(s) in gdb + manual-debug Let user manually start mysqld in debugger, before + running test(s) + manual-gdb Let user manually start mysqld in gdb, before running + test(s) master-binary=PATH Specify the master "mysqld" to use slave-binary=PATH Specify the slave "mysqld" to use + strace-client Create strace output for mysqltest client Options for coverage, profiling etc gcov FIXME gprof FIXME - valgrind Run the "mysqltest" and "mysqld" executables using valgrind - valgrind-all Same as "valgrind" but will also add "verbose" and "--show-reachable" - flags to valgrind + valgrind Run the "mysqltest" and "mysqld" executables using + valgrind + valgrind-all Same as "valgrind" but will also add "verbose" and + "--show-reachable" flags to valgrind valgrind-mysqltest Run the "mysqltest" executable with valgrind valgrind-mysqld Run the "mysqld" executable with valgrind valgrind-options=ARGS Extra options to give valgrind @@ -3658,10 +3679,10 @@ Options for coverage, profiling etc Misc options comment=STR Write STR to the output + notimer Don't show test case execution time script-debug Debug this script itself - timer Show test case execution time - start-and-exit Only initiate and start the "mysqld" servers, use the startup - settings for the specified test case if any + start-and-exit Only initiate and start the "mysqld" servers, use + the startup settings for the specified test case if any start-dirty Only start the "mysqld" servers without initiation fast Don't try to cleanup from earlier runs reorder Reorder tests to get less server restarts @@ -3676,7 +3697,6 @@ Deprecated options Options not yet described, or that I want to look into more - debug local local-master netware diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 4485d8ca073..aad71f89ef2 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -7,6 +7,12 @@ # List of failed cases (--force) backported from 4.1 by Joerg # :-) +#echo "##################################################"; +#echo "This script is deprecated and will soon be removed"; +#echo "Use mysql-test-run.pl instead"; +#echo "##################################################"; +#echo + #++ # Access Definitions #-- @@ -238,12 +244,9 @@ MASTER_MYPORT=9306 SLAVE_RUNNING=0 SLAVE_MYHOST=127.0.0.1 SLAVE_MYPORT=9308 # leave room for 2 masters for cluster tests -MYSQL_MANAGER_PORT=9305 # needs to be out of the way of slaves +MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log NDBCLUSTER_PORT=9350 NDBCLUSTER_PORT_SLAVE=9358 -MYSQL_MANAGER_PW_FILE=$MYSQL_TEST_DIR/var/tmp/manager.pwd -MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log -MYSQL_MANAGER_USER=root # # To make it easier for different devs to work on the same host, @@ -257,14 +260,12 @@ MYSQL_MANAGER_USER=root # if [ -n "$MTR_BUILD_THREAD" ] ; then MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 10 + 10000` - MYSQL_MANAGER_PORT=`expr $MASTER_MYPORT + 2` SLAVE_MYPORT=`expr $MASTER_MYPORT + 3` NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 6` NDBCLUSTER_PORT_SLAVE=`expr $MASTER_MYPORT + 7` echo "Using MTR_BUILD_THREAD = $MTR_BUILD_THREAD" echo "Using MASTER_MYPORT = $MASTER_MYPORT" - echo "Using MYSQL_MANAGER_PORT = $MYSQL_MANAGER_PORT" echo "Using SLAVE_MYPORT = $SLAVE_MYPORT" echo "Using NDBCLUSTER_PORT = $NDBCLUSTER_PORT" echo "Using NDBCLUSTER_PORT_SLAVE = $NDBCLUSTER_PORT_SLAVE" @@ -330,6 +331,8 @@ STRESS_INIT_FILE="" STRESS_TEST_FILE="" STRESS_TEST="" +$ECHO "Logging: $0 $*" # To ensure we see all arguments in the output, for the test analysis tool + while test $# -gt 0; do case "$1" in --embedded-server) @@ -347,7 +350,6 @@ while test $# -gt 0; do --user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;; --force) FORCE=1 ;; --timer) USE_TIMER=1 ;; - --verbose-manager) MANAGER_QUIET_OPT="" ;; --old-master) MASTER_40_ARGS="";; --master-binary=*) MASTER_MYSQLD=`$ECHO "$1" | $SED -e "s;--master-binary=;;"` ;; @@ -393,7 +395,6 @@ while test $# -gt 0; do LOCAL_MASTER=1 ;; --master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;; --slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;; - --manager-port=*) MYSQL_MANAGER_PORT=`$ECHO "$1" | $SED -e "s;--manager_port=;;"` ;; --ndbcluster_port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster_port=;;"` ;; --ndbcluster-port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster-port=;;"` ;; --ndbcluster-port-slave=*) NDBCLUSTER_PORT_SLAVE=`$ECHO "$1" | $SED -e "s;--ndbcluster-port-slave=;;"` ;; @@ -409,11 +410,6 @@ while test $# -gt 0; do MYSQL_TEST_SSL_OPTS="--ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \ --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem \ --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem" ;; - --no-manager | --skip-manager) USE_MANAGER=0 ;; - --manager) - USE_MANAGER=1 - USE_RUNNING_SERVER=0 - ;; --start-and-exit) START_AND_EXIT=1 ;; @@ -631,7 +627,6 @@ fi #-- MYRUN_DIR=$MYSQL_TEST_DIR/var/run -MANAGER_PID_FILE="$MYRUN_DIR/manager.pid" MASTER_MYDDIR="$MYSQL_TEST_DIR/var/master-data" MASTER_MYSOCK="$MYSQL_TMP_DIR/master.sock" @@ -745,9 +740,6 @@ if [ x$SOURCE_DIST = x1 ] ; then MYSQLADMIN="$CLIENT_BINDIR/mysqladmin" WAIT_PID="$BASEDIR/extra/mysql_waitpid" MYSQL_MY_PRINT_DEFAULTS="$BASEDIR/extra/my_print_defaults" - MYSQL_MANAGER_CLIENT="$CLIENT_BINDIR/mysqltestmanagerc" - MYSQL_MANAGER="$BASEDIR/tools/mysqltestmanager" - MYSQL_MANAGER_PWGEN="$CLIENT_BINDIR/mysqltestmanager-pwgen" MYSQL="$CLIENT_BINDIR/mysql" LANGUAGE="$BASEDIR/sql/share/english/" CHARSETSDIR="$BASEDIR/sql/share/charsets" @@ -808,9 +800,6 @@ else MYSQLADMIN="$CLIENT_BINDIR/mysqladmin" WAIT_PID="$CLIENT_BINDIR/mysql_waitpid" MYSQL_MY_PRINT_DEFAULTS="$CLIENT_BINDIR/my_print_defaults" - MYSQL_MANAGER="$CLIENT_BINDIR/mysqltestmanager" - MYSQL_MANAGER_CLIENT="$CLIENT_BINDIR/mysqltestmanagerc" - MYSQL_MANAGER_PWGEN="$CLIENT_BINDIR/mysqltestmanager-pwgen" MYSQL="$CLIENT_BINDIR/mysql" INSTALL_DB="./install_test_db --bin" MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables" @@ -1200,96 +1189,28 @@ abort_if_failed() fi } -start_manager() -{ - if [ $USE_MANAGER = 0 ] ; then - echo "Manager disabled, skipping manager start." - $RM -f $MYSQL_MANAGER_LOG - return - fi - $ECHO "Starting MySQL Manager" - if [ -f "$MANAGER_PID_FILE" ] ; then - kill `cat $MANAGER_PID_FILE` - sleep 1 - if [ -f "$MANAGER_PID_FILE" ] ; then - kill -9 `cat $MANAGER_PID_FILE` - sleep 1 - fi - fi - - $RM -f $MANAGER_PID_FILE - MYSQL_MANAGER_PW=`$MYSQL_MANAGER_PWGEN -u $MYSQL_MANAGER_USER \ - -o $MYSQL_MANAGER_PW_FILE` - $MYSQL_MANAGER --log=$MYSQL_MANAGER_LOG --port=$MYSQL_MANAGER_PORT \ - --password-file=$MYSQL_MANAGER_PW_FILE --pid-file=$MANAGER_PID_FILE - abort_if_failed "Could not start MySQL manager" - mysqltest_manager_args="--manager-host=localhost \ - --manager-user=$MYSQL_MANAGER_USER \ - --manager-password=$MYSQL_MANAGER_PW \ - --manager-port=$MYSQL_MANAGER_PORT \ - --manager-wait-timeout=$START_WAIT_TIMEOUT" - MYSQL_TEST="$MYSQL_TEST $mysqltest_manager_args" - MYSQL_TEST_ARGS="$MYSQL_TEST_ARGS $mysqltest_manager_args" - while [ ! -f $MANAGER_PID_FILE ] ; do - sleep 1 - done - echo "Manager started" -} - -stop_manager() -{ - if [ $USE_MANAGER = 0 ] ; then - return - fi - $MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT -u$MYSQL_MANAGER_USER \ - -p$MYSQL_MANAGER_PW -P $MYSQL_MANAGER_PORT <<EOF -shutdown -EOF - echo "Manager terminated" - -} - -manager_launch() +launch_in_background() { - ident=$1 shift - if [ $USE_MANAGER = 0 ] ; then - echo $@ | /bin/sh >> $CUR_MYERR 2>&1 & - sleep 2 #hack - return - fi - $MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \ - --password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF -def_exec $ident "$@" -set_exec_stdout $ident $CUR_MYERR -set_exec_stderr $ident $CUR_MYERR -set_exec_con $ident root localhost $CUR_MYSOCK -start_exec $ident $START_WAIT_TIMEOUT -EOF - abort_if_failed "Could not execute manager command" + echo $@ | /bin/sh >> $CUR_MYERR 2>&1 & + sleep 2 #hack + return } -manager_term() +shutdown_mysqld() { pid=$1 ident=$2 - if [ $USE_MANAGER = 0 ] ; then - # Shutdown time must be high as slave may be in reconnect - $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1 - res=$? - # Some systems require an extra connect - $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1 - if test $res = 0 - then - wait_for_pid $pid - fi - return $res + # Shutdown time must be high as slave may be in reconnect + $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1 + res=$? + # Some systems require an extra connect + $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1 + if test $res = 0 + then + wait_for_pid $pid fi - $MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \ - --password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF -stop_exec $ident $STOP_WAIT_TIMEOUT -EOF - abort_if_failed "Could not execute manager command" + return $res } start_ndbcluster() @@ -1472,7 +1393,7 @@ start_master() if [ x$DO_DDD = x1 ] then $ECHO "set args $master_args" > $GDB_MASTER_INIT$1 - manager_launch master ddd -display $DISPLAY --debugger \ + launch_in_background master ddd -display $DISPLAY --debugger \ "gdb -x $GDB_MASTER_INIT$1" $MASTER_MYSQLD elif [ x$DO_GDB = x1 ] then @@ -1493,11 +1414,11 @@ end r EOF fi ) > $GDB_MASTER_INIT$1 - manager_launch master $XTERM -display $DISPLAY \ + launch_in_background master $XTERM -display $DISPLAY \ -title "Master" -e gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD fi else - manager_launch master $MASTER_MYSQLD $master_args + launch_in_background master $MASTER_MYSQLD $master_args fi sleep_until_file_created $MASTER_MYPID$1 $wait_for_master wait_for_master=$SLEEP_TIME_FOR_SECOND_MASTER @@ -1630,7 +1551,7 @@ start_slave() if [ x$DO_DDD = x1 ] then $ECHO "set args $slave_args" > $GDB_SLAVE_INIT - manager_launch $slave_ident ddd -display $DISPLAY --debugger \ + launch_in_background $slave_ident ddd -display $DISPLAY --debugger \ "gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD elif [ x$DO_GDB = x1 ] then @@ -1651,11 +1572,11 @@ end r EOF fi ) > $GDB_SLAVE_INIT - manager_launch $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \ + launch_in_background $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \ gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD fi else - manager_launch $slave_ident $SLAVE_MYSQLD $slave_args + launch_in_background $slave_ident $SLAVE_MYSQLD $slave_args fi eval "SLAVE$1_RUNNING=1" sleep_until_file_created $slave_pid $wait_for_slave @@ -1687,7 +1608,7 @@ stop_slave () if [ x$this_slave_running = x1 ] then pid=`$CAT $slave_pid` - manager_term $pid $slave_ident + shutdown_mysqld $pid $slave_ident if [ $? != 0 ] && [ -f $slave_pid ] then # try harder! $ECHO "slave not cooperating with mysqladmin, will try manual kill" @@ -1734,7 +1655,7 @@ stop_master () # MASTER_RUNNING=0 to get cleanup when calling start_master(). if [ x$USE_EMBEDDED_SERVER != x1 ] ; then pid=`$CAT $MASTER_MYPID$1` - manager_term $pid master $1 + shutdown_mysqld $pid master $1 if [ $? != 0 ] && [ -f $MASTER_MYPID$1 ] then # try harder! $ECHO "master not cooperating with mysqladmin, will try manual kill" @@ -2060,7 +1981,6 @@ run_testcase () [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ] then mysql_stop - stop_manager fi exit 1 fi @@ -2230,18 +2150,6 @@ then rm $MASTER_MYPID $MASTER_MYPID"1" $SLAVE_MYPID fi - # Kill any running managers - if [ -f "$MANAGER_PID_FILE" ] - then - kill `cat $MANAGER_PID_FILE` - sleep 1 - if [ -f "$MANAGER_PID_FILE" ] - then - kill -9 `cat $MANAGER_PID_FILE` - sleep 1 - fi - fi - # just to force stopping anything from previous runs USE_NDBCLUSTER_OPT=$USE_NDBCLUSTER stop_ndbcluster @@ -2265,10 +2173,8 @@ then USE_NDBCLUSTER_OPT= fi - start_manager - -# Do not automagically start daemons if we are in gdb or running only one test -# case +# Do not automagically start daemons if we are in gdb or running only one +# test case if [ -z "$DO_GDB" ] && [ -z "$DO_DDD" ] then mysql_start @@ -2315,7 +2221,6 @@ then fi cd $savedir mysql_stop - stop_manager exit fi @@ -2337,7 +2242,6 @@ then if [ $USE_RUNNING_SERVER -eq 0 ] ; then mysql_stop - stop_manager fi exit @@ -2384,7 +2288,6 @@ if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && [ -z "$DO_DDD" ] then mysql_stop fi -stop_manager report_stats $ECHO diff --git a/mysql-test/mysql_test_run_new.c b/mysql-test/mysql_test_run_new.c deleted file mode 100644 index 79db71fa274..00000000000 --- a/mysql-test/mysql_test_run_new.c +++ /dev/null @@ -1,1933 +0,0 @@ -/* - Copyright (c) 2002, 2003 Novell, Inc. All Rights Reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <stdlib.h> -#include <stdio.h> -#include <errno.h> -#ifndef __WIN__ -#include <dirent.h> -#endif -#include <string.h> -#ifdef __NETWARE__ -#include <screen.h> -#include <nks/vm.h> -#endif -#include <ctype.h> -#include <sys/stat.h> -#ifndef __WIN__ -#include <unistd.h> -#endif -#include <fcntl.h> -#ifdef __NETWARE__ -#include <sys/mode.h> -#endif -#ifdef __WIN__ -#include <windows.h> -#include <shlwapi.h> -#include <direct.h> -#endif - -#include "my_manage.h" - -/****************************************************************************** - - macros - -******************************************************************************/ - -#define HEADER "TEST RESULT \n" -#define DASH "-------------------------------------------------------\n" - -#define NW_TEST_SUFFIX ".nw-test" -#define NW_RESULT_SUFFIX ".nw-result" -#define TEST_SUFFIX ".test" -#define RESULT_SUFFIX ".result" -#define REJECT_SUFFIX ".reject" -#define OUT_SUFFIX ".out" -#define ERR_SUFFIX ".err" - -const char *TEST_PASS= "[ pass ]"; -const char *TEST_SKIP= "[ skip ]"; -const char *TEST_FAIL= "[ fail ]"; -const char *TEST_BAD= "[ bad ]"; -const char *TEST_IGNORE= "[ignore]"; - -/****************************************************************************** - - global variables - -******************************************************************************/ - -#ifdef __NETWARE__ -static char base_dir[FN_REFLEN]= "sys:/mysql"; -#else -static char base_dir[FN_REFLEN]= ".."; -#endif -static char db[FN_LEN]= "test"; -static char user[FN_LEN]= "root"; -static char password[FN_LEN]= ""; - -int master_port= 9306; -int slave_port= 9307; - -#if !defined(__NETWARE__) && !defined(__WIN__) -static char master_socket[FN_REFLEN]= "./var/tmp/master.sock"; -static char slave_socket[FN_REFLEN]= "./var/tmp/slave.sock"; -#endif - -#define MAX_COUNT_TESTES 1024 - -#ifdef __WIN__ -# define sting_compare_func _stricmp -#else -# ifdef HAVE_STRCASECMP -# define sting_compare_func strcasecmp -# else -# define sting_compare_func strcmp -# endif -#endif - -/* comma delimited list of tests to skip or empty string */ -#ifndef __WIN__ -static char skip_test[FN_REFLEN]= " lowercase_table3 , system_mysql_db_fix "; -#else -/* - The most ignore testes contain the calls of system command - - lowercase_table3 is disabled by Gerg - system_mysql_db_fix is disabled by Gerg - sp contains a command system - rpl_EE_error contains a command system - rpl_loaddatalocal contains a command system - ndb_autodiscover contains a command system - rpl_rotate_logs contains a command system - repair contains a command system - rpl_trunc_binlog contains a command system - mysqldump contains a command system - rpl000001 makes non-exit loop...temporary skiped -*/ -static char skip_test[FN_REFLEN]= -" lowercase_table3 ," -" system_mysql_db_fix ," -" sp ," -" rpl_EE_error ," -" rpl_loaddatalocal ," -" ndb_autodiscover ," -" rpl_rotate_logs ," -" repair ," -" rpl_trunc_binlog ," -" mysqldump ," -" rpl000001 ," - -" derived ," -" group_by ," -" select ," -" rpl000015 ," -" subselect "; -#endif -static char ignore_test[FN_REFLEN]= ""; - -static char bin_dir[FN_REFLEN]; -static char mysql_test_dir[FN_REFLEN]; -static char test_dir[FN_REFLEN]; -static char mysql_tmp_dir[FN_REFLEN]; -static char result_dir[FN_REFLEN]; -static char master_dir[FN_REFLEN]; -static char slave_dir[FN_REFLEN]; -static char slave1_dir[FN_REFLEN]; -static char slave2_dir[FN_REFLEN]; -static char lang_dir[FN_REFLEN]; -static char char_dir[FN_REFLEN]; - -static char mysqladmin_file[FN_REFLEN]; -static char mysqld_file[FN_REFLEN]; -static char mysqltest_file[FN_REFLEN]; -#ifndef __WIN__ -static char master_pid[FN_REFLEN]; -static char slave_pid[FN_REFLEN]; -static char sh_file[FN_REFLEN]= "/bin/sh"; -#else -static HANDLE master_pid; -static HANDLE slave_pid; -#endif - -static char master_opt[FN_REFLEN]= ""; -static char slave_opt[FN_REFLEN]= ""; - -static char slave_master_info[FN_REFLEN]= ""; - -static char master_init_script[FN_REFLEN]= ""; -static char slave_init_script[FN_REFLEN]= ""; - -/* OpenSSL */ -static char ca_cert[FN_REFLEN]; -static char server_cert[FN_REFLEN]; -static char server_key[FN_REFLEN]; -static char client_cert[FN_REFLEN]; -static char client_key[FN_REFLEN]; - -int total_skip= 0; -int total_pass= 0; -int total_fail= 0; -int total_test= 0; - -int total_ignore= 0; - -int use_openssl= FALSE; -int master_running= FALSE; -int slave_running= FALSE; -int skip_slave= TRUE; -int single_test= TRUE; - -int restarts= 0; - -FILE *log_fd= NULL; - -static char argument[FN_REFLEN]; - -/****************************************************************************** - - functions - -******************************************************************************/ - -/****************************************************************************** - - prototypes - -******************************************************************************/ - -void report_stats(); -void install_db(char *); -void mysql_install_db(); -void start_master(); -void start_slave(); -void mysql_start(); -void stop_slave(); -void stop_master(); -void mysql_stop(); -void mysql_restart(); -int read_option(char *, char *); -void run_test(char *); -void setup(char *); -void vlog(const char *, va_list); -void mlog(const char *, ...); -void log_info(const char *, ...); -void log_error(const char *, ...); -void log_errno(const char *, ...); -void die(const char *); -char *str_tok(char* dest, char *string, const char *delim); -#ifndef __WIN__ -void run_init_script(const char *script_name); -#endif -/****************************************************************************** - - report_stats() - - Report the gathered statistics. - -******************************************************************************/ - -void report_stats() -{ - if (total_fail == 0) - { - mlog("\nAll %d test(s) were successful.\n", total_test); - } - else - { - double percent= ((double)total_pass / total_test) * 100; - - mlog("\nFailed %u/%u test(s), %.02f%% successful.\n", - total_fail, total_test, percent); - mlog("\nThe .out and .err files in %s may give you some\n", result_dir); - mlog("hint of what when wrong.\n"); - mlog("\nIf you want to report this error, please first read " - "the documentation\n"); - mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n"); - } -} - -/****************************************************************************** - - install_db() - - Install the a database. - -******************************************************************************/ - -void install_db(char *datadir) -{ - arg_list_t al; - int err; - char input[FN_REFLEN]; - char output[FN_REFLEN]; - char error[FN_REFLEN]; - - /* input file */ -#ifdef __NETWARE__ - snprintf(input, FN_REFLEN, "%s/bin/init_db.sql", base_dir); -#else - snprintf(input, FN_REFLEN, "%s/mysql-test/init_db.sql", base_dir); -#endif - snprintf(output, FN_REFLEN, "%s/install.out", datadir); - snprintf(error, FN_REFLEN, "%s/install.err", datadir); - - if (create_system_files(datadir,input, TRUE)) - die("Unable to create init_db.sql."); - /* args */ - init_args(&al); - add_arg(&al, mysqld_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--bootstrap"); - add_arg(&al, "--skip-grant-tables"); - add_arg(&al, "--basedir=%s", base_dir); - add_arg(&al, "--datadir=%s", datadir); - add_arg(&al, "--skip-innodb"); - add_arg(&al, "--skip-ndbcluster"); - add_arg(&al, "--skip-bdb"); -#ifndef __NETWARE__ - add_arg(&al, "--character-sets-dir=%s", char_dir); - add_arg(&al, "--language=%s", lang_dir); -#endif -// added - add_arg(&al, "--default-character-set=latin1"); - add_arg(&al, "--innodb_data_file_path=ibdata1:50M"); - - /* spawn */ - if ((err= spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0) - { - die("Unable to create database."); - } - - /* free args */ - free_args(&al); -} - -/****************************************************************************** - - mysql_install_db() - - Install the test databases. - -******************************************************************************/ - -void mysql_install_db() -{ - char temp[FN_REFLEN]; - - /* var directory */ - snprintf(temp, FN_REFLEN, "%s/var", mysql_test_dir); - - /* create var directory */ -#ifndef __WIN__ - mkdir(temp, S_IRWXU); - /* create subdirectories */ - mlog("Creating test-suite folders...\n"); - snprintf(temp, FN_REFLEN, "%s/var/run", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/tmp", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/master-data", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/master-data/mysql", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir); - mkdir(temp, S_IRWXU); - - snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir); - mkdir(temp, S_IRWXU); - - snprintf(temp, FN_REFLEN, "%s/var/slave1-data", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/slave1-data/mysql", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/slave1-data/test", mysql_test_dir); - mkdir(temp, S_IRWXU); - - snprintf(temp, FN_REFLEN, "%s/var/slave2-data", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/slave2-data/mysql", mysql_test_dir); - mkdir(temp, S_IRWXU); - snprintf(temp, FN_REFLEN, "%s/var/slave2-data/test", mysql_test_dir); - mkdir(temp, S_IRWXU); -#else - mkdir(temp); - /* create subdirectories */ - mlog("Creating test-suite folders...\n"); - snprintf(temp, FN_REFLEN, "%s/var/run", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/tmp", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/master-data", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/master-data/mysql", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir); - mkdir(temp); - snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir); - mkdir(temp); -#endif - - /* install databases */ - mlog("Creating test databases for master... \n"); - install_db(master_dir); - mlog("Creating test databases for slave... \n"); - install_db(slave_dir); - install_db(slave1_dir); - install_db(slave2_dir); -} - -/****************************************************************************** - - start_master() - - Start the master server. - -******************************************************************************/ - -void start_master() -{ - arg_list_t al; - int err; - char master_out[FN_REFLEN]; - char master_err[FN_REFLEN]; - char temp2[FN_REFLEN]; - - /* remove old berkeley db log files that can confuse the server */ - removef("%s/log.*", master_dir); - - /* remove stale binary logs */ - removef("%s/var/log/*-bin.*", mysql_test_dir); - - /* remove stale binary logs */ - removef("%s/var/log/*.index", mysql_test_dir); - - /* remove master.info file */ - removef("%s/master.info", master_dir); - - /* remove relay files */ - removef("%s/var/log/*relay*", mysql_test_dir); - - /* remove relay-log.info file */ - removef("%s/relay-log.info", master_dir); - - /* init script */ - if (master_init_script[0] != 0) - { -#ifdef __NETWARE__ - /* TODO: use the scripts */ - if (strinstr(master_init_script, "repair_part2-master.sh") != 0) - { - FILE *fp; - - /* create an empty index file */ - snprintf(temp, FN_REFLEN, "%s/test/t1.MYI", master_dir); - fp= fopen(temp, "wb+"); - - fputs("1", fp); - - fclose(fp); - } -#elif !defined(__WIN__) - run_init_script(master_init_script); -#endif - } - - /* redirection files */ - snprintf(master_out, FN_REFLEN, "%s/var/run/master%u.out", - mysql_test_dir, restarts); - snprintf(master_err, FN_REFLEN, "%s/var/run/master%u.err", - mysql_test_dir, restarts); -#ifndef __WIN__ - snprintf(temp2,FN_REFLEN,"%s/var",mysql_test_dir); - mkdir(temp2,S_IRWXU); - snprintf(temp2,FN_REFLEN,"%s/var/log",mysql_test_dir); - mkdir(temp2,S_IRWXU); -#else - snprintf(temp2,FN_REFLEN,"%s/var",mysql_test_dir); - mkdir(temp2); - snprintf(temp2,FN_REFLEN,"%s/var/log",mysql_test_dir); - mkdir(temp2); -#endif - /* args */ - init_args(&al); - add_arg(&al, "%s", mysqld_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir); - add_arg(&al, "--server-id=1"); - add_arg(&al, "--basedir=%s", base_dir); - add_arg(&al, "--port=%u", master_port); -#if !defined(__NETWARE__) && !defined(__WIN__) - add_arg(&al, "--socket=%s",master_socket); -#endif - add_arg(&al, "--local-infile"); - add_arg(&al, "--core"); - add_arg(&al, "--log-bin-trust-function-creators"); - add_arg(&al, "--datadir=%s", master_dir); -#ifndef __WIN__ - add_arg(&al, "--pid-file=%s", master_pid); -#endif - add_arg(&al, "--character-sets-dir=%s", char_dir); - add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); - add_arg(&al, "--language=%s", lang_dir); - - add_arg(&al, "--rpl-recovery-rank=1"); - add_arg(&al, "--init-rpl-role=master"); - add_arg(&al, "--default-character-set=latin1"); -// add_arg(&al, "--innodb_data_file_path=ibdata1:50M"); -#ifdef DEBUG /* only for debug builds */ - add_arg(&al, "--debug"); -#endif - - if (use_openssl) - { - add_arg(&al, "--ssl-ca=%s", ca_cert); - add_arg(&al, "--ssl-cert=%s", server_cert); - add_arg(&al, "--ssl-key=%s", server_key); - } - - /* $MASTER_40_ARGS */ - add_arg(&al, "--rpl-recovery-rank=1"); - add_arg(&al, "--init-rpl-role=master"); - - /* $SMALL_SERVER */ - add_arg(&al, "-O"); - add_arg(&al, "key_buffer_size=1M"); - add_arg(&al, "-O"); - add_arg(&al, "sort_buffer=256K"); - add_arg(&al, "-O"); - add_arg(&al, "max_heap_table_size=1M"); - - /* $EXTRA_MASTER_OPT */ - if (master_opt[0] != 0) - { - char *p; - - p= (char *)str_tok(argument, master_opt, " \t"); - if (!strstr(master_opt, "timezone")) - { - while (p) - { - add_arg(&al, "%s", p); - p= (char *)str_tok(argument, NULL, " \t"); - } - } - } - - /* remove the pid file if it exists */ -#ifndef __WIN__ - remove(master_pid); -#endif - - /* spawn */ -#ifdef __WIN__ - if ((err= spawn(mysqld_file, &al, FALSE, NULL, - master_out, master_err, &master_pid)) == 0) -#else - if ((err= spawn(mysqld_file, &al, FALSE, NULL, - master_out, master_err, master_pid)) == 0) -#endif - { - sleep_until_file_exists(master_pid); - - if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password, - master_port, mysql_tmp_dir)) == 0) - { - master_running= TRUE; - } - else - { - log_error("The master server went down early."); - } - } - else - { - log_error("Unable to start master server."); - } - - /* free_args */ - free_args(&al); -} - -/****************************************************************************** - - start_slave() - - Start the slave server. - -******************************************************************************/ - -void start_slave() -{ - arg_list_t al; - int err; - char slave_out[FN_REFLEN]; - char slave_err[FN_REFLEN]; - - /* skip? */ - if (skip_slave) return; - - /* remove stale binary logs */ - removef("%s/*-bin.*", slave_dir); - - /* remove stale binary logs */ - removef("%s/*.index", slave_dir); - - /* remove master.info file */ - removef("%s/master.info", slave_dir); - - /* remove relay files */ - removef("%s/var/log/*relay*", mysql_test_dir); - - /* remove relay-log.info file */ - removef("%s/relay-log.info", slave_dir); - - /* init script */ - if (slave_init_script[0] != 0) - { -#ifdef __NETWARE__ - /* TODO: use the scripts */ - if (strinstr(slave_init_script, "rpl000016-slave.sh") != 0) - { - /* create empty master.info file */ - snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir); - close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); - } - else if (strinstr(slave_init_script, "rpl000017-slave.sh") != 0) - { - FILE *fp; - - /* create a master.info file */ - snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir); - fp= fopen(temp, "wb+"); - - fputs("master-bin.000001\n", fp); - fputs("4\n", fp); - fputs("127.0.0.1\n", fp); - fputs("replicate\n", fp); - fputs("aaaaaaaaaaaaaaab\n", fp); - fputs("9306\n", fp); - fputs("1\n", fp); - fputs("0\n", fp); - - fclose(fp); - } - else if (strinstr(slave_init_script, "rpl_rotate_logs-slave.sh") != 0) - { - /* create empty master.info file */ - snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir); - close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO)); - } -#elif !defined(__WIN__) - run_init_script(slave_init_script); -#endif - } - - /* redirection files */ - snprintf(slave_out, FN_REFLEN, "%s/var/run/slave%u.out", - mysql_test_dir, restarts); - snprintf(slave_err, FN_REFLEN, "%s/var/run/slave%u.err", - mysql_test_dir, restarts); - - /* args */ - init_args(&al); - add_arg(&al, "%s", mysqld_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--log-bin=slave-bin"); - add_arg(&al, "--relay_log=slave-relay-bin"); - add_arg(&al, "--basedir=%s", base_dir); -#if !defined(__NETWARE__) && !defined(__WIN__) - add_arg(&al, "--socket=%s",slave_socket); -#endif - add_arg(&al, "--port=%u", slave_port); - add_arg(&al, "--datadir=%s", slave_dir); -#ifndef __WIN__ - add_arg(&al, "--pid-file=%s", slave_pid); -#endif - add_arg(&al, "--character-sets-dir=%s", char_dir); - add_arg(&al, "--core"); - add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); - add_arg(&al, "--language=%s", lang_dir); - - add_arg(&al, "--exit-info=256"); - add_arg(&al, "--log-slave-updates"); - add_arg(&al, "--init-rpl-role=slave"); - add_arg(&al, "--skip-innodb"); - add_arg(&al, "--skip-slave-start"); - add_arg(&al, "--slave-load-tmpdir=../../var/tmp"); - - add_arg(&al, "--report-user=%s", user); - add_arg(&al, "--report-host=127.0.0.1"); - add_arg(&al, "--report-port=%u", slave_port); - - add_arg(&al, "--master-retry-count=10"); - add_arg(&al, "-O"); - add_arg(&al, "slave_net_timeout=10"); - add_arg(&al, "--log-slave-updates"); - add_arg(&al, "--log=%s/var/log/slave.log", mysql_test_dir); - add_arg(&al, "--default-character-set=latin1"); - add_arg(&al, "--skip-ndbcluster"); - -#ifdef DEBUG /* only for debug builds */ - add_arg(&al, "--debug"); -#endif - - if (use_openssl) - { - add_arg(&al, "--ssl-ca=%s", ca_cert); - add_arg(&al, "--ssl-cert=%s", server_cert); - add_arg(&al, "--ssl-key=%s", server_key); - } - - /* slave master info */ - if (slave_master_info[0] != 0) - { - char *p; - - p= (char *)str_tok(argument, slave_master_info, " \t"); - - while (p) - { - add_arg(&al, "%s", p); - p= (char *)str_tok(argument, NULL, " \t"); - } - } - else - { - add_arg(&al, "--master-user=%s", user); - add_arg(&al, "--master-password=%s", password); - add_arg(&al, "--master-host=127.0.0.1"); - add_arg(&al, "--master-port=%u", master_port); - add_arg(&al, "--master-connect-retry=1"); - add_arg(&al, "--server-id=2"); - add_arg(&al, "--rpl-recovery-rank=2"); - } - - /* small server */ - add_arg(&al, "-O"); - add_arg(&al, "key_buffer_size=1M"); - add_arg(&al, "-O"); - add_arg(&al, "sort_buffer=256K"); - add_arg(&al, "-O"); - add_arg(&al, "max_heap_table_size=1M"); - - - /* opt args */ - if (slave_opt[0] != 0) - { - char *p; - - p= (char *)str_tok(argument, slave_opt, " \t"); - - while (p) - { - add_arg(&al, "%s", p); - p= (char *)str_tok(argument, NULL, " \t"); - } - } - - /* remove the pid file if it exists */ -#ifndef __WIN__ - remove(slave_pid); -#endif - /* spawn */ -#ifdef __WIN__ - if ((err= spawn(mysqld_file, &al, FALSE, NULL, - slave_out, slave_err, &slave_pid)) == 0) -#else - if ((err= spawn(mysqld_file, &al, FALSE, NULL, - slave_out, slave_err, slave_pid)) == 0) -#endif - { - sleep_until_file_exists(slave_pid); - - if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password, - slave_port, mysql_tmp_dir)) == 0) - { - slave_running= TRUE; - } - else - { - log_error("The slave server went down early."); - } - } - else - { - log_error("Unable to start slave server."); - } - - /* free args */ - free_args(&al); -} - -/****************************************************************************** - - mysql_start() - - Start the mysql servers. - -******************************************************************************/ - -void mysql_start() -{ - - - printf("loading master...\r"); - start_master(); - - printf("loading slave...\r"); - start_slave(); - - /* activate the test screen */ -#ifdef __NETWARE__ - ActivateScreen(getscreenhandle()); -#endif -} - -/****************************************************************************** - - stop_slave() - - Stop the slave server. - -******************************************************************************/ - -void stop_slave() -{ - int err; - - /* running? */ - if (!slave_running) return; - - /* stop */ - if ((err= stop_server(bin_dir, mysqladmin_file, user, password, - slave_port, slave_pid, mysql_tmp_dir)) == 0) - { - slave_running= FALSE; - } - else - { - log_error("Unable to stop slave server."); - } -} - -/****************************************************************************** - - stop_master() - - Stop the master server. - -******************************************************************************/ - -void stop_master() -{ - int err; - - /* running? */ - if (!master_running) return; - - if ((err= stop_server(bin_dir, mysqladmin_file, user, password, - master_port, master_pid, mysql_tmp_dir)) == 0) - { - master_running= FALSE; - } - else - { - log_error("Unable to stop master server."); - } -} - -/****************************************************************************** - - mysql_stop() - - Stop the mysql servers. - -******************************************************************************/ - -void mysql_stop() -{ - - stop_master(); - - stop_slave(); - - /* activate the test screen */ -#ifdef __NETWARE__ - ActivateScreen(getscreenhandle()); -#endif -} - -/****************************************************************************** - - mysql_restart() - - Restart the mysql servers. - -******************************************************************************/ - -void mysql_restart() -{ -/* log_info("Restarting the MySQL server(s): %u", ++restarts); */ - - mysql_stop(); - - mlog(DASH); - sleep(1); - - mysql_start(); -} - -/****************************************************************************** - - read_option() - - Read the option file. - -******************************************************************************/ - -int read_option(char *opt_file, char *opt) -{ - int fd, err; - char *p; - char buf[FN_REFLEN]; - - /* copy current option */ - strncpy(buf, opt, FN_REFLEN); - - /* open options file */ - fd= open(opt_file, O_RDONLY); - err= read(fd, opt, FN_REFLEN); - close(fd); - - if (err > 0) - { - /* terminate string */ - if ((p= strchr(opt, '\n')) != NULL) - { - *p= 0; - - /* check for a '\r' */ - if ((p= strchr(opt, '\r')) != NULL) - { - *p= 0; - } - } - else - { - opt[err]= 0; - } - - /* check for $MYSQL_TEST_DIR */ - if ((p= strstr(opt, "$MYSQL_TEST_DIR")) != NULL) - { - char temp[FN_REFLEN]; - - *p= 0; - - strcpy(temp, p + strlen("$MYSQL_TEST_DIR")); - strcat(opt, mysql_test_dir); - strcat(opt, temp); - } - /* Check for double backslash and replace it with single bakslash */ - if ((p= strstr(opt, "\\\\")) != NULL) - { - /* bmove is guranteed to work byte by byte */ - bmove(p, p+1, strlen(p)+1); - } - } - else - { - /* clear option */ - *opt= 0; - } - - /* compare current option with previous */ - return strcmp(opt, buf); -} - -/****************************************************************************** - - run_test() - - Run the given test case. - -******************************************************************************/ - -void run_test(char *test) -{ - char temp[FN_REFLEN]; - const char *rstr; - int skip= FALSE, ignore=FALSE; - int restart= FALSE; - int flag= FALSE; - struct stat info; - - /* skip tests in the skip list */ - snprintf(temp, FN_REFLEN, " %s ", test); - skip= (strinstr(skip_test, temp) != 0); - if (skip == FALSE) - ignore= (strinstr(ignore_test, temp) != 0); - - snprintf(master_init_script, FN_REFLEN, "%s/%s-master.sh", test_dir, test); - snprintf(slave_init_script, FN_REFLEN, "%s/%s-slave.sh", test_dir, test); -#ifdef __WIN__ - if (! stat(master_init_script, &info)) - skip= TRUE; - if (!stat(slave_init_script, &info)) - skip= TRUE; -#endif - if (ignore) - { - /* show test */ - mlog("%-46s ", test); - - /* ignore */ - rstr= TEST_IGNORE; - ++total_ignore; - } - else if (!skip) /* skip test? */ - { - char test_file[FN_REFLEN]; - char master_opt_file[FN_REFLEN]; - char slave_opt_file[FN_REFLEN]; - char slave_master_info_file[FN_REFLEN]; - char result_file[FN_REFLEN]; - char reject_file[FN_REFLEN]; - char out_file[FN_REFLEN]; - char err_file[FN_REFLEN]; - int err; - arg_list_t al; - /* skip slave? */ - flag= skip_slave; - skip_slave= (strncmp(test, "rpl", 3) != 0); - if (flag != skip_slave) restart= TRUE; - - /* create files */ - snprintf(master_opt_file, FN_REFLEN, "%s/%s-master.opt", test_dir, test); - snprintf(slave_opt_file, FN_REFLEN, "%s/%s-slave.opt", test_dir, test); - snprintf(slave_master_info_file, FN_REFLEN, "%s/%s.slave-mi", - test_dir, test); - snprintf(reject_file, FN_REFLEN, "%s/%s%s", - result_dir, test, REJECT_SUFFIX); - snprintf(out_file, FN_REFLEN, "%s/%s%s", result_dir, test, OUT_SUFFIX); - snprintf(err_file, FN_REFLEN, "%s/%s%s", result_dir, test, ERR_SUFFIX); - - /* netware specific files */ - snprintf(test_file, FN_REFLEN, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX); - if (stat(test_file, &info)) - { - snprintf(test_file, FN_REFLEN, "%s/%s%s", test_dir, test, TEST_SUFFIX); - if (access(test_file,0)) - { - printf("Invalid test name %s, %s file not found\n",test,test_file); - return; - } - } - - snprintf(result_file, FN_REFLEN, "%s/%s%s", - result_dir, test, NW_RESULT_SUFFIX); - if (stat(result_file, &info)) - { - snprintf(result_file, FN_REFLEN, "%s/%s%s", - result_dir, test, RESULT_SUFFIX); - } - - /* init scripts */ - if (stat(master_init_script, &info)) - master_init_script[0]= 0; - else - restart= TRUE; - - if (stat(slave_init_script, &info)) - slave_init_script[0]= 0; - else - restart= TRUE; - - /* read options */ - if (read_option(master_opt_file, master_opt)) restart= TRUE; - if (read_option(slave_opt_file, slave_opt)) restart= TRUE; - if (read_option(slave_master_info_file, slave_master_info)) restart= TRUE; - - /* cleanup previous run */ - remove(reject_file); - remove(out_file); - remove(err_file); - - /* start or restart? */ - if (!master_running) mysql_start(); - else if (restart) mysql_restart(); - - /* show test */ - mlog("%-46s ", test); - - /* args */ - init_args(&al); - add_arg(&al, "%s", mysqltest_file); - add_arg(&al, "--no-defaults"); - add_arg(&al, "--port=%u", master_port); -#if !defined(__NETWARE__) && !defined(__WIN__) - add_arg(&al, "--socket=%s", master_socket); - add_arg(&al, "--tmpdir=%s", mysql_tmp_dir); -#endif - add_arg(&al, "--database=%s", db); - add_arg(&al, "--user=%s", user); - add_arg(&al, "--password=%s", password); - add_arg(&al, "--silent"); - add_arg(&al, "--basedir=%s/", mysql_test_dir); - add_arg(&al, "--host=127.0.0.1"); - add_arg(&al, "--skip-safemalloc"); - add_arg(&al, "-v"); - add_arg(&al, "-R"); - add_arg(&al, "%s", result_file); - - - if (use_openssl) - { - add_arg(&al, "--ssl-ca=%s", ca_cert); - add_arg(&al, "--ssl-cert=%s", client_cert); - add_arg(&al, "--ssl-key=%s", client_key); - } - - /* spawn */ - err= spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL); - /* free args */ - free_args(&al); - - remove_empty_file(out_file); - remove_empty_file(err_file); - - if (err == 0) - { - /* pass */ - rstr= TEST_PASS; - ++total_pass; - - /* increment total */ - ++total_test; - } - else if (err == 2) - { - /* skip */ - rstr= TEST_SKIP; - ++total_skip; - } - else if (err == 1) - { - /* fail */ - rstr= TEST_FAIL; - ++total_fail; - - /* increment total */ - ++total_test; - } - else - { - rstr= TEST_BAD; - } - } - else /* early skips */ - { - /* show test */ - mlog("%-46s ", test); - - /* skip */ - rstr= TEST_SKIP; - ++total_skip; - } - - /* result */ - mlog("%-14s\n", rstr); -} - -/****************************************************************************** - - vlog() - - Log the message. - -******************************************************************************/ - -void vlog(const char *format, va_list ap) -{ - vfprintf(stdout, format, ap); - fflush(stdout); - - if (log_fd) - { - vfprintf(log_fd, format, ap); - fflush(log_fd); - } -} - -/****************************************************************************** - - log() - - Log the message. - -******************************************************************************/ - -void mlog(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - vlog(format, ap); - - va_end(ap); -} - -/****************************************************************************** - - log_info() - - Log the given information. - -******************************************************************************/ - -void log_info(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - mlog("-- INFO : "); - vlog(format, ap); - mlog("\n"); - - va_end(ap); -} - -/****************************************************************************** - - log_error() - - Log the given error. - -******************************************************************************/ - -void log_error(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - mlog("-- ERROR: "); - vlog(format, ap); - mlog("\n"); - - va_end(ap); -} - -/****************************************************************************** - - log_errno() - - Log the given error and errno. - -******************************************************************************/ - -void log_errno(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - - mlog("-- ERROR: (%003u) ", errno); - vlog(format, ap); - mlog("\n"); - - va_end(ap); -} - -/****************************************************************************** - - die() - - Exit the application. - -******************************************************************************/ - -void die(const char *msg) -{ - log_error(msg); -#ifdef __NETWARE__ - pressanykey(); -#endif - exit(-1); -} - -/****************************************************************************** - - setup() - - Setup the mysql test enviornment. - -******************************************************************************/ - -void setup(char *file __attribute__((unused))) -{ - char temp[FN_REFLEN]; -#if defined(__WIN__) || defined(__NETWARE__) - char file_path[FN_REFLEN*2]; -#endif - char *p; - int position; - - /* set the timezone for the timestamp test */ -#ifdef __WIN__ - _putenv( "TZ=GMT-3" ); -#else - putenv((char *)"TZ=GMT-3"); -#endif - /* find base dir */ -#ifdef __NETWARE__ - strcpy(temp, strlwr(file)); - while ((p= strchr(temp, '\\')) != NULL) *p= '/'; -#else - getcwd(temp, FN_REFLEN); - position= strlen(temp); - temp[position]= '/'; - temp[position+1]= 0; -#ifdef __WIN__ - while ((p= strchr(temp, '\\')) != NULL) *p= '/'; -#endif -#endif - - if ((position= strinstr(temp, "/mysql-test/")) != 0) - { - p= temp + position - 1; - *p= 0; - strcpy(base_dir, temp); - } - - log_info("Currect directory: %s",base_dir); - -#ifdef __NETWARE__ - /* setup paths */ - snprintf(bin_dir, FN_REFLEN, "%s/bin", base_dir); - snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir); - snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir); - snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir); - snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir); - snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir); - snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir); - snprintf(lang_dir, FN_REFLEN, "%s/share/english", base_dir); - snprintf(char_dir, FN_REFLEN, "%s/share/charsets", base_dir); - -#ifdef HAVE_OPENSSL - use_openssl= TRUE; -#endif /* HAVE_OPENSSL */ - - /* OpenSSL paths */ - snprintf(ca_cert, FN_REFLEN, "%s/std_data/cacert.pem", mysql_test_dir); - snprintf(server_cert, FN_REFLEN, "%s/std_data/server-cert.pem", mysql_test_dir); - snprintf(server_key, FN_REFLEN, "%s/std_data/server-key.pem", mysql_test_dir); - snprintf(client_cert, FN_REFLEN, "%s/std_data/client-cert.pem", mysql_test_dir); - snprintf(client_key, FN_REFLEN, "%s/std_data/client-key.pem", mysql_test_dir); - - /* setup files */ - snprintf(mysqld_file, FN_REFLEN, "%s/mysqld", bin_dir); - snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest", bin_dir); - snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin", bin_dir); - snprintf(master_pid, FN_REFLEN, "%s/var/run/master.pid", mysql_test_dir); - snprintf(slave_pid, FN_REFLEN, "%s/var/run/slave.pid", mysql_test_dir); -#elif __WIN__ - /* setup paths */ -#ifdef _DEBUG - snprintf(bin_dir, FN_REFLEN, "%s/client_debug", base_dir); -#else - snprintf(bin_dir, FN_REFLEN, "%s/client_release", base_dir); -#endif - snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir); - snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir); - snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir); - snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir); - snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir); - snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir); - snprintf(lang_dir, FN_REFLEN, "%s/share/english", base_dir); - snprintf(char_dir, FN_REFLEN, "%s/share/charsets", base_dir); - -#ifdef HAVE_OPENSSL - use_openssl= TRUE; -#endif /* HAVE_OPENSSL */ - - /* OpenSSL paths */ - snprintf(ca_cert, FN_REFLEN, "%s/std_data/cacert.pem", mysql_test_dir); - snprintf(server_cert, FN_REFLEN, "%s/std_data/server-cert.pem", mysql_test_dir); - snprintf(server_key, FN_REFLEN, "%s/std_data/server-key.pem", mysql_test_dir); - snprintf(client_cert, FN_REFLEN, "%s/std_data/client-cert.pem", mysql_test_dir); - snprintf(client_key, FN_REFLEN, "%s/std_data/client-key.pem", mysql_test_dir); - - /* setup files */ -#ifdef _DEBUG - snprintf(mysqld_file, FN_REFLEN, "%s/mysqld-debug.exe", bin_dir); -#else - snprintf(mysqld_file, FN_REFLEN, "%s/mysqld.exe", bin_dir); -#endif - snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest.exe", bin_dir); - snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin.exe", bin_dir); -#else - /* setup paths */ - snprintf(bin_dir, FN_REFLEN, "%s/client", base_dir); - snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir); - snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir); - snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir); - snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir); - snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir); - snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir); - snprintf(slave1_dir, FN_REFLEN, "%s/var/slave1-data", mysql_test_dir); - snprintf(slave2_dir, FN_REFLEN, "%s/var/slave2-data", mysql_test_dir); - snprintf(lang_dir, FN_REFLEN, "%s/sql/share/english", base_dir); - snprintf(char_dir, FN_REFLEN, "%s/sql/share/charsets", base_dir); - -#ifdef HAVE_OPENSSL - use_openssl= TRUE; -#endif /* HAVE_OPENSSL */ - - /* OpenSSL paths */ - snprintf(ca_cert, FN_REFLEN, "%s/std_data/cacert.pem", mysql_test_dir); - snprintf(server_cert, FN_REFLEN, "%s/std_data/server-cert.pem", mysql_test_dir); - snprintf(server_key, FN_REFLEN, "%s/std_data/server-key.pem", mysql_test_dir); - snprintf(client_cert, FN_REFLEN, "%s/std_data/client-cert.pem", mysql_test_dir); - snprintf(client_key, FN_REFLEN, "%s/std_data/client-key.pem", mysql_test_dir); - - /* setup files */ - snprintf(mysqld_file, FN_REFLEN, "%s/sql/mysqld", base_dir); - snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest", bin_dir); - snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin", bin_dir); - snprintf(master_pid, FN_REFLEN, "%s/var/run/master.pid", mysql_test_dir); - snprintf(slave_pid, FN_REFLEN, "%s/var/run/slave.pid", mysql_test_dir); - - snprintf(master_socket,FN_REFLEN, "%s/var/tmp/master.sock", mysql_test_dir); - snprintf(slave_socket,FN_REFLEN, "%s/var/tmp/slave.sock", mysql_test_dir); - -#endif - /* create log file */ - snprintf(temp, FN_REFLEN, "%s/mysql-test-run.log", mysql_test_dir); - if ((log_fd= fopen(temp, "w+")) == NULL) - { - log_errno("Unable to create log file."); - } - - /* prepare skip test list */ - while ((p= strchr(skip_test, ',')) != NULL) *p= ' '; - strcpy(temp, strlwr(skip_test)); - snprintf(skip_test, FN_REFLEN, " %s ", temp); - - /* environment */ -#ifdef __NETWARE__ - setenv("MYSQL_TEST_DIR", mysql_test_dir, 1); - snprintf(file_path, FN_REFLEN*2, - "%s/client/mysqldump --no-defaults -u root --port=%u", - bin_dir, master_port); - setenv("MYSQL_DUMP", file_path, 1); - snprintf(file_path, FN_REFLEN*2, - "%s/client/mysqlbinlog --no-defaults --local-load=%s", - bin_dir, mysql_tmp_dir); - setenv("MYSQL_BINLOG", file_path, 1); -#elif __WIN__ - snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir); - _putenv(file_path); - snprintf(file_path, FN_REFLEN*2, - "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -uroot --port=%u", - bin_dir, master_port); - _putenv(file_path); - snprintf(file_path, FN_REFLEN*2, - "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s", - bin_dir, mysql_tmp_dir); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "TESTS_BINDIR=%s/tests", base_dir); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "CHARSETSDIR=%s/sql/share/charsets", base_dir); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "MYSQL=%s/mysql --port=%u ", - bin_dir, master_port); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "MYSQL_FIX_SYSTEM_TABLES=%s/scripts/mysql_fix_privilege_tables --no-defaults " - "--host=localhost --port=%u " - "--basedir=%s --bindir=%s --verbose", - base_dir,master_port, base_dir, bin_dir); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "NDB_TOOLS_DIR=%s/ndb/tools", base_dir); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "CLIENT_BINDIR=%s", bin_dir); - _putenv(file_path); - - snprintf(file_path, FN_REFLEN*2, - "MYSQL_CLIENT_TEST=%s/tests/mysql_client_test --no-defaults --testcase " - "--user=root --port=%u --silent", - base_dir, master_port); - _putenv(file_path); - -#else - { - static char env_MYSQL_TEST_DIR[FN_REFLEN*2]; - static char env_MYSQL_DUMP[FN_REFLEN*2]; - static char env_MYSQL_BINLOG[FN_REFLEN*2]; - static char env_MASTER_MYSOCK[FN_REFLEN*2]; - static char env_TESTS_BINDIR[FN_REFLEN*2]; - static char env_CHARSETSDIR[FN_REFLEN*2]; - static char env_MYSQL[FN_REFLEN*2]; - static char env_MYSQL_FIX_SYSTEM_TABLES[FN_REFLEN*2]; - static char env_CLIENT_BINDIR[FN_REFLEN*2]; - static char env_MYSQL_CLIENT_TEST[FN_REFLEN*2]; - static char env_NDB_TOOLS_DIR[FN_REFLEN*2]; - static char env_NDB_MGM[FN_REFLEN*2]; - static char env_NDB_BACKUP_DIR[FN_REFLEN*2]; - static char env_NDB_TOOLS_OUTPUT[FN_REFLEN*2]; - - snprintf(env_MYSQL_TEST_DIR,FN_REFLEN*2, - "MYSQL_TEST_DIR=%s",mysql_test_dir); - putenv(env_MYSQL_TEST_DIR); - - snprintf(env_MYSQL_DUMP, FN_REFLEN*2,"MYSQL_DUMP=%s/mysqldump --no-defaults " - "-uroot --port=%u --socket=%s ", - bin_dir, master_port, master_socket); - putenv(env_MYSQL_DUMP); - - snprintf(env_MYSQL_BINLOG, FN_REFLEN*2, - "MYSQL_BINLOG=%s/mysqlbinlog --no-defaults --local-load=%s -uroot ", - bin_dir, mysql_tmp_dir); - putenv(env_MYSQL_BINLOG); - - snprintf(env_MASTER_MYSOCK, FN_REFLEN*2, - "MASTER_MYSOCK=%s", master_socket); - putenv(env_MASTER_MYSOCK); - - snprintf(env_TESTS_BINDIR, FN_REFLEN*2, - "TESTS_BINDIR=%s/tests", base_dir); - putenv(env_TESTS_BINDIR); - - snprintf(env_CHARSETSDIR, FN_REFLEN*2, - "CHARSETSDIR=%s/sql/share/charsets", base_dir); - putenv(env_CHARSETSDIR); - - snprintf(env_MYSQL, FN_REFLEN*2, - "MYSQL=%s/mysql --port=%u --socket=%s -uroot ", - bin_dir, master_port, master_socket); - putenv(env_MYSQL); - - snprintf(env_MYSQL_FIX_SYSTEM_TABLES, FN_REFLEN*2, - "MYSQL_FIX_SYSTEM_TABLES=%s/scripts/mysql_fix_privilege_tables --no-defaults " - "--host=localhost --port=%u --socket=%s " - "--basedir=%s --bindir=%s --verbose -uroot ", - base_dir,master_port, master_socket, base_dir, bin_dir); - putenv(env_MYSQL_FIX_SYSTEM_TABLES); - - - snprintf(env_CLIENT_BINDIR, FN_REFLEN*2, - "CLIENT_BINDIR=%s", bin_dir); - putenv(env_CLIENT_BINDIR); - - snprintf(env_MYSQL_CLIENT_TEST, FN_REFLEN*2, - "MYSQL_CLIENT_TEST=%s/tests/mysql_client_test --no-defaults --testcase " - "--user=root --socket=%s --port=%u --silent", - base_dir, master_socket, master_port); - putenv(env_MYSQL_CLIENT_TEST); - - // NDB - - snprintf(env_NDB_TOOLS_DIR, FN_REFLEN*2, - "NDB_TOOLS_DIR=%s/ndb/tools", base_dir); - putenv(env_NDB_TOOLS_DIR); - - snprintf(env_NDB_MGM, FN_REFLEN*2, - "NDB_MGM=%s/ndb/src/mgmclient/ndb_mgm", base_dir); - putenv(env_NDB_MGM); - - //NDBCLUSTER_PORT=9350 - snprintf(env_NDB_BACKUP_DIR, FN_REFLEN*2, - "NDB_BACKUP_DIR=%s/var/ndbcluster-%i", mysql_test_dir, 9350); - putenv(env_NDB_BACKUP_DIR); - - snprintf(env_NDB_TOOLS_OUTPUT, FN_REFLEN*2, - "NDB_TOOLS_OUTPUT=%s/var/log/ndb_tools.log", mysql_test_dir); - putenv(env_NDB_TOOLS_OUTPUT); - - putenv((char *)"NDB_STATUS_OK=1"); - -// NDB_MGM="$BASEDIR/ndb/src/mgmclient/ndb_mgm" -// NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT -// NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log - } - -#endif - -#ifndef __WIN__ - putenv((char *)"MASTER_MYPORT=9306"); - putenv((char *)"SLAVE_MYPORT=9307"); - putenv((char *)"MYSQL_TCP_PORT=3306"); - -#else - _putenv("MASTER_MYPORT=9306"); - _putenv("SLAVE_MYPORT=9307"); - _putenv("MYSQL_TCP_PORT=3306"); -#endif - -} - -/* - Compare names of testes for right order -*/ -int compare( const void *arg1, const void *arg2 ) -{ - return sting_compare_func( * ( char** ) arg1, * ( char** ) arg2 ); -} - - - -/****************************************************************************** - - main() - -******************************************************************************/ - -int main(int argc, char **argv) -{ - int is_ignore_list= 0; - char **names= 0; - char **testes= 0; - int name_index; - int index; - char var_dir[FN_REFLEN]; - /* setup */ - setup(argv[0]); - - /* delete all file in var */ - snprintf(var_dir,FN_REFLEN,"%s/var",mysql_test_dir); - del_tree(var_dir); - - /* - The --ignore option is comma saperated list of test cases to skip and - should be very first command line option to the test suite. - - The usage is now: - mysql_test_run --ignore=test1,test2 test3 test4 - where test1 and test2 are test cases to ignore - and test3 and test4 are test cases to run. - */ - if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1)) - { - char *temp, *token; - temp= strdup(strchr(argv[1],'=') + 1); - for (token=str_tok(argument, temp, ","); token != NULL; - token=str_tok(argument, NULL, ",")) - { - if (strlen(ignore_test) + strlen(token) + 2 <= FN_REFLEN-1) - sprintf(ignore_test+strlen(ignore_test), " %s ", token); - else - { - free(temp); - die("ignore list too long."); - } - } - free(temp); - is_ignore_list= 1; - } - /* header */ -#ifndef __WIN__ - mlog("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); -#else - mlog("MySQL Server ---, for %s (%s)\n\n", SYSTEM_TYPE, MACHINE_TYPE); -#endif - - mlog("Initializing Tests...\n"); - - /* install test databases */ - mysql_install_db(); - - mlog("Starting Tests...\n"); - - mlog("\n"); - mlog(HEADER); - mlog(DASH); - - if ( argc > 1 + is_ignore_list ) - { - int i; - - /* single test */ - single_test= TRUE; - - for (i= 1 + is_ignore_list; i < argc; i++) - { - /* run given test */ - run_test(argv[i]); - } - } - else - { - /* run all tests */ - testes= malloc(MAX_COUNT_TESTES*sizeof(void*)); - if (!testes) - die("can not allcate memory for sorting"); - names= testes; - name_index= 0; -#ifndef __WIN__ - struct dirent *entry; - DIR *parent; - char test[FN_LEN]; - int position; - - /* FIXME are we sure the list is sorted if using readdir()? */ - if ((parent= opendir(test_dir)) == NULL) /* Not thread safe */ - die("Unable to open tests directory."); - else - { - while ((entry= readdir(parent)) != NULL) /* Not thread safe */ - { - strcpy(test, strlwr(entry->d_name)); - /* find the test suffix */ - if ((position= strinstr(test, TEST_SUFFIX)) != 0) - { - if (name_index < MAX_COUNT_TESTES) - { - /* null terminate at the suffix */ - *(test + position - 1)= '\0'; - /* insert test */ - *names= malloc(FN_REFLEN); - strcpy(*names,test); - names++; - name_index++; - } - else - die("can not sort files, array is overloaded"); - } - } - closedir(parent); - } -#else - { - struct _finddata_t dir; - int* handle; - char test[FN_LEN]; - char mask[FN_REFLEN]; - int position; - - /* single test */ - single_test= FALSE; - - snprintf(mask,FN_REFLEN,"%s/*.test",test_dir); - - if ((handle=_findfirst(mask,&dir)) == -1L) - { - die("Unable to open tests directory."); - } - - - do - { - if (!(dir.attrib & _A_SUBDIR)) - { - strcpy(test, strlwr(dir.name)); - - /* find the test suffix */ - if ((position= strinstr(test, TEST_SUFFIX)) != 0) - { - if (name_index < MAX_COUNT_TESTES) - { - /* null terminate at the suffix */ - *(test + position - 1)= '\0'; - /* insert test */ - *names= malloc(FN_REFLEN); - strcpy(*names,test); - names++; - name_index++; - } - else - die("can not sort files, array is overloaded"); - } - } - }while (_findnext(handle,&dir) == 0); - - _findclose(handle); - } -#endif - qsort( (void *)testes, name_index, sizeof( char * ), compare ); - - for (index= 0; index < name_index; index++) - { - run_test(testes[index]); - free(testes[index]); - } - - free(testes); - } - - /* stop server */ - mysql_stop(); - - mlog(DASH); - mlog("\n"); - - mlog("Ending Tests...\n"); - - /* report stats */ - report_stats(); - - /* close log */ - if (log_fd) fclose(log_fd); - - /* keep results up */ -#ifdef __NETWARE__ - pressanykey(); -#endif - return 0; -} - - -/* - Synopsis: - This function breaks the string into a sequence of tokens. The difference - between this function and strtok is that it respects the quoted string i.e. - it skips any delimiter character within the quoted part of the string. - It return tokens by eliminating quote character. It modifies the input string - passed. It will work with whitespace delimeter but may not work properly with - other delimeter. If the delimeter will contain any quote character, then - function will not tokenize and will return null string. - e.g. if input string is - --init-slave="set global max_connections=500" --skip-external-locking - then the output will two string i.e. - --init-slave=set global max_connections=500 - --skip-external-locking - -Arguments: - string: input string - delim: set of delimiter character -Output: - return the null terminated token of NULL. -*/ -char *str_tok(char* dest, char *string, const char *delim) -{ - char *token; - char *ptr_end_token= NULL; - char *ptr_quote= NULL; - char *ptr_token= NULL; - int count_quotes= 0; - - *dest = '\0'; - if (strchr(delim,'\'') || strchr(delim,'\"')) - return NULL; - - token= (char*)strtok(string, delim); - if (token) - { - /* double quote is found */ - if (strchr(token,'\"')) - { - do - { - if (count_quotes & 1) - { - if (*dest == '\0') - sprintf(dest,"%s", ptr_token); - else - sprintf(dest,"%s %s", dest, ptr_token); - ptr_token= (char*)strtok(NULL, delim); - if (!ptr_token) - break; - } - else - { - ptr_token= token; - } - if (ptr_quote = strchr(ptr_token,'\"')) - { - ptr_end_token= ptr_token + strlen(ptr_token); - do - { -#ifndef __WIN__ - bmove(ptr_quote, ptr_quote+1, ptr_end_token - ptr_quote); -#endif - count_quotes++; - } while (ptr_quote != NULL && (ptr_quote = strchr(ptr_quote+1,'\"'))); - } - /* there are unpair quotes we have to search next quote*/ - } while (count_quotes & 1); - if (ptr_token != NULL) - { - if (*dest == '\0') - sprintf(dest,"%s", ptr_token); - else - sprintf(dest,"%s %s",dest,ptr_token); - } - } - else - { - sprintf(dest,"%s",token); - } - } - return token ? dest : NULL; -} - -#ifndef __WIN__ -/* - Synopsis: - This function run scripts files on Linux and Netware - -Arguments: - script_name: name of script file - -Output: - nothing -*/ - -void run_init_script(const char *script_name) -{ - arg_list_t al; - int err; - - /* args */ - init_args(&al); - add_arg(&al, sh_file); - add_arg(&al, script_name); - - /* spawn */ - if ((err= spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0) - { - die("Unable to run script."); - } - - /* free args */ - free_args(&al); -} -#endif diff --git a/mysql-test/ndb/Makefile.am b/mysql-test/ndb/Makefile.am index 2a1c59fd359..4ddf61cf5cc 100644 --- a/mysql-test/ndb/Makefile.am +++ b/mysql-test/ndb/Makefile.am @@ -1,14 +1,11 @@ -BUILT_SOURCES = ndbcluster - benchdir_root= $(prefix) testdir = $(benchdir_root)/mysql-test/ndb -test_SCRIPTS = ndbcluster - -noinst_HEADERS = ndbcluster.sh - +EXTRA_DIST = ndbcluster.sh +CLEANFILES = ndbcluster dist_test_DATA = ndb_config_2_node.ini ndb_config_1_node.ini +test_SCRIPTS = ndbcluster SUFFIXES = .sh diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result index 0be99e071cd..09813458069 100644 --- a/mysql-test/r/archive.result +++ b/mysql-test/r/archive.result @@ -13809,4 +13809,11 @@ alter table t1 add unique key (i, v); select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn'); i v 4 3r4f +alter table t1 data directory="$MYSQLTEST_VARDIR/tmp"; +select * from t1; +i v +1 def +2 abc +4 3r4f +5 lmn drop table t1, t2, t4, t5; diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 70eaac2eb4e..3adcc895474 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5085,6 +5085,36 @@ Table Op Msg_type Msg_text test.test_repair_table5 repair status OK SELECT * FROM test_repair_table5; num magic_no company_name founded +INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT", 1876); +SELECT * FROM test_repair_table5; +num magic_no company_name founded +1 0102 CORRECT 1876 +FLUSH TABLES; +CHECK TABLE test_repair_table5; +Table Op Msg_type Msg_text +test.test_repair_table5 check error Corrupt +REPAIR TABLE test_repair_table5; +Table Op Msg_type Msg_text +test.test_repair_table5 repair status OK +SELECT * FROM test_repair_table5; +num magic_no company_name founded +1 0102 CORRECT 1876 +INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT2", 1876); +SELECT * FROM test_repair_table5; +num magic_no company_name founded +1 0102 CORRECT 1876 +1 0102 CORRECT2 1876 +FLUSH TABLES; +CHECK TABLE test_repair_table5; +Table Op Msg_type Msg_text +test.test_repair_table5 check error Corrupt +REPAIR TABLE test_repair_table5; +Table Op Msg_type Msg_text +test.test_repair_table5 repair status OK +SELECT * FROM test_repair_table5; +num magic_no company_name founded +1 0102 CORRECT 1876 +1 0102 CORRECT2 1876 DROP TABLE test_repair_table5; create table t1 (a int) engine=csv; insert t1 values (1); diff --git a/mysql-test/r/ctype_filename.result b/mysql-test/r/ctype_filename.result new file mode 100644 index 00000000000..acc32c7dedf --- /dev/null +++ b/mysql-test/r/ctype_filename.result @@ -0,0 +1,13 @@ +drop table if exists con, aux, nul, lpt1, com1, `clock$`; +create table con (a int); +drop table con; +create table aux (a int); +drop table aux; +create table nul (a int); +drop table nul; +create table lpt1 (a int); +drop table lpt1; +create table com1 (a int); +drop table com1; +create table `clock$` (a int); +drop table `clock$`; diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index edbdd6b08da..b5fd35d926f 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -847,3 +847,28 @@ timestampdiff(year,'2004-02-28','2005-02-28') select timestampdiff(year,'2004-02-29','2005-02-28'); timestampdiff(year,'2004-02-29','2005-02-28') 0 +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, day date); +CREATE TABLE t2 (id int NOT NULL PRIMARY KEY, day date); +INSERT INTO t1 VALUES +(1, '2005-06-01'), (2, '2005-02-01'), (3, '2005-07-01'); +INSERT INTO t2 VALUES +(1, '2005-08-01'), (2, '2005-06-15'), (3, '2005-07-15'); +SELECT * FROM t1, t2 +WHERE t1.day BETWEEN +'2005.09.01' - INTERVAL 6 MONTH AND t2.day; +id day id day +1 2005-06-01 1 2005-08-01 +3 2005-07-01 1 2005-08-01 +1 2005-06-01 2 2005-06-15 +1 2005-06-01 3 2005-07-15 +3 2005-07-01 3 2005-07-15 +SELECT * FROM t1, t2 +WHERE CAST(t1.day AS DATE) BETWEEN +'2005.09.01' - INTERVAL 6 MONTH AND t2.day; +id day id day +1 2005-06-01 1 2005-08-01 +3 2005-07-01 1 2005-08-01 +1 2005-06-01 2 2005-06-15 +1 2005-06-01 3 2005-07-15 +3 2005-07-01 3 2005-07-15 +DROP TABLE t1,t2; diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index c827e11e50e..fe918e4c3ff 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -360,8 +360,6 @@ s1 count(s1) y 1 drop table t1; DROP SCHEMA IF EXISTS HU; -Warnings: -Note 1008 Can't drop database 'HU'; database doesn't exist CREATE SCHEMA HU ; USE HU ; CREATE TABLE STAFF diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result index b20e66a1098..d7dcc7853cd 100644 --- a/mysql-test/r/index_merge_innodb.result +++ b/mysql-test/r/index_merge_innodb.result @@ -260,3 +260,25 @@ t_vers t_rele t_cust filler1 7.6 a 7.6 a drop table t1; +create table t1 ( +pk int(11) not null auto_increment, +a int(11) not null default '0', +b int(11) not null default '0', +c int(11) not null default '0', +filler1 datetime, filler2 varchar(15), +filler3 longtext, +kp1 varchar(4), kp2 varchar(7), +kp3 varchar(2), kp4 varchar(4), +kp5 varchar(7), +filler4 char(1), +primary key (pk), +key idx1(a,b,c), +key idx2(c), +key idx3(kp1,kp2,kp3,kp4,kp5) +) engine=innodb default charset=latin1; +set @fill=NULL; +SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND +kp1='279' AND kp2='ELM0678' AND kp3='6' AND kp4='10' AND kp5 = 'R '; +COUNT(*) +1 +drop table t1; diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index bbeaf3519c2..a003ed14c77 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1640,6 +1640,30 @@ t2 CREATE TABLE `t2` ( CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t2, t1; +flush status; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 0 +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 0 +create table t1 (a int) engine=innodb; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 1 +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +begin; +delete from t1; +commit; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 2 +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +drop table t1; create table t1 (c char(10), index (c,c)) engine=innodb; ERROR 42S21: Duplicate column name 'c' create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb; @@ -1751,6 +1775,21 @@ select count(*) from t1 where x = 18446744073709551601; count(*) 1 drop table t1; +show status like "Innodb_buffer_pool_pages_total"; +Variable_name Value +Innodb_buffer_pool_pages_total 512 +show status like "Innodb_page_size"; +Variable_name Value +Innodb_page_size 16384 +show status like "Innodb_rows_deleted"; +Variable_name Value +Innodb_rows_deleted 2070 +show status like "Innodb_rows_inserted"; +Variable_name Value +Innodb_rows_inserted 31727 +show status like "Innodb_rows_updated"; +Variable_name Value +Innodb_rows_updated 29530 show status like "Innodb_row_lock_waits"; Variable_name Value Innodb_row_lock_waits 0 @@ -3194,6 +3233,15 @@ drop trigger t2t; drop trigger t3t; drop trigger t4t; drop table t1, t2, t3, t4, t5; +create table t1(a date) engine=innodb; +create table t2(a date, key(a)) engine=innodb; +insert into t1 values('2005-10-01'); +insert into t2 values('2005-10-01'); +select * from t1, t2 +where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; +a a +2005-10-01 2005-10-01 +drop table t1, t2; CREATE TABLE t1 ( field1 varchar(8) NOT NULL DEFAULT '', field2 varchar(8) NOT NULL DEFAULT '', diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 57067bea36b..ae50c714bba 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -72,7 +72,16 @@ c_cp932 +----------------------+------------+--------+ | concat('>',col1,'<') | col2 | col3 | +----------------------+------------+--------+ -| >a < | b | 123421 | -| >a < | 0123456789 | 4 | -| >abcd< | | 4 | +| >a < | b | 123421 | +| >a < | 0123456789 | 4 | +| >abcd< | NULL | 4 | +----------------------+------------+--------+ ++------+------+---------------------------+ +| i | j | k | ++------+------+---------------------------+ +| 1 | NULL | NULL | +| NULL | NULL | <-----------------------> | +| NULL | NULL | <----- | +| NULL | NULL | Τη γλώσσα | +| NULL | NULL | ᛖᚴ ᚷᛖᛏ | ++------+------+---------------------------+ diff --git a/mysql-test/r/mysqlslap.result b/mysql-test/r/mysqlslap.result index 1a8b77fde1c..045a34a7458 100644 --- a/mysql-test/r/mysqlslap.result +++ b/mysql-test/r/mysqlslap.result @@ -129,7 +129,6 @@ INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2'); select * from t1; select * from t2; -select * from t1; DROP SCHEMA IF EXISTS `mysqlslap`; DROP SCHEMA IF EXISTS `mysqlslap`; CREATE SCHEMA `mysqlslap`; @@ -141,5 +140,4 @@ INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2'); select * from t1; select * from t2; -select * from t1; DROP SCHEMA IF EXISTS `mysqlslap`; diff --git a/mysql-test/r/ndb_alter_table2.result b/mysql-test/r/ndb_alter_table2.result new file mode 100644 index 00000000000..3783c76447c --- /dev/null +++ b/mysql-test/r/ndb_alter_table2.result @@ -0,0 +1,41 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +a INT NOT NULL PRIMARY KEY, +b INT NOT NULL +) ENGINE=ndbcluster; +BEGIN; +INSERT INTO t1 VALUES (9410,9412); +BEGIN; +INSERT INTO t1 VALUES (9411,9412); +BEGIN; +INSERT INTO t1 VALUES (9412,9412); +BEGIN; +INSERT INTO t1 VALUES (9413,9412); +BEGIN; +INSERT INTO t1 VALUES (9414,9412); +BEGIN; +INSERT INTO t1 VALUES (9415,9412); +ROLLBACK; +ROLLBACK; +ROLLBACK; +ROLLBACK; +ROLLBACK; +ROLLBACK; +drop table t1; +CREATE TABLE t1 ( +a INT NOT NULL PRIMARY KEY, +b INT NOT NULL, +c INT NOT NULL +) ENGINE=ndbcluster; +select * from t1; +select * from t1; +a b c +select * from t1; +a b c +select * from t1; +a b c +select * from t1; +a b c +select * from t1; +a b c +drop table t1; diff --git a/mysql-test/r/ndb_alter_table_stm.result b/mysql-test/r/ndb_alter_table_stm.result index 9c1d09a8970..7cb7b990e2c 100644 --- a/mysql-test/r/ndb_alter_table_stm.result +++ b/mysql-test/r/ndb_alter_table_stm.result @@ -8,6 +8,7 @@ a b c 2 two two alter table t1 drop index c; select * from t1 where c = 'two'; +select * from t1 where c = 'two'; a b c 2 two two drop table t1; diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result index 9477caf97ab..4a1f5f587df 100644 --- a/mysql-test/r/ndb_basic.result +++ b/mysql-test/r/ndb_basic.result @@ -6,13 +6,6 @@ attr1 INT NOT NULL, attr2 INT, attr3 VARCHAR(10) ) ENGINE=ndbcluster; -drop table t1; -CREATE TABLE t1 ( -pk1 INT NOT NULL PRIMARY KEY, -attr1 INT NOT NULL, -attr2 INT, -attr3 VARCHAR(10) -) ENGINE=ndbcluster; SHOW INDEX FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 pk1 A 0 NULL NULL BTREE diff --git a/mysql-test/r/ndb_binlog_ddl_multi.result b/mysql-test/r/ndb_binlog_ddl_multi.result index 3b217c50402..f3e9b23920d 100644 --- a/mysql-test/r/ndb_binlog_ddl_multi.result +++ b/mysql-test/r/ndb_binlog_ddl_multi.result @@ -27,11 +27,13 @@ master-bin1.000001 # Query # # use `test`; alter table t2 add column (b int) reset master; reset master; ALTER DATABASE mysqltest CHARACTER SET latin1; -drop table mysqltest.t1; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # ALTER DATABASE mysqltest CHARACTER SET latin1 -master-bin.000001 # Query # # use `mysqltest`; drop table `t1` +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # ALTER DATABASE mysqltest CHARACTER SET latin1 +drop table mysqltest.t1; reset master; reset master; use test; @@ -79,7 +81,6 @@ DROP TABLESPACE ts1 ENGINE = NDB; DROP LOGFILE GROUP lg1 ENGINE =NDB; -drop table t1; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin1.000001 # Query # # CREATE LOGFILE GROUP lg1 @@ -110,7 +111,37 @@ master-bin1.000001 # Query # # DROP TABLESPACE ts1 ENGINE = NDB master-bin1.000001 # Query # # DROP LOGFILE GROUP lg1 ENGINE =NDB -master-bin1.000001 # Query # # use `test`; drop table `t1` +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin1.000001 # Query # # CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M +ENGINE=NDB +master-bin1.000001 # Query # # ALTER LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile02.dat' +INITIAL_SIZE = 4M +ENGINE=NDB +master-bin1.000001 # Query # # CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE NDB +master-bin1.000001 # Query # # ALTER TABLESPACE ts1 +ADD DATAFILE 'datafile02.dat' +INITIAL_SIZE = 4M +ENGINE=NDB +master-bin1.000001 # Query # # ALTER TABLESPACE ts1 +DROP DATAFILE 'datafile.dat' +ENGINE = NDB +master-bin1.000001 # Query # # ALTER TABLESPACE ts1 +DROP DATAFILE 'datafile02.dat' +ENGINE = NDB +master-bin1.000001 # Query # # DROP TABLESPACE ts1 +ENGINE = NDB +master-bin1.000001 # Query # # DROP LOGFILE GROUP lg1 +ENGINE =NDB +drop table t1; reset master; show tables; Tables_in_test diff --git a/mysql-test/r/ndb_bitfield.result b/mysql-test/r/ndb_bitfield.result index 13fd31d7e88..9a8c571cfba 100644 --- a/mysql-test/r/ndb_bitfield.result +++ b/mysql-test/r/ndb_bitfield.result @@ -201,21 +201,21 @@ create table t1 ( pk1 bit(9) not null primary key, b int ) engine=ndbcluster; -ERROR HY000: Can't create table 'test.t1' (errno: 140) +ERROR HY000: Can't create table 'test.t1' (errno: 906) show warnings; Level Code Message -Error 1296 Got error 739 'Unsupported primary key length' from NDB -Error 1005 Can't create table 'test.t1' (errno: 140) +Error 1296 Got error 906 'Unsupported attribute type in index' from NDB +Error 1005 Can't create table 'test.t1' (errno: 906) create table t1 ( pk1 int not null primary key, b bit(9), key(b) ) engine=ndbcluster; -ERROR HY000: Can't create table 'test.t1' (errno: 140) +ERROR HY000: Can't create table 'test.t1' (errno: 906) show warnings; Level Code Message -Error 1296 Got error 743 'Unsupported character set in table or index' from NDB -Error 1005 Can't create table 'test.t1' (errno: 140) +Error 1296 Got error 906 'Unsupported attribute type in index' from NDB +Error 1005 Can't create table 'test.t1' (errno: 906) create table t1 ( pk1 int primary key, b bit(32) not null diff --git a/mysql-test/r/ndb_blob_partition.result b/mysql-test/r/ndb_blob_partition.result new file mode 100644 index 00000000000..b08a91f0cdd --- /dev/null +++ b/mysql-test/r/ndb_blob_partition.result @@ -0,0 +1,104 @@ +drop table if exists t1; +create table t1 ( +a mediumint not null, +b text not null, +c int not null, +d longblob, +primary key using hash (a,c), +unique key (c) +) +engine=ndb +partition by range (c) +partitions 3 +( partition p1 values less than (200), +partition p2 values less than (300), +partition p3 values less than (400)); +insert into t1 values (1, @v1, 101, @v2); +insert into t1 values (1, @v2, 102, @v3); +insert into t1 values (1, @v3, 103, @v4); +insert into t1 values (2, @v4, 201, @v5); +insert into t1 values (2, @v5, 202, @v6); +insert into t1 values (2, @v6, 203, @v7); +insert into t1 values (3, @v7, 301, @v8); +insert into t1 values (3, @v8, 302, @v9); +insert into t1 values (3, @v9, 303, @v1); +select a, sha1(b), c, sha1(d) from t1 order by a; +a sha1(b) c sha1(d) +1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6 +1 10d3c783026b310218d10b7188da96a2401648c6 102 a33549d9844092289a58ac348dd59f09fc28406a +1 a33549d9844092289a58ac348dd59f09fc28406a 103 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c +2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d +2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 202 090565c580809efed3d369481a4bbb168b20713e +2 090565c580809efed3d369481a4bbb168b20713e 203 1e0070bec426871a46291de27b9bd6e4255ab4e5 +3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e +3 acbaba01bc2e682f015f40e79d9cbe475db3002e 302 9ee30d99162574f79c66ae95cdf132dcf9cbc259 +3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 303 1d42dd9090cf78314a06665d4ea938c35cc760f4 +select a, sha1(b), c, sha1(d) from t1 where a = 1 and c = 101; +a sha1(b) c sha1(d) +1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6 +select a, sha1(b), c, sha1(d) from t1 where a = 2 and c = 201; +a sha1(b) c sha1(d) +2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d +select a, sha1(b), c, sha1(d) from t1 where a = 3 and c = 301; +a sha1(b) c sha1(d) +3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e +update t1 set b = @v3, d = @v4 where a = 1 and c = 102; +update t1 set b = @v6, d = @v7 where a = 2 and c = 202; +update t1 set b = @v9, d = @v1 where a = 3 and c = 302; +select a, sha1(b), c, sha1(d) from t1 order by a; +a sha1(b) c sha1(d) +1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6 +1 a33549d9844092289a58ac348dd59f09fc28406a 102 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c +1 a33549d9844092289a58ac348dd59f09fc28406a 103 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c +2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d +2 090565c580809efed3d369481a4bbb168b20713e 202 1e0070bec426871a46291de27b9bd6e4255ab4e5 +2 090565c580809efed3d369481a4bbb168b20713e 203 1e0070bec426871a46291de27b9bd6e4255ab4e5 +3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e +3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 302 1d42dd9090cf78314a06665d4ea938c35cc760f4 +3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 303 1d42dd9090cf78314a06665d4ea938c35cc760f4 +update t1 set b = @v4, d = @v5 where c = 103; +update t1 set b = @v7, d = @v8 where c = 203; +update t1 set b = @v1, d = @v2 where c = 303; +select a, sha1(b), c, sha1(d) from t1 order by a; +a sha1(b) c sha1(d) +1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6 +1 a33549d9844092289a58ac348dd59f09fc28406a 102 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c +1 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 103 70fc9a7d08beebc522258bfb02000a30c77a8f1d +2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d +2 090565c580809efed3d369481a4bbb168b20713e 202 1e0070bec426871a46291de27b9bd6e4255ab4e5 +2 1e0070bec426871a46291de27b9bd6e4255ab4e5 203 acbaba01bc2e682f015f40e79d9cbe475db3002e +3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e +3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 302 1d42dd9090cf78314a06665d4ea938c35cc760f4 +3 1d42dd9090cf78314a06665d4ea938c35cc760f4 303 10d3c783026b310218d10b7188da96a2401648c6 +update t1 set b = @v5, d = @v6; +select a, sha1(b), c, sha1(d) from t1 order by a; +a sha1(b) c sha1(d) +1 70fc9a7d08beebc522258bfb02000a30c77a8f1d 101 090565c580809efed3d369481a4bbb168b20713e +1 70fc9a7d08beebc522258bfb02000a30c77a8f1d 102 090565c580809efed3d369481a4bbb168b20713e +1 70fc9a7d08beebc522258bfb02000a30c77a8f1d 103 090565c580809efed3d369481a4bbb168b20713e +2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 201 090565c580809efed3d369481a4bbb168b20713e +2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 202 090565c580809efed3d369481a4bbb168b20713e +2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 203 090565c580809efed3d369481a4bbb168b20713e +3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 301 090565c580809efed3d369481a4bbb168b20713e +3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 302 090565c580809efed3d369481a4bbb168b20713e +3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 303 090565c580809efed3d369481a4bbb168b20713e +update t1 set b = @v1, d = @v2 where 100 < c and c < 200; +update t1 set b = @v4, d = @v5 where 200 < c and c < 300; +update t1 set b = @v7, d = @v8 where 300 < c and c < 400; +select a, sha1(b), c, sha1(d) from t1 order by a; +a sha1(b) c sha1(d) +1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6 +1 1d42dd9090cf78314a06665d4ea938c35cc760f4 102 10d3c783026b310218d10b7188da96a2401648c6 +1 1d42dd9090cf78314a06665d4ea938c35cc760f4 103 10d3c783026b310218d10b7188da96a2401648c6 +2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d +2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 202 70fc9a7d08beebc522258bfb02000a30c77a8f1d +2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 203 70fc9a7d08beebc522258bfb02000a30c77a8f1d +3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e +3 1e0070bec426871a46291de27b9bd6e4255ab4e5 302 acbaba01bc2e682f015f40e79d9cbe475db3002e +3 1e0070bec426871a46291de27b9bd6e4255ab4e5 303 acbaba01bc2e682f015f40e79d9cbe475db3002e +delete from t1 where a = 1 and c = 101; +delete from t1 where c = 102; +delete from t1; +select a, sha1(b), c, sha1(d) from t1 order by a; +a sha1(b) c sha1(d) +drop table t1; diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 2e293df50e2..0da071374ea 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -839,4 +839,51 @@ SHOW TABLE STATUS; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 MyISAM 10 Dynamic 0 0 0 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned DROP TABLE t1; +create table t1 (a int) +partition by list (a) +(partition `s1 s2` values in (0)); +drop table t1; +create table t1 (a int) +partition by list (a) +(partition `7` values in (0)); +drop table t1; +create table t1 (a int) +partition by list (a) +(partition `s1 s2 ` values in (0)); +ERROR HY000: Incorrect partition name +create table t1 (a int) +partition by list (a) +subpartition by hash (a) +(partition p1 values in (0) (subpartition `p1 p2 `)); +ERROR HY000: Incorrect partition name +CREATE TABLE t1 (a int) +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (NULL)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (NULL) ENGINE = MyISAM) +DROP TABLE t1; +CREATE TABLE t1 (a int) +PARTITION BY RANGE(a) +(PARTITION p0 VALUES LESS THAN (NULL)); +ERROR 42000: Not allowed to use NULL value in VALUES LESS THAN near '))' at line 3 +create table t1 (s1 int auto_increment primary key) +partition by list (s1) +(partition p1 values in (1), +partition p2 values in (2), +partition p3 values in (3)); +insert into t1 values (null); +insert into t1 values (null); +insert into t1 values (null); +select auto_increment from information_schema.tables where table_name='t1'; +auto_increment +4 +select * from t1; +s1 +1 +2 +3 +drop table t1; End of 5.1 tests diff --git a/mysql-test/r/partition_grant.result b/mysql-test/r/partition_grant.result new file mode 100644 index 00000000000..da0e00c9858 --- /dev/null +++ b/mysql-test/r/partition_grant.result @@ -0,0 +1,23 @@ +drop schema if exists mysqltest_1; +create schema mysqltest_1; +use mysqltest_1; +create table t1 (a int) partition by list (a) (partition p1 values in (1), partition p2 values in (2), partition p3 values in (3)); +insert into t1 values (1),(2); +grant select,alter on mysqltest_1.* to mysqltest_1@localhost; +show grants for current_user; +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' +GRANT SELECT, ALTER ON `mysqltest_1`.* TO 'mysqltest_1'@'localhost' +alter table t1 add b int; +alter table t1 drop partition p2; +ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1' +grant drop on mysqltest_1.* to mysqltest_1@localhost; +alter table t1 drop partition p2; +revoke alter on mysqltest_1.* from mysqltest_1@localhost; +alter table t1 drop partition p3; +ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' +revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop table t1; +drop schema mysqltest_1; +End of 5.1 tests diff --git a/mysql-test/r/partition_hash.result b/mysql-test/r/partition_hash.result index 64dcf8c5837..08faccd024e 100644 --- a/mysql-test/r/partition_hash.result +++ b/mysql-test/r/partition_hash.result @@ -73,3 +73,29 @@ drop table t1; CREATE TABLE t1 (s1 int) ENGINE=BLACKHOLE PARTITION BY HASH (s1); INSERT INTO t1 VALUES (0); DROP TABLE t1; +create table t1 (c1 int DEFAULT NULL, +c2 varchar (30) DEFAULT NULL, +c3 date DEFAULT NULL) +engine = myisam +partition by hash (to_days(c3)) +partitions 12; +insert into t1 values +(136,'abc','2002-01-05'),(142,'abc','2002-02-14'),(162,'abc','2002-06-28'), +(182,'abc','2002-11-09'),(158,'abc','2002-06-01'),(184,'abc','2002-11-22'); +select * from t1; +c1 c2 c3 +136 abc 2002-01-05 +158 abc 2002-06-01 +142 abc 2002-02-14 +162 abc 2002-06-28 +182 abc 2002-11-09 +184 abc 2002-11-22 +select * from t1 where c3 between '2002-01-01' and '2002-12-31'; +c1 c2 c3 +136 abc 2002-01-05 +158 abc 2002-06-01 +142 abc 2002-02-14 +162 abc 2002-06-28 +182 abc 2002-11-09 +184 abc 2002-11-22 +drop table t1; diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index 8b959cb6a3e..b13f0d55e39 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -659,3 +659,14 @@ explain partitions select count(*) from t1 where s1 < 0 or s1 is null; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p3 system NULL NULL NULL NULL 1 drop table t1; +create table t1 (a char(32) primary key) +partition by key() +partitions 100; +insert into t1 values ('na'); +select * from t1; +a +na +select * from t1 where a like 'n%'; +a +na +drop table t1; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 6db5e8f8157..3de7ab61e73 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -108,6 +108,9 @@ set @fvar= 123.4567; prepare stmt1 from @fvar; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123.4567' at line 1 drop table t1,t2; +deallocate prepare stmt3; +deallocate prepare stmt4; +deallocate prepare stmt5; PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?"; set @var='A'; EXECUTE stmt1 USING @var; @@ -253,6 +256,7 @@ set names latin1; execute ``; 1234 1234 +deallocate prepare ``; set names default; create table t1 (a varchar(10)) charset=utf8; insert into t1 (a) values ('yahoo'); @@ -781,6 +785,7 @@ EXECUTE b12651; 1 DROP VIEW b12651_V1; DROP TABLE b12651_T1, b12651_T2; +DEALLOCATE PREPARE b12651; prepare stmt from "select @@time_zone"; execute stmt; @@time_zone @@ -873,6 +878,130 @@ length(a) 10 drop table t1; deallocate prepare stmt; +create table t1 (col1 integer, col2 integer); +insert into t1 values(100,100),(101,101),(102,102),(103,103); +prepare stmt from 'select col1, col2 from t1 where (col1, col2) in ((?,?))'; +set @a=100, @b=100; +execute stmt using @a,@b; +col1 col2 +100 100 +set @a=101, @b=101; +execute stmt using @a,@b; +col1 col2 +101 101 +set @a=102, @b=102; +execute stmt using @a,@b; +col1 col2 +102 102 +set @a=102, @b=103; +execute stmt using @a,@b; +col1 col2 +deallocate prepare stmt; +drop table t1; +set @old_max_prepared_stmt_count= @@max_prepared_stmt_count; +show variables like 'max_prepared_stmt_count'; +Variable_name Value +max_prepared_stmt_count 16382 +show variables like 'prepared_stmt_count'; +Variable_name Value +prepared_stmt_count 0 +select @@max_prepared_stmt_count, @@prepared_stmt_count; +@@max_prepared_stmt_count @@prepared_stmt_count +16382 0 +set global max_prepared_stmt_count=-1; +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +0 +set global max_prepared_stmt_count=10000000000000000; +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +1048576 +set global max_prepared_stmt_count=default; +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +16382 +set @@max_prepared_stmt_count=1; +ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL +set max_prepared_stmt_count=1; +ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL +set local max_prepared_stmt_count=1; +ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL +set local prepared_stmt_count=0; +ERROR HY000: Variable 'prepared_stmt_count' is a read only variable +set @@prepared_stmt_count=0; +ERROR HY000: Variable 'prepared_stmt_count' is a read only variable +set global prepared_stmt_count=1; +ERROR HY000: Variable 'prepared_stmt_count' is a read only variable +set global max_prepared_stmt_count=1; +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +1 +set global max_prepared_stmt_count=0; +select @@max_prepared_stmt_count, @@prepared_stmt_count; +@@max_prepared_stmt_count @@prepared_stmt_count +0 0 +prepare stmt from "select 1"; +ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0) +select @@prepared_stmt_count; +@@prepared_stmt_count +0 +set global max_prepared_stmt_count=1; +prepare stmt from "select 1"; +select @@prepared_stmt_count; +@@prepared_stmt_count +1 +prepare stmt1 from "select 1"; +ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 1) +select @@prepared_stmt_count; +@@prepared_stmt_count +1 +deallocate prepare stmt; +select @@prepared_stmt_count; +@@prepared_stmt_count +0 +prepare stmt from "select 1"; +select @@prepared_stmt_count; +@@prepared_stmt_count +1 +prepare stmt from "select 2"; +select @@prepared_stmt_count; +@@prepared_stmt_count +1 +select @@prepared_stmt_count, @@max_prepared_stmt_count; +@@prepared_stmt_count @@max_prepared_stmt_count +1 1 +set global max_prepared_stmt_count=0; +prepare stmt from "select 1"; +ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0) +execute stmt; +ERROR HY000: Unknown prepared statement handler (stmt) given to EXECUTE +select @@prepared_stmt_count; +@@prepared_stmt_count +0 +prepare stmt from "select 1"; +ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0) +select @@prepared_stmt_count; +@@prepared_stmt_count +0 +set global max_prepared_stmt_count=3; +select @@max_prepared_stmt_count, @@prepared_stmt_count; +@@max_prepared_stmt_count @@prepared_stmt_count +3 0 +prepare stmt from "select 1"; +prepare stmt from "select 2"; +prepare stmt1 from "select 3"; +prepare stmt2 from "select 4"; +ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 3) +prepare stmt2 from "select 4"; +ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 3) +select @@max_prepared_stmt_count, @@prepared_stmt_count; +@@max_prepared_stmt_count @@prepared_stmt_count +3 3 +deallocate prepare stmt; +select @@max_prepared_stmt_count, @@prepared_stmt_count; +@@max_prepared_stmt_count @@prepared_stmt_count +3 0 +set global max_prepared_stmt_count= @old_max_prepared_stmt_count; create table t1 (id int); prepare ins_call from "insert into t1 (id) values (1)"; execute ins_call; @@ -883,6 +1012,7 @@ drop table t1; create table t1 (a int, b int); insert into t1 (a,b) values (2,8),(1,9),(3,7); prepare stmt from "select * from t1 order by ?"; +set @a=NULL; execute stmt using @a; a b 2 8 diff --git a/mysql-test/r/rpl_ndb_dd_advance.result b/mysql-test/r/rpl_ndb_dd_advance.result index 9d9a4e5b5ad..ba89592b532 100644 --- a/mysql-test/r/rpl_ndb_dd_advance.result +++ b/mysql-test/r/rpl_ndb_dd_advance.result @@ -370,13 +370,10 @@ COUNT(*) 10000 ***** Add some more records to master ********* ***** Finsh the slave sync process ******* -* 1. * @the_epoch:=MAX(epoch) <the_epoch> -* 2. * @the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) <the_pos> master-bin.000001 -* 3. * * 4. * * 5. * START SLAVE; diff --git a/mysql-test/r/rpl_ndb_relay_space.result b/mysql-test/r/rpl_ndb_relay_space.result deleted file mode 100644 index 1e25b7fe8c1..00000000000 --- a/mysql-test/r/rpl_ndb_relay_space.result +++ /dev/null @@ -1,25 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -SHOW VARIABLES LIKE 'relay_log_space_limit'; -Variable_name Value -relay_log_space_limit 0 -CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=NDB; -INSERT INTO t1 SET name='Andy', age=31; -INSERT t1 SET name='Jacob', age=2; -INSERT into t1 SET name='Caleb', age=1; -ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY; -SELECT * FROM t1 ORDER BY id; -name age id -Andy 31 00000001 -Caleb 1 00000002 -Jacob 2 00000003 -SELECT * FROM t1 ORDER BY id; -name age id -Andy 31 00000001 -Caleb 1 00000002 -Jacob 2 00000003 -drop table t1; diff --git a/mysql-test/r/rpl_ndb_sync.result b/mysql-test/r/rpl_ndb_sync.result index 897737e95d5..4ca73167603 100644 --- a/mysql-test/r/rpl_ndb_sync.result +++ b/mysql-test/r/rpl_ndb_sync.result @@ -25,13 +25,13 @@ hex(c2) hex(c3) c1 0 1 BCDEF 1 0 CD 0 0 DEFGHIJKL -CREATE TEMPORARY TABLE IF NOT EXISTS cluster.backup_info (id INT, backup_id INT)ENGINE=HEAP; -DELETE FROM cluster.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster.backup_info FIELDS TERMINATED BY ','; -SELECT @the_backup_id:=backup_id FROM cluster.backup_info; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +DELETE FROM test.backup_info; +LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id <the_backup_id> -DROP TABLE cluster.backup_info; +DROP TABLE test.backup_info; UPDATE t1 SET c2=0 WHERE c3="row2"; SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; hex(c1) hex(c2) c3 diff --git a/mysql-test/r/rpl_relay_space_innodb.result b/mysql-test/r/rpl_relay_space_innodb.result index 80d8c48c241..54aac2eca35 100644 --- a/mysql-test/r/rpl_relay_space_innodb.result +++ b/mysql-test/r/rpl_relay_space_innodb.result @@ -8,9 +8,9 @@ SHOW VARIABLES LIKE 'relay_log_space_limit'; Variable_name Value relay_log_space_limit 0 CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=InnoDB; -INSERT INTO t1 SET name='Andy', age=31; -INSERT t1 SET name='Jacob', age=2; -INSERT into t1 SET name='Caleb', age=1; +INSERT INTO t1 SET name='Andy', age=31; +INSERT INTO t1 SET name='Jacob', age=2; +INSERT INTO t1 SET name='Caleb', age=1; ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY; SELECT * FROM t1 ORDER BY id; name age id @@ -22,4 +22,4 @@ name age id Andy 31 00000001 Jacob 2 00000002 Caleb 1 00000003 -drop table t1; +DROP TABLE t1; diff --git a/mysql-test/r/rpl_relay_space_myisam.result b/mysql-test/r/rpl_relay_space_myisam.result index 02bff7ae881..e8d2d63e46e 100644 --- a/mysql-test/r/rpl_relay_space_myisam.result +++ b/mysql-test/r/rpl_relay_space_myisam.result @@ -8,9 +8,9 @@ SHOW VARIABLES LIKE 'relay_log_space_limit'; Variable_name Value relay_log_space_limit 0 CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=MyISAM; -INSERT INTO t1 SET name='Andy', age=31; -INSERT t1 SET name='Jacob', age=2; -INSERT into t1 SET name='Caleb', age=1; +INSERT INTO t1 SET name='Andy', age=31; +INSERT INTO t1 SET name='Jacob', age=2; +INSERT INTO t1 SET name='Caleb', age=1; ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY; SELECT * FROM t1 ORDER BY id; name age id @@ -22,4 +22,4 @@ name age id Andy 31 00000001 Jacob 2 00000002 Caleb 1 00000003 -drop table t1; +DROP TABLE t1; diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result index 5e3030f2c7a..bc5cc262079 100644 --- a/mysql-test/r/rpl_temporary.result +++ b/mysql-test/r/rpl_temporary.result @@ -74,3 +74,17 @@ f 7 drop table t1,t2; create temporary table t3 (f int); +create temporary table t4 (f int); +create table t5 (f int); +drop table if exists t999; +create temporary table t999 (f int); +LOAD DATA INFILE "./tmp/bl_dump_thread_id" into table t999; +drop table t999; +insert into t4 values (1); +kill `select id from information_schema.processlist where command='Binlog Dump'`; +insert into t5 select * from t4; +select * from t5 /* must be 1 after reconnection */; +f +1 +drop temporary table t4; +drop table t5; diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result index 298ee9678a2..c66adbe871d 100644 --- a/mysql-test/r/type_bit.result +++ b/mysql-test/r/type_bit.result @@ -564,3 +564,12 @@ b1+0 sum(b1) sum(b2) 1 4 4 2 2 2 drop table t1, t2; +create table t1 (a bit(7)); +insert into t1 values (0x60); +select * from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a a 16 7 1 Y 0 0 63 +a +` +drop table t1; +End of 5.0 tests diff --git a/mysql-test/r/type_bit_innodb.result b/mysql-test/r/type_bit_innodb.result index fcaa9bfedda..8dc016d5a4a 100644 --- a/mysql-test/r/type_bit_innodb.result +++ b/mysql-test/r/type_bit_innodb.result @@ -402,3 +402,12 @@ t1 CREATE TABLE `t1` ( `b` bit(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; +create table t1 (a bit(7)) engine=innodb; +insert into t1 values (0x60); +select * from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a a 16 7 1 Y 0 0 63 +a +` +drop table t1; +End of 5.0 tests diff --git a/mysql-test/r/upgrade.result b/mysql-test/r/upgrade.result index 9d35314d0c6..8a2249480e9 100644 --- a/mysql-test/r/upgrade.result +++ b/mysql-test/r/upgrade.result @@ -41,19 +41,19 @@ t1 t-1 drop database `mysqltest1`; drop database `mysqltest-1`; -drop table if exists `txu@0023P@0023p1`; -drop table if exists `txu#P#p1`; -create table `txu#P#p1` (s1 int); -insert into `txu#P#p1` values (1); -select * from `txu@0023P@0023p1`; -ERROR 42S02: Table 'test.txu@0023P@0023p1' doesn't exist -create table `txu@0023P@0023p1` (s1 int); -insert into `txu@0023P@0023p1` values (2); -select * from `txu@0023P@0023p1`; +drop table if exists `txu@0023p@0023p1`; +drop table if exists `txu#p#p1`; +create table `txu#p#p1` (s1 int); +insert into `txu#p#p1` values (1); +select * from `txu@0023p@0023p1`; +ERROR 42S02: Table 'test.txu@0023p@0023p1' doesn't exist +create table `txu@0023p@0023p1` (s1 int); +insert into `txu@0023p@0023p1` values (2); +select * from `txu@0023p@0023p1`; s1 2 -select * from `txu#P#p1`; +select * from `txu#p#p1`; s1 1 -drop table `txu@0023P@0023p1`; -drop table `txu#P#p1`; +drop table `txu@0023p@0023p1`; +drop table `txu#p#p1`; diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index fc3e5475ae7..0b6ebe9dd89 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -2579,3 +2579,24 @@ COUNT(*) 2 DROP VIEW v2; DROP TABLE t1, t2; +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, +td date DEFAULT NULL, KEY idx(td)); +INSERT INTO t1 VALUES +(1, '2005-01-01'), (2, '2005-01-02'), (3, '2005-01-02'), +(4, '2005-01-03'), (5, '2005-01-04'), (6, '2005-01-05'), +(7, '2005-01-05'), (8, '2005-01-05'), (9, '2005-01-06'); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT * FROM t1 WHERE td BETWEEN '2005.01.02' AND '2005.01.04'; +id td +2 2005-01-02 +3 2005-01-02 +4 2005-01-03 +5 2005-01-04 +SELECT * FROM v1 WHERE td BETWEEN '2005.01.02' AND '2005.01.04'; +id td +2 2005-01-02 +3 2005-01-02 +4 2005-01-03 +5 2005-01-04 +DROP VIEW v1; +DROP TABLE t1; diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 52f80000015..61dd1390a6a 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -468,6 +468,30 @@ extractValue(@xml, '/a/@b[substring(.,2,1)="1"]') select extractValue(@xml, '/a/@b[substring(.,2,1)="2"]'); extractValue(@xml, '/a/@b[substring(.,2,1)="2"]') 12 22 +SET @xml='<a><b>b1</b><b>b2</b></a>'; +SELECT extractValue(@xml, '/a/b[string-length("x")=1]'); +extractValue(@xml, '/a/b[string-length("x")=1]') +b1 b2 +SELECT extractValue(@xml, '/a/b[string-length("xx")=2]'); +extractValue(@xml, '/a/b[string-length("xx")=2]') +b1 b2 +SELECT extractValue(@xml, '/a/b[string-length("xxx")=2]'); +extractValue(@xml, '/a/b[string-length("xxx")=2]') + +SELECT extractValue(@xml, '/a/b[string-length("x")]'); +extractValue(@xml, '/a/b[string-length("x")]') +b1 +SELECT extractValue(@xml, '/a/b[string-length("xx")]'); +extractValue(@xml, '/a/b[string-length("xx")]') +b2 +SELECT extractValue(@xml, '/a/b[string-length()]'); +extractValue(@xml, '/a/b[string-length()]') +b2 +SELECT extractValue(@xml, 'string-length()'); +ERROR HY000: XPATH syntax error: '' +SELECT extractValue(@xml, 'string-length("x")'); +extractValue(@xml, 'string-length("x")') +1 SET @xml='<a b="b11" b="b12" b="b21" b="22"/>'; select extractValue(@xml,'/a/@b'); extractValue(@xml,'/a/@b') @@ -609,9 +633,35 @@ extractvalue('<a>Jack</a>','/a[contains(../a,"j")]' collate latin1_bin) select extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]'); extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]') +select ExtractValue('<tag1><![CDATA[test]]></tag1>','/tag1'); +ExtractValue('<tag1><![CDATA[test]]></tag1>','/tag1') +test select extractValue('<e>1</e>','position()'); ERROR HY000: XPATH syntax error: '' select extractValue('<e>1</e>','last()'); ERROR HY000: XPATH syntax error: '' select extractValue('<e><a>1</a></e>','/e/'); ERROR HY000: XPATH syntax error: '' +set names utf8; +select extractValue('<Ñ><r>r</r></Ñ>','/Ñ/r'); +extractValue('<Ñ><r>r</r></Ñ>','/Ñ/r') +r +select extractValue('<r><Ñ>Ñ</Ñ></r>','/r/Ñ'); +extractValue('<r><Ñ>Ñ</Ñ></r>','/r/Ñ') +Ñ +select extractValue('<Ñ r="r"/>','/Ñ/@r'); +extractValue('<Ñ r="r"/>','/Ñ/@r') +r +select extractValue('<r Ñ="Ñ"/>','/r/@Ñ'); +extractValue('<r Ñ="Ñ"/>','/r/@Ñ') +Ñ +DROP PROCEDURE IF EXISTS p2; +CREATE PROCEDURE p2 () +BEGIN +DECLARE p LONGTEXT CHARACTER SET UTF8 DEFAULT '<Ñ><r>A</r></Ñ>'; +SELECT EXTRACTVALUE(p,'/Ñ/r'); +END// +CALL p2(); +EXTRACTVALUE(p,'/Ñ/r') +A +DROP PROCEDURE p2; diff --git a/mysql-test/std_data/cacert.pem b/mysql-test/std_data/cacert.pem new file mode 100644 index 00000000000..a63dae57767 --- /dev/null +++ b/mysql-test/std_data/cacert.pem @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDcTCCAtqgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEBhMCU0Ux +EDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMSEwHwYDVQQDExhB +YnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAvBgkqhkiG9w0BCQEWImFic3RyYWN0 +Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wHhcNMDMwOTEyMTYxNDE2WhcNMTMw +OTA5MTYxNDE2WjCBiDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAP +BgNVBAoTCE15U1FMIEFCMSEwHwYDVQQDExhBYnN0cmFjdCBNeVNRTCBEZXZlbG9w +ZXIxMTAvBgkqhkiG9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNx +bC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKrT7zp5tp5djXp+TEQs +5ZEds1XUglp/EQUQ1FMMb1Xe6gqJsQ62O+jsUe0nrUjXBrUCUy49k6mcnmQtZREj +l1pWKmzx1fgcYpxTwxaY7IKB2jik5IWprhVPmSQ+AWss43oolXMZWR+csKehqm3j ++YNZc9NsR4ydE71l0VEtJEQvAgMBAAGjgegwgeUwHQYDVR0OBBYEFIiYZdnz8osD +HWZgYSP6rXNt02iSMIG1BgNVHSMEga0wgaqAFIiYZdnz8osDHWZgYSP6rXNt02iS +oYGOpIGLMIGIMQswCQYDVQQGEwJTRTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UE +ChMITXlTUUwgQUIxITAfBgNVBAMTGEFic3RyYWN0IE15U1FMIERldmVsb3BlcjEx +MC8GCSqGSIb3DQEJARYiYWJzdHJhY3QubXlzcWwuZGV2ZWxvcGVyQG15c3FsLmNv +bYIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4GBAGIL22MCIU/0sKDp +pZIhoabvNVDTfuhtene+WBCrzCzGXPZjB4+b/KAJJNvOR4zi43Kk7euu+PENs9M7 +nKpInMdhvT1RcCnUHJ3jBCvDDzXab2msqn3rxhwetWWbfE0OeEn/PoQcwiZCe7x5 +h+Zz+oUbvsEe4DjtDVgG4UH9nSSS +-----END CERTIFICATE----- diff --git a/mysql-test/std_data/client-cert.pem b/mysql-test/std_data/client-cert.pem new file mode 100644 index 00000000000..4c81162c911 --- /dev/null +++ b/mysql-test/std_data/client-cert.pem @@ -0,0 +1,67 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=SE, L=Uppsala, O=MySQL AB, CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com + Validity + Not Before: Sep 12 16:21:19 2003 GMT + Not After : Sep 9 16:21:19 2013 GMT + Subject: C=SE, L=Uppsala, O=MySQL AB, CN=MySQL Client/Email=abstract.mysql.developer@mysql.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:c4:03:0a:ee:e3:b1:12:fc:ee:b4:19:f4:e1:60: + 1d:e0:28:c3:96:2d:df:82:69:cd:74:7c:54:58:d0: + ae:b3:59:3f:0c:19:1c:99:10:a6:12:c9:cf:3a:64: + 05:43:8e:bf:d2:65:36:80:91:0b:65:b0:27:26:38: + c9:23:d8:36:a2:4a:f0:f7:c0:2f:68:38:70:01:27: + 29:ff:b2:c5:52:e1:6b:f1:c8:d7:c3:5c:ee:f0:37: + 6c:2a:9b:96:1a:05:9e:eb:33:a2:39:5a:77:66:62: + 27:75:1f:2f:6f:38:da:e5:9f:78:af:ca:6b:22:3f: + 57:2b:bc:a6:8f:47:d1:99:6f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Comment: + OpenSSL Generated Certificate + X509v3 Subject Key Identifier: + 80:81:A9:22:EB:AB:D6:CA:7E:3F:8D:BB:D1:AC:2A:F4:87:9D:13:29 + X509v3 Authority Key Identifier: + keyid:88:98:65:D9:F3:F2:8B:03:1D:66:60:61:23:FA:AD:73:6D:D3:68:92 + DirName:/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com + serial:00 + + Signature Algorithm: md5WithRSAEncryption + 86:17:1c:f3:9f:10:1b:75:47:03:ca:54:ea:ef:f7:15:54:8d: + 8f:58:c9:64:7d:de:2e:bf:ea:a6:5d:72:56:c9:81:be:bb:1c: + 78:a5:91:d6:f8:77:df:9d:d2:cb:94:d9:06:61:4f:05:21:22: + 2a:ea:9e:c3:8b:4d:fe:94:c7:98:61:cd:7e:88:19:c9:92:01: + 1f:10:5b:c6:16:95:99:9b:32:01:3a:89:df:fa:0a:89:ac:fa: + b5:40:55:7a:ca:0a:bd:5d:8b:06:d8:7e:e1:44:8c:70:c8:63: + c7:77:6a:37:3d:a4:ac:57:dc:00:c1:c1:f3:72:17:5b:50:95: + ee:b7 +-----BEGIN CERTIFICATE----- +MIIDkTCCAvqgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEBhMCU0Ux +EDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMSEwHwYDVQQDExhB +YnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAvBgkqhkiG9w0BCQEWImFic3RyYWN0 +Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wHhcNMDMwOTEyMTYyMTE5WhcNMTMw +OTA5MTYyMTE5WjB8MQswCQYDVQQGEwJTRTEQMA4GA1UEBxMHVXBwc2FsYTERMA8G +A1UEChMITXlTUUwgQUIxFTATBgNVBAMTDE15U1FMIENsaWVudDExMC8GCSqGSIb3 +DQEJARYiYWJzdHJhY3QubXlzcWwuZGV2ZWxvcGVyQG15c3FsLmNvbTCBnzANBgkq +hkiG9w0BAQEFAAOBjQAwgYkCgYEAxAMK7uOxEvzutBn04WAd4CjDli3fgmnNdHxU +WNCus1k/DBkcmRCmEsnPOmQFQ46/0mU2gJELZbAnJjjJI9g2okrw98AvaDhwAScp +/7LFUuFr8cjXw1zu8DdsKpuWGgWe6zOiOVp3ZmIndR8vbzja5Z94r8prIj9XK7ym +j0fRmW8CAwEAAaOCARQwggEQMAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9w +ZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBSAgaki66vWyn4/ +jbvRrCr0h50TKTCBtQYDVR0jBIGtMIGqgBSImGXZ8/KLAx1mYGEj+q1zbdNokqGB +jqSBizCBiDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoT +CE15U1FMIEFCMSEwHwYDVQQDExhBYnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAv +BgkqhkiG9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb22C +AQAwDQYJKoZIhvcNAQEEBQADgYEAhhcc858QG3VHA8pU6u/3FVSNj1jJZH3eLr/q +pl1yVsmBvrsceKWR1vh3353Sy5TZBmFPBSEiKuqew4tN/pTHmGHNfogZyZIBHxBb +xhaVmZsyATqJ3/oKiaz6tUBVesoKvV2LBth+4USMcMhjx3dqNz2krFfcAMHB83IX +W1CV7rc= +-----END CERTIFICATE----- diff --git a/mysql-test/std_data/client-key.pem b/mysql-test/std_data/client-key.pem new file mode 100644 index 00000000000..58fa805e620 --- /dev/null +++ b/mysql-test/std_data/client-key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQDEAwru47ES/O60GfThYB3gKMOWLd+Cac10fFRY0K6zWT8MGRyZ +EKYSyc86ZAVDjr/SZTaAkQtlsCcmOMkj2DaiSvD3wC9oOHABJyn/ssVS4WvxyNfD +XO7wN2wqm5YaBZ7rM6I5WndmYid1Hy9vONrln3ivymsiP1crvKaPR9GZbwIDAQAB +AoGAcR7IaoGhKbIrGGl6d67+zuT3q24h9aOV3Mn7653TlNHGnvbHGFcRYPpyy+H5 +X7m8XnHm+F+80hzNGzPecP9Q12oPOyoZgeQn6bTK73OFkNcX7FAkNdyH4xVhf2aK +YOzTcQfq3gRCqXtVIg4qBShTMjJLE31R8H430Or62XmJgFECQQDjP+Kz+ecQwuTB +HADLm+GQgceIB1kLgdQoZ3deUxGvqtVImuDRViSM0F2srfJ4GfkEDhc27UI5f6ir +ZTOw4ww7AkEA3M9wCPgWNtbOXbYjaNA0IzHcjMDxQDVvJAmb3EiZlKQp4EfrESxR +ly/u08TyfwrK6q5WS7xE0ad8+95G1af4XQJBAI9+3ME20SB1YItMCniHYwSj3oHX +2fN5NKWax/Zoz+c0IV+qZMHq+kNso2oRoOUTyXk1CJWndcTnBnPMALr2c9cCQQCZ +VL7Cq6uZVx6kemcqUHH0AprZbt3YLYLI7pc5p3xmeHzPzoEQQstBhjp8+aU+zPrN +blRkcQ8E2x5yNA7SLLrNAkAhzkA+EK8hc0f9W3ncy+py0Rn0i5Ay0N3T715vkThf +CfOHE3L91dLlmYpL5xVqOpugY/2sHyxwctv97DgS6tHZ +-----END RSA PRIVATE KEY----- diff --git a/mysql-test/std_data/server-cert.pem b/mysql-test/std_data/server-cert.pem new file mode 100644 index 00000000000..debf7026e3c --- /dev/null +++ b/mysql-test/std_data/server-cert.pem @@ -0,0 +1,67 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 2 (0x2) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=SE, L=Uppsala, O=MySQL AB, CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com + Validity + Not Before: Sep 12 16:22:06 2003 GMT + Not After : Sep 9 16:22:06 2013 GMT + Subject: C=SE, L=Uppsala, O=MySQL AB, CN=MySQL Server/Email=abstract.mysql.developer@mysql.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:e9:86:7a:55:84:88:4c:be:a4:f8:92:73:30:12: + 49:0b:7a:85:87:39:34:39:0d:7d:0b:8d:18:c2:17: + 95:13:52:d2:3f:55:10:57:c8:3f:5a:f5:b2:fa:8b: + d0:67:49:cc:aa:82:fc:9f:ce:00:b4:73:f3:36:d2: + 3a:d3:c2:b0:0e:14:c3:d4:b2:21:74:a1:f0:31:81: + 60:87:98:73:5c:10:c1:b1:1a:4d:f1:f3:b0:98:3f: + f0:d7:97:9b:2b:fd:d5:21:79:b2:2f:eb:64:15:c9: + 9b:9d:fc:9e:2d:d4:f8:04:5b:ea:a9:75:4b:42:c3: + 3d:0e:4d:2a:a8:b8:ca:99:8d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Comment: + OpenSSL Generated Certificate + X509v3 Subject Key Identifier: + 6E:E4:9B:6A:C5:EA:E4:E6:C7:EF:D7:1E:C8:63:45:60:2B:1B:D4:D4 + X509v3 Authority Key Identifier: + keyid:88:98:65:D9:F3:F2:8B:03:1D:66:60:61:23:FA:AD:73:6D:D3:68:92 + DirName:/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com + serial:00 + + Signature Algorithm: md5WithRSAEncryption + 31:77:69:b9:bd:ab:29:f3:fc:5a:09:16:6f:5d:42:ea:ba:01: + 55:69:e3:75:cf:b8:d1:b7:b9:bf:da:63:85:8c:48:92:06:60: + 76:97:e0:00:78:4b:ad:da:ab:6a:90:6d:8b:03:a8:b1:e9:09: + 78:e1:29:98:56:12:60:6b:42:fe:e8:a7:c4:f8:d6:15:07:e8: + 2b:c2:d8:8a:e5:1b:2e:51:08:9b:56:e3:b3:7a:4c:3e:e5:be: + 4a:4d:f8:65:7b:a8:21:e0:ca:fe:8b:ab:d7:ec:f2:2d:f7:d0: + bf:d7:c5:23:1c:08:d8:aa:57:c7:f3:5f:ba:33:3f:78:d1:f4: + 8e:5e +-----BEGIN CERTIFICATE----- +MIIDkTCCAvqgAwIBAgIBAjANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEBhMCU0Ux +EDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMSEwHwYDVQQDExhB +YnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAvBgkqhkiG9w0BCQEWImFic3RyYWN0 +Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wHhcNMDMwOTEyMTYyMjA2WhcNMTMw +OTA5MTYyMjA2WjB8MQswCQYDVQQGEwJTRTEQMA4GA1UEBxMHVXBwc2FsYTERMA8G +A1UEChMITXlTUUwgQUIxFTATBgNVBAMTDE15U1FMIFNlcnZlcjExMC8GCSqGSIb3 +DQEJARYiYWJzdHJhY3QubXlzcWwuZGV2ZWxvcGVyQG15c3FsLmNvbTCBnzANBgkq +hkiG9w0BAQEFAAOBjQAwgYkCgYEA6YZ6VYSITL6k+JJzMBJJC3qFhzk0OQ19C40Y +wheVE1LSP1UQV8g/WvWy+ovQZ0nMqoL8n84AtHPzNtI608KwDhTD1LIhdKHwMYFg +h5hzXBDBsRpN8fOwmD/w15ebK/3VIXmyL+tkFcmbnfyeLdT4BFvqqXVLQsM9Dk0q +qLjKmY0CAwEAAaOCARQwggEQMAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9w +ZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBRu5Jtqxerk5sfv +1x7IY0VgKxvU1DCBtQYDVR0jBIGtMIGqgBSImGXZ8/KLAx1mYGEj+q1zbdNokqGB +jqSBizCBiDELMAkGA1UEBhMCU0UxEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoT +CE15U1FMIEFCMSEwHwYDVQQDExhBYnN0cmFjdCBNeVNRTCBEZXZlbG9wZXIxMTAv +BgkqhkiG9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb22C +AQAwDQYJKoZIhvcNAQEEBQADgYEAMXdpub2rKfP8WgkWb11C6roBVWnjdc+40be5 +v9pjhYxIkgZgdpfgAHhLrdqrapBtiwOosekJeOEpmFYSYGtC/uinxPjWFQfoK8LY +iuUbLlEIm1bjs3pMPuW+Sk34ZXuoIeDK/our1+zyLffQv9fFIxwI2KpXx/NfujM/ +eNH0jl4= +-----END CERTIFICATE----- diff --git a/mysql-test/std_data/server-key.pem b/mysql-test/std_data/server-key.pem new file mode 100644 index 00000000000..4292dc79929 --- /dev/null +++ b/mysql-test/std_data/server-key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQDphnpVhIhMvqT4knMwEkkLeoWHOTQ5DX0LjRjCF5UTUtI/VRBX +yD9a9bL6i9BnScyqgvyfzgC0c/M20jrTwrAOFMPUsiF0ofAxgWCHmHNcEMGxGk3x +87CYP/DXl5sr/dUhebIv62QVyZud/J4t1PgEW+qpdUtCwz0OTSqouMqZjQIDAQAB +AoGBALTq11nrjIEQbdSZ+R1z/R0kddB2U+wjdA3/6P9tr7PBxVsFdtzbKaI5mcib +iwCKX0J2qmrP+SHUdsexBZxLR4KV/Z55v9Pym99Dy+DxDA95zURyCMKRBIzlU5uN +F7USEQoltLUCsmZwNWdit0gfxSWdddkHNuI0uxTzHwuDcUlNAkEA/76zVremngNL +DlekM9NPn/8E/TXBHN1b1jdUKd7WymSJykdcm3viU98dFNZFWF8B0jiTcuBKXgpR +vTShNab/swJBAOnCGp554BLhioTyyk8qjRLt3xEsjsDljJULHVLYWcUqIkMf97GL +VLBhl6ZEI9i0WduqvgZ+Bacd0uHqIHz1Yb8CQQDm1CjqTDiGxlIoT9JVNJTZxEOs +h6gVdXY+kxHT+N3FL5luiZp8fAR7zxVgiUVtzdLG+2madfapiobcT3RyCJkhAkBI +64AaR7KasTjg2Ew7/e4cJZAcb2XozrLYG6t+GHeIhehCQEqoW+qDSy5fc4orI7eU +SuMUa2OgCjGqv7p6wKFJAkEAznmum/MbVOBpC4FsdnIGkxyFKIbh2OLY2aUb2KkK +Ouf4S8Y5Ldgszi0fnDPRaxWJzewwZKvcff2zj+mYZeAXbA== +-----END RSA PRIVATE KEY----- diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index 535402c2e13..7e091991475 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1486,6 +1486,9 @@ select * from t1; alter table t1 add unique key (i, v); select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn'); +alter table t1 data directory="$MYSQLTEST_VARDIR/tmp"; +select * from t1; + # # Cleanup, test is over # diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test index 7e09f44397c..533da542855 100644 --- a/mysql-test/t/cast.test +++ b/mysql-test/t/cast.test @@ -171,6 +171,8 @@ select cast(1.0e+300 as signed int); CREATE TABLE t1 (f1 double); INSERT INTO t1 SET f1 = -1.0e+30 ; INSERT INTO t1 SET f1 = +1.0e+30 ; +# Expected result is +-1e+30, but Windows returns +-1e+030. +--replace_result 1e+030 1e+30 SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1; DROP TABLE t1; diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index 63c76e79fc7..9ba99167ab9 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1477,8 +1477,29 @@ CREATE TABLE test_repair_table5 ( CHECK TABLE test_repair_table5; REPAIR TABLE test_repair_table5; SELECT * FROM test_repair_table5; -DROP TABLE test_repair_table5; +INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT", 1876); +SELECT * FROM test_repair_table5; +# Corrupt a table -- put a row with wrong # of columns at end of file +--exec perl -e 'print "\"1\",\"101\",\"IBM\"\n";' >> $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV + +FLUSH TABLES; +CHECK TABLE test_repair_table5; +REPAIR TABLE test_repair_table5; +# The correct record inserted should still be in the file +SELECT * FROM test_repair_table5; +INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT2", 1876); +SELECT * FROM test_repair_table5; + +# Corrupt table again -- put a row with wrong # of columns at end of file +--exec perl -e 'print "\"1\",\"101\",\"IBM\"\n";' >> $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV + +FLUSH TABLES; +CHECK TABLE test_repair_table5; +REPAIR TABLE test_repair_table5; +# The two correct records inserted should still be in the file +SELECT * FROM test_repair_table5; +DROP TABLE test_repair_table5; # # BUG#13406 - incorrect amount of "records deleted" diff --git a/mysql-test/t/ctype_filename.test b/mysql-test/t/ctype_filename.test new file mode 100644 index 00000000000..436ccfc4f2e --- /dev/null +++ b/mysql-test/t/ctype_filename.test @@ -0,0 +1,21 @@ +--disable_warnings +drop table if exists con, aux, nul, lpt1, com1, `clock$`; +--enable_warnings + +create table con (a int); +drop table con; + +create table aux (a int); +drop table aux; + +create table nul (a int); +drop table nul; + +create table lpt1 (a int); +drop table lpt1; + +create table com1 (a int); +drop table com1; + +create table `clock$` (a int); +drop table `clock$`; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 8827eab6bb5..2a9feec91c1 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -4,46 +4,53 @@ # # Separate the test case name and the comment with ':'. # -# <testcasename> : Comment test +# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment> # # Do not use any TAB characters for whitespace. # ############################################################################## -events_bugs : test case unstable (race conditions). andrey will fix -events_stress : test case unstable. andrey will fix -events : test case unstable. andrey will fix -#ndb_alter_table_row : sometimes wrong error 1015!=1046 -ndb_autodiscover : Needs to be fixed w.r.t binlog -ndb_autodiscover2 : Needs to be fixed w.r.t binlog -#ndb_binlog_basic : Results are not deterministic, Tomas will fix -#ndb_binlog_multi : Results are not deterministic, Tomas will fix -ndb_cache2 : Bug #18597 -ndb_gis : Bug #18600 -ndb_load : Bug#17233 -partition_03ndb : Bug#16385 -ps_7ndb : dbug assert in RBR mode when executing test suite -#rpl_bit_npk : Bug#13418 -#rpl_ddl : Bug#15963 SBR does not show "Definer" correctly -rpl_ndb_dd_basic : Bug #18569 -rpl_ndb_2innodb : assertion in get_parts_for_update() -rpl_ndb_2myisam : assertion in get_parts_for_update() -rpl_ndb_auto_inc : Bug#17086 -rpl_ndb_basic : Bug #18592 -#rpl_ndb_blob : interferes with following tests, causing hang -#rpl_ndb_blob2 : interferes with following tests, causing hang -rpl_ndb_ddl : master hangs -#rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails -rpl_ndb_insert_ignore : Bug #18567 -rpl_ndb_innodb2ndb : Bug#18261: Cluster Replication: tests rpl_ndb_xxx2ndb fails -rpl_ndb_myisam2ndb : Bug#18261: Cluster Replication: tests rpl_ndb_xxx2ndb fails -rpl_ndb_multi_update3 : Bug#18627: Cluster Replication: rpl_ndb_multi_update3 fails on Intel 64 bit -rpl_ndb_log : result not deterministic, TBD if should remove -rpl_ndb_relay_space : Bug#16993 -#rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails -rpl_switch_stm_row_mixed : Bug #18590 -rpl_row_inexist_tbl : Disabled since patch makes this test wait forever -rpl_sp : Bug#16456 -rpl_until : Unstable test case, bug#15886 -sp-goto : GOTO is currently is disabled - will be fixed in the future -mysqldump : BUG#18078 -udf : Bug#18564 (Permission by Brian) +events_bugs : BUG#17619 2006-02-21 andrey Race conditions +events_stress : BUG#17619 2006-02-21 andrey Race conditions +events : BUG#17619 2006-02-21 andrey Race conditions +events_scheduling : BUG#18958 2006-04-13 andrey Test case unstable +events_logs_tests : BUG#18953 2006-04-12 kent Test is randomly failing +ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog +ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog +ndb_cache2 : BUG#18597 2006-03-28 brian simultaneous drop table and ndb statistics update triggers node failure +ndb_cache_multi2 : BUG#18597 2006-04-10 kent simultaneous drop table and ndb statistics update triggers node failure +partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table +ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open +rpl_deadlock_innodb : BUG#16920 2006-04-12 kent fails in show slave status (randomly) +rpl_ndb_2innodb : BUG#19004 2006-03-22 tomas ndb: partition by range and update hangs +rpl_ndb_2myisam : BUG#19004 2006-03-22 tomas ndb: partition by range and update hangs +rpl_ndb_auto_inc : BUG#17086 2006-02-16 jmiller CR: auto_increment_increment and auto_increment_offset produce duplicate key er +rpl_ndb_ddl : result file needs update + test needs to checked +rpl_ndb_innodb2ndb : BUG#18094 2006-03-16 mats Slave caches invalid table definition after atlters causes select failure +rpl_ndb_log : BUG#18947 2006-03-21 tomas CRBR: order in binlog of create table and insert (on different table) not determ +rpl_ndb_myisam2ndb : BUG#18094 2006-03-16 mats Slave caches invalid table definition after atlters causes select failure +#rpl_ndb_relay_space : BUG#16993 2006-02-16 jmiller RBR: ALTER TABLE ZEROFILL AUTO_INCREMENT is not replicated correctly +rpl_switch_stm_row_mixed : BUG#18590 2006-03-28 brian +#rpl_row_basic_7ndb : BUG#17400 2006-04-09 brian Cluster Replication: delete & update of rows in table without pk fails on slave. +rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly +rpl_row_func003 : BUG#19074 2006-13-04 andrei test failed +rpl_row_inexist_tbl : BUG#18948 2006-03-09 mats Disabled since patch makes this test wait forever +rpl_sp : BUG#16456 2006-02-16 jmiller +rpl_until : BUG#15886 2006-02-16 jmiller Unstable test case +sp-goto : BUG#18949 2006-02-16 jmiller GOTO is currently is disabled - will be fixed in the future +mysqldump : BUG#18078 2006-03-10 lars +udf : BUG#18564 2006-03-27 ian (Permission by Brian) + +# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open +#ndb_binlog_ddl_multi : BUG#18976 2006-04-10 kent CRBR: multiple binlog, second binlog may miss schema log events + +# the below ndb failures have not been objerved for > 5 push builds, close bugs +#ndb_gis : BUG#18600 2006-03-28 brian ndb_gis test failure +#ndb_load : BUG#17233 2006-02-16 jmiller failed load data from infile causes mysqld dbug_assert, binlog not flushed +#rpl_ndb_basic : BUG#18592 2006-03-28 brian rpl_ndb_basic failure +#rpl_ndb_dd_advance : BUG#18924 2006-04-09 brian rpl_ndb_dd_advance failure +rpl_ndb_dd_partitions : BUG#18094 2006-04-19 mats Slave caches invalid table definition... +#rpl_ndb_dd_basic : BUG#18569 2006-03-28 brian rpl_ndb_dd_basic failure +#rpl_ndb_insert_ignore : BUG#18567 2006-03-28 brian rpl_ndb_insert_ignore failure +#rpl_ndb_multi_update2 : BUG#18928 2006-04-09 brian rpl_ndb_multi_update2 failed +#rpl_ndb_multi_update3 : BUG#18627 2006-03-29 monty Cluster Replication: rpl_ndb_multi_update3 fails on Intel 64 bit +#rpl_ndb_trig004 : BUG#18977 2006-04-10 kent Test fails randomly diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index c98c1c94609..4e4fb8f777a 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -446,4 +446,26 @@ select timestampdiff(year,'1999-09-11','2001-9-11'); select timestampdiff(year,'2004-02-28','2005-02-28'); select timestampdiff(year,'2004-02-29','2005-02-28'); +# +# Bug #18618: BETWEEN for dates with the second argument being a constant +# expression and the first and the third arguments being fields +# + +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, day date); +CREATE TABLE t2 (id int NOT NULL PRIMARY KEY, day date); + +INSERT INTO t1 VALUES + (1, '2005-06-01'), (2, '2005-02-01'), (3, '2005-07-01'); +INSERT INTO t2 VALUES + (1, '2005-08-01'), (2, '2005-06-15'), (3, '2005-07-15'); + +SELECT * FROM t1, t2 + WHERE t1.day BETWEEN + '2005.09.01' - INTERVAL 6 MONTH AND t2.day; +SELECT * FROM t1, t2 + WHERE CAST(t1.day AS DATE) BETWEEN + '2005.09.01' - INTERVAL 6 MONTH AND t2.day; + +DROP TABLE t1,t2; + # End of 5.0 tests diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 9e5bc4bc136..9b21e544657 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -354,7 +354,9 @@ drop table t1; # when the server is run on Windows or with --lower-case-table-names=1 # +--disable_warnings DROP SCHEMA IF EXISTS HU; +--enable_warnings CREATE SCHEMA HU ; USE HU ; diff --git a/mysql-test/t/index_merge_innodb.test b/mysql-test/t/index_merge_innodb.test index a48626a9ec3..25f4e0b4e65 100644 --- a/mysql-test/t/index_merge_innodb.test +++ b/mysql-test/t/index_merge_innodb.test @@ -248,3 +248,55 @@ select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6' drop table t1; +# BUG#19021: Crash in index_merge/ROR-intersection optimizer under +# specific circumstances. +create table t1 ( + pk int(11) not null auto_increment, + a int(11) not null default '0', + b int(11) not null default '0', + c int(11) not null default '0', + + filler1 datetime, filler2 varchar(15), + filler3 longtext, + + kp1 varchar(4), kp2 varchar(7), + kp3 varchar(2), kp4 varchar(4), + kp5 varchar(7), + filler4 char(1), + + primary key (pk), + key idx1(a,b,c), + key idx2(c), + key idx3(kp1,kp2,kp3,kp4,kp5) +) engine=innodb default charset=latin1; +--disable_query_log +set @fill= uncompress(unhex(concat( +'F91D0000789CDD993D6FDB301086F7FE0A6D4E0105B8E3F1335D5BA028DA0EEDE28E1D320408', +'52A0713BF4D7571FB62C51A475924839080307B603E77DEE787C8FA41F9E9EEF7F1F8A87A7C3', +'AFE280C5DF9F8F7FEE9F8B1B2CB114D6902E918455245DB91300FA16E42D5201FA4EE29DA05D', +'B9FB3718A33718A3FA8C30AEFAFDE1F317D016AA67BA7A60FDE45BF5F8BA7B5BDE8812AA9F1A', +'069DB03C9804346644F3A3A6A1338DB572756A3C4D1BCC804CABF912C654AE9BB855A2B85962', +'3A479259CAE6A86C0411D01AE5483581EDCBD9A39C45252D532E533979EB9F82E971D979BDB4', +'8531105670740AFBFD1E34AAB0029E4AD0A1D46A6D0946A21A16038A5CD965CD2D524673F712', +'20C304477315CE18405EAF9BD0AFFEAC74FDA14F1FBF5BD34C769D73FBBEDF4750ADD4E5A99C', +'5C8DC04934AFA275D483D536D174C11B12AF27F8F888B41B6FC9DBA569E1FD7BD72D698130B7', +'91B23A98803512B3D31881E8DCDA2AC1754E3644C4BB3A8466750B911681274A39E35E8624B7', +'444A42AC1213F354758E3CF1A4CDD5A688C767CF1B11ABC5867CB15D8A18E0B91E9EC275BB94', +'58F33C2936F64690D55BC29E4A293D95A798D84217736CEAAA538CE1354269EE2162053FBC66', +'496D90CB53323CB279D3A6AF651B4B22B9E430743D83BE48E995A09D4FC9871C22D8D189B945', +'706911BCB8C3C774B9C08D2FC6ED853ADACA37A14A4CB2E027630E5B80ECACD939431B1CDF62', +'7D71487536EA2C678F59685E91F4B6C144BCCB94C1EBA9FA6F5552DDCA4E4539BE326A2720CB', +'45ED028EB3616AC93C46E775FEA9FA6DA7CFCEC6DEBA5FCD1F915EED4D983BDDB881528AD9AB', +'43C1576F29AAB35BDFBC21D422F52B307D350589D45225A887AC46C8EDD72D99EC3ED2E1BCEF', +'7AF26FC4C74097B6768A5EDAFA660CC64278F7E63F99AC954B'))); +prepare x from @fill; +execute x; +deallocate prepare x; +--enable_query_log +set @fill=NULL; +SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND + kp1='279' AND kp2='ELM0678' AND kp3='6' AND kp4='10' AND kp5 = 'R '; + +drop table t1; + + diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 0a8e46d694c..ab408e9b4a5 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1142,6 +1142,41 @@ drop table t2, t1; # +# Let us test binlog_cache_use and binlog_cache_disk_use status vars. +# Actually this test has nothing to do with innodb per se, it just requires +# transactional table. +# +flush status; +show status like "binlog_cache_use"; +show status like "binlog_cache_disk_use"; + +create table t1 (a int) engine=innodb; + +# Now we are going to create transaction which is long enough so its +# transaction binlog will be flushed to disk... +let $1=2000; +disable_query_log; +begin; +while ($1) +{ + eval insert into t1 values( $1 ); + dec $1; +} +commit; +enable_query_log; +show status like "binlog_cache_use"; +show status like "binlog_cache_disk_use"; + +# Transaction which should not be flushed to disk and so should not +# increase binlog_cache_disk_use. +begin; +delete from t1; +commit; +show status like "binlog_cache_use"; +show status like "binlog_cache_disk_use"; +drop table t1; + +# # Bug #6126: Duplicate columns in keys gives misleading error message # --error 1060 @@ -1255,6 +1290,15 @@ select * from t1 where x > -16; select count(*) from t1 where x = 18446744073709551601; drop table t1; + +# Test for testable InnoDB status variables. This test +# uses previous ones(pages_created, rows_deleted, ...). +show status like "Innodb_buffer_pool_pages_total"; +show status like "Innodb_page_size"; +show status like "Innodb_rows_deleted"; +show status like "Innodb_rows_inserted"; +show status like "Innodb_rows_updated"; + # Test for row locks InnoDB status variables. show status like "Innodb_row_lock_waits"; show status like "Innodb_row_lock_current_waits"; @@ -2086,6 +2130,18 @@ disconnect a; disconnect b; # +# Bug #14360: problem with intervals +# + +create table t1(a date) engine=innodb; +create table t2(a date, key(a)) engine=innodb; +insert into t1 values('2005-10-01'); +insert into t2 values('2005-10-01'); +select * from t1, t2 + where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; +drop table t1, t2; + +# # Test that cascading updates leading to duplicate keys give the correct # error message (bug #9680) # @@ -2137,4 +2193,3 @@ alter table t1 drop foreign key c2_fk; show create table t1; # drop table t1, t2; - diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index ddde6cfa5d3..f3dd8e7e199 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -175,3 +175,4 @@ select count(*) from t2; insert into t2 select t1.* from t1, t2 t, t3 where t1.id1 = t.id2 and t.id2 = t3.id3; select count(*) from t2; drop table t1,t2,t3; + diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index dbf65845e6a..95cba2743da 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -61,3 +61,9 @@ drop table t1; # Bug#16859 -- NULLs in columns must not truncate data as if a C-language "string". # --exec $MYSQL -t test -e "create table t1 (col1 binary(4), col2 varchar(10), col3 int); insert into t1 values ('a', 'b', 123421),('a ', '0123456789', 4), ('abcd', '', 4); select concat('>',col1,'<'), col2, col3 from t1; drop table t1;" 2>&1 + +# +# Bug#18265 -- mysql client: No longer right-justifies numeric columns +# +--exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int, k char(25) charset utf8); insert into t1 (i) values (1); insert into t1 (k) values ('<----------------------->'); insert into t1 (k) values ('<-----'); insert into t1 (k) values ('Τη γλώσσα'); insert into t1 (k) values ('ᛖᚴ ᚷᛖᛏ'); select * from t1; DROP TABLE t1;" + diff --git a/mysql-test/t/ndb_alter_table2.test b/mysql-test/t/ndb_alter_table2.test new file mode 100644 index 00000000000..afe6e44f698 --- /dev/null +++ b/mysql-test/t/ndb_alter_table2.test @@ -0,0 +1,85 @@ +-- source include/have_ndb.inc +-- source include/have_multi_ndb.inc +-- source include/not_embedded.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +connect (con1,localhost,root,,test); +connect (con2,localhost,root,,test); +connect (con3,localhost,root,,test); +connect (con4,localhost,root,,test); +connect (con5,localhost,root,,test); +connect (con6,localhost,root,,test); + +CREATE TABLE t1 ( + a INT NOT NULL PRIMARY KEY, + b INT NOT NULL +) ENGINE=ndbcluster; + +connection con1; +BEGIN; +INSERT INTO t1 VALUES (9410,9412); +connection con2; +BEGIN; +--send +INSERT INTO t1 VALUES (9411,9412); +connection con3; +BEGIN; +--send +INSERT INTO t1 VALUES (9412,9412); +connection con4; +BEGIN; +--send +INSERT INTO t1 VALUES (9413,9412); +connection con5; +BEGIN; +--send +INSERT INTO t1 VALUES (9414,9412); +connection con6; +BEGIN; +--send +INSERT INTO t1 VALUES (9415,9412); +connection con1; +sleep 1; + +ROLLBACK; +connection con2; +reap; +ROLLBACK; +connection con3; +reap; +ROLLBACK; +connection con4; +reap; +ROLLBACK; +connection con5; +reap; +ROLLBACK; +connection con6; +reap; +ROLLBACK; + +connection server2; + +drop table t1; +CREATE TABLE t1 ( + a INT NOT NULL PRIMARY KEY, + b INT NOT NULL, + c INT NOT NULL +) ENGINE=ndbcluster; + +connection server1; + +--disable_result_log +--error 0,1412 +select * from t1; +--enable_result_log +select * from t1; +select * from t1; +select * from t1; +select * from t1; +select * from t1; + +drop table t1; diff --git a/mysql-test/t/ndb_alter_table_stm.test b/mysql-test/t/ndb_alter_table_stm.test index 2c52b542b12..bf162dd0d50 100644 --- a/mysql-test/t/ndb_alter_table_stm.test +++ b/mysql-test/t/ndb_alter_table_stm.test @@ -17,6 +17,12 @@ select * from t1 where c = 'two'; connection server1; alter table t1 drop index c; connection server2; + +--disable_result_log +--error 0,1412 +select * from t1 where c = 'two'; +--enable_result_log + select * from t1 where c = 'two'; connection server1; drop table t1; diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index df94545abea..ab62e3dd13a 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -6,17 +6,6 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; drop database if exists mysqltest; --enable_warnings -# workaround for bug#16445 -# remove to reproduce bug and run tests drom ndb start -# and with ndb_autodiscover disabled -CREATE TABLE t1 ( - pk1 INT NOT NULL PRIMARY KEY, - attr1 INT NOT NULL, - attr2 INT, - attr3 VARCHAR(10) -) ENGINE=ndbcluster; -drop table t1; - # # Basic test to show that the NDB # table handler is working diff --git a/mysql-test/t/ndb_binlog_ddl_multi.test b/mysql-test/t/ndb_binlog_ddl_multi.test index 120117d1e0a..f41e7c3a527 100644 --- a/mysql-test/t/ndb_binlog_ddl_multi.test +++ b/mysql-test/t/ndb_binlog_ddl_multi.test @@ -58,13 +58,19 @@ reset master; ALTER DATABASE mysqltest CHARACTER SET latin1; -# drop table and drop should come after data events ---connection server2 -drop table mysqltest.t1; +# having drop here instead of below sometimes triggers bug#18976 +## drop table and drop should come after data events +#--connection server2 +#drop table mysqltest.t1; --connection server1 --source include/show_binlog_events.inc +# to track down bug#18976 +--real_sleep 10 +--source include/show_binlog_events.inc +--connection server2 +drop table mysqltest.t1; # drop database and drop should come after data events --connection server1 @@ -127,10 +133,16 @@ ENGINE = NDB; DROP LOGFILE GROUP lg1 ENGINE =NDB; -drop table t1; +# having drop here instead of below sometimes triggers bug#18976 +#drop table t1; --connection server2 --source include/show_binlog_events.inc +# to track down bug#18976 +--real_sleep 10 +--source include/show_binlog_events.inc + +drop table t1; # # Bug #17827 cluster: rename of several tables in one statement, diff --git a/mysql-test/t/ndb_blob_partition.test b/mysql-test/t/ndb_blob_partition.test new file mode 100644 index 00000000000..a3948cc9491 --- /dev/null +++ b/mysql-test/t/ndb_blob_partition.test @@ -0,0 +1,93 @@ +--source include/have_ndb.inc +-- source include/not_embedded.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# Minimal NDB blobs test with range partitions. +# + +create table t1 ( + a mediumint not null, + b text not null, + c int not null, + d longblob, + primary key using hash (a,c), + unique key (c) +) + engine=ndb + partition by range (c) + partitions 3 + ( partition p1 values less than (200), + partition p2 values less than (300), + partition p3 values less than (400)); + +--disable_query_log +sleep 1; + +# length 61 +set @s0 = 'rggurloniukyehuxdbfkkyzlceixzrehqhvxvxbpwizzvjzpucqmzrhzxzfau'; +set @s1 = 'ykyymbzqgqlcjhlhmyqelfoaaohvtbekvifukdtnvcrrjveevfakxarxexomz'; +set @s2 = 'dbnfqyzgtqxalcrwtfsqabknvtfcbpoonxsjiqvmhnfikxxhcgoexlkoezvah'; + +set @v1 = repeat(@s0, 100); -- 1d42dd9090cf78314a06665d4ea938c35cc760f4 +set @v2 = repeat(@s1, 200); -- 10d3c783026b310218d10b7188da96a2401648c6 +set @v3 = repeat(@s2, 300); -- a33549d9844092289a58ac348dd59f09fc28406a +set @v4 = repeat(@s0, 400); -- daa61c6de36a0526f0d47dc29d6b9de7e6d2630c +set @v5 = repeat(@s1, 500); -- 70fc9a7d08beebc522258bfb02000a30c77a8f1d +set @v6 = repeat(@s2, 600); -- 090565c580809efed3d369481a4bbb168b20713e +set @v7 = repeat(@s0, 700); -- 1e0070bec426871a46291de27b9bd6e4255ab4e5 +set @v8 = repeat(@s1, 800); -- acbaba01bc2e682f015f40e79d9cbe475db3002e +set @v9 = repeat(@s2, 900); -- 9ee30d99162574f79c66ae95cdf132dcf9cbc259 +--enable_query_log + +# -- insert -- +insert into t1 values (1, @v1, 101, @v2); +insert into t1 values (1, @v2, 102, @v3); +insert into t1 values (1, @v3, 103, @v4); +insert into t1 values (2, @v4, 201, @v5); +insert into t1 values (2, @v5, 202, @v6); +insert into t1 values (2, @v6, 203, @v7); +insert into t1 values (3, @v7, 301, @v8); +insert into t1 values (3, @v8, 302, @v9); +insert into t1 values (3, @v9, 303, @v1); +select a, sha1(b), c, sha1(d) from t1 order by a; + +# -- pk read -- +select a, sha1(b), c, sha1(d) from t1 where a = 1 and c = 101; +select a, sha1(b), c, sha1(d) from t1 where a = 2 and c = 201; +select a, sha1(b), c, sha1(d) from t1 where a = 3 and c = 301; + +# -- pk update -- +update t1 set b = @v3, d = @v4 where a = 1 and c = 102; +update t1 set b = @v6, d = @v7 where a = 2 and c = 202; +update t1 set b = @v9, d = @v1 where a = 3 and c = 302; +select a, sha1(b), c, sha1(d) from t1 order by a; + +# -- hash index update -- +update t1 set b = @v4, d = @v5 where c = 103; +update t1 set b = @v7, d = @v8 where c = 203; +update t1 set b = @v1, d = @v2 where c = 303; +select a, sha1(b), c, sha1(d) from t1 order by a; + +# -- full scan update -- +update t1 set b = @v5, d = @v6; +select a, sha1(b), c, sha1(d) from t1 order by a; + +# -- range scan update +update t1 set b = @v1, d = @v2 where 100 < c and c < 200; +update t1 set b = @v4, d = @v5 where 200 < c and c < 300; +update t1 set b = @v7, d = @v8 where 300 < c and c < 400; +select a, sha1(b), c, sha1(d) from t1 order by a; + +# -- delete -- +delete from t1 where a = 1 and c = 101; +delete from t1 where c = 102; +# delete from t1 where c < 300; # XXX coredump +delete from t1; +select a, sha1(b), c, sha1(d) from t1 order by a; + +# -- clean up -- +drop table t1; diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index a3aa3f6f025..272cdc27af6 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -956,4 +956,57 @@ PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM); SHOW TABLE STATUS; DROP TABLE t1; +# +#BUG 18750 Problems with partition names +# +create table t1 (a int) +partition by list (a) +(partition `s1 s2` values in (0)); +drop table t1; + +create table t1 (a int) +partition by list (a) +(partition `7` values in (0)); +drop table t1; + +--error ER_WRONG_PARTITION_NAME +create table t1 (a int) +partition by list (a) +(partition `s1 s2 ` values in (0)); + +--error ER_WRONG_PARTITION_NAME +create table t1 (a int) +partition by list (a) +subpartition by hash (a) +(partition p1 values in (0) (subpartition `p1 p2 `)); + +# +# BUG 18752 SHOW CREATE TABLE doesn't show NULL value in SHOW CREATE TABLE +# +CREATE TABLE t1 (a int) +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (NULL)); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--error 1064 +CREATE TABLE t1 (a int) +PARTITION BY RANGE(a) +(PARTITION p0 VALUES LESS THAN (NULL)); + +# +# Bug#18753 Partitions: auto_increment fails +# +create table t1 (s1 int auto_increment primary key) +partition by list (s1) +(partition p1 values in (1), + partition p2 values in (2), + partition p3 values in (3)); +insert into t1 values (null); +insert into t1 values (null); +insert into t1 values (null); +select auto_increment from information_schema.tables where table_name='t1'; +select * from t1; +drop table t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/partition_grant.test b/mysql-test/t/partition_grant.test new file mode 100644 index 00000000000..e2e80a7ca04 --- /dev/null +++ b/mysql-test/t/partition_grant.test @@ -0,0 +1,51 @@ +-- source include/have_partition.inc +# Grant tests not performed with embedded server +-- source include/not_embedded.inc + +--disable_warnings +drop schema if exists mysqltest_1; +--enable_warnings + + +# +# Bug #17139: ALTER TABLE ... DROP PARTITION should require DROP privilege +# + +create schema mysqltest_1; +use mysqltest_1; + +create table t1 (a int) partition by list (a) (partition p1 values in (1), partition p2 values in (2), partition p3 values in (3)); +insert into t1 values (1),(2); + +grant select,alter on mysqltest_1.* to mysqltest_1@localhost; + +connect (conn1,localhost,mysqltest_1,,mysqltest_1); +show grants for current_user; +alter table t1 add b int; +--error ER_TABLEACCESS_DENIED_ERROR +alter table t1 drop partition p2; +disconnect conn1; + +connection default; +grant drop on mysqltest_1.* to mysqltest_1@localhost; + +connect (conn2,localhost,mysqltest_1,,mysqltest_1); +alter table t1 drop partition p2; +disconnect conn2; + +connection default; +revoke alter on mysqltest_1.* from mysqltest_1@localhost; + +connect (conn3,localhost,mysqltest_1,,mysqltest_1); +--error ER_TABLEACCESS_DENIED_ERROR +alter table t1 drop partition p3; +disconnect conn3; + +connection default; + +revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop table t1; +drop schema mysqltest_1; + +--echo End of 5.1 tests diff --git a/mysql-test/t/partition_hash.test b/mysql-test/t/partition_hash.test index 75a36713694..8494de98371 100644 --- a/mysql-test/t/partition_hash.test +++ b/mysql-test/t/partition_hash.test @@ -90,3 +90,22 @@ drop table t1; CREATE TABLE t1 (s1 int) ENGINE=BLACKHOLE PARTITION BY HASH (s1); INSERT INTO t1 VALUES (0); DROP TABLE t1; + +# +# BUG 18423 Hash partitioning can lose rows in some queries +# +create table t1 (c1 int DEFAULT NULL, + c2 varchar (30) DEFAULT NULL, + c3 date DEFAULT NULL) +engine = myisam +partition by hash (to_days(c3)) +partitions 12; + +insert into t1 values +(136,'abc','2002-01-05'),(142,'abc','2002-02-14'),(162,'abc','2002-06-28'), +(182,'abc','2002-11-09'),(158,'abc','2002-06-01'),(184,'abc','2002-11-22'); +select * from t1; +select * from t1 where c3 between '2002-01-01' and '2002-12-31'; + +drop table t1; + diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 71fed4f20c9..0c922392d32 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -554,3 +554,15 @@ drop table t1; # No tests for NULLs in RANGE(monotonic_expr()) - they depend on BUG#15447 # being fixed. + +# +#BUG 17946 Like searches fail with partitioning +# +create table t1 (a char(32) primary key) +partition by key() +partitions 100; +insert into t1 values ('na'); +select * from t1; +select * from t1 where a like 'n%'; +drop table t1; + diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index b54efcad3a3..9ffdb72ca22 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -114,6 +114,9 @@ set @fvar= 123.4567; prepare stmt1 from @fvar; drop table t1,t2; +deallocate prepare stmt3; +deallocate prepare stmt4; +deallocate prepare stmt5; # # Bug #4105: Server crash on attempt to prepare a statement with character @@ -257,6 +260,7 @@ prepare `ü` from 'select 1234'; execute `ü` ; set names latin1; execute ``; +deallocate prepare ``; set names default; @@ -823,6 +827,7 @@ EXECUTE b12651; DROP VIEW b12651_V1; DROP TABLE b12651_T1, b12651_T2; +DEALLOCATE PREPARE b12651; # # Bug#9359 "Prepared statements take snapshot of system vars at PREPARE @@ -921,6 +926,143 @@ select length(a) from t1; drop table t1; deallocate prepare stmt; +# +# Bug#16248 "WHERE (col1,col2) IN ((?,?)) gives wrong results": +# check that ROW implementation is reexecution-friendly. +# +create table t1 (col1 integer, col2 integer); +insert into t1 values(100,100),(101,101),(102,102),(103,103); +prepare stmt from 'select col1, col2 from t1 where (col1, col2) in ((?,?))'; +set @a=100, @b=100; +execute stmt using @a,@b; +set @a=101, @b=101; +execute stmt using @a,@b; +set @a=102, @b=102; +execute stmt using @a,@b; +set @a=102, @b=103; +execute stmt using @a,@b; +deallocate prepare stmt; +drop table t1; + +# +# Bug#16365 Prepared Statements: DoS with too many open statements +# Check that the limit @@max_prpeared_stmt_count works. +# +# Save the old value +set @old_max_prepared_stmt_count= @@max_prepared_stmt_count; +# +# Disable prepared statement protocol: in this test we set +# @@max_prepared_stmt_count to 0 or 1 and would like to test the limit +# manually. +# +--disable_ps_protocol +# +# A. Check that the new variables are present in SHOW VARIABLES list. +# +show variables like 'max_prepared_stmt_count'; +show variables like 'prepared_stmt_count'; +# +# B. Check that the new variables are selectable. +# +select @@max_prepared_stmt_count, @@prepared_stmt_count; +# +# C. Check that max_prepared_stmt_count is settable (global only), +# whereas prepared_stmt_count is readonly. +# +set global max_prepared_stmt_count=-1; +select @@max_prepared_stmt_count; +set global max_prepared_stmt_count=10000000000000000; +select @@max_prepared_stmt_count; +set global max_prepared_stmt_count=default; +select @@max_prepared_stmt_count; +--error ER_GLOBAL_VARIABLE +set @@max_prepared_stmt_count=1; +--error ER_GLOBAL_VARIABLE +set max_prepared_stmt_count=1; +--error ER_GLOBAL_VARIABLE +set local max_prepared_stmt_count=1; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +set local prepared_stmt_count=0; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +set @@prepared_stmt_count=0; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +set global prepared_stmt_count=1; +# set to a reasonable limit works +set global max_prepared_stmt_count=1; +select @@max_prepared_stmt_count; +# +# D. Check that the variables actually work. +# +set global max_prepared_stmt_count=0; +select @@max_prepared_stmt_count, @@prepared_stmt_count; +--error ER_MAX_PREPARED_STMT_COUNT_REACHED +prepare stmt from "select 1"; +select @@prepared_stmt_count; +set global max_prepared_stmt_count=1; +prepare stmt from "select 1"; +select @@prepared_stmt_count; +--error ER_MAX_PREPARED_STMT_COUNT_REACHED +prepare stmt1 from "select 1"; +select @@prepared_stmt_count; +deallocate prepare stmt; +select @@prepared_stmt_count; +# +# E. Check that we can prepare a statement with the same name +# successfully, without hitting the limit. +# +prepare stmt from "select 1"; +select @@prepared_stmt_count; +prepare stmt from "select 2"; +select @@prepared_stmt_count; +# +# F. We can set the max below the current count. In this case no new +# statements should be allowed to prepare. +# +select @@prepared_stmt_count, @@max_prepared_stmt_count; +set global max_prepared_stmt_count=0; +--error ER_MAX_PREPARED_STMT_COUNT_REACHED +prepare stmt from "select 1"; +# Result: the old statement is deallocated, the new is not created. +--error 1243 # ER_UNKNOWN_STMT_HANDLER +execute stmt; +select @@prepared_stmt_count; +--error ER_MAX_PREPARED_STMT_COUNT_REACHED +prepare stmt from "select 1"; +select @@prepared_stmt_count; +# +# G. Show that the variables are up to date even after a connection with all +# statements in it was terminated. +# +set global max_prepared_stmt_count=3; +select @@max_prepared_stmt_count, @@prepared_stmt_count; +prepare stmt from "select 1"; +connect (con1,localhost,root,,); +connection con1; +prepare stmt from "select 2"; +prepare stmt1 from "select 3"; +--error ER_MAX_PREPARED_STMT_COUNT_REACHED +prepare stmt2 from "select 4"; +connection default; +--error ER_MAX_PREPARED_STMT_COUNT_REACHED +prepare stmt2 from "select 4"; +select @@max_prepared_stmt_count, @@prepared_stmt_count; +disconnect con1; +connection default; +# Wait for the connection to die: deal with a possible race +deallocate prepare stmt; +let $count= `select @@prepared_stmt_count`; +if ($count) +{ +--sleep 2 + let $count= `select @@prepared_stmt_count`; +} +select @@max_prepared_stmt_count, @@prepared_stmt_count; +# +# Restore the old value. +# +set global max_prepared_stmt_count= @old_max_prepared_stmt_count; +--enable_ps_protocol + # End of 4.1 tests # @@ -946,6 +1088,7 @@ insert into t1 (a,b) values (2,8),(1,9),(3,7); # Will order by index prepare stmt from "select * from t1 order by ?"; +set @a=NULL; execute stmt using @a; set @a=1; execute stmt using @a; diff --git a/mysql-test/t/rpl_ndb_bank.test b/mysql-test/t/rpl_ndb_bank.test index 102450fce91..3601c841c54 100644 --- a/mysql-test/t/rpl_ndb_bank.test +++ b/mysql-test/t/rpl_ndb_bank.test @@ -132,34 +132,7 @@ let the_backup_id=`select @the_backup_id`; # # now setup replication to continue from last epoch -# 1. get apply_status epoch from slave -# 2. get corresponding _next_ binlog postition from master -# 3. change master on slave -# 4. start the replication - -# 1. ---connection slave ---replace_column 1 <the_epoch> -SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status; ---let $the_epoch= `select @the_epoch` - -# 2. ---connection master ---replace_result $the_epoch <the_epoch> ---replace_column 1 <the_pos> -eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) - FROM cluster.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1; ---let $the_pos= `SELECT @the_pos` ---let $the_file= `SELECT @the_file` - -# 3. ---connection slave ---replace_result $the_pos <the_pos> -eval CHANGE MASTER TO - master_log_file = '$the_file', - master_log_pos = $the_pos; - -# 4. +--source include/ndb_setup_slave.inc --connection slave START SLAVE; diff --git a/mysql-test/t/rpl_ndb_basic.test b/mysql-test/t/rpl_ndb_basic.test index bcce0284642..d7d1d50d88f 100644 --- a/mysql-test/t/rpl_ndb_basic.test +++ b/mysql-test/t/rpl_ndb_basic.test @@ -146,4 +146,4 @@ select * from t1 order by nid; # cleanup --connection master DROP TABLE t1; -sync_slave_with_master; +-- source include/master-slave-end.inc diff --git a/mysql-test/t/rpl_ndb_dd_advance.test b/mysql-test/t/rpl_ndb_dd_advance.test index 97a6dae0dec..80ff533ec5b 100644 --- a/mysql-test/t/rpl_ndb_dd_advance.test +++ b/mysql-test/t/rpl_ndb_dd_advance.test @@ -479,29 +479,9 @@ while ($j) # 5. start the replication --echo ***** Finsh the slave sync process ******* -# 1. ---echo * 1. * -connection slave; --disable_query_log ---replace_column 1 <the_epoch> -SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status; ---let $the_epoch= `select @the_epoch` - -# 2. ---echo * 2. * -connection master; ---replace_column 1 <the_pos> -eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) - FROM cluster.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1; ---let $the_pos= `SELECT @the_pos` ---let $the_file= `SELECT @the_file` - -# 3. ---echo * 3. * -connection slave; -eval CHANGE MASTER TO - master_log_file = '$the_file', - master_log_pos = $the_pos; +# 1. 2. 3. +--source include/ndb_setup_slave.inc --enable_query_log # 4. diff --git a/mysql-test/t/rpl_ndb_dd_basic.test b/mysql-test/t/rpl_ndb_dd_basic.test index f515e0299ac..104be91e6e4 100644 --- a/mysql-test/t/rpl_ndb_dd_basic.test +++ b/mysql-test/t/rpl_ndb_dd_basic.test @@ -82,4 +82,4 @@ drop datafile 'datafile02.dat' engine=ndb; DROP TABLESPACE ts1 ENGINE=NDB; DROP LOGFILE GROUP lg1 ENGINE=NDB; ---sync_slave_with_master +-- source include/master-slave-end.inc diff --git a/mysql-test/t/rpl_ndb_dd_partitions.test b/mysql-test/t/rpl_ndb_dd_partitions.test new file mode 100644 index 00000000000..026c31bbdc7 --- /dev/null +++ b/mysql-test/t/rpl_ndb_dd_partitions.test @@ -0,0 +1,301 @@ +####################################### +# Author: JBM # +# Date: 2006-03-09 # +# Purpose: To test the replication of # +# Cluster Disk Data using partitions # +####################################### + +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--echo --- Doing pre test cleanup --- + +connection master; +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_query_log + + +# Start by creating a logfile group +################################## + +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M +ENGINE=NDB; + +ALTER LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile02.dat' +INITIAL_SIZE = 4M +ENGINE=NDB; + +################################################### +# Create a tablespace connected to the logfile group +################################################### + +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE NDB; + +ALTER TABLESPACE ts1 +ADD DATAFILE 'datafile02.dat' +INITIAL_SIZE = 4M +ENGINE=NDB; + +################################################################# + +--echo --- Start test 2 partition RANGE testing -- +--echo --- Do setup -- + + +################################################# +# Requirment: Create table that is partitioned # +# by range on year i.e. year(t) and replicate # +# basice operations such at insert, update # +# delete between 2 different storage engines # +# Alter table and ensure table is handled # +# Correctly on the slave # +################################################# + +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), + bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, + f FLOAT DEFAULT 0, total BIGINT UNSIGNED, + y YEAR, t DATE) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB + PARTITION BY RANGE (YEAR(t)) + (PARTITION p0 VALUES LESS THAN (1901), + PARTITION p1 VALUES LESS THAN (1946), + PARTITION p2 VALUES LESS THAN (1966), + PARTITION p3 VALUES LESS THAN (1986), + PARTITION p4 VALUES LESS THAN (2005), + PARTITION p5 VALUES LESS THAN MAXVALUE); + +--echo --- Show table on master --- + +SHOW CREATE TABLE t1; + +--echo --- Show table on slave -- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 MODIFY vc VARCHAR(255); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still same engine --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- +--enable_query_log + +--source include/rpl_multi_engine3.inc + +--echo --- End test 2 partition RANGE testing --- +--echo --- Do Cleanup --- + +DROP TABLE IF EXISTS t1; + +######################################################## + +--echo --- Start test 3 partition LIST testing --- +--echo --- Do setup --- +################################################# + + +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), + bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, + f FLOAT DEFAULT 0, total BIGINT UNSIGNED, + y YEAR, t DATE) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB + PARTITION BY LIST(id) + (PARTITION p0 VALUES IN (2, 4), + PARTITION p1 VALUES IN (42, 142)); + +--echo --- Test 3 Alter to add partition --- + +ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412)); + +--echo --- Show table on master --- + +SHOW CREATE TABLE t1; + +--echo --- Show table on slave --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 MODIFY vc VARCHAR(255); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still same engine --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- End test 3 partition LIST testing --- +--echo --- Do Cleanup -- + +DROP TABLE IF EXISTS t1; + +######################################################## + +--echo --- Start test 4 partition HASH testing --- +--echo --- Do setup --- +################################################# + + +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), + bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, + f FLOAT DEFAULT 0, total BIGINT UNSIGNED, + y YEAR, t DATE) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB + PARTITION BY HASH( YEAR(t) ) + PARTITIONS 4; + +--echo --- show that tables have been created correctly --- + +SHOW CREATE TABLE t1; +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 MODIFY vc VARCHAR(255); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still same engine --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- End test 4 partition HASH testing --- +--echo --- Do Cleanup -- + +DROP TABLE IF EXISTS t1; + +######################################################## + +--echo --- Start test 5 partition by key testing --- +--echo --- Create Table Section --- + +################################################# + +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), + bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, + f FLOAT DEFAULT 0, total BIGINT UNSIGNED, + y YEAR, t DATE,PRIMARY KEY(id)) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB + PARTITION BY KEY() + PARTITIONS 4; + +--echo --- Show that tables on master are ndbcluster tables --- + +SHOW CREATE TABLE t1; + +--echo --- Show that tables on slave --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +# Okay lets see how it holds up to table changes +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still right type --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 MODIFY vc VARCHAR(255); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still same engine --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- End test 5 key partition testing --- +--echo --- Do Cleanup --- + +DROP TABLE IF EXISTS t1; + +# End of 5.1 test case diff --git a/mysql-test/t/rpl_ndb_delete_nowhere.test b/mysql-test/t/rpl_ndb_delete_nowhere.test index 7c8c16339cb..92ceddf7f5c 100644 --- a/mysql-test/t/rpl_ndb_delete_nowhere.test +++ b/mysql-test/t/rpl_ndb_delete_nowhere.test @@ -3,5 +3,6 @@ # Share test code between engine tests # ######################################### --source include/have_ndb.inc +-- source include/have_binlog_format_row.inc let $engine_type=NDB; -- source extra/rpl_tests/rpl_delete_no_where.test diff --git a/mysql-test/t/rpl_ndb_insert_ignore.test b/mysql-test/t/rpl_ndb_insert_ignore.test index fbebd99a44c..17acb5983f4 100644 --- a/mysql-test/t/rpl_ndb_insert_ignore.test +++ b/mysql-test/t/rpl_ndb_insert_ignore.test @@ -2,6 +2,7 @@ # Wrapper for rpl_insert_ignore.test# ##################################### -- source include/have_ndb.inc +-- source include/have_binlog_format_row.inc let $engine_type=NDB; let $engine_type2=myisam; -- source extra/rpl_tests/rpl_insert_ignore.test diff --git a/mysql-test/t/rpl_ndb_multi_update3.test b/mysql-test/t/rpl_ndb_multi_update3.test index 78f9f0fbc8d..008e2143987 100644 --- a/mysql-test/t/rpl_ndb_multi_update3.test +++ b/mysql-test/t/rpl_ndb_multi_update3.test @@ -3,5 +3,6 @@ # to reuse test code between engine runs # ############################################################ -- source include/have_ndb.inc +-- source include/have_binlog_format_row.inc let $engine_type=NDB; -- source extra/rpl_tests/rpl_multi_update3.test diff --git a/mysql-test/t/rpl_ndb_relay_space.test b/mysql-test/t/rpl_ndb_relay_space.test deleted file mode 100644 index 0484d807996..00000000000 --- a/mysql-test/t/rpl_ndb_relay_space.test +++ /dev/null @@ -1,21 +0,0 @@ -################################### -# Wrapper rpl_sv_relay_space.test # -# This test has to be wrapped as # -# It tests ndb, innodb and MyISAM.# -# By Wrapping we are saving some # -# space and making the test more # -# Maintainable by only having one # -# test file and reusing the code # -# In Addition, INNODB has to have # -# Option files during this test # -# to force innodb on the slave # -# else the test will fail # -################################### -#Change Author: JBM # -#Change Date: 2006-02-03 # -#Change: Added Comments # -################################### ---source include/have_ndb.inc -let $engine_type=NDB; --- source extra/rpl_tests/rpl_sv_relay_space.test - diff --git a/mysql-test/t/rpl_ndb_sync.test b/mysql-test/t/rpl_ndb_sync.test index d56f4a4ad03..95f56609ed7 100644 --- a/mysql-test/t/rpl_ndb_sync.test +++ b/mysql-test/t/rpl_ndb_sync.test @@ -8,13 +8,13 @@ # # stop the save -connection slave; +--connection slave STOP SLAVE; CREATE DATABASE ndbsynctest; USE ndbsynctest; # get some data on the master -connection master; +--connection master CREATE DATABASE ndbsynctest; USE ndbsynctest; CREATE TABLE t1 (c1 BIT(1) NOT NULL, c2 BIT(1) NOT NULL, c3 CHAR(15), PRIMARY KEY(c3)) ENGINE = NDB ; @@ -25,21 +25,14 @@ SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1; # take a backup on master ---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat -CREATE TEMPORARY TABLE IF NOT EXISTS cluster.backup_info (id INT, backup_id INT)ENGINE=HEAP; -DELETE FROM cluster.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster.backup_info FIELDS TERMINATED BY ','; ---replace_column 1 <the_backup_id> -SELECT @the_backup_id:=backup_id FROM cluster.backup_info; -let the_backup_id=`select @the_backup_id` ; -DROP TABLE cluster.backup_info; +--source include/ndb_backup.inc + # update a row UPDATE t1 SET c2=0 WHERE c3="row2"; SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; # restore on slave, first check that nothing is there -connection slave +--connection slave # we should have no tables SHOW TABLES; @@ -66,40 +59,16 @@ SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1; # # now setup replication to continue from last epoch -# 1. get apply_status epoch from slave -# 2. get corresponding _next_ binlog postition from master -# 3. change master on slave - -# 1. -connection slave; ---replace_column 1 <the_epoch> -SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status; -let $the_epoch= `select @the_epoch` ; - -# 2. -connection master; ---replace_result $the_epoch <the_epoch> ---replace_column 1 <the_pos> -eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) - FROM cluster.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1; -let $the_pos= `SELECT @the_pos` ; -let $the_file= `SELECT @the_file` ; - -# 3. -connection slave; ---replace_result $the_pos <the_pos> -eval CHANGE MASTER TO - master_log_file = '$the_file', - master_log_pos = $the_pos ; +--source include/ndb_setup_slave.inc +--connection slave START SLAVE; # # # -connection master; -#sync_slave_with_master; ---sleep 2 -connection slave; +--connection master +--sync_slave_with_master +--connection slave --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> SHOW SLAVE STATUS; @@ -111,22 +80,21 @@ SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1; # Cleanup # -connection master; +--connection master DROP DATABASE ndbsynctest; -#sync_slave_with_master; ---sleep 2 -connection slave; +--sync_slave_with_master +--connection slave STOP SLAVE; # # Test some replication commands # -connection master; +--connection master reset master; # should now contain nothing select * from cluster.binlog_index; -connection slave; +--connection slave reset slave; # should now contain nothing select * from cluster.apply_status; diff --git a/mysql-test/t/rpl_row_basic_8partition.test b/mysql-test/t/rpl_row_basic_8partition.test index 0e2518817fa..8cad2226d4a 100644 --- a/mysql-test/t/rpl_row_basic_8partition.test +++ b/mysql-test/t/rpl_row_basic_8partition.test @@ -7,6 +7,7 @@ # partition tables with same engine (MyISAM) in both ends. # ############################################################ +--source include/have_partition.inc --source include/master-slave.inc connection master; --disable_warnings diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test index 9c6056f9217..7269b54556b 100644 --- a/mysql-test/t/rpl_temporary.test +++ b/mysql-test/t/rpl_temporary.test @@ -131,4 +131,30 @@ drop table t1,t2; create temporary table t3 (f int); sync_with_master; +# +# Bug#17284 erroneous temp table cleanup on slave +# + +connection master; +create temporary table t4 (f int); +create table t5 (f int); +sync_with_master; +# find dumper's $id +source include/get_binlog_dump_thread_id.inc; +insert into t4 values (1); +# a hint how to do that in 5.1 +--replace_result $id "`select id from information_schema.processlist where command='Binlog Dump'`" +eval kill $id; # to stimulate reconnection by slave w/o timeout +insert into t5 select * from t4; +save_master_pos; + +connection slave; +sync_with_master; +select * from t5 /* must be 1 after reconnection */; + +connection master; +drop temporary table t4; +drop table t5; + # The server will now close done +# End of 5.1 tests diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test index 1f05a9574d6..e028dbc51d9 100644 --- a/mysql-test/t/type_bit.test +++ b/mysql-test/t/type_bit.test @@ -227,3 +227,15 @@ select sum(a1), b1+0, b2+0 from t1 join t2 on b1 = b2 group by b1 order by 1; select 1 from t1 join t2 on b1 = b2 group by b1 order by 1; select b1+0,sum(b1), sum(b2) from t1 join t2 on b1 = b2 group by b1 order by 1; drop table t1, t2; + +# +# Bug #13601: Wrong field length reported for BIT fields +# +create table t1 (a bit(7)); +insert into t1 values (0x60); +--enable_metadata +select * from t1; +--disable_metadata +drop table t1; + +--echo End of 5.0 tests diff --git a/mysql-test/t/type_bit_innodb.test b/mysql-test/t/type_bit_innodb.test index ec433f40a88..dbca69d67f0 100644 --- a/mysql-test/t/type_bit_innodb.test +++ b/mysql-test/t/type_bit_innodb.test @@ -133,3 +133,15 @@ show create table t1; alter table t1 engine=innodb; show create table t1; drop table t1; + +# +# Bug #13601: Wrong field length reported for BIT fields +# +create table t1 (a bit(7)) engine=innodb; +insert into t1 values (0x60); +--enable_metadata +select * from t1; +--disable_metadata +drop table t1; + +--echo End of 5.0 tests diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test index f2017d81d5c..5c5046cf7e9 100644 --- a/mysql-test/t/upgrade.test +++ b/mysql-test/t/upgrade.test @@ -34,16 +34,16 @@ drop database `mysqltest-1`; # Bug#17142: Crash if create with encoded name # --disable_warnings -drop table if exists `txu@0023P@0023p1`; -drop table if exists `txu#P#p1`; +drop table if exists `txu@0023p@0023p1`; +drop table if exists `txu#p#p1`; --enable_warnings -create table `txu#P#p1` (s1 int); -insert into `txu#P#p1` values (1); +create table `txu#p#p1` (s1 int); +insert into `txu#p#p1` values (1); --error 1146 -select * from `txu@0023P@0023p1`; -create table `txu@0023P@0023p1` (s1 int); -insert into `txu@0023P@0023p1` values (2); -select * from `txu@0023P@0023p1`; -select * from `txu#P#p1`; -drop table `txu@0023P@0023p1`; -drop table `txu#P#p1`; +select * from `txu@0023p@0023p1`; +create table `txu@0023p@0023p1` (s1 int); +insert into `txu@0023p@0023p1` values (2); +select * from `txu@0023p@0023p1`; +select * from `txu#p#p1`; +drop table `txu@0023p@0023p1`; +drop table `txu#p#p1`; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index fd9589a6f59..82f053fb223 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -2439,3 +2439,23 @@ SELECT COUNT(*) FROM t1 LEFT JOIN v2 ON t1.id=v2.id; DROP VIEW v2; DROP TABLE t1, t2; + +# +# Bug #16069: VIEW does return the same results as underlying SELECT +# with WHERE condition containing BETWEEN over dates + +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, + td date DEFAULT NULL, KEY idx(td)); + +INSERT INTO t1 VALUES + (1, '2005-01-01'), (2, '2005-01-02'), (3, '2005-01-02'), + (4, '2005-01-03'), (5, '2005-01-04'), (6, '2005-01-05'), + (7, '2005-01-05'), (8, '2005-01-05'), (9, '2005-01-06'); + +CREATE VIEW v1 AS SELECT * FROM t1; + +SELECT * FROM t1 WHERE td BETWEEN '2005.01.02' AND '2005.01.04'; +SELECT * FROM v1 WHERE td BETWEEN '2005.01.02' AND '2005.01.04'; + +DROP VIEW v1; +DROP TABLE t1; diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index af3ec2d827e..8a12dbca51d 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -192,6 +192,20 @@ select extractValue(@xml, '/a/@b[substring(.,1,1)="2"]'); select extractValue(@xml, '/a/@b[substring(.,2,1)="1"]'); select extractValue(@xml, '/a/@b[substring(.,2,1)="2"]'); +# +# Bug#16319: XML: extractvalue() returns syntax errors for some functions +# +SET @xml='<a><b>b1</b><b>b2</b></a>'; +SELECT extractValue(@xml, '/a/b[string-length("x")=1]'); +SELECT extractValue(@xml, '/a/b[string-length("xx")=2]'); +SELECT extractValue(@xml, '/a/b[string-length("xxx")=2]'); +SELECT extractValue(@xml, '/a/b[string-length("x")]'); +SELECT extractValue(@xml, '/a/b[string-length("xx")]'); +SELECT extractValue(@xml, '/a/b[string-length()]'); +--error 1105 +SELECT extractValue(@xml, 'string-length()'); +SELECT extractValue(@xml, 'string-length("x")'); + SET @xml='<a b="b11" b="b12" b="b21" b="22"/>'; select extractValue(@xml,'/a/@b'); select extractValue(@xml,'/a/@b[contains(.,"1")]'); @@ -279,6 +293,12 @@ select extractvalue('<a>Jack</a>','/a[contains(../a,"j")]' collate latin1_bin); select extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]'); # +# Bug#18285: ExtractValue not returning character +# data within <![CDATA[]]> as expected +# +select ExtractValue('<tag1><![CDATA[test]]></tag1>','/tag1'); + +# # Bug #18171 XML: ExtractValue: the XPath position() # function crashes the server! # @@ -295,3 +315,23 @@ select extractValue('<e>1</e>','last()'); --error 1105 select extractValue('<e><a>1</a></e>','/e/'); +# +# Bug#16233: XML: ExtractValue() fails with special characters +# +set names utf8; +select extractValue('<Ñ><r>r</r></Ñ>','/Ñ/r'); +select extractValue('<r><Ñ>Ñ</Ñ></r>','/r/Ñ'); +select extractValue('<Ñ r="r"/>','/Ñ/@r'); +select extractValue('<r Ñ="Ñ"/>','/r/@Ñ'); +--disable_warnings +DROP PROCEDURE IF EXISTS p2; +--enable_warnings +DELIMITER //; +CREATE PROCEDURE p2 () +BEGIN + DECLARE p LONGTEXT CHARACTER SET UTF8 DEFAULT '<Ñ><r>A</r></Ñ>'; + SELECT EXTRACTVALUE(p,'/Ñ/r'); +END// +DELIMITER ;// +CALL p2(); +DROP PROCEDURE p2; |