mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
ca59e88ce3
Problem: Many test cases don't clean up after themselves (fail to drop tables or fail to reset variables). This implies that: (1) check-testcase in the new mtr that currently lives in 5.1-rpl failed. (2) it may cause unexpected results in subsequent tests. Fix: make all tests clean up. Also: cleaned away unnecessary output in rpl_packet.result Also: fixed bug where rpl_log called RESET MASTER with a running slave. This is not supposed to work. Also: removed unnecessary code from rpl_stm_EE_err2 and made it verify that an error occurred. Also: removed unnecessary code from rpl_ndb_ctype_ucs2_def. mysql-test/extra/rpl_tests/rpl_loaddata.test: Made test clean up after itself. mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test: Made test clean up after itself. Also removed unnecessary save_master_pos. Also made test verify that an error occurred. mysql-test/extra/rpl_tests/rpl_truncate_helper.test: Made test clean up after itself. mysql-test/include/query_cache.inc: Made test clean up after itself. mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test: Made test clean up after itself. mysql-test/suite/rpl/t/rpl_alter_db.test: Made test clean up after itself. Easiest to refactor the test a little, to use an auxiliary database instead of mysql: Then we don't need to read the collation at the start of the test and reset it at the end of the test. We can just drop the database. mysql-test/suite/rpl/t/rpl_drop_db.test: Made test clean up after itself. mysql-test/suite/rpl/t/rpl_drop_view.test: Made test clean up after itself. mysql-test/suite/rpl/t/rpl_events.test: Made test clean up after itself. mysql-test/suite/rpl/t/rpl_idempotency.test: Made test clean up after itself. mysql-test/suite/rpl/t/rpl_ignore_table.test: Made test clean up after itself. The existing cleanup code didn't work, because the --replicate-* options prevented the "drop table" from being replicated. Moved "drop table t4" to a statement of its own. mysql-test/suite/rpl/t/rpl_packet.test: Made test clean up after itself. Also replaced SHOW SLAVE STATUS by query_get_value(SHOW SLAVE STATUS...), since only one column of the result was interesting. mysql-test/suite/rpl/t/rpl_row_max_relay_size.test: Made test clean up after itself. Instead of setting binlog format at the beginning of the test, we just do 'source include/have_binlog_format_row.inc' like all other tests. mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test: Made test clean up after itself. mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test: Made test clean up after itself. Also removed unnecessary 'create table; drop table' Also removed unnecessary use of --command mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test: Made test clean up after itself. mysql-test/t/innodb-autoinc-optimize.test: Made test clean up after itself. mysql-test/t/innodb.test: Made test clean up after itself. mysql-test/t/log_tables.test: Made test clean up after itself. mysql-test/t/mysql_client_test.test: Made test clean up after itself. mysql-test/t/partition.test: Made test clean up after itself. mysql-test/t/status.test: Made test clean up after itself.
222 lines
5.1 KiB
Text
222 lines
5.1 KiB
Text
SET SESSION STORAGE_ENGINE = InnoDB;
|
|
drop table if exists t1,t2,t3;
|
|
flush status;
|
|
set autocommit=0;
|
|
create table t1 (a int not null);
|
|
insert into t1 values (1),(2),(3);
|
|
select * from t1;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
show status like "Qcache_queries_in_cache";
|
|
Variable_name Value
|
|
Qcache_queries_in_cache 0
|
|
drop table t1;
|
|
commit;
|
|
set autocommit=1;
|
|
begin;
|
|
create table t1 (a int not null);
|
|
insert into t1 values (1),(2),(3);
|
|
select * from t1;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
show status like "Qcache_queries_in_cache";
|
|
Variable_name Value
|
|
Qcache_queries_in_cache 1
|
|
drop table t1;
|
|
commit;
|
|
create table t1 (a int not null);
|
|
create table t2 (a int not null);
|
|
create table t3 (a int not null);
|
|
insert into t1 values (1),(2);
|
|
insert into t2 values (1),(2);
|
|
insert into t3 values (1),(2);
|
|
select * from t1;
|
|
a
|
|
1
|
|
2
|
|
select * from t2;
|
|
a
|
|
1
|
|
2
|
|
select * from t3;
|
|
a
|
|
1
|
|
2
|
|
show status like "Qcache_queries_in_cache";
|
|
Variable_name Value
|
|
Qcache_queries_in_cache 3
|
|
show status like "Qcache_hits";
|
|
Variable_name Value
|
|
Qcache_hits 0
|
|
begin;
|
|
select * from t1;
|
|
a
|
|
1
|
|
2
|
|
select * from t2;
|
|
a
|
|
1
|
|
2
|
|
select * from t3;
|
|
a
|
|
1
|
|
2
|
|
show status like "Qcache_queries_in_cache";
|
|
Variable_name Value
|
|
Qcache_queries_in_cache 3
|
|
show status like "Qcache_hits";
|
|
Variable_name Value
|
|
Qcache_hits 3
|
|
insert into t1 values (3);
|
|
insert into t2 values (3);
|
|
insert into t1 values (4);
|
|
select * from t1;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
select * from t2;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
select * from t3;
|
|
a
|
|
1
|
|
2
|
|
show status like "Qcache_queries_in_cache";
|
|
Variable_name Value
|
|
Qcache_queries_in_cache 1
|
|
show status like "Qcache_hits";
|
|
Variable_name Value
|
|
Qcache_hits 4
|
|
commit;
|
|
show status like "Qcache_queries_in_cache";
|
|
Variable_name Value
|
|
Qcache_queries_in_cache 1
|
|
drop table t3,t2,t1;
|
|
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id));
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
insert into t1 (id) values (0);
|
|
select count(*) from t1;
|
|
count(*)
|
|
1
|
|
drop table t1;
|
|
set GLOBAL query_cache_size=1355776;
|
|
CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a));
|
|
CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b));
|
|
CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`));
|
|
INSERT INTO t1 VALUES (1,'me');
|
|
INSERT INTO t2 VALUES (1,'you');
|
|
INSERT INTO t3 VALUES (2,1,1,2);
|
|
delete from t3 where t1_id = 1 and t2_id = 1;
|
|
select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc;
|
|
id a
|
|
begin;
|
|
insert into t3 VALUES ( NULL, 1, 1, 2 );
|
|
insert into t3 VALUES ( NULL, 1, 1, 2 );
|
|
ERROR 23000: Duplicate entry '1-1' for key 't1_id'
|
|
commit;
|
|
select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc;
|
|
id a
|
|
1 me
|
|
drop table t3,t2,t1;
|
|
SET SESSION STORAGE_ENGINE = InnoDB;
|
|
SET @@autocommit=1;
|
|
connection default
|
|
SHOW VARIABLES LIKE 'have_query_cache';
|
|
Variable_name Value
|
|
have_query_cache YES
|
|
SET GLOBAL query_cache_size = 200000;
|
|
flush status;
|
|
SET @@autocommit=1;
|
|
SET SESSION STORAGE_ENGINE = InnoDB;
|
|
CREATE TABLE t2 (s1 int, s2 varchar(1000), key(s1));
|
|
INSERT INTO t2 VALUES (1,repeat('a',10)),(2,repeat('a',10)),(3,repeat('a',10)),(4,repeat('a',10));
|
|
COMMIT;
|
|
START TRANSACTION;
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
0
|
|
UPDATE t2 SET s2 = 'w' WHERE s1 = 3;
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
1
|
|
show status like "Qcache_queries_in_cache";
|
|
Variable_name Value
|
|
Qcache_queries_in_cache 0
|
|
connection connection1
|
|
START TRANSACTION;
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
0
|
|
INSERT INTO t2 VALUES (5,'w');
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
1
|
|
COMMIT;
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
1
|
|
show status like "Qcache_queries_in_cache";
|
|
Variable_name Value
|
|
Qcache_queries_in_cache 0
|
|
connection default
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
1
|
|
COMMIT;
|
|
show status like "Qcache_queries_in_cache";
|
|
Variable_name Value
|
|
Qcache_queries_in_cache 0
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
2
|
|
show status like "Qcache_queries_in_cache";
|
|
Variable_name Value
|
|
Qcache_queries_in_cache 1
|
|
connection connection1
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
2
|
|
START TRANSACTION;
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
2
|
|
INSERT INTO t2 VALUES (6,'w');
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
3
|
|
connection default
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
2
|
|
START TRANSACTION;
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
2
|
|
DELETE from t2 WHERE s1=3;
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
1
|
|
COMMIT;
|
|
connection connection1
|
|
COMMIT;
|
|
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
|
count(*)
|
|
2
|
|
show status like "Qcache_queries_in_cache";
|
|
Variable_name Value
|
|
Qcache_queries_in_cache 1
|
|
show status like "Qcache_hits";
|
|
Variable_name Value
|
|
Qcache_hits 2
|
|
set GLOBAL query_cache_size=1048576;
|
|
drop table t2;
|