Commit ce0d5539 authored by Sergey Vojtovich's avatar Sergey Vojtovich

Merge Spider updates. Fixes

MDEV-4949 - Spider engine causes compilation errors if compiled without
            partitioning
parents 6c396aaf 6c76e503
This diff is collapsed.
......@@ -140,6 +140,7 @@ public:
int multi_range_num;
bool have_second_range;
KEY_MULTI_RANGE mrr_second_range;
spider_string *mrr_key_buff;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
range_id_t *multi_range_keys;
#else
......@@ -226,6 +227,11 @@ public:
#ifdef INFO_KIND_FORCE_LIMIT_BEGIN
longlong info_limit;
#endif
spider_index_rnd_init prev_index_rnd_init;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
SPIDER_ITEM_HLD *direct_aggregate_item_first;
SPIDER_ITEM_HLD *direct_aggregate_item_current;
#endif
/* for fulltext search */
bool ft_init_and_first;
......@@ -696,6 +702,9 @@ public:
uint info_type,
void *info
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
void return_record_by_parent();
#endif
TABLE *get_table();
void set_ft_discard_bitmap();
void set_searched_bitmap();
......@@ -818,6 +827,10 @@ public:
const key_range *start_key
);
int reuse_tmp_table_and_sql_for_bka();
int append_union_table_and_sql_for_bka(
const key_range *start_key
);
int reuse_union_table_and_sql_for_bka();
int append_insert_sql_part();
int append_update_sql_part();
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
......@@ -878,10 +891,20 @@ public:
int append_values_terminator_sql_part(
ulong sql_type
);
int append_union_table_connector_sql_part(
ulong sql_type
);
int append_union_table_terminator_sql_part(
ulong sql_type
);
int append_key_column_values_sql_part(
const key_range *start_key,
ulong sql_type
);
int append_key_column_values_with_name_sql_part(
const key_range *start_key,
ulong sql_type
);
int append_key_where_sql_part(
const key_range *start_key,
const key_range *end_key,
......@@ -903,6 +926,13 @@ public:
ulong sql_type,
bool test_flg
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_sum_select_sql_part(
ulong sql_type,
const char *alias,
uint alias_length
);
#endif
int append_match_select_sql_part(
ulong sql_type,
const char *alias,
......@@ -983,6 +1013,10 @@ public:
uint multi_range_cnt,
bool with_comma
);
int append_multi_range_cnt_with_name_sql_part(
ulong sql_type,
uint multi_range_cnt
);
int append_delete_all_rows_sql_part(
ulong sql_type
);
......@@ -1024,4 +1058,6 @@ public:
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
bool support_bulk_access_hs() const;
#endif
int init_union_table_name_pos_sql();
int set_union_table_name_pos_sql();
};
......@@ -98,19 +98,6 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s')
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
create no index table
DROP TABLE IF EXISTS ta_l_no_idx;
CREATE TABLE ta_l_no_idx
......@@ -282,18 +269,6 @@ 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
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
insert
TRUNCATE TABLE ta_l;
INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
......@@ -467,26 +442,6 @@ 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 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
TRUNCATE TABLE ta_l;
INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
......@@ -657,28 +612,6 @@ 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 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
truncate
TRUNCATE TABLE ta_l;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
......
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
......@@ -74,47 +74,6 @@ SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate 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 STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate 1
SELECT COUNT(*) FROM ta_l2;
COUNT(*)
5
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate 3
SELECT MAX(a) FROM ta_l2;
MAX(a)
5
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate 3
SELECT MIN(a) FROM ta_l2;
MIN(a)
1
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate 3
SELECT MAX(a) FROM ta_l2 WHERE a < 5;
MAX(a)
4
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate 3
SELECT MIN(a) FROM ta_l2 WHERE a > 1;
MIN(a)
2
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate 3
deinit
DROP DATABASE IF EXISTS auto_test_local;
DROP DATABASE IF EXISTS auto_test_remote;
......
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 STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate 0
SELECT COUNT(*) FROM ta_l2;
COUNT(*)
5
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate 2
SELECT MAX(a) FROM ta_l2;
MAX(a)
5
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate 2
SELECT MIN(a) FROM ta_l2;
MIN(a)
1
SHOW 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 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 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
......@@ -121,94 +121,6 @@ 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
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 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 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 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 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 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 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 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 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;
......
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 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 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 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 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 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 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 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 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
......@@ -138,111 +138,6 @@ SELECT spider_flush_table_mon_cache();
spider_flush_table_mon_cache()
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 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_l2 (a, b, c) VALUES
(6, 'e', '2011-05-05 20:04:05');
ERROR HY000: Table 'auto_test_remote3.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_l 1
auto_test_local ta_l2#P#pt2 1
SHOW 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_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;
active standby test
create table test
DROP TABLE IF EXISTS ta_l;
......@@ -271,7 +166,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s')
fail-over test
SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
Variable_name Value
Spider_mon_table_cache_version 2
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');
......@@ -284,7 +179,6 @@ 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_l2#P#pt2 1
auto_test_local ta_l 0
SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
Variable_name Value
......@@ -316,91 +210,6 @@ SELECT spider_flush_table_mon_cache();
spider_flush_table_mon_cache()
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_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 STATUS LIKE 'Spider_mon_table_cache_version%';
Variable_name Value
Spider_mon_table_cache_version 2
Spider_mon_table_cache_version_req 3
INSERT INTO ta_l2 (a, b, c) VALUES
(6, 'e', '2011-05-05 20:04:05');
ERROR HY000: Table 'auto_test_remote.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_l 1
auto_test_local ta_l2#P#pt2 1
auto_test_local ta_l 0
auto_test_local ta_l2#P#pt2 0
SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
Variable_name Value
Spider_mon_table_cache_version 3
Spider_mon_table_cache_version_req 3
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;
......
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 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 'auto_test_remote3.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 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 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 'auto_test_remote.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 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
......@@ -190,167 +190,6 @@ id
3108
5000
10000
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('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
'srv "s_2_1"')
1
spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
'srv "s_2_2"')
1
spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
'srv "s_2_1"')
1
spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
'srv "s_2_2"')
1
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
777
SELECT MAX(id) FROM t1;
MAX(id)
777
INSERT INTO t2 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1554
SELECT MAX(id) FROM t2;
MAX(id)
1554
MASTER_1_AUTO_INCREMENT_OFFSET3
INSERT INTO t1 (id) VALUES (null);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
778
SELECT MAX(id) FROM t1;
MAX(id)
1554
MASTER_1_AUTO_INCREMENT_OFFSET4
INSERT INTO t2 (id) VALUES (null);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
2331
SELECT MAX(id) FROM t2;
MAX(id)
2331
MASTER_1_AUTO_INCREMENT_OFFSET3
INSERT INTO t1 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1555
SELECT id FROM t1 ORDER BY id;
id
777
778
1554
1555
2331
2332
3109
3886
MASTER_1_AUTO_INCREMENT_OFFSET4
INSERT INTO t2 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3108
SELECT id FROM t2 ORDER BY id;
id
777
778
1554
1555
2331
2332
3108
3109
3885
3886
4662
5439
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
INSERT INTO t1 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
777
SELECT id FROM t1 ORDER BY id;
id
777
1554
2331
3108
INSERT INTO t2 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3885
SELECT id FROM t2 ORDER BY id;
id
777
1554
2331
3108
3885
4662
5439
6216
SET INSERT_ID=5000;
MASTER_1_AUTO_INCREMENT_OFFSET3
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
SELECT MAX(id) FROM t1;
MAX(id)
6216
MASTER_1_AUTO_INCREMENT_OFFSET4
INSERT INTO t2 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
6993
SELECT MAX(id) FROM t2;
MAX(id)
6993
INSERT INTO t1 (id) VALUES (10000);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
6993
SELECT MAX(id) FROM t1;
MAX(id)
10000
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
6993
SELECT MAX(id) FROM t2;
MAX(id)
10000
SELECT id FROM t1 ORDER BY id;
id
777
1554
2331
3108
5000
10000
deinit
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 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_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('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
'srv "s_2_1"')
1
spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
'srv "s_2_2"')
1
spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
'srv "s_2_1"')
1
spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
'srv "s_2_2"')
1
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
777
SELECT MAX(id) FROM t1;
MAX(id)
777
INSERT INTO t2 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1554
SELECT MAX(id) FROM t2;
MAX(id)
1554
MASTER_1_AUTO_INCREMENT_OFFSET3
INSERT INTO t1 (id) VALUES (null);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
778
SELECT MAX(id) FROM t1;
MAX(id)
1554
MASTER_1_AUTO_INCREMENT_OFFSET4
INSERT INTO t2 (id) VALUES (null);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
2331
SELECT MAX(id) FROM t2;
MAX(id)
2331
MASTER_1_AUTO_INCREMENT_OFFSET3
INSERT INTO t1 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1555
SELECT id FROM t1 ORDER BY id;
id
777
778
1554
1555
2331
2332
3109
3886
MASTER_1_AUTO_INCREMENT_OFFSET4
INSERT INTO t2 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3108
SELECT id FROM t2 ORDER BY id;
id
777
778
1554
1555
2331
2332
3108
3109
3885
3886
4662
5439
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
INSERT INTO t1 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
777
SELECT id FROM t1 ORDER BY id;
id
777
1554
2331
3108
INSERT INTO t2 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3885
SELECT id FROM t2 ORDER BY id;
id
777
1554
2331
3108
3885
4662
5439
6216
SET INSERT_ID=5000;
MASTER_1_AUTO_INCREMENT_OFFSET3
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
SELECT MAX(id) FROM t1;
MAX(id)
6216
MASTER_1_AUTO_INCREMENT_OFFSET4
INSERT INTO t2 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
6993
SELECT MAX(id) FROM t2;
MAX(id)
6993
INSERT INTO t1 (id) VALUES (10000);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
6993
SELECT MAX(id) FROM t1;
MAX(id)
10000
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
6993
SELECT MAX(id) FROM t2;
MAX(id)
10000
SELECT id FROM t1 ORDER BY id;
id
777
1554
2331
3108
5000
10000
deinit
DROP DATABASE IF EXISTS auto_test_local;
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
......@@ -166,36 +166,8 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s')
3 e 2007-06-04 20:03:11
4 d 2003-11-30 05:01:03
5 c 2001-12-31 23:59:59
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
CREATE TABLE ta_l_int (
a INT AUTO_INCREMENT,
......@@ -216,27 +188,6 @@ a b c
3 4 5
4 5 6
5 6 7
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.24
index scan update without PK
......@@ -250,29 +201,45 @@ 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 (1, 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
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
17 2 4
18 2 4
2.25
direct order limit
......@@ -283,7 +250,7 @@ SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3;
a b c
1 2 4
2 3 4
4 5 6
3 4 5
SHOW STATUS LIKE 'Spider_direct_order_limit';
Variable_name Value
Spider_direct_order_limit 0
......@@ -405,94 +372,12 @@ id
6216
10000
auto_increment with partition
read only
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('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
'srv "s_2_1"')
1
spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
'srv "s_2_2"')
1
spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
'srv "s_2_1"')
1
spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
'srv "s_2_2"')
1
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
id int(11) NOT NULL,
PRIMARY KEY (id)
) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
777
SELECT MAX(id) FROM t1;
MAX(id)
777
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1554
SELECT MAX(id) FROM t1;
MAX(id)
1554
INSERT INTO t1 (id) VALUES (null);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
2331
SELECT MAX(id) FROM t1;
MAX(id)
2331
INSERT INTO t1 (id) VALUES (null);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3108
SELECT MAX(id) FROM t1;
MAX(id)
3108
INSERT INTO t1 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3885
SELECT id FROM t1 ORDER BY id;
id
777
1554
2331
3108
3885
4662
5439
6216
SET INSERT_ID=5000;
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
SELECT MAX(id) FROM t1;
MAX(id)
6216
INSERT INTO t1 (id) VALUES (10000);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
SELECT MAX(id) FROM t1;
MAX(id)
10000
INSERT INTO t1 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
SELECT MAX(id) FROM t1;
MAX(id)
10000
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1
SELECT id FROM t1 ORDER BY id;
id
777
......@@ -506,27 +391,11 @@ id
5439
6216
10000
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
1000
1554
3108
4662
5000
6216
10000
INSERT INTO t1 (id) VALUES (1);
ERROR HY000: Table 'auto_test_local.t1' is read only
UPDATE t1 SET id = 4 WHERE id = 1000;
UPDATE t1 SET id = 4 WHERE id = 777;
ERROR HY000: Table 'auto_test_local.t1' is read only
DELETE FROM t1 WHERE id = 1000;
DELETE FROM t1 WHERE id = 777;
ERROR HY000: Table 'auto_test_local.t1' is read only
DELETE FROM t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
......
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_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('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
'srv "s_2_1"')
1
spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
'srv "s_2_2"')
1
spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
'srv "s_2_1"')
1
spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
'srv "s_2_2"')
1
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
777
SELECT MAX(id) FROM t1;
MAX(id)
777
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1554
SELECT MAX(id) FROM t1;
MAX(id)
1554
INSERT INTO t1 (id) VALUES (null);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
2331
SELECT MAX(id) FROM t1;
MAX(id)
2331
INSERT INTO t1 (id) VALUES (null);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3108
SELECT MAX(id) FROM t1;
MAX(id)
3108
INSERT INTO t1 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3885
SELECT id FROM t1 ORDER BY id;
id
777
1554
2331
3108
3885
4662
5439
6216
SET INSERT_ID=5000;
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
SELECT MAX(id) FROM t1;
MAX(id)
6216
INSERT INTO t1 (id) VALUES (10000);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
SELECT MAX(id) FROM t1;
MAX(id)
10000
INSERT INTO t1 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
SELECT MAX(id) FROM t1;
MAX(id)
10000
SELECT id FROM t1 ORDER BY id;
id
777
1000
1554
2331
3108
3885
4662
5000
5439
6216
10000
deinit
DROP DATABASE IF EXISTS auto_test_local;
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
This diff is collapsed.
--let $SKIP_REASON=
--disable_warnings
--disable_query_log
--disable_result_log
......@@ -25,28 +24,6 @@ if ($USE_CHILD_GROUP2)
}
--enable_warnings
if ($SKIP_REASON)
{
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
--connection child2_2
DROP DATABASE IF EXISTS auto_test_remote2;
}
--disable_query_log
--disable_result_log
--source test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--skip $SKIP_REASON
}
--echo
--echo test select 1
--connection master_1
......@@ -180,120 +157,6 @@ if ($USE_CHILD_GROUP2)
}
}
--echo
--echo with partition test
if ($HAVE_PARTITION)
{
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_2
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_2_DROP_TABLES;
echo CHILD2_2_CREATE_TABLES;
}
--disable_warnings
eval $CHILD2_2_DROP_TABLES;
--enable_warnings
eval $CHILD2_2_CREATE_TABLES;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES2;
echo CHILD2_1_CREATE_TABLES2;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES2;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES2;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_query_log
echo CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
eval 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
(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');
--enable_query_log
eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
SELECT COUNT(*) FROM ta_l2;
eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
SELECT MAX(a) FROM ta_l2;
eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
SELECT MIN(a) FROM ta_l2;
eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
SELECT MAX(a) FROM ta_l2 WHERE a < 5;
eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
SELECT MIN(a) FROM ta_l2 WHERE a > 1;
eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_2
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
}
eval $CHILD2_2_SELECT_TABLES;
--connection child2_1
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
}
eval $CHILD2_1_SELECT_TABLES2;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
}
--echo
--echo deinit
--disable_warnings
......
--disable_warnings
--disable_query_log
--disable_result_log
--source test_init.inc
--enable_result_log
--enable_query_log
if (!$HAVE_PARTITION)
{
--disable_query_log
--disable_result_log
--source test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
skip Test requires partitioning;
}
--echo
--echo drop and create databases
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
--connection child2_2
DROP DATABASE IF EXISTS auto_test_remote2;
CREATE DATABASE auto_test_remote2;
USE auto_test_remote2;
}
--enable_warnings
--echo
--echo test select 1
--connection master_1
SELECT 1;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
SELECT 1;
--connection child2_2
SELECT 1;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo with partition test
if ($HAVE_PARTITION)
{
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_2
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_2_DROP_TABLES;
echo CHILD2_2_CREATE_TABLES;
}
--disable_warnings
eval $CHILD2_2_DROP_TABLES;
--enable_warnings
eval $CHILD2_2_CREATE_TABLES;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES2;
echo CHILD2_1_CREATE_TABLES2;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES2;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES2;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_query_log
echo CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
eval 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
(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');
--enable_query_log
eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
SELECT COUNT(*) FROM ta_l2;
eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
SELECT MAX(a) FROM ta_l2;
eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
SELECT MIN(a) FROM ta_l2;
eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
SELECT MAX(a) FROM ta_l2 WHERE a < 5;
eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
SELECT MIN(a) FROM ta_l2 WHERE a > 1;
eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_2
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
}
eval $CHILD2_2_SELECT_TABLES;
--connection child2_1
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
}
eval $CHILD2_1_SELECT_TABLES2;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
}
--echo
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
--connection child2_2
DROP DATABASE IF EXISTS auto_test_remote2;
}
--disable_query_log
--disable_result_log
--source test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--echo
--echo end of test
--let $SKIP_REASON=
--disable_warnings
--disable_query_log
--disable_result_log
......@@ -25,28 +24,6 @@ if ($USE_CHILD_GROUP2)
}
--enable_warnings
if ($SKIP_REASON)
{
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
--connection child2_2
DROP DATABASE IF EXISTS auto_test_remote2;
}
--disable_query_log
--disable_result_log
--source test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--skip $SKIP_REASON
}
--echo
--echo test select 1
--connection master_1
......@@ -199,139 +176,6 @@ if ($USE_CHILD_GROUP2)
}
}
--echo
--echo with partition test
if ($HAVE_PARTITION)
{
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_2
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_2_DROP_TABLES;
echo CHILD2_2_CREATE_TABLES;
}
--disable_warnings
eval $CHILD2_2_DROP_TABLES;
--enable_warnings
eval $CHILD2_2_CREATE_TABLES;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES2;
echo CHILD2_1_CREATE_TABLES2;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES2;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES2;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_query_log
echo CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
eval 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
(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');
--enable_query_log
eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo update all rows with function
UPDATE ta_l2 SET c = ADDDATE(c, 1);
eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo update by primary key
UPDATE ta_l2 SET b = 'x' WHERE a = 3;
eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo update by a column without index
UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x';
eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo 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;
eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo delete by primary key with order and limit
DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1;
eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo delete by a column without index
DELETE FROM ta_l2 WHERE b = 'c';
eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo delete by primary key
DELETE FROM ta_l2 WHERE a = 3;
eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_2
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
}
eval $CHILD2_2_SELECT_TABLES;
--connection child2_1
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
}
eval $CHILD2_1_SELECT_TABLES2;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
}
--echo
--echo deinit
--disable_warnings
......
--disable_warnings
--disable_query_log
--disable_result_log
--source test_init.inc
--enable_result_log
--enable_query_log
if (!$HAVE_PARTITION)
{
--disable_query_log
--disable_result_log
--source test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
skip Test requires partitioning;
}
--echo
--echo drop and create databases
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
--connection child2_2
DROP DATABASE IF EXISTS auto_test_remote2;
CREATE DATABASE auto_test_remote2;
USE auto_test_remote2;
}
--enable_warnings
--echo
--echo test select 1
--connection master_1
SELECT 1;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
SELECT 1;
--connection child2_2
SELECT 1;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo with partition test
if ($HAVE_PARTITION)
{
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_2
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_2_DROP_TABLES;
echo CHILD2_2_CREATE_TABLES;
}
--disable_warnings
eval $CHILD2_2_DROP_TABLES;
--enable_warnings
eval $CHILD2_2_CREATE_TABLES;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES2;
echo CHILD2_1_CREATE_TABLES2;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES2;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES2;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_query_log
echo CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
eval 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
(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');
--enable_query_log
eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo update all rows with function
UPDATE ta_l2 SET c = ADDDATE(c, 1);
eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo update by primary key
UPDATE ta_l2 SET b = 'x' WHERE a = 3;
eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo update by a column without index
UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x';
eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo 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;
eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo delete by primary key with order and limit
DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1;
eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo delete by a column without index
DELETE FROM ta_l2 WHERE b = 'c';
eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
--echo delete by primary key
DELETE FROM ta_l2 WHERE a = 3;
eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_2
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
}
eval $CHILD2_2_SELECT_TABLES;
--connection child2_1
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %';
}
eval $CHILD2_1_SELECT_TABLES2;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
}
--echo
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
--connection child2_2
DROP DATABASE IF EXISTS auto_test_remote2;
}
--disable_query_log
--disable_result_log
--source test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--echo
--echo end of test
# This test tests for using functions
--let $SKIP_REASON=
--disable_warnings
--disable_query_log
--disable_result_log
......@@ -26,28 +25,6 @@ if ($USE_CHILD_GROUP2)
}
--enable_warnings
if ($SKIP_REASON)
{
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
--connection child2_2
DROP DATABASE IF EXISTS auto_test_remote2;
}
--disable_query_log
--disable_result_log
--source test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--skip $SKIP_REASON
}
--echo
--echo test select 1
--connection master_1
......
This diff is collapsed.
# This test tests for Spider 3.0's bug fixes
--let $SKIP_REASON=
source include/have_log_bin.inc;
--disable_warnings
--disable_query_log
......@@ -35,34 +34,6 @@ if ($USE_CHILD_GROUP2)
}
--enable_warnings
if ($SKIP_REASON)
{
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_REPLICATION)
{
--connection slave1_1
DROP DATABASE IF EXISTS auto_test_local;
}
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
--connection child2_2
DROP DATABASE IF EXISTS auto_test_remote2;
}
--disable_query_log
--disable_result_log
--source slave_test_deinit.inc
--source test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--skip $SKIP_REASON
}
--echo
--echo test select 1
--connection master_1
......@@ -293,255 +264,6 @@ if ($USE_CHILD_GROUP2)
}
--echo auto_increment with partition
if ($HAVE_PARTITION)
{
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_INCREMENT_TABLES1;
echo CHILD2_1_CREATE_INCREMENT_TABLES1;
echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
}
--disable_warnings
eval $CHILD2_1_DROP_INCREMENT_TABLES1;
--enable_warnings
eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
--connection child2_2
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_2_DROP_INCREMENT_TABLES1;
echo CHILD2_2_CREATE_INCREMENT_TABLES1;
echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
}
--disable_warnings
eval $CHILD2_2_DROP_INCREMENT_TABLES1;
--enable_warnings
eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
if ($USE_REPLICATION)
{
save_master_pos;
--connection slave1_1
sync_with_master;
--connection master_1
--disable_query_log
SET SESSION sql_log_bin= 0;
--enable_query_log
}
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
--disable_query_log
echo 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;
echo 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;
echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
echo MASTER_1_AUTO_INCREMENT_OFFSET2;
eval 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;
eval 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;
eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
if ($USE_REPLICATION)
{
SET SESSION sql_log_bin= 1;
--connection slave1_1
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
echo CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
echo CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
eval CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
eval CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
--connection master_1
}
--enable_query_log
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t1;
INSERT INTO t2 () VALUES ();
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
--disable_query_log
echo MASTER_1_AUTO_INCREMENT_OFFSET3;
eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
--enable_query_log
INSERT INTO t1 (id) VALUES (null);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t1;
--disable_query_log
echo MASTER_1_AUTO_INCREMENT_OFFSET4;
eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
--enable_query_log
INSERT INTO t2 (id) VALUES (null);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
--disable_query_log
echo MASTER_1_AUTO_INCREMENT_OFFSET3;
eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
--enable_query_log
INSERT INTO t1 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
SELECT id FROM t1 ORDER BY id;
--disable_query_log
echo MASTER_1_AUTO_INCREMENT_OFFSET4;
eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
--enable_query_log
INSERT INTO t2 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
SELECT id FROM t2 ORDER BY id;
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
INSERT INTO t1 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
SELECT id FROM t1 ORDER BY id;
INSERT INTO t2 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
SELECT id FROM t2 ORDER BY id;
SET INSERT_ID=5000;
--disable_query_log
echo MASTER_1_AUTO_INCREMENT_OFFSET3;
eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
--enable_query_log
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t1;
--disable_query_log
echo MASTER_1_AUTO_INCREMENT_OFFSET4;
eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
--enable_query_log
INSERT INTO t2 () VALUES ();
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
INSERT INTO t1 (id) VALUES (10000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t1;
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
if ($USE_REPLICATION)
{
save_master_pos;
--connection slave1_1
sync_with_master;
SELECT id FROM t1 ORDER BY id;
--connection master_1
--disable_query_log
SET SESSION sql_log_bin= 0;
--enable_query_log
}
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
}
eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
}
eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
--connection child2_2
if ($USE_GENERAL_LOG)
{
SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
}
eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
}
eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
}
--echo
--echo deinit
--disable_warnings
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment