| 1 |
CREATE USER test_2@localhost; |
| 2 |
GRANT SELECT,INSERT,CREATE,ALTER,DROP on test.* to test_2@localhost; |
| 3 |
|
| 4 |
--source include/not_embedded.inc |
| 5 |
--disable_result_log |
| 6 |
--disable_query_log |
| 7 |
--source suite/parts/inc/part_exch_tabs.inc |
| 8 |
--enable_result_log |
| 9 |
--enable_query_log |
| 10 |
|
| 11 |
# 8) Exchanges partition and table and back in 2 sessions with an insert. |
| 12 |
# Parallel INSERT and SELECT |
| 13 |
# LOCK behaviour when exchanging different partitons. |
| 14 |
--echo send |
| 15 |
--send |
| 16 |
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; |
| 17 |
|
| 18 |
connect (test_2,localhost,test_2,,test,$MASTER_MYPORT,$MASTER_MYSOCK); |
| 19 |
# Wait until exchange has been done. |
| 20 |
let $wait_condition= SELECT count(a)>0 FROM tp WHERE a=1; |
| 21 |
--source include/wait_condition.inc |
| 22 |
# Expect 1,3,5,9 in tp and 2,4,6,8 in t_10 |
| 23 |
--sorted_result |
| 24 |
SELECT * FROM t_10; |
| 25 |
--sorted_result |
| 26 |
SELECT * FROM tp WHERE a BETWEEN 0 AND 10; |
| 27 |
# Exchange back. |
| 28 |
INSERT INTO tp VALUES (7,"Seven"); |
| 29 |
# Expect 2,4,6,8 in tp |
| 30 |
--sorted_result |
| 31 |
SELECT * FROM tp WHERE a BETWEEN 0 AND 10; |
| 32 |
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; |
| 33 |
|
| 34 |
connection default; |
| 35 |
--echo reap; |
| 36 |
reap; |
| 37 |
--sorted_result |
| 38 |
SELECT * FROM t_10; |
| 39 |
--sorted_result |
| 40 |
SELECT * FROM tp WHERE a BETWEEN 0 AND 10; |
| 41 |
|
| 42 |
connection test_2; |
| 43 |
let $wait_condition= SELECT count(a)>0 FROM tp WHERE a=2; |
| 44 |
--source include/wait_condition.inc |
| 45 |
--sorted_result |
| 46 |
SELECT * FROM t_10; |
| 47 |
--sorted_result |
| 48 |
SELECT * FROM tp WHERE a BETWEEN 0 AND 10; |
| 49 |
disconnect test_2; |
| 50 |
|
| 51 |
connection default; |
| 52 |
--sorted_result |
| 53 |
SELECT * FROM t_10; |
| 54 |
--sorted_result |
| 55 |
SELECT * FROM tp WHERE a BETWEEN 0 AND 10; |
| 56 |
--source suite/parts/inc/part_exch_drop_tabs.inc |
| 57 |
|
| 58 |
DROP USER test_2@localhost; |