Commit 0b4a89a1 authored by Kentoku SHIBA's avatar Kentoku SHIBA

fix MDEV-4949 Spider engine causes compilation errors if compiled without partitioning

parent dc01d230
...@@ -312,9 +312,9 @@ int ha_spider::open( ...@@ -312,9 +312,9 @@ int ha_spider::open(
bool create_pt_handler_share = FALSE, pt_handler_mutex = FALSE, bool create_pt_handler_share = FALSE, pt_handler_mutex = FALSE,
may_be_clone = FALSE; may_be_clone = FALSE;
ha_spider **pt_handler_share_handlers; ha_spider **pt_handler_share_handlers;
#endif
#ifdef SPIDER_HAS_HASH_VALUE_TYPE #ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value; my_hash_value_type hash_value;
#endif
#endif #endif
DBUG_ENTER("ha_spider::open"); DBUG_ENTER("ha_spider::open");
DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider this=%p", this));
...@@ -602,8 +602,10 @@ int ha_spider::open( ...@@ -602,8 +602,10 @@ int ha_spider::open(
searched_bitmap = NULL; searched_bitmap = NULL;
} }
error_searched_bitmap_alloc: error_searched_bitmap_alloc:
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (pt_handler_mutex) if (pt_handler_mutex)
pthread_mutex_unlock(&partition_share->pt_handler_mutex); pthread_mutex_unlock(&partition_share->pt_handler_mutex);
#endif
spider_free_share(share); spider_free_share(share);
share = NULL; share = NULL;
error_get_share: error_get_share:
...@@ -8033,7 +8035,9 @@ int ha_spider::info( ...@@ -8033,7 +8035,9 @@ int ha_spider::info(
if (flag & HA_STATUS_AUTO) if (flag & HA_STATUS_AUTO)
{ {
if ( if (
#ifdef WITH_PARTITION_STORAGE_ENGINE
share->partition_share && share->partition_share &&
#endif
tmp_auto_increment_mode == 1 && tmp_auto_increment_mode == 1 &&
!share->auto_increment_init !share->auto_increment_init
) { ) {
......
...@@ -98,19 +98,6 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') ...@@ -98,19 +98,6 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s')
4 i 2003-10-30 05:01:03 4 i 2003-10-30 05:01:03
5 h 2001-10-31 23:59:59 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 create no index table
DROP TABLE IF EXISTS ta_l_no_idx; DROP TABLE IF EXISTS ta_l_no_idx;
CREATE TABLE 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; ...@@ -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') a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
2 g 2000-02-01 00:00:00 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 insert
TRUNCATE TABLE ta_l; TRUNCATE TABLE ta_l;
INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); 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') ...@@ -467,26 +442,6 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s')
1 g 2009-03-03 03:03:03 1 g 2009-03-03 03:03:03
2 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 delete
TRUNCATE TABLE ta_l; TRUNCATE TABLE ta_l;
INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), 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; ...@@ -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') a b date_format(c, '%Y-%m-%d %H:%i:%s')
10 j 2008-01-01 23:59:59 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
TRUNCATE TABLE ta_l; TRUNCATE TABLE ta_l;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; 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'; ...@@ -74,47 +74,6 @@ SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value Variable_name Value
Spider_direct_aggregate 1 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 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_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') ...@@ -121,94 +121,6 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s')
1 a 2008-08-02 10:21:39 1 a 2008-08-02 10:21:39
4 d 2003-12-01 05:01:03 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 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_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(); ...@@ -138,111 +138,6 @@ SELECT spider_flush_table_mon_cache();
spider_flush_table_mon_cache() spider_flush_table_mon_cache()
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 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 active standby test
create table test create table test
DROP TABLE IF EXISTS ta_l; DROP TABLE IF EXISTS ta_l;
...@@ -271,7 +166,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') ...@@ -271,7 +166,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s')
fail-over test fail-over test
SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
Variable_name Value Variable_name Value
Spider_mon_table_cache_version 2 Spider_mon_table_cache_version 1
Spider_mon_table_cache_version_req 2 Spider_mon_table_cache_version_req 2
INSERT INTO ta_l (a, b, c) VALUES INSERT INTO ta_l (a, b, c) VALUES
(6, 'e', '2011-05-05 20:04:05'); (6, 'e', '2011-05-05 20:04:05');
...@@ -284,7 +179,6 @@ auto_test_local ta_l 1 1 ...@@ -284,7 +179,6 @@ auto_test_local ta_l 1 1
SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
db_name table_name link_id db_name table_name link_id
auto_test_local ta_l 1 auto_test_local ta_l 1
auto_test_local ta_l2#P#pt2 1
auto_test_local ta_l 0 auto_test_local ta_l 0
SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
Variable_name Value Variable_name Value
...@@ -316,91 +210,6 @@ SELECT spider_flush_table_mon_cache(); ...@@ -316,91 +210,6 @@ SELECT spider_flush_table_mon_cache();
spider_flush_table_mon_cache() spider_flush_table_mon_cache()
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_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 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_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 ...@@ -190,167 +190,6 @@ id
3108 3108
5000 5000
10000 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 deinit
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 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') ...@@ -166,36 +166,8 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s')
3 e 2007-06-04 20:03:11 3 e 2007-06-04 20:03:11
4 d 2003-11-30 05:01:03 4 d 2003-11-30 05:01:03
5 c 2001-12-31 23:59:59 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 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 index merge
CREATE TABLE ta_l_int ( CREATE TABLE ta_l_int (
a INT AUTO_INCREMENT, a INT AUTO_INCREMENT,
...@@ -216,27 +188,6 @@ a b c ...@@ -216,27 +188,6 @@ a b c
3 4 5 3 4 5
4 5 6 4 5 6
5 6 7 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 2.24
index scan update without PK index scan update without PK
...@@ -250,29 +201,45 @@ KEY idx2(c) ...@@ -250,29 +201,45 @@ KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
SELECT a, b, c FROM ta_l_int ORDER BY a; SELECT a, b, c FROM ta_l_int ORDER BY a;
a b c a b c
1 2 3
2 3 4 2 3 4
3 4 5
4 5 6 4 5 6
5 6 7
6 7 8 6 7 8
7 8 9
8 9 10 8 9 10
9 10 11
10 11 12 10 11 12
11 12 13
12 13 14 12 13 14
13 14 15
14 15 16 14 15 16
15 16 17
16 17 18 16 17 18
INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3); 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; UPDATE ta_l_int SET c = 4 WHERE b = 2;
SELECT a, b, c FROM ta_l_int ORDER BY a; SELECT a, b, c FROM ta_l_int ORDER BY a;
a b c a b c
1 2 4 1 2 4
2 3 4 2 3 4
3 4 5
4 5 6 4 5 6
5 6 7
6 7 8 6 7 8
7 8 9
8 9 10 8 9 10
9 10 11
10 11 12 10 11 12
11 12 13
12 13 14 12 13 14
13 14 15
14 15 16 14 15 16
15 16 17
16 17 18 16 17 18
17 2 4 17 2 4
18 2 4
2.25 2.25
direct order limit direct order limit
...@@ -283,7 +250,7 @@ SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; ...@@ -283,7 +250,7 @@ SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3;
a b c a b c
1 2 4 1 2 4
2 3 4 2 3 4
4 5 6 3 4 5
SHOW STATUS LIKE 'Spider_direct_order_limit'; SHOW STATUS LIKE 'Spider_direct_order_limit';
Variable_name Value Variable_name Value
Spider_direct_order_limit 0 Spider_direct_order_limit 0
...@@ -405,94 +372,12 @@ id ...@@ -405,94 +372,12 @@ id
6216 6216
10000 10000
auto_increment with partition read only
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT, id int(11) NOT NULL,
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) PRIMARY KEY (id)
) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1 ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_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; SELECT id FROM t1 ORDER BY id;
id id
777 777
...@@ -506,27 +391,11 @@ id ...@@ -506,27 +391,11 @@ id
5439 5439
6216 6216
10000 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); INSERT INTO t1 (id) VALUES (1);
ERROR HY000: Table 'auto_test_local.t1' is read only 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 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 ERROR HY000: Table 'auto_test_local.t1' is read only
DELETE FROM t1; DELETE FROM t1;
ERROR HY000: Table 'auto_test_local.t1' is read only 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_warnings
--disable_query_log --disable_query_log
--disable_result_log --disable_result_log
...@@ -25,28 +24,6 @@ if ($USE_CHILD_GROUP2) ...@@ -25,28 +24,6 @@ if ($USE_CHILD_GROUP2)
} }
--enable_warnings --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
--echo test select 1 --echo test select 1
--connection master_1 --connection master_1
...@@ -180,120 +157,6 @@ if ($USE_CHILD_GROUP2) ...@@ -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
--echo deinit --echo deinit
--disable_warnings --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_warnings
--disable_query_log --disable_query_log
--disable_result_log --disable_result_log
...@@ -25,28 +24,6 @@ if ($USE_CHILD_GROUP2) ...@@ -25,28 +24,6 @@ if ($USE_CHILD_GROUP2)
} }
--enable_warnings --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
--echo test select 1 --echo test select 1
--connection master_1 --connection master_1
...@@ -199,139 +176,6 @@ if ($USE_CHILD_GROUP2) ...@@ -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
--echo deinit --echo deinit
--disable_warnings --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 # This test tests for using functions
--let $SKIP_REASON=
--disable_warnings --disable_warnings
--disable_query_log --disable_query_log
--disable_result_log --disable_result_log
...@@ -26,28 +25,6 @@ if ($USE_CHILD_GROUP2) ...@@ -26,28 +25,6 @@ if ($USE_CHILD_GROUP2)
} }
--enable_warnings --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
--echo test select 1 --echo test select 1
--connection master_1 --connection master_1
......
This diff is collapsed.
# This test tests for Spider 3.0's bug fixes # This test tests for Spider 3.0's bug fixes
--let $SKIP_REASON=
source include/have_log_bin.inc; source include/have_log_bin.inc;
--disable_warnings --disable_warnings
--disable_query_log --disable_query_log
...@@ -35,34 +34,6 @@ if ($USE_CHILD_GROUP2) ...@@ -35,34 +34,6 @@ if ($USE_CHILD_GROUP2)
} }
--enable_warnings --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
--echo test select 1 --echo test select 1
--connection master_1 --connection master_1
...@@ -293,255 +264,6 @@ if ($USE_CHILD_GROUP2) ...@@ -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
--echo deinit --echo deinit
--disable_warnings --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.
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