diff options
Diffstat (limited to 'storage/spider/mysql-test/spider/oracle2/r')
14 files changed, 3103 insertions, 0 deletions
diff --git a/storage/spider/mysql-test/spider/oracle2/r/basic_sql.result b/storage/spider/mysql-test/spider/oracle2/r/basic_sql.result new file mode 100644 index 00000000..1e9fe78a --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/basic_sql.result @@ -0,0 +1,634 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +SELECT 1; +1 +1 + +create table select test +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +INSERT INTO tb_l (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +SELECT a, b, c FROM tb_l +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 + +create table ignore select test +DROP TABLE IF EXISTS ta_l; +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +INSERT INTO tb_l (a, b, c) VALUES +(1, 'f', '2008-07-01 10:21:39'), +(2, 'g', '2000-02-01 00:00:00'), +(3, 'j', '2007-05-04 20:03:11'), +(4, 'i', '2003-10-30 05:01:03'), +(5, 'h', '2001-10-31 23:59:59'); +CREATE TABLE ta_l ( +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +IGNORE SELECT a, b, c FROM tb_l +Warnings: +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +Warning 1062 Duplicate entry '2' for key 'PRIMARY' +Warning 1062 Duplicate entry '3' for key 'PRIMARY' +Warning 1062 Duplicate entry '4' for key 'PRIMARY' +Warning 1062 Duplicate entry '5' for key 'PRIMARY' +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 + +create table ignore select test +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +REPLACE SELECT a, b, c FROM tb_l +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +create no index table +DROP TABLE IF EXISTS ta_l_no_idx; +CREATE TABLE ta_l_no_idx +MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1 +SELECT a, b, c FROM tb_l +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select table +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select table shared mode +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a +LOCK IN SHARE MODE; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select table for update +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a +FOR UPDATE; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select table join +SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b +WHERE a.a = b.a ORDER BY a.a; +a b date_format(b.c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select table straight_join +SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') +FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a; +a b date_format(b.c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select sql_small_result +SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select sql_big_result +SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select sql_buffer_result +SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select sql_cache +SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select sql_no_cache +SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select sql_calc_found_rows +SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a LIMIT 4; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +SELECT found_rows(); +found_rows() +5 + +select high_priority +SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select distinct +SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select count +SELECT count(*) FROM ta_l ORDER BY a; +count(*) +5 + +select table join not use index +SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE +EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a; +a b date_format(a.c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select using pushdown +SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE +a.b = 'g' ORDER BY a.a; +a b date_format(a.c, '%Y-%m-%d %H:%i:%s') +2 g 2000-02-01 00:00:00 + +select using index and pushdown +SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE +a.a > 0 AND a.b = 'g' ORDER BY a.a; +a b date_format(a.c, '%Y-%m-%d %H:%i:%s') +2 g 2000-02-01 00:00:00 + +insert +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 e 2008-01-01 23:59:59 + +insert select +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +insert select a +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), +'e', '2008-01-01 23:59:59'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 23:59:59 + +insert low_priority +TRUNCATE TABLE ta_l; +INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 e 2008-01-01 23:59:59 + +insert high_priority +TRUNCATE TABLE ta_l; +INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e', +'2008-01-01 23:59:59'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 e 2008-01-01 23:59:59 + +insert ignore +INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01'); +Warnings: +Warning 1062 Duplicate entry '2' for key 'PRIMARY' +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 e 2008-01-01 23:59:59 + +insert update (insert) +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE +KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 e 2008-01-01 23:59:59 + +insert update (update) +INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE +KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 f 2005-08-08 11:11:11 + +replace +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); +REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 f 2008-02-02 02:02:02 + +replace select +REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +replace select a +REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), +'e', '2008-01-01 23:59:59'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 23:59:59 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +replace low_priority +REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g', +'2009-03-03 03:03:03'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 23:59:59 +2 g 2000-02-01 00:00:00 +3 g 2009-03-03 03:03:03 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +update +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'); +UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 23:59:59 +2 f 2008-02-02 02:02:02 + +update select +UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM +tb_l); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 g 2009-03-03 03:03:03 +2 g 2009-03-03 03:03:03 + +update select a +UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM +tb_l ORDER BY a LIMIT 1); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 h 2010-04-04 04:04:04 +2 g 2009-03-03 03:03:03 + +update join +UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 + +update join a +UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE +a.a = b.a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 g 2009-03-03 03:03:03 +2 g 2009-03-03 03:03:03 + +update low_priority +UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 g 2009-03-03 03:03:03 +2 f 2008-02-02 02:02:02 + +update ignore +UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 g 2009-03-03 03:03:03 +2 f 2008-02-02 02:02:02 + +update pushdown +update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f'; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 g 2009-03-03 03:03:03 +2 j 2009-03-03 03:03:03 + +update index pushdown +UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j'; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 g 2009-03-03 03:03:03 +2 g 2009-03-03 03:03:03 + +delete +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +DELETE FROM ta_l WHERE a = 2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 23:59:59 +3 e 2008-01-01 23:59:59 +4 e 2008-01-01 23:59:59 +5 e 2008-01-01 23:59:59 +6 e 2008-01-01 23:59:59 +7 e 2008-01-01 23:59:59 +8 e 2008-01-01 23:59:59 +9 e 2008-01-01 23:59:59 +10 j 2008-01-01 23:59:59 + +delete all +DELETE FROM ta_l; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') + +delete select +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +6 e 2008-01-01 23:59:59 +7 e 2008-01-01 23:59:59 +8 e 2008-01-01 23:59:59 +9 e 2008-01-01 23:59:59 +10 j 2008-01-01 23:59:59 + +delete select a +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 e 2008-01-01 23:59:59 +3 e 2008-01-01 23:59:59 +4 e 2008-01-01 23:59:59 +5 e 2008-01-01 23:59:59 +6 e 2008-01-01 23:59:59 +7 e 2008-01-01 23:59:59 +8 e 2008-01-01 23:59:59 +9 e 2008-01-01 23:59:59 +10 j 2008-01-01 23:59:59 + +delete join +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +6 e 2008-01-01 23:59:59 +7 e 2008-01-01 23:59:59 +8 e 2008-01-01 23:59:59 +9 e 2008-01-01 23:59:59 +10 j 2008-01-01 23:59:59 + +delete low_priority +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +DELETE LOW_PRIORITY FROM ta_l WHERE a = 2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 23:59:59 +3 e 2008-01-01 23:59:59 +4 e 2008-01-01 23:59:59 +5 e 2008-01-01 23:59:59 +6 e 2008-01-01 23:59:59 +7 e 2008-01-01 23:59:59 +8 e 2008-01-01 23:59:59 +9 e 2008-01-01 23:59:59 +10 j 2008-01-01 23:59:59 + +delete ignore +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +DELETE IGNORE FROM ta_l WHERE a = 2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 23:59:59 +3 e 2008-01-01 23:59:59 +4 e 2008-01-01 23:59:59 +5 e 2008-01-01 23:59:59 +6 e 2008-01-01 23:59:59 +7 e 2008-01-01 23:59:59 +8 e 2008-01-01 23:59:59 +9 e 2008-01-01 23:59:59 +10 j 2008-01-01 23:59:59 + +delete quick +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +DELETE QUICK FROM ta_l WHERE a = 2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 23:59:59 +3 e 2008-01-01 23:59:59 +4 e 2008-01-01 23:59:59 +5 e 2008-01-01 23:59:59 +6 e 2008-01-01 23:59:59 +7 e 2008-01-01 23:59:59 +8 e 2008-01-01 23:59:59 +9 e 2008-01-01 23:59:59 +10 j 2008-01-01 23:59:59 + +delete pushdown +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +DELETE FROM ta_l WHERE b = 'e'; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +10 j 2008-01-01 23:59:59 + +delete index pushdown +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +DELETE FROM ta_l WHERE a > 0 AND b = 'e'; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +10 j 2008-01-01 23:59:59 + +truncate +TRUNCATE TABLE ta_l; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/basic_sql_part.result b/storage/spider/mysql-test/spider/oracle2/r/basic_sql_part.result new file mode 100644 index 00000000..9e1201c1 --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/basic_sql_part.result @@ -0,0 +1,121 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +SELECT 1; +1 +1 +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +INSERT INTO tb_l (a, b, c) VALUES +(1, 'f', '2008-07-01 10:21:39'), +(2, 'g', '2000-02-01 00:00:00'), +(3, 'j', '2007-05-04 20:03:11'), +(4, 'i', '2003-10-30 05:01:03'), +(5, 'h', '2001-10-31 23:59:59'); + +create table with partition and select test +CREATE TABLE ta_l2 ( +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1 +SELECT a, b, c FROM tb_l +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select partition using pushdown +SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE +a.b = 'g' ORDER BY a.a; +a b date_format(a.c, '%Y-%m-%d %H:%i:%s') +2 g 2000-02-01 00:00:00 + +select partition using index pushdown +SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE +a.a > 0 AND a.b = 'g' ORDER BY a.a; +a b date_format(a.c, '%Y-%m-%d %H:%i:%s') +2 g 2000-02-01 00:00:00 + +update partition pushdown +UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j'; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 e 2009-03-03 03:03:03 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +update partition index pushdown +UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e'; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2009-03-03 03:03:03 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +delete partition pushdown +TRUNCATE TABLE ta_l2; +INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; +DELETE FROM ta_l2 WHERE b = 'g'; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +delete partition index pushdown +TRUNCATE TABLE ta_l2; +INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; +DELETE FROM ta_l2 WHERE a > 0 AND b = 'g'; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate.result b/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate.result new file mode 100644 index 00000000..fe5752cf --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate.result @@ -0,0 +1,91 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +SELECT 1; +1 +1 + +create table select test +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO ta_l (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); + +direct_aggregating test +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 0 +SELECT COUNT(*) FROM ta_l; +COUNT(*) +5 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 1 +SELECT MAX(a) FROM ta_l; +MAX(a) +5 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 1 +SELECT MIN(a) FROM ta_l; +MIN(a) +1 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 1 +SELECT MAX(a) FROM ta_l WHERE a < 5; +MAX(a) +4 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 1 +SELECT MIN(a) FROM ta_l WHERE a > 1; +MIN(a) +2 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 1 + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate_part.result b/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate_part.result new file mode 100644 index 00000000..9bde4a17 --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate_part.result @@ -0,0 +1,82 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +SELECT 1; +1 +1 + +with partition test +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 0 +SELECT COUNT(*) FROM ta_l2; +COUNT(*) +5 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 2 +SELECT MAX(a) FROM ta_l2; +MAX(a) +5 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 2 +SELECT MIN(a) FROM ta_l2; +MIN(a) +1 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 2 +SELECT MAX(a) FROM ta_l2 WHERE a < 5; +MAX(a) +4 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 2 +SELECT MIN(a) FROM ta_l2 WHERE a > 1; +MIN(a) +2 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 2 + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/direct_update.result b/storage/spider/mysql-test/spider/oracle2/r/direct_update.result new file mode 100644 index 00000000..3dc39d5f --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/direct_update.result @@ -0,0 +1,138 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +SELECT 1; +1 +1 + +create table select test +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO ta_l (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); + +direct_updating test +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 +update all rows with function +UPDATE ta_l SET c = ADDDATE(c, 1); +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +2 b 2000-01-02 00:00:00 +3 e 2007-06-05 20:03:11 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +update by primary key +UPDATE ta_l SET b = 'x' WHERE a = 3; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +2 b 2000-01-02 00:00:00 +3 x 2007-06-05 20:03:11 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +update by a column without index +UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x'; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +2 b 2000-01-02 00:00:00 +3 x 2011-10-17 00:00:00 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +update by primary key with order and limit +UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +2 b 2000-01-02 00:00:00 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +delete by primary key with order and limit +DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1; +SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +delete by a column without index +DELETE FROM ta_l WHERE b = 'c'; +SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 05:01:03 +delete by primary key +DELETE FROM ta_l WHERE a = 3; +SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +4 d 2003-12-01 05:01:03 + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/direct_update_part.result b/storage/spider/mysql-test/spider/oracle2/r/direct_update_part.result new file mode 100644 index 00000000..8a22c40a --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/direct_update_part.result @@ -0,0 +1,129 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +SELECT 1; +1 +1 + +with partition test +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 +update all rows with function +UPDATE ta_l2 SET c = ADDDATE(c, 1); +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +2 b 2000-01-02 00:00:00 +3 e 2007-06-05 20:03:11 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +update by primary key +UPDATE ta_l2 SET b = 'x' WHERE a = 3; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +2 b 2000-01-02 00:00:00 +3 x 2007-06-05 20:03:11 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +update by a column without index +UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x'; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +2 b 2000-01-02 00:00:00 +3 x 2011-10-17 00:00:00 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +update by primary key with order and limit +UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +2 b 2000-01-02 00:00:00 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +delete by primary key with order and limit +DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1; +SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +delete by a column without index +DELETE FROM ta_l2 WHERE b = 'c'; +SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 05:01:03 +delete by primary key +DELETE FROM ta_l2 WHERE a = 3; +SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +4 d 2003-12-01 05:01:03 + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/function.result b/storage/spider/mysql-test/spider/oracle2/r/function.result new file mode 100644 index 00000000..764c7745 --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/function.result @@ -0,0 +1,149 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +SELECT 1; +1 +1 + +in() +CREATE TABLE t1 ( +a VARCHAR(255), +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1 +insert into t1 values ('1'); +insert into t1 select a + 1 from t1; +insert into t1 select a + 2 from t1; +insert into t1 select a + 4 from t1; +insert into t1 select a + 8 from t1; +insert into t1 select a + 16 from t1; +insert into t1 select a + 32 from t1; +insert into t1 select a + 64 from t1; +insert into t1 select a + 128 from t1; +insert into t1 select a + 256 from t1; +insert into t1 select a + 512 from t1; +flush tables; +select a from t1 where a in ('15', '120'); +a +120 +15 + +date_sub() +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO ta_l (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 +UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-08-01 10:21:39 +2 b 1999-01-01 00:00:00 +3 e 2006-06-04 20:03:11 +4 d 2002-11-30 05:01:03 +5 c 2000-12-31 23:59:59 +UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-11-01 10:21:39 +2 b 1999-04-01 00:00:00 +3 e 2006-09-04 20:03:11 +4 d 2003-02-28 05:01:03 +5 c 2001-03-31 23:59:59 +UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-10-01 10:21:39 +2 b 1999-03-01 00:00:00 +3 e 2006-08-04 20:03:11 +4 d 2003-01-28 05:01:03 +5 c 2001-02-28 23:59:59 +UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-10-08 10:21:39 +2 b 1999-03-08 00:00:00 +3 e 2006-08-11 20:03:11 +4 d 2003-02-04 05:01:03 +5 c 2001-03-07 23:59:59 +UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-10-07 10:21:39 +2 b 1999-03-07 00:00:00 +3 e 2006-08-10 20:03:11 +4 d 2003-02-03 05:01:03 +5 c 2001-03-06 23:59:59 +UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-10-07 11:21:39 +2 b 1999-03-07 01:00:00 +3 e 2006-08-10 21:03:11 +4 d 2003-02-03 06:01:03 +5 c 2001-03-07 00:59:59 +UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-10-07 11:20:39 +2 b 1999-03-07 00:59:00 +3 e 2006-08-10 21:02:11 +4 d 2003-02-03 06:00:03 +5 c 2001-03-07 00:58:59 +UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-10-07 11:20:40 +2 b 1999-03-07 00:59:01 +3 e 2006-08-10 21:02:12 +4 d 2003-02-03 06:00:04 +5 c 2001-03-07 00:59:00 + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/ha.result b/storage/spider/mysql-test/spider/oracle2/r/ha.result new file mode 100644 index 00000000..8ca64dec --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/ha.result @@ -0,0 +1,240 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +DROP DATABASE IF EXISTS auto_test_remote3; +CREATE DATABASE auto_test_remote3; +USE auto_test_remote3; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; + +test select 1 +SELECT 1; +1 +1 + +create table test +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1 +INSERT INTO ta_l (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); + +select test +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 + +fail-over test +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 0 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +ERROR HY000: Table 'SYSTEM.ta_r3' get a problem +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l 0 1 +auto_test_local ta_l 1 3 +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +db_name table_name link_id +auto_test_local ta_l 1 +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 +6 e 2011-05-05 20:04:05 + +recovery test +ALTER TABLE ta_l +CONNECTION='host "xe", user "system", + password "oracle", msi "2", mkd "2", + database "SYSTEM", lst "0 2"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l 0 1 +auto_test_local ta_l 1 2 +SELECT spider_copy_tables('ta_l', '0', '1'); +spider_copy_tables('ta_l', '0', '1') +1 +ALTER TABLE ta_l +CONNECTION='host "xe", user "system", + password "oracle", msi "2", mkd "2", + database "SYSTEM", lst "0 1"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l 0 1 +auto_test_local ta_l 1 1 +INSERT INTO ta_l (a, b, c) VALUES +(8, 'g', '2011-05-05 21:33:30'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 +6 e 2011-05-05 20:04:05 +8 g 2011-05-05 21:33:30 +DROP TABLE ta_l; +SELECT spider_flush_table_mon_cache(); +spider_flush_table_mon_cache() +1 + +active standby test +create table test +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1 +INSERT INTO ta_l (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); + +select test +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 + +fail-over test +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 2 +INSERT INTO ta_l (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +ERROR HY000: Table 'SYSTEM.ta_r' get a problem +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l 0 3 +auto_test_local ta_l 1 1 +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +db_name table_name link_id +auto_test_local ta_l 1 +auto_test_local ta_l 0 +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 2 +Spider_mon_table_cache_version_req 2 +INSERT INTO ta_l (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +6 e 2011-05-05 20:04:05 + +recovery test +ALTER TABLE ta_l +CONNECTION='host "xe", user "system", + password "oracle", msi "2", mkd "2", alc "1", + database "SYSTEM", lst "1 0"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l 0 1 +auto_test_local ta_l 1 1 +INSERT INTO ta_l (a, b, c) VALUES +(8, 'g', '2011-05-05 21:33:30'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +8 g 2011-05-05 21:33:30 +DROP TABLE ta_l; +SELECT spider_flush_table_mon_cache(); +spider_flush_table_mon_cache() +1 + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +DROP DATABASE IF EXISTS auto_test_remote3; +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_local; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/ha_part.result b/storage/spider/mysql-test/spider/oracle2/r/ha_part.result new file mode 100644 index 00000000..e11b6f69 --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/ha_part.result @@ -0,0 +1,262 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +DROP DATABASE IF EXISTS auto_test_remote3; +CREATE DATABASE auto_test_remote3; +USE auto_test_remote3; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; + +test select 1 +SELECT 1; +1 +1 + +create table with partition test +DROP TABLE IF EXISTS ta_l2; +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1 +INSERT INTO ta_l2 (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); + +select test +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 + +fail-over test +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 0 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +ERROR HY000: Table 'SYSTEM.ta_r4' get a problem +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 1 +auto_test_local ta_l2#P#pt2 1 3 +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +db_name table_name link_id +auto_test_local ta_l2#P#pt2 1 +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 +6 e 2011-05-05 20:04:05 + +recovery test +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 1 +auto_test_local ta_l2#P#pt2 1 2 +SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); +spider_copy_tables('ta_l2#P#pt2', '0', '1') +1 +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 1 +auto_test_local ta_l2#P#pt2 1 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(8, 'g', '2011-05-05 21:33:30'), +(9, 'h', '2011-05-05 22:32:10'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 +6 e 2011-05-05 20:04:05 +8 g 2011-05-05 21:33:30 +9 h 2011-05-05 22:32:10 +DROP TABLE ta_l2; + +create table with partition test +DROP TABLE IF EXISTS ta_l2; +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1 +INSERT INTO ta_l2 (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); + +select test +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 + +fail-over test +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +ERROR HY000: Table 'SYSTEM.ta_r2' get a problem +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 3 +auto_test_local ta_l2#P#pt2 1 1 +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +db_name table_name link_id +auto_test_local ta_l2#P#pt2 1 +auto_test_local ta_l2#P#pt2 0 +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +3 e 2007-06-04 20:03:11 +5 c 2001-12-31 23:59:59 +6 e 2011-05-05 20:04:05 + +recovery test +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 1 +auto_test_local ta_l2#P#pt2 1 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(8, 'g', '2011-05-05 21:33:30'), +(9, 'h', '2011-05-05 22:32:10'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +3 e 2007-06-04 20:03:11 +5 c 2001-12-31 23:59:59 +8 g 2011-05-05 21:33:30 +9 h 2011-05-05 22:32:10 +DROP TABLE ta_l2; + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +DROP DATABASE IF EXISTS auto_test_remote3; +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_local; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes.result b/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes.result new file mode 100644 index 00000000..dd6c8715 --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes.result @@ -0,0 +1,210 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for slave1_1 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +SELECT 1; +1 +1 + +3.1 +auto_increment +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 +MASTER_1_AUTO_INCREMENT_INCREMENT2 +MASTER_1_AUTO_INCREMENT_OFFSET2 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +1 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +1 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +1 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +1 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2 +SELECT MAX(id) FROM t1; +MAX(id) +2 +INSERT INTO t2 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +6 +SELECT MAX(id) FROM t2; +MAX(id) +6 +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +10 +SELECT MAX(id) FROM t1; +MAX(id) +10 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +14 +SELECT MAX(id) FROM t2; +MAX(id) +14 +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +18 +SELECT id FROM t1 ORDER BY id; +id +2 +6 +10 +14 +18 +22 +26 +30 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +34 +SELECT id FROM t2 ORDER BY id; +id +2 +6 +10 +14 +18 +22 +26 +30 +34 +38 +42 +46 +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +INSERT INTO t1 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +50 +SELECT id FROM t1 ORDER BY id; +id +50 +54 +58 +62 +INSERT INTO t2 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +66 +SELECT id FROM t2 ORDER BY id; +id +50 +54 +58 +62 +66 +70 +74 +78 +SET INSERT_ID=5000; +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +82 +SELECT MAX(id) FROM t1; +MAX(id) +82 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +86 +SELECT MAX(id) FROM t2; +MAX(id) +86 +INSERT INTO t1 (id) VALUES (10000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +90 +SELECT MAX(id) FROM t1; +MAX(id) +90 +INSERT INTO t2 (id) VALUES (1000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +94 +SELECT MAX(id) FROM t2; +MAX(id) +94 + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +for slave1_1 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes_part.result new file mode 100644 index 00000000..38875214 --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes_part.result @@ -0,0 +1,208 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for slave1_1 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +SELECT 1; +1 +1 +auto_increment with partition +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 +MASTER_1_AUTO_INCREMENT_INCREMENT2 +MASTER_1_AUTO_INCREMENT_OFFSET2 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +1 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +1 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +1 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +1 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +3 +SELECT MAX(id) FROM t1; +MAX(id) +3 +INSERT INTO t2 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +7 +SELECT MAX(id) FROM t2; +MAX(id) +7 +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2 +SELECT MAX(id) FROM t1; +MAX(id) +7 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +6 +SELECT MAX(id) FROM t2; +MAX(id) +7 +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +10 +SELECT id FROM t1 ORDER BY id; +id +2 +3 +6 +7 +10 +11 +14 +15 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +18 +SELECT id FROM t2 ORDER BY id; +id +2 +3 +6 +7 +10 +11 +14 +15 +18 +19 +22 +23 +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +INSERT INTO t1 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +26 +SELECT id FROM t1 ORDER BY id; +id +26 +27 +30 +31 +INSERT INTO t2 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +34 +SELECT id FROM t2 ORDER BY id; +id +26 +27 +30 +31 +34 +35 +38 +39 +SET INSERT_ID=5000; +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +42 +SELECT MAX(id) FROM t1; +MAX(id) +42 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +43 +SELECT MAX(id) FROM t2; +MAX(id) +43 +INSERT INTO t1 (id) VALUES (10000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +46 +SELECT MAX(id) FROM t1; +MAX(id) +46 +INSERT INTO t2 (id) VALUES (1000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +50 +SELECT MAX(id) FROM t2; +MAX(id) +50 + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +for slave1_1 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/spider_fixes.result b/storage/spider/mysql-test/spider/oracle2/r/spider_fixes.result new file mode 100644 index 00000000..5a41603c --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/spider_fixes.result @@ -0,0 +1,556 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for slave1_1 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +SELECT 1; +1 +1 + +create table and insert +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +INSERT INTO tb_l (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO ta_l SELECT a, b, c FROM tb_l; + +2.13 +select table with "order by desc" and "<" +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +WHERE a < 5 ORDER BY a DESC LIMIT 3; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +4 d 2003-11-30 05:01:03 +3 e 2007-06-04 20:03:11 +2 b 2000-01-01 00:00:00 + +select table with "order by desc" and "<=" +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +WHERE a <= 5 ORDER BY a DESC LIMIT 3; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +5 c 2001-12-31 23:59:59 +4 d 2003-11-30 05:01:03 +3 e 2007-06-04 20:03:11 + +2.14 +update table with range scan and split_read +UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-02-02 00:00:00 +3 e 2000-02-02 00:00:00 +4 d 2000-02-02 00:00:00 +5 c 2000-02-02 00:00:00 + +2.15 +select table with range scan +TRUNCATE TABLE ta_l; +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +a int(11) NOT NULL DEFAULT '0', +b char(1) DEFAULT NULL, +c datetime DEFAULT NULL, +PRIMARY KEY (a, b, c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1 +INSERT INTO ta_l SELECT a, b, c FROM tb_l; +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' +AND c = '2003-11-30 05:01:03'; +a b c +4 d 2003-11-30 05:01:03 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' +AND c = '2003-11-30 05:01:03'; +a b c +4 d 2003-11-30 05:01:03 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd' +AND c = '2003-11-30 05:01:03'; +a b c +4 d 2003-11-30 05:01:03 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c' +AND c = '2001-12-31 23:59:59'; +a b c +5 c 2001-12-31 23:59:59 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd' +AND c = '2003-11-30 05:01:03'; +a b c +4 d 2003-11-30 05:01:03 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e' +AND c = '2003-11-30 05:01:03'; +a b c +4 d 2003-11-30 05:01:03 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b' +AND c = '2000-01-01 00:00:00'; +a b c +2 b 2000-01-01 00:00:00 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b' +AND c = '2000-01-01 00:00:00'; +a b c +2 b 2000-01-01 00:00:00 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' +AND b <= 'd' AND c = '2003-11-30 05:01:03'; +a b c +4 d 2003-11-30 05:01:03 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' +AND b < 'e' AND c = '2003-11-30 05:01:03'; +a b c +4 d 2003-11-30 05:01:03 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1 +AND b >= 'b' AND c = '2003-11-30 05:01:03'; +a b c +4 d 2003-11-30 05:01:03 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1 +AND b >= 'b' AND c = '2000-01-01 00:00:00'; +a b c +2 b 2000-01-01 00:00:00 + +2.16 +auto_increment insert with trigger +CREATE TABLE ta_l_auto_inc ( +a INT AUTO_INCREMENT, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1 +CREATE TABLE tc_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END;; +INSERT INTO ta_l_auto_inc (a, b, c) VALUES +(NULL, 's', '2008-12-31 20:59:59'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 s 2008-12-31 20:59:59 + +2.17 +engine-condition-pushdown with "or" and joining +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l); +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 + +2.23 +index merge +CREATE TABLE ta_l_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 +INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); +INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; +INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; +INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; +INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; +SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) +WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; +a b c +3 4 5 +4 5 6 +5 6 7 + +2.24 +index scan update without PK +DROP TABLE IF EXISTS ta_l_int; +CREATE TABLE ta_l_int ( +a INT NOT NULL, +b INT DEFAULT 10, +c INT DEFAULT 11, +KEY idx1(b), +KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 +SELECT a, b, c FROM ta_l_int ORDER BY a; +a b c +1 2 3 +2 3 4 +3 4 5 +4 5 6 +5 6 7 +6 7 8 +7 8 9 +8 9 10 +9 10 11 +10 11 12 +11 12 13 +12 13 14 +13 14 15 +14 15 16 +15 16 17 +16 17 18 +INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3); +INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3); +UPDATE ta_l_int SET c = 4 WHERE b = 2; +SELECT a, b, c FROM ta_l_int ORDER BY a; +a b c +0 2 4 +1 2 4 +2 3 4 +3 4 5 +4 5 6 +5 6 7 +6 7 8 +7 8 9 +8 9 10 +9 10 11 +10 11 12 +11 12 13 +12 13 14 +13 14 15 +14 15 16 +15 16 17 +16 17 18 +18 2 4 + +2.25 +direct order limit +SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%'; +Variable_name Value +Spider_direct_order_limit 0 +SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; +a b c +1 2 4 +2 3 4 +3 4 5 +SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%'; +Variable_name Value +Spider_direct_order_limit 0 + +2.26 +lock tables +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +CREATE TABLE t1 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1 +CREATE TABLE t2 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2 +LOCK TABLES t1 READ, t2 READ; +UNLOCK TABLES; + +auto_increment +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 +MASTER_1_AUTO_INCREMENT_INCREMENT2 +MASTER_1_AUTO_INCREMENT_OFFSET2 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +1 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +1 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +1 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +1 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2 +SELECT MAX(id) FROM t1; +MAX(id) +2 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +6 +SELECT MAX(id) FROM t1; +MAX(id) +6 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +10 +SELECT MAX(id) FROM t1; +MAX(id) +10 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +14 +SELECT MAX(id) FROM t1; +MAX(id) +14 +INSERT INTO t1 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +18 +SELECT id FROM t1 ORDER BY id; +id +2 +6 +10 +14 +18 +22 +26 +30 +SET INSERT_ID=5000; +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +34 +SELECT MAX(id) FROM t1; +MAX(id) +34 +INSERT INTO t1 (id) VALUES (10000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +38 +SELECT MAX(id) FROM t1; +MAX(id) +38 +INSERT INTO t1 (id) VALUES (1000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +42 +SELECT MAX(id) FROM t1; +MAX(id) +42 + +read only +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1 +SELECT id FROM t1 ORDER BY id; +id +2 +6 +10 +14 +18 +22 +26 +30 +34 +38 +42 +INSERT INTO t1 (id) VALUES (1); +ERROR HY000: Table 'auto_test_local.t1' is read only +UPDATE t1 SET id = 4 WHERE id = 2; +ERROR HY000: Table 'auto_test_local.t1' is read only +DELETE FROM t1 WHERE id = 2; +ERROR HY000: Table 'auto_test_local.t1' is read only +DELETE FROM t1; +ERROR HY000: Table 'auto_test_local.t1' is read only +TRUNCATE t1; +ERROR HY000: Table 'auto_test_local.t1' is read only + +2.27 +error mode +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1 +SELECT id FROM t1 ORDER BY id; +id +Warnings: +Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? + +Error 12712 Oracle error +Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? + +Error 12712 Oracle error +INSERT INTO t1 (id) VALUES (1); +Warnings: +Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? + +Error 12712 Oracle error +DELETE FROM t1; +Warnings: +Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? + +Error 12712 Oracle error +TRUNCATE t1; +Warnings: +Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? + +Error 12712 Oracle error + +3.0 +is null +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +a VARCHAR(255), +b VARCHAR(255), +c VARCHAR(255), +KEY idx1(a,b), +KEY idx2(b), +PRIMARY KEY(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1 +insert into t1 values (null, null, '2048'); +insert into t1 values ('1', '1', '1'); +insert into t1 select a + 1, b + 1, c + 1 from t1; +insert into t1 select a + 2, b + 2, c + 2 from t1; +insert into t1 select a + 4, b + 4, c + 4 from t1; +insert into t1 select a + 8, b + 8, c + 8 from t1; +insert into t1 select a + 16, b + 16, c + 16 from t1; +insert into t1 select a + 32, b + 32, c + 32 from t1; +insert into t1 select a + 64, b + 64, c + 64 from t1; +insert into t1 select a + 128, b + 128, c + 128 from t1; +insert into t1 select a + 256, b + 256, c + 256 from t1; +insert into t1 select a + 512, b + 512, c + 512 from t1; +flush tables; +select a from t1 where a is null order by a limit 30; +a +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +select b from t1 where b is null order by b limit 30; +b +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL + +direct_order_limit +TRUNCATE TABLE t1; +insert into t1 values ('1', '1', '1'); +insert into t1 select a + 1, b + 1, c + 1 from t1; +insert into t1 select a + 2, b + 2, c + 2 from t1; +insert into t1 select a + 4, b + 4, c + 4 from t1; +insert into t1 select a + 8, b + 8, c + 8 from t1; +insert into t1 select a + 16, b + 16, c + 16 from t1; +insert into t1 select a, b + 32, c + 32 from t1; +insert into t1 select a, b + 64, c + 64 from t1; +insert into t1 select a, b + 128, c + 128 from t1; +flush tables; +select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5; +a b c +10 74 74 +10 42 42 +10 234 234 +10 202 202 +10 170 170 +select a, c from t1 where a = '10' order by b desc limit 5; +a c +10 74 +10 42 +10 234 +10 202 +10 170 + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +for slave1_1 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/oracle2/r/spider_fixes_part.result new file mode 100644 index 00000000..20a5ca18 --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/spider_fixes_part.result @@ -0,0 +1,203 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for slave1_1 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +SELECT 1; +1 +1 +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +INSERT INTO tb_l (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); + +2.17 +partition with sort +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 +INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1 +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 + +2.23 +partition update with moving partition +DROP TABLE IF EXISTS ta_l2; +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 +INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00'); +UPDATE ta_l2 SET a = 4 WHERE a = 3; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +4 B 2010-09-26 00:00:00 +index merge with partition +DROP TABLE IF EXISTS ta_l_int; +CREATE TABLE ta_l_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1 +INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); +INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; +INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; +INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; +INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; +SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) +WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; +a b c +3 4 5 +4 5 6 +5 6 7 + +2.26 +auto_increment with partition +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 +MASTER_1_AUTO_INCREMENT_INCREMENT2 +MASTER_1_AUTO_INCREMENT_OFFSET2 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +1 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +1 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +1 +spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') +1 +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +1 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +3 +SELECT MAX(id) FROM t1; +MAX(id) +3 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2 +SELECT MAX(id) FROM t1; +MAX(id) +3 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +7 +SELECT MAX(id) FROM t1; +MAX(id) +7 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +6 +SELECT MAX(id) FROM t1; +MAX(id) +7 +INSERT INTO t1 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +10 +SELECT id FROM t1 ORDER BY id; +id +2 +3 +6 +7 +10 +11 +14 +15 +SET INSERT_ID=5000; +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +18 +SELECT MAX(id) FROM t1; +MAX(id) +18 +INSERT INTO t1 (id) VALUES (10000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +22 +SELECT MAX(id) FROM t1; +MAX(id) +22 +INSERT INTO t1 (id) VALUES (1000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +26 +SELECT MAX(id) FROM t1; +MAX(id) +26 + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +for slave1_1 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/vp_fixes.result b/storage/spider/mysql-test/spider/oracle2/r/vp_fixes.result new file mode 100644 index 00000000..15dd29aa --- /dev/null +++ b/storage/spider/mysql-test/spider/oracle2/r/vp_fixes.result @@ -0,0 +1,80 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +SELECT 1; +1 +1 + +create table and insert +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +INSERT INTO tb_l (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO ta_l SELECT a, b, c FROM tb_l; + +0.9 +create different primary key table +CREATE TABLE ta_l_int ( +a INT DEFAULT 10, +b INT AUTO_INCREMENT, +c INT DEFAULT 11, +PRIMARY KEY(b) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 +INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); +create un-correspond primary key table +DROP TABLE IF EXISTS ta_l_int; +CREATE TABLE ta_l_int ( +a INT DEFAULT 10, +b INT DEFAULT 12, +c INT DEFAULT 11, +PRIMARY KEY(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 +INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); + +deinit +DROP DATABASE IF EXISTS auto_test_local; +DROP DATABASE IF EXISTS auto_test_remote; +DROP DATABASE IF EXISTS auto_test_remote2; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test |