1 --source include/have_partition.inc
2 SET @
auto= @@global.autocommit;
3 SET @@global.autocommit= off;
4 SET @iso= @@global.tx_isolation;
5 SET @@global.tx_isolation=
'repeatable-read';
6 SET @completion= @@global.completion_type;
7 SET @@global.completion_type=
'no_chain';
8 SET @lock_timeout= @@global.lock_wait_timeout;
9 SET @@global.lock_wait_timeout= 1;
10 SELECT @@global.lock_wait_timeout;
11 SET @innodb_lock_timeout= @@global.innodb_lock_wait_timeout;
12 SET @@global.innodb_lock_wait_timeout= 1;
16 --echo # Additional tests
for WL#5217 by QA, testplan 1.1
19 --source suite/parts/inc/partition-dml_cr_tab.inc
20 --source suite/parts/inc/partition-dml_ins_tab.inc
24 GRANT ALL PRIVILEGES ON
test.* TO test_user_1 IDENTIFIED BY
'testpw';
25 GRANT ALL PRIVILEGES ON
test.* TO test_user_2 IDENTIFIED BY
'testpw';
26 GRANT ALL PRIVILEGES ON
test.* TO test_user_3 IDENTIFIED BY
'testpw';
28 connect (session1, localhost, test_user_1,
'testpw',
test);
30 SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 0 AND 9 LOCK IN SHARE MODE;
31 UPDATE t1 PARTITION (`p0-29`) SET b='p0-29-upd-1' WHERE a BETWEEN 0 AND 9 ;
33 connect (session2, localhost, test_user_2,'testpw',
test);
34 --echo
####### expect p0-29 has not been updated
35 SELECT * FROM t1 PARTITION (`p0-29`);
36 --error ER_LOCK_WAIT_TIMEOUT
37 SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 0 AND 9 LOCK IN SHARE MODE;
38 --error ER_LOCK_WAIT_TIMEOUT
39 SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 20 AND 29 FOR UPDATE;
43 --echo
####### expect p0-29 (0-9) has been updated
45 SELECT * FROM t1 PARTITION (`p0-29`);
48 --echo ####### expect p0-29 has not been updated
50 SELECT * FROM t1 PARTITION (`p0-29`);
52 SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 20 AND 29 FOR UPDATE;
53 UPDATE t1 PARTITION (`p0-29`) SET b='p0-29-upd-2' WHERE a BETWEEN 20 AND 29 ;
56 --echo
####### expect only p0-29 (0-9) has been updated
58 SELECT * FROM t1 PARTITION (`p0-29`);
59 --error ER_LOCK_WAIT_TIMEOUT
60 SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 0 AND 9 LOCK IN SHARE MODE;
61 --error ER_LOCK_WAIT_TIMEOUT
62 SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 20 AND 29 FOR UPDATE;
66 --echo
####### expect p0-29 is completely updated
68 SELECT * FROM t1 PARTITION (`p0-29`);
71 --echo ####### expect only p0-29 (0-9) has been updated
73 SELECT * FROM t1 PARTITION (`p0-29`);
75 --echo ####### expect p0-29 is completely updated
77 SELECT * FROM t1 PARTITION (`p0-29`);
83 DROP USER test_user_1;
84 DROP USER test_user_2;
85 DROP USER test_user_3;
87 SET @@global.autocommit= @
auto;
88 SET @@global.tx_isolation= @iso;
89 SET @@global.completion_type= @completion;
90 SET @@global.lock_wait_timeout= @lock_timeout;
91 SET @@global.innodb_lock_wait_timeout= @innodb_lock_timeout;