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 eval DROP INDEX ind_$TABLENAME ON $TABLENAME;
21 --source suite/parts/inc/partition-dml_ins_tab.inc
25 GRANT ALL PRIVILEGES ON
test.* TO test_user_1 IDENTIFIED BY
'testpw';
26 GRANT ALL PRIVILEGES ON
test.* TO test_user_2 IDENTIFIED BY
'testpw';
27 GRANT ALL PRIVILEGES ON
test.* TO test_user_3 IDENTIFIED BY
'testpw';
29 connect (session1, localhost, test_user_1,
'testpw',
test);
31 SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 0 AND 9 LOCK IN SHARE MODE;
32 UPDATE t1 PARTITION (`p0-29`) SET b='p0-29-upd-1' WHERE a BETWEEN 0 AND 9 ;
34 connect (session2, localhost, test_user_2,'testpw',
test);
35 --echo
####### expect p0-29 has not been updated
36 SELECT * FROM t1 PARTITION (`p0-29`);
37 --error ER_LOCK_WAIT_TIMEOUT
38 SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 0 AND 9 LOCK IN SHARE MODE;
39 --error ER_LOCK_WAIT_TIMEOUT
40 SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 20 AND 29 FOR UPDATE;
44 --echo
####### expect p0-29 (0-9) has been updated
46 SELECT * FROM t1 PARTITION (`p0-29`);
49 --echo ####### expect p0-29 has not been updated
51 SELECT * FROM t1 PARTITION (`p0-29`);
53 SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 20 AND 29 FOR UPDATE;
54 UPDATE t1 PARTITION (`p0-29`) SET b='p0-29-upd-2' WHERE a BETWEEN 20 AND 29 ;
57 --echo
####### expect only p0-29 (0-9) has been updated
59 SELECT * FROM t1 PARTITION (`p0-29`);
60 --error ER_LOCK_WAIT_TIMEOUT
61 SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 0 AND 9 LOCK IN SHARE MODE;
62 --error ER_LOCK_WAIT_TIMEOUT
63 SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 20 AND 29 FOR UPDATE;
67 --echo
####### expect p0-29 is completely updated
69 SELECT * FROM t1 PARTITION (`p0-29`);
72 --echo ####### expect only p0-29 (0-9) has been updated
74 SELECT * FROM t1 PARTITION (`p0-29`);
76 --echo ####### expect p0-29 is completely updated
78 SELECT * FROM t1 PARTITION (`p0-29`);
84 DROP USER test_user_1;
85 DROP USER test_user_2;
86 DROP USER test_user_3;
88 SET @@global.autocommit= @
auto;
89 SET @@global.tx_isolation= @iso;
90 SET @@global.completion_type= @completion;
91 SET @@global.lock_wait_timeout= @lock_timeout;
92 SET @@global.innodb_lock_wait_timeout= @innodb_lock_timeout;