1use test;
2drop table if exists t1;
3create table t1 (id int primary key, value int, value2 int,
4value3 int, index(value,value2)) engine=innodb;
5insert into t1 values
6(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14),
7(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19),
8(20,20,20,20);
9use test;
10start transaction with consistent snapshot;
11use test;
12CREATE PROCEDURE update_t1()
13BEGIN
14DECLARE i INT DEFAULT 1;
15while (i <= 5000) DO
16update test.t1 set value2=value2+1, value3=value3+1 where id=12;
17SET i = i + 1;
18END WHILE;
19END|
20set autocommit=0;
21CALL update_t1();
22select * from t1;
23id	value	value2	value3
2410	10	10	10
2511	11	11	11
2612	12	5012	5012
2713	13	13	13
2814	14	14	14
2915	15	15	15
3016	16	16	16
3117	17	17	17
3218	18	18	18
3319	19	19	19
3420	20	20	20
35set autocommit=1;
36select * from t1;
37id	value	value2	value3
3810	10	10	10
3911	11	11	11
4012	12	5012	5012
4113	13	13	13
4214	14	14	14
4315	15	15	15
4416	16	16	16
4517	17	17	17
4618	18	18	18
4719	19	19	19
4820	20	20	20
49select * from t1 force index(value) where value=12;
50kill query @id;
51ERROR 70100: Query execution was interrupted
52drop procedure if exists update_t1;
53drop table if exists t1;
54