MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
part_exch_qa_7.inc
1 CREATE USER test_2@localhost;
2 
3 --source include/not_embedded.inc
4 --disable_result_log
5 --disable_query_log
6 --source suite/parts/inc/part_exch_tabs.inc
7 --enable_result_log
8 --enable_query_log
9 
10 # 8) Exchanges partition and table and back in 2 sessions with an insert.
11 # Parallel INSERT and SELECT
12 # LOCK behaviour when exchanging different partitons.
13 --echo send
14 --send
15 ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10;
16 
17 --echo connect (test_2,localhost,test_2,,test,MASTER_MYPORT,MASTER_MYSOCK);
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 --echo connection default;
35 connection default;
36 --echo reap;
37 reap;
38 --sorted_result
39 SELECT * FROM t_10;
40 --sorted_result
41 SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
42 
43 --echo connection test_2;
44 connection test_2;
45 let $wait_condition= SELECT count(a)>0 FROM tp WHERE a=2;
46 --source include/wait_condition.inc
47 --sorted_result
48 SELECT * FROM t_10;
49 --sorted_result
50 SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
51 --echo disconnect test_2;
52 disconnect test_2;
53 
54 --echo connection default;
55 connection default;
56 --sorted_result
57 SELECT * FROM t_10;
58 --sorted_result
59 SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
60 --source suite/parts/inc/part_exch_drop_tabs.inc
61 
62 DROP USER test_2@localhost;
63