1connect conn1, localhost, root;
2set session transaction isolation level serializable;
3connect conn2, localhost, root;
4set session transaction isolation level serializable;
5connection conn1;
6drop table if exists t;
7create table t (a int primary key, b int) engine=tokudb;
8insert ignore t values(1, 1);
9insert ignore t values(2, 4);
10insert ignore t values(3, 9);
11insert ignore t values(4, 16);
12insert ignore t values(5, 25);
13insert ignore t values(6, 36);
14connection conn1;
15set session tokudb_lock_timeout=0;
16connection conn2;
17set session tokudb_lock_timeout=0;
18connection conn1;
19begin;
20select * from t where a=1 for update;
21a	b
221	1
23connection conn2;
24select * from t where a=1 for update;
25ERROR HY000: Lock wait timeout exceeded; try restarting transaction
26select * from t where a=2 for update;
27a	b
282	4
29select * from t where a=3 for update;
30a	b
313	9
32select * from t where a=4 for update;
33a	b
344	16
35begin;
36select * from t;
37ERROR HY000: Lock wait timeout exceeded; try restarting transaction
38select * from t where a=1;
39ERROR HY000: Lock wait timeout exceeded; try restarting transaction
40select * from t where a>=2;
41a	b
422	4
433	9
444	16
455	25
466	36
47commit;
48connection conn1;
49commit;
50connection conn2;
51select * from t where a=1 for update;
52a	b
531	1
54begin;
55select * from t;
56a	b
571	1
582	4
593	9
604	16
615	25
626	36
63commit;
64connection conn1;
65connection conn1;
66begin;
67select * from t where a=1 for update;
68a	b
691	1
70connection conn2;
71update t set b=b where a=1;
72ERROR HY000: Lock wait timeout exceeded; try restarting transaction
73update t set b=b where a=2;
74update t set b=b where a=3;
75update t set b=b where a=4;
76begin;
77select * from t;
78ERROR HY000: Lock wait timeout exceeded; try restarting transaction
79select * from t where a=1;
80ERROR HY000: Lock wait timeout exceeded; try restarting transaction
81select * from t where a>=2;
82a	b
832	4
843	9
854	16
865	25
876	36
88commit;
89connection conn1;
90commit;
91connection conn2;
92update t set b=b where a=1;
93begin;
94select * from t;
95a	b
961	1
972	4
983	9
994	16
1005	25
1016	36
102commit;
103connection conn1;
104connection conn1;
105begin;
106select * from t where a=1 for update;
107a	b
1081	1
109connection conn2;
110insert ignore t values(1, 100);
111ERROR HY000: Lock wait timeout exceeded; try restarting transaction
112insert ignore t values(2, 100);
113insert ignore t values(3, 100);
114insert ignore t values(4, 100);
115begin;
116select * from t;
117ERROR HY000: Lock wait timeout exceeded; try restarting transaction
118select * from t where a=1;
119ERROR HY000: Lock wait timeout exceeded; try restarting transaction
120select * from t where a>=2;
121a	b
1222	4
1233	9
1244	16
1255	25
1266	36
127commit;
128connection conn1;
129commit;
130connection conn2;
131insert ignore t values(1, 100);
132begin;
133select * from t;
134a	b
1351	1
1362	4
1373	9
1384	16
1395	25
1406	36
141commit;
142connection conn1;
143connection conn1;
144begin;
145select * from t where a=1 for update;
146a	b
1471	1
148connection conn2;
149replace t values(1, 100);
150ERROR HY000: Lock wait timeout exceeded; try restarting transaction
151replace t values(2, 100);
152replace t values(3, 100);
153replace t values(4, 100);
154begin;
155select * from t;
156ERROR HY000: Lock wait timeout exceeded; try restarting transaction
157select * from t where a=1;
158ERROR HY000: Lock wait timeout exceeded; try restarting transaction
159select * from t where a>=2;
160a	b
1612	100
1623	100
1634	100
1645	25
1656	36
166commit;
167connection conn1;
168commit;
169connection conn2;
170replace t values(1, 100);
171begin;
172select * from t;
173a	b
1741	100
1752	100
1763	100
1774	100
1785	25
1796	36
180commit;
181connection conn1;
182connection conn1;
183begin;
184select * from t where a=1 for update;
185a	b
1861	100
187connection conn2;
188select * from t where a<=2 for update;
189ERROR HY000: Lock wait timeout exceeded; try restarting transaction
190select * from t where a>=0 for update;
191ERROR HY000: Lock wait timeout exceeded; try restarting transaction
192select * from t where a>2 for update;
193a	b
1943	100
1954	100
1965	25
1976	36
198begin;
199select * from t;
200ERROR HY000: Lock wait timeout exceeded; try restarting transaction
201select * from t where a=1;
202ERROR HY000: Lock wait timeout exceeded; try restarting transaction
203select * from t where a>=2;
204a	b
2052	100
2063	100
2074	100
2085	25
2096	36
210commit;
211connection conn1;
212commit;
213connection conn2;
214select * from t where a<=2 for update;
215a	b
2161	100
2172	100
218select * from t where a>=0 for update;
219a	b
2201	100
2212	100
2223	100
2234	100
2245	25
2256	36
226begin;
227select * from t;
228a	b
2291	100
2302	100
2313	100
2324	100
2335	25
2346	36
235commit;
236connection conn1;
237connection conn1;
238begin;
239select * from t where a=1 for update;
240a	b
2411	100
242connection conn2;
243update t set b=b where a<=2;
244ERROR HY000: Lock wait timeout exceeded; try restarting transaction
245update t set b=b where a>=0;
246ERROR HY000: Lock wait timeout exceeded; try restarting transaction
247update t set b=b where a>2;
248begin;
249select * from t;
250ERROR HY000: Lock wait timeout exceeded; try restarting transaction
251select * from t where a=1;
252ERROR HY000: Lock wait timeout exceeded; try restarting transaction
253select * from t where a>=2;
254a	b
2552	100
2563	100
2574	100
2585	25
2596	36
260commit;
261connection conn1;
262commit;
263connection conn2;
264update t set b=b where a<=2;
265update t set b=b where a>=0;
266begin;
267select * from t;
268a	b
2691	100
2702	100
2713	100
2724	100
2735	25
2746	36
275commit;
276connection conn1;
277connection conn1;
278begin;
279update t set b=b where a=1;
280connection conn2;
281select * from t where a=1 for update;
282ERROR HY000: Lock wait timeout exceeded; try restarting transaction
283select * from t where a=2 for update;
284a	b
2852	100
286select * from t where a=3 for update;
287a	b
2883	100
289select * from t where a=4 for update;
290a	b
2914	100
292begin;
293select * from t;
294ERROR HY000: Lock wait timeout exceeded; try restarting transaction
295select * from t where a=1;
296ERROR HY000: Lock wait timeout exceeded; try restarting transaction
297select * from t where a>=2;
298a	b
2992	100
3003	100
3014	100
3025	25
3036	36
304commit;
305connection conn1;
306commit;
307connection conn2;
308select * from t where a=1 for update;
309a	b
3101	100
311begin;
312select * from t;
313a	b
3141	100
3152	100
3163	100
3174	100
3185	25
3196	36
320commit;
321connection conn1;
322connection conn1;
323begin;
324update t set b=b where a=1;
325connection conn2;
326update t set b=b where a=1;
327ERROR HY000: Lock wait timeout exceeded; try restarting transaction
328update t set b=b where a=2;
329update t set b=b where a=3;
330update t set b=b where a=4;
331begin;
332select * from t;
333ERROR HY000: Lock wait timeout exceeded; try restarting transaction
334select * from t where a=1;
335ERROR HY000: Lock wait timeout exceeded; try restarting transaction
336select * from t where a>=2;
337a	b
3382	100
3393	100
3404	100
3415	25
3426	36
343commit;
344connection conn1;
345commit;
346connection conn2;
347update t set b=b where a=1;
348begin;
349select * from t;
350a	b
3511	100
3522	100
3533	100
3544	100
3555	25
3566	36
357commit;
358connection conn1;
359connection conn1;
360begin;
361update t set b=b where a=1;
362connection conn2;
363insert ignore t values(1, 100);
364ERROR HY000: Lock wait timeout exceeded; try restarting transaction
365insert ignore t values(2, 100);
366insert ignore t values(3, 100);
367insert ignore t values(4, 100);
368begin;
369select * from t;
370ERROR HY000: Lock wait timeout exceeded; try restarting transaction
371select * from t where a=1;
372ERROR HY000: Lock wait timeout exceeded; try restarting transaction
373select * from t where a>=2;
374a	b
3752	100
3763	100
3774	100
3785	25
3796	36
380commit;
381connection conn1;
382commit;
383connection conn2;
384insert ignore t values(1, 100);
385begin;
386select * from t;
387a	b
3881	100
3892	100
3903	100
3914	100
3925	25
3936	36
394commit;
395connection conn1;
396connection conn1;
397begin;
398update t set b=b where a=1;
399connection conn2;
400replace t values(1, 100);
401ERROR HY000: Lock wait timeout exceeded; try restarting transaction
402replace t values(2, 100);
403replace t values(3, 100);
404replace t values(4, 100);
405begin;
406select * from t;
407ERROR HY000: Lock wait timeout exceeded; try restarting transaction
408select * from t where a=1;
409ERROR HY000: Lock wait timeout exceeded; try restarting transaction
410select * from t where a>=2;
411a	b
4122	100
4133	100
4144	100
4155	25
4166	36
417commit;
418connection conn1;
419commit;
420connection conn2;
421replace t values(1, 100);
422begin;
423select * from t;
424a	b
4251	100
4262	100
4273	100
4284	100
4295	25
4306	36
431commit;
432connection conn1;
433connection conn1;
434begin;
435update t set b=b where a=1;
436connection conn2;
437select * from t where a<=2 for update;
438ERROR HY000: Lock wait timeout exceeded; try restarting transaction
439select * from t where a>=0 for update;
440ERROR HY000: Lock wait timeout exceeded; try restarting transaction
441select * from t where a>2 for update;
442a	b
4433	100
4444	100
4455	25
4466	36
447begin;
448select * from t;
449ERROR HY000: Lock wait timeout exceeded; try restarting transaction
450select * from t where a=1;
451ERROR HY000: Lock wait timeout exceeded; try restarting transaction
452select * from t where a>=2;
453a	b
4542	100
4553	100
4564	100
4575	25
4586	36
459commit;
460connection conn1;
461commit;
462connection conn2;
463select * from t where a<=2 for update;
464a	b
4651	100
4662	100
467select * from t where a>=0 for update;
468a	b
4691	100
4702	100
4713	100
4724	100
4735	25
4746	36
475begin;
476select * from t;
477a	b
4781	100
4792	100
4803	100
4814	100
4825	25
4836	36
484commit;
485connection conn1;
486connection conn1;
487begin;
488update t set b=b where a=1;
489connection conn2;
490update t set b=b where a<=2;
491ERROR HY000: Lock wait timeout exceeded; try restarting transaction
492update t set b=b where a>=0;
493ERROR HY000: Lock wait timeout exceeded; try restarting transaction
494update t set b=b where a>2;
495begin;
496select * from t;
497ERROR HY000: Lock wait timeout exceeded; try restarting transaction
498select * from t where a=1;
499ERROR HY000: Lock wait timeout exceeded; try restarting transaction
500select * from t where a>=2;
501a	b
5022	100
5033	100
5044	100
5055	25
5066	36
507commit;
508connection conn1;
509commit;
510connection conn2;
511update t set b=b where a<=2;
512update t set b=b where a>=0;
513begin;
514select * from t;
515a	b
5161	100
5172	100
5183	100
5194	100
5205	25
5216	36
522commit;
523connection conn1;
524connection conn1;
525begin;
526insert ignore t values(1, 100);
527connection conn2;
528select * from t where a=1 for update;
529ERROR HY000: Lock wait timeout exceeded; try restarting transaction
530select * from t where a=2 for update;
531a	b
5322	100
533select * from t where a=3 for update;
534a	b
5353	100
536select * from t where a=4 for update;
537a	b
5384	100
539begin;
540select * from t;
541ERROR HY000: Lock wait timeout exceeded; try restarting transaction
542select * from t where a=1;
543ERROR HY000: Lock wait timeout exceeded; try restarting transaction
544select * from t where a>=2;
545a	b
5462	100
5473	100
5484	100
5495	25
5506	36
551commit;
552connection conn1;
553commit;
554connection conn2;
555select * from t where a=1 for update;
556a	b
5571	100
558begin;
559select * from t;
560a	b
5611	100
5622	100
5633	100
5644	100
5655	25
5666	36
567commit;
568connection conn1;
569connection conn1;
570begin;
571insert ignore t values(1, 100);
572connection conn2;
573update t set b=b where a=1;
574ERROR HY000: Lock wait timeout exceeded; try restarting transaction
575update t set b=b where a=2;
576update t set b=b where a=3;
577update t set b=b where a=4;
578begin;
579select * from t;
580ERROR HY000: Lock wait timeout exceeded; try restarting transaction
581select * from t where a=1;
582ERROR HY000: Lock wait timeout exceeded; try restarting transaction
583select * from t where a>=2;
584a	b
5852	100
5863	100
5874	100
5885	25
5896	36
590commit;
591connection conn1;
592commit;
593connection conn2;
594update t set b=b where a=1;
595begin;
596select * from t;
597a	b
5981	100
5992	100
6003	100
6014	100
6025	25
6036	36
604commit;
605connection conn1;
606connection conn1;
607begin;
608insert ignore t values(1, 100);
609connection conn2;
610insert ignore t values(1, 100);
611ERROR HY000: Lock wait timeout exceeded; try restarting transaction
612insert ignore t values(2, 100);
613insert ignore t values(3, 100);
614insert ignore t values(4, 100);
615begin;
616select * from t;
617ERROR HY000: Lock wait timeout exceeded; try restarting transaction
618select * from t where a=1;
619ERROR HY000: Lock wait timeout exceeded; try restarting transaction
620select * from t where a>=2;
621a	b
6222	100
6233	100
6244	100
6255	25
6266	36
627commit;
628connection conn1;
629commit;
630connection conn2;
631insert ignore t values(1, 100);
632begin;
633select * from t;
634a	b
6351	100
6362	100
6373	100
6384	100
6395	25
6406	36
641commit;
642connection conn1;
643connection conn1;
644begin;
645insert ignore t values(1, 100);
646connection conn2;
647replace t values(1, 100);
648ERROR HY000: Lock wait timeout exceeded; try restarting transaction
649replace t values(2, 100);
650replace t values(3, 100);
651replace t values(4, 100);
652begin;
653select * from t;
654ERROR HY000: Lock wait timeout exceeded; try restarting transaction
655select * from t where a=1;
656ERROR HY000: Lock wait timeout exceeded; try restarting transaction
657select * from t where a>=2;
658a	b
6592	100
6603	100
6614	100
6625	25
6636	36
664commit;
665connection conn1;
666commit;
667connection conn2;
668replace t values(1, 100);
669begin;
670select * from t;
671a	b
6721	100
6732	100
6743	100
6754	100
6765	25
6776	36
678commit;
679connection conn1;
680connection conn1;
681begin;
682insert ignore t values(1, 100);
683connection conn2;
684select * from t where a<=2 for update;
685ERROR HY000: Lock wait timeout exceeded; try restarting transaction
686select * from t where a>=0 for update;
687ERROR HY000: Lock wait timeout exceeded; try restarting transaction
688select * from t where a>2 for update;
689a	b
6903	100
6914	100
6925	25
6936	36
694begin;
695select * from t;
696ERROR HY000: Lock wait timeout exceeded; try restarting transaction
697select * from t where a=1;
698ERROR HY000: Lock wait timeout exceeded; try restarting transaction
699select * from t where a>=2;
700a	b
7012	100
7023	100
7034	100
7045	25
7056	36
706commit;
707connection conn1;
708commit;
709connection conn2;
710select * from t where a<=2 for update;
711a	b
7121	100
7132	100
714select * from t where a>=0 for update;
715a	b
7161	100
7172	100
7183	100
7194	100
7205	25
7216	36
722begin;
723select * from t;
724a	b
7251	100
7262	100
7273	100
7284	100
7295	25
7306	36
731commit;
732connection conn1;
733connection conn1;
734begin;
735insert ignore t values(1, 100);
736connection conn2;
737update t set b=b where a<=2;
738ERROR HY000: Lock wait timeout exceeded; try restarting transaction
739update t set b=b where a>=0;
740ERROR HY000: Lock wait timeout exceeded; try restarting transaction
741update t set b=b where a>2;
742begin;
743select * from t;
744ERROR HY000: Lock wait timeout exceeded; try restarting transaction
745select * from t where a=1;
746ERROR HY000: Lock wait timeout exceeded; try restarting transaction
747select * from t where a>=2;
748a	b
7492	100
7503	100
7514	100
7525	25
7536	36
754commit;
755connection conn1;
756commit;
757connection conn2;
758update t set b=b where a<=2;
759update t set b=b where a>=0;
760begin;
761select * from t;
762a	b
7631	100
7642	100
7653	100
7664	100
7675	25
7686	36
769commit;
770connection conn1;
771connection conn1;
772begin;
773replace t values(1, 100);
774connection conn2;
775select * from t where a=1 for update;
776ERROR HY000: Lock wait timeout exceeded; try restarting transaction
777select * from t where a=2 for update;
778a	b
7792	100
780select * from t where a=3 for update;
781a	b
7823	100
783select * from t where a=4 for update;
784a	b
7854	100
786begin;
787select * from t;
788ERROR HY000: Lock wait timeout exceeded; try restarting transaction
789select * from t where a=1;
790ERROR HY000: Lock wait timeout exceeded; try restarting transaction
791select * from t where a>=2;
792a	b
7932	100
7943	100
7954	100
7965	25
7976	36
798commit;
799connection conn1;
800commit;
801connection conn2;
802select * from t where a=1 for update;
803a	b
8041	100
805begin;
806select * from t;
807a	b
8081	100
8092	100
8103	100
8114	100
8125	25
8136	36
814commit;
815connection conn1;
816connection conn1;
817begin;
818replace t values(1, 100);
819connection conn2;
820update t set b=b where a=1;
821ERROR HY000: Lock wait timeout exceeded; try restarting transaction
822update t set b=b where a=2;
823update t set b=b where a=3;
824update t set b=b where a=4;
825begin;
826select * from t;
827ERROR HY000: Lock wait timeout exceeded; try restarting transaction
828select * from t where a=1;
829ERROR HY000: Lock wait timeout exceeded; try restarting transaction
830select * from t where a>=2;
831a	b
8322	100
8333	100
8344	100
8355	25
8366	36
837commit;
838connection conn1;
839commit;
840connection conn2;
841update t set b=b where a=1;
842begin;
843select * from t;
844a	b
8451	100
8462	100
8473	100
8484	100
8495	25
8506	36
851commit;
852connection conn1;
853connection conn1;
854begin;
855replace t values(1, 100);
856connection conn2;
857insert ignore t values(1, 100);
858ERROR HY000: Lock wait timeout exceeded; try restarting transaction
859insert ignore t values(2, 100);
860insert ignore t values(3, 100);
861insert ignore t values(4, 100);
862begin;
863select * from t;
864ERROR HY000: Lock wait timeout exceeded; try restarting transaction
865select * from t where a=1;
866ERROR HY000: Lock wait timeout exceeded; try restarting transaction
867select * from t where a>=2;
868a	b
8692	100
8703	100
8714	100
8725	25
8736	36
874commit;
875connection conn1;
876commit;
877connection conn2;
878insert ignore t values(1, 100);
879begin;
880select * from t;
881a	b
8821	100
8832	100
8843	100
8854	100
8865	25
8876	36
888commit;
889connection conn1;
890connection conn1;
891begin;
892replace t values(1, 100);
893connection conn2;
894replace t values(1, 100);
895ERROR HY000: Lock wait timeout exceeded; try restarting transaction
896replace t values(2, 100);
897replace t values(3, 100);
898replace t values(4, 100);
899begin;
900select * from t;
901ERROR HY000: Lock wait timeout exceeded; try restarting transaction
902select * from t where a=1;
903ERROR HY000: Lock wait timeout exceeded; try restarting transaction
904select * from t where a>=2;
905a	b
9062	100
9073	100
9084	100
9095	25
9106	36
911commit;
912connection conn1;
913commit;
914connection conn2;
915replace t values(1, 100);
916begin;
917select * from t;
918a	b
9191	100
9202	100
9213	100
9224	100
9235	25
9246	36
925commit;
926connection conn1;
927connection conn1;
928begin;
929replace t values(1, 100);
930connection conn2;
931select * from t where a<=2 for update;
932ERROR HY000: Lock wait timeout exceeded; try restarting transaction
933select * from t where a>=0 for update;
934ERROR HY000: Lock wait timeout exceeded; try restarting transaction
935select * from t where a>2 for update;
936a	b
9373	100
9384	100
9395	25
9406	36
941begin;
942select * from t;
943ERROR HY000: Lock wait timeout exceeded; try restarting transaction
944select * from t where a=1;
945ERROR HY000: Lock wait timeout exceeded; try restarting transaction
946select * from t where a>=2;
947a	b
9482	100
9493	100
9504	100
9515	25
9526	36
953commit;
954connection conn1;
955commit;
956connection conn2;
957select * from t where a<=2 for update;
958a	b
9591	100
9602	100
961select * from t where a>=0 for update;
962a	b
9631	100
9642	100
9653	100
9664	100
9675	25
9686	36
969begin;
970select * from t;
971a	b
9721	100
9732	100
9743	100
9754	100
9765	25
9776	36
978commit;
979connection conn1;
980connection conn1;
981begin;
982replace t values(1, 100);
983connection conn2;
984update t set b=b where a<=2;
985ERROR HY000: Lock wait timeout exceeded; try restarting transaction
986update t set b=b where a>=0;
987ERROR HY000: Lock wait timeout exceeded; try restarting transaction
988update t set b=b where a>2;
989begin;
990select * from t;
991ERROR HY000: Lock wait timeout exceeded; try restarting transaction
992select * from t where a=1;
993ERROR HY000: Lock wait timeout exceeded; try restarting transaction
994select * from t where a>=2;
995a	b
9962	100
9973	100
9984	100
9995	25
10006	36
1001commit;
1002connection conn1;
1003commit;
1004connection conn2;
1005update t set b=b where a<=2;
1006update t set b=b where a>=0;
1007begin;
1008select * from t;
1009a	b
10101	100
10112	100
10123	100
10134	100
10145	25
10156	36
1016commit;
1017connection conn1;
1018connection conn1;
1019begin;
1020select * from t where a>=2 and a<=4 for update;
1021a	b
10222	100
10233	100
10244	100
1025connection conn2;
1026select * from t where a>=0 and a<=3 for update;
1027ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1028select * from t where a>=3 and a<=6 for update;
1029ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1030select * from t where a<=2 for update;
1031ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1032select * from t where a>=5 for update;
1033a	b
10345	25
10356	36
1036begin;
1037select * from t;
1038ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1039select * from t where a=2;
1040ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1041select * from t where a>=3 and a<=5;
1042ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1043select * from t where a>=5;
1044a	b
10455	25
10466	36
1047commit;
1048connection conn1;
1049commit;
1050connection conn2;
1051select * from t where a>=0 and a<=3 for update;
1052a	b
10531	100
10542	100
10553	100
1056select * from t where a>=3 and a<=6 for update;
1057a	b
10583	100
10594	100
10605	25
10616	36
1062select * from t where a<=2 for update;
1063a	b
10641	100
10652	100
1066begin;
1067select * from t;
1068a	b
10691	100
10702	100
10713	100
10724	100
10735	25
10746	36
1075commit;
1076connection conn1;
1077connection conn1;
1078begin;
1079select * from t where a>=2 and a<=4 for update;
1080a	b
10812	100
10823	100
10834	100
1084connection conn2;
1085update t set b=b where a>=0 and a<=3;
1086ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1087update t set b=b where a>=3 and a<=6;
1088ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1089update t set b=b where a<=2;
1090ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1091update t set b=b where a>=5;
1092begin;
1093select * from t;
1094ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1095select * from t where a=2;
1096ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1097select * from t where a>=3 and a<=5;
1098ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1099select * from t where a>=5;
1100a	b
11015	25
11026	36
1103commit;
1104connection conn1;
1105commit;
1106connection conn2;
1107update t set b=b where a>=0 and a<=3;
1108update t set b=b where a>=3 and a<=6;
1109update t set b=b where a<=2;
1110begin;
1111select * from t;
1112a	b
11131	100
11142	100
11153	100
11164	100
11175	25
11186	36
1119commit;
1120connection conn1;
1121connection conn1;
1122begin;
1123update t set b=b where a>=2 and a<=4;
1124connection conn2;
1125select * from t where a>=0 and a<=3 for update;
1126ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1127select * from t where a>=3 and a<=6 for update;
1128ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1129select * from t where a<=2 for update;
1130ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1131select * from t where a>=5 for update;
1132a	b
11335	25
11346	36
1135begin;
1136select * from t;
1137ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1138select * from t where a=2;
1139ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1140select * from t where a>=3 and a<=5;
1141ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1142select * from t where a>=5;
1143a	b
11445	25
11456	36
1146commit;
1147connection conn1;
1148commit;
1149connection conn2;
1150select * from t where a>=0 and a<=3 for update;
1151a	b
11521	100
11532	100
11543	100
1155select * from t where a>=3 and a<=6 for update;
1156a	b
11573	100
11584	100
11595	25
11606	36
1161select * from t where a<=2 for update;
1162a	b
11631	100
11642	100
1165begin;
1166select * from t;
1167a	b
11681	100
11692	100
11703	100
11714	100
11725	25
11736	36
1174commit;
1175connection conn1;
1176connection conn1;
1177begin;
1178update t set b=b where a>=2 and a<=4;
1179connection conn2;
1180update t set b=b where a>=0 and a<=3;
1181ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1182update t set b=b where a>=3 and a<=6;
1183ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1184update t set b=b where a<=2;
1185ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1186update t set b=b where a>=5;
1187begin;
1188select * from t;
1189ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1190select * from t where a=2;
1191ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1192select * from t where a>=3 and a<=5;
1193ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1194select * from t where a>=5;
1195a	b
11965	25
11976	36
1198commit;
1199connection conn1;
1200commit;
1201connection conn2;
1202update t set b=b where a>=0 and a<=3;
1203update t set b=b where a>=3 and a<=6;
1204update t set b=b where a<=2;
1205begin;
1206select * from t;
1207a	b
12081	100
12092	100
12103	100
12114	100
12125	25
12136	36
1214commit;
1215connection conn1;
1216connection conn1;
1217set session tokudb_lock_timeout=500;
1218connection conn2;
1219set session tokudb_lock_timeout=500;
1220connection conn1;
1221begin;
1222select * from t where a=1 for update;
1223a	b
12241	100
1225connection conn2;
1226select * from t where a=1 for update;
1227ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1228select * from t where a=2 for update;
1229a	b
12302	100
1231select * from t where a=3 for update;
1232a	b
12333	100
1234select * from t where a=4 for update;
1235a	b
12364	100
1237begin;
1238select * from t;
1239ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1240select * from t where a=1;
1241ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1242select * from t where a>=2;
1243a	b
12442	100
12453	100
12464	100
12475	25
12486	36
1249commit;
1250connection conn1;
1251commit;
1252connection conn2;
1253select * from t where a=1 for update;
1254a	b
12551	100
1256begin;
1257select * from t;
1258a	b
12591	100
12602	100
12613	100
12624	100
12635	25
12646	36
1265commit;
1266connection conn1;
1267connection conn1;
1268begin;
1269select * from t where a=1 for update;
1270a	b
12711	100
1272connection conn2;
1273select * from t where a=1 for update;
1274connection conn1;
1275commit;
1276connection conn2;
1277a	b
12781	100
1279connection conn1;
1280begin;
1281select * from t where a=1 for update;
1282a	b
12831	100
1284connection conn2;
1285update t set b=b where a=1;
1286ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1287update t set b=b where a=2;
1288update t set b=b where a=3;
1289update t set b=b where a=4;
1290begin;
1291select * from t;
1292ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1293select * from t where a=1;
1294ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1295select * from t where a>=2;
1296a	b
12972	100
12983	100
12994	100
13005	25
13016	36
1302commit;
1303connection conn1;
1304commit;
1305connection conn2;
1306update t set b=b where a=1;
1307begin;
1308select * from t;
1309a	b
13101	100
13112	100
13123	100
13134	100
13145	25
13156	36
1316commit;
1317connection conn1;
1318connection conn1;
1319begin;
1320select * from t where a=1 for update;
1321a	b
13221	100
1323connection conn2;
1324update t set b=b where a=1;
1325connection conn1;
1326commit;
1327connection conn2;
1328connection conn1;
1329begin;
1330select * from t where a=1 for update;
1331a	b
13321	100
1333connection conn2;
1334insert ignore t values(1, 100);
1335ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1336insert ignore t values(2, 100);
1337insert ignore t values(3, 100);
1338insert ignore t values(4, 100);
1339begin;
1340select * from t;
1341ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1342select * from t where a=1;
1343ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1344select * from t where a>=2;
1345a	b
13462	100
13473	100
13484	100
13495	25
13506	36
1351commit;
1352connection conn1;
1353commit;
1354connection conn2;
1355insert ignore t values(1, 100);
1356begin;
1357select * from t;
1358a	b
13591	100
13602	100
13613	100
13624	100
13635	25
13646	36
1365commit;
1366connection conn1;
1367connection conn1;
1368begin;
1369select * from t where a=1 for update;
1370a	b
13711	100
1372connection conn2;
1373insert ignore t values(1, 175);
1374connection conn1;
1375commit;
1376connection conn2;
1377connection conn1;
1378begin;
1379select * from t where a=1 for update;
1380a	b
13811	100
1382connection conn2;
1383replace t values(1, 100);
1384ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1385replace t values(2, 100);
1386replace t values(3, 100);
1387replace t values(4, 100);
1388begin;
1389select * from t;
1390ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1391select * from t where a=1;
1392ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1393select * from t where a>=2;
1394a	b
13952	100
13963	100
13974	100
13985	25
13996	36
1400commit;
1401connection conn1;
1402commit;
1403connection conn2;
1404replace t values(1, 100);
1405begin;
1406select * from t;
1407a	b
14081	100
14092	100
14103	100
14114	100
14125	25
14136	36
1414commit;
1415connection conn1;
1416connection conn1;
1417begin;
1418select * from t where a=1 for update;
1419a	b
14201	100
1421connection conn2;
1422replace t values(1, 175);
1423connection conn1;
1424commit;
1425connection conn2;
1426connection conn1;
1427begin;
1428select * from t where a=1 for update;
1429a	b
14301	175
1431connection conn2;
1432select * from t where a<=2 for update;
1433ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1434select * from t where a>=0 for update;
1435ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1436select * from t where a>2 for update;
1437a	b
14383	100
14394	100
14405	25
14416	36
1442begin;
1443select * from t;
1444ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1445select * from t where a=1;
1446ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1447select * from t where a>=2;
1448a	b
14492	100
14503	100
14514	100
14525	25
14536	36
1454commit;
1455connection conn1;
1456commit;
1457connection conn2;
1458select * from t where a<=2 for update;
1459a	b
14601	175
14612	100
1462select * from t where a>=0 for update;
1463a	b
14641	175
14652	100
14663	100
14674	100
14685	25
14696	36
1470begin;
1471select * from t;
1472a	b
14731	175
14742	100
14753	100
14764	100
14775	25
14786	36
1479commit;
1480connection conn1;
1481connection conn1;
1482begin;
1483select * from t where a=1 for update;
1484a	b
14851	175
1486connection conn2;
1487select * from t where a<=2 for update;
1488connection conn1;
1489commit;
1490connection conn2;
1491a	b
14921	175
14932	100
1494connection conn1;
1495begin;
1496select * from t where a=1 for update;
1497a	b
14981	175
1499connection conn2;
1500update t set b=b where a<=2;
1501ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1502update t set b=b where a>=0;
1503ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1504update t set b=b where a>2;
1505begin;
1506select * from t;
1507ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1508select * from t where a=1;
1509ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1510select * from t where a>=2;
1511a	b
15122	100
15133	100
15144	100
15155	25
15166	36
1517commit;
1518connection conn1;
1519commit;
1520connection conn2;
1521update t set b=b where a<=2;
1522update t set b=b where a>=0;
1523begin;
1524select * from t;
1525a	b
15261	175
15272	100
15283	100
15294	100
15305	25
15316	36
1532commit;
1533connection conn1;
1534connection conn1;
1535begin;
1536select * from t where a=1 for update;
1537a	b
15381	175
1539connection conn2;
1540update t set b=b where a<=2;
1541connection conn1;
1542commit;
1543connection conn2;
1544connection conn1;
1545begin;
1546update t set b=b where a=1;
1547connection conn2;
1548select * from t where a=1 for update;
1549ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1550select * from t where a=2 for update;
1551a	b
15522	100
1553select * from t where a=3 for update;
1554a	b
15553	100
1556select * from t where a=4 for update;
1557a	b
15584	100
1559begin;
1560select * from t;
1561ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1562select * from t where a=1;
1563ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1564select * from t where a>=2;
1565a	b
15662	100
15673	100
15684	100
15695	25
15706	36
1571commit;
1572connection conn1;
1573commit;
1574connection conn2;
1575select * from t where a=1 for update;
1576a	b
15771	175
1578begin;
1579select * from t;
1580a	b
15811	175
15822	100
15833	100
15844	100
15855	25
15866	36
1587commit;
1588connection conn1;
1589connection conn1;
1590begin;
1591update t set b=b where a=1;
1592connection conn2;
1593select * from t where a=1 for update;
1594connection conn1;
1595commit;
1596connection conn2;
1597a	b
15981	175
1599connection conn1;
1600begin;
1601update t set b=b where a=1;
1602connection conn2;
1603update t set b=b where a=1;
1604ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1605update t set b=b where a=2;
1606update t set b=b where a=3;
1607update t set b=b where a=4;
1608begin;
1609select * from t;
1610ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1611select * from t where a=1;
1612ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1613select * from t where a>=2;
1614a	b
16152	100
16163	100
16174	100
16185	25
16196	36
1620commit;
1621connection conn1;
1622commit;
1623connection conn2;
1624update t set b=b where a=1;
1625begin;
1626select * from t;
1627a	b
16281	175
16292	100
16303	100
16314	100
16325	25
16336	36
1634commit;
1635connection conn1;
1636connection conn1;
1637begin;
1638update t set b=b where a=1;
1639connection conn2;
1640update t set b=b where a=1;
1641connection conn1;
1642commit;
1643connection conn2;
1644connection conn1;
1645begin;
1646update t set b=b where a=1;
1647connection conn2;
1648insert ignore t values(1, 100);
1649ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1650insert ignore t values(2, 100);
1651insert ignore t values(3, 100);
1652insert ignore t values(4, 100);
1653begin;
1654select * from t;
1655ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1656select * from t where a=1;
1657ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1658select * from t where a>=2;
1659a	b
16602	100
16613	100
16624	100
16635	25
16646	36
1665commit;
1666connection conn1;
1667commit;
1668connection conn2;
1669insert ignore t values(1, 100);
1670begin;
1671select * from t;
1672a	b
16731	175
16742	100
16753	100
16764	100
16775	25
16786	36
1679commit;
1680connection conn1;
1681connection conn1;
1682begin;
1683update t set b=b where a=1;
1684connection conn2;
1685insert ignore t values(1, 175);
1686connection conn1;
1687commit;
1688connection conn2;
1689connection conn1;
1690begin;
1691update t set b=b where a=1;
1692connection conn2;
1693replace t values(1, 100);
1694ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1695replace t values(2, 100);
1696replace t values(3, 100);
1697replace t values(4, 100);
1698begin;
1699select * from t;
1700ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1701select * from t where a=1;
1702ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1703select * from t where a>=2;
1704a	b
17052	100
17063	100
17074	100
17085	25
17096	36
1710commit;
1711connection conn1;
1712commit;
1713connection conn2;
1714replace t values(1, 100);
1715begin;
1716select * from t;
1717a	b
17181	100
17192	100
17203	100
17214	100
17225	25
17236	36
1724commit;
1725connection conn1;
1726connection conn1;
1727begin;
1728update t set b=b where a=1;
1729connection conn2;
1730replace t values(1, 175);
1731connection conn1;
1732commit;
1733connection conn2;
1734connection conn1;
1735begin;
1736update t set b=b where a=1;
1737connection conn2;
1738select * from t where a<=2 for update;
1739ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1740select * from t where a>=0 for update;
1741ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1742select * from t where a>2 for update;
1743a	b
17443	100
17454	100
17465	25
17476	36
1748begin;
1749select * from t;
1750ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1751select * from t where a=1;
1752ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1753select * from t where a>=2;
1754a	b
17552	100
17563	100
17574	100
17585	25
17596	36
1760commit;
1761connection conn1;
1762commit;
1763connection conn2;
1764select * from t where a<=2 for update;
1765a	b
17661	175
17672	100
1768select * from t where a>=0 for update;
1769a	b
17701	175
17712	100
17723	100
17734	100
17745	25
17756	36
1776begin;
1777select * from t;
1778a	b
17791	175
17802	100
17813	100
17824	100
17835	25
17846	36
1785commit;
1786connection conn1;
1787connection conn1;
1788begin;
1789update t set b=b where a=1;
1790connection conn2;
1791select * from t where a<=2 for update;
1792connection conn1;
1793commit;
1794connection conn2;
1795a	b
17961	175
17972	100
1798connection conn1;
1799begin;
1800update t set b=b where a=1;
1801connection conn2;
1802update t set b=b where a<=2;
1803ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1804update t set b=b where a>=0;
1805ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1806update t set b=b where a>2;
1807begin;
1808select * from t;
1809ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1810select * from t where a=1;
1811ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1812select * from t where a>=2;
1813a	b
18142	100
18153	100
18164	100
18175	25
18186	36
1819commit;
1820connection conn1;
1821commit;
1822connection conn2;
1823update t set b=b where a<=2;
1824update t set b=b where a>=0;
1825begin;
1826select * from t;
1827a	b
18281	175
18292	100
18303	100
18314	100
18325	25
18336	36
1834commit;
1835connection conn1;
1836connection conn1;
1837begin;
1838update t set b=b where a=1;
1839connection conn2;
1840update t set b=b where a<=2;
1841connection conn1;
1842commit;
1843connection conn2;
1844connection conn1;
1845begin;
1846insert ignore t values(1, 100);
1847connection conn2;
1848select * from t where a=1 for update;
1849ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1850select * from t where a=2 for update;
1851a	b
18522	100
1853select * from t where a=3 for update;
1854a	b
18553	100
1856select * from t where a=4 for update;
1857a	b
18584	100
1859begin;
1860select * from t;
1861ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1862select * from t where a=1;
1863ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1864select * from t where a>=2;
1865a	b
18662	100
18673	100
18684	100
18695	25
18706	36
1871commit;
1872connection conn1;
1873commit;
1874connection conn2;
1875select * from t where a=1 for update;
1876a	b
18771	175
1878begin;
1879select * from t;
1880a	b
18811	175
18822	100
18833	100
18844	100
18855	25
18866	36
1887commit;
1888connection conn1;
1889connection conn1;
1890begin;
1891insert ignore t values(1, 150);
1892connection conn2;
1893select * from t where a=1 for update;
1894connection conn1;
1895commit;
1896connection conn2;
1897a	b
18981	175
1899connection conn1;
1900begin;
1901insert ignore t values(1, 100);
1902connection conn2;
1903update t set b=b where a=1;
1904ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1905update t set b=b where a=2;
1906update t set b=b where a=3;
1907update t set b=b where a=4;
1908begin;
1909select * from t;
1910ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1911select * from t where a=1;
1912ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1913select * from t where a>=2;
1914a	b
19152	100
19163	100
19174	100
19185	25
19196	36
1920commit;
1921connection conn1;
1922commit;
1923connection conn2;
1924update t set b=b where a=1;
1925begin;
1926select * from t;
1927a	b
19281	175
19292	100
19303	100
19314	100
19325	25
19336	36
1934commit;
1935connection conn1;
1936connection conn1;
1937begin;
1938insert ignore t values(1, 150);
1939connection conn2;
1940update t set b=b where a=1;
1941connection conn1;
1942commit;
1943connection conn2;
1944connection conn1;
1945begin;
1946insert ignore t values(1, 100);
1947connection conn2;
1948insert ignore t values(1, 100);
1949ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1950insert ignore t values(2, 100);
1951insert ignore t values(3, 100);
1952insert ignore t values(4, 100);
1953begin;
1954select * from t;
1955ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1956select * from t where a=1;
1957ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1958select * from t where a>=2;
1959a	b
19602	100
19613	100
19624	100
19635	25
19646	36
1965commit;
1966connection conn1;
1967commit;
1968connection conn2;
1969insert ignore t values(1, 100);
1970begin;
1971select * from t;
1972a	b
19731	175
19742	100
19753	100
19764	100
19775	25
19786	36
1979commit;
1980connection conn1;
1981connection conn1;
1982begin;
1983insert ignore t values(1, 150);
1984connection conn2;
1985insert ignore t values(1, 175);
1986connection conn1;
1987commit;
1988connection conn2;
1989connection conn1;
1990begin;
1991insert ignore t values(1, 100);
1992connection conn2;
1993replace t values(1, 100);
1994ERROR HY000: Lock wait timeout exceeded; try restarting transaction
1995replace t values(2, 100);
1996replace t values(3, 100);
1997replace t values(4, 100);
1998begin;
1999select * from t;
2000ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2001select * from t where a=1;
2002ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2003select * from t where a>=2;
2004a	b
20052	100
20063	100
20074	100
20085	25
20096	36
2010commit;
2011connection conn1;
2012commit;
2013connection conn2;
2014replace t values(1, 100);
2015begin;
2016select * from t;
2017a	b
20181	100
20192	100
20203	100
20214	100
20225	25
20236	36
2024commit;
2025connection conn1;
2026connection conn1;
2027begin;
2028insert ignore t values(1, 150);
2029connection conn2;
2030replace t values(1, 175);
2031connection conn1;
2032commit;
2033connection conn2;
2034connection conn1;
2035begin;
2036insert ignore t values(1, 100);
2037connection conn2;
2038select * from t where a<=2 for update;
2039ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2040select * from t where a>=0 for update;
2041ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2042select * from t where a>2 for update;
2043a	b
20443	100
20454	100
20465	25
20476	36
2048begin;
2049select * from t;
2050ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2051select * from t where a=1;
2052ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2053select * from t where a>=2;
2054a	b
20552	100
20563	100
20574	100
20585	25
20596	36
2060commit;
2061connection conn1;
2062commit;
2063connection conn2;
2064select * from t where a<=2 for update;
2065a	b
20661	175
20672	100
2068select * from t where a>=0 for update;
2069a	b
20701	175
20712	100
20723	100
20734	100
20745	25
20756	36
2076begin;
2077select * from t;
2078a	b
20791	175
20802	100
20813	100
20824	100
20835	25
20846	36
2085commit;
2086connection conn1;
2087connection conn1;
2088begin;
2089insert ignore t values(1, 150);
2090connection conn2;
2091select * from t where a<=2 for update;
2092connection conn1;
2093commit;
2094connection conn2;
2095a	b
20961	175
20972	100
2098connection conn1;
2099begin;
2100insert ignore t values(1, 100);
2101connection conn2;
2102update t set b=b where a<=2;
2103ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2104update t set b=b where a>=0;
2105ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2106update t set b=b where a>2;
2107begin;
2108select * from t;
2109ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2110select * from t where a=1;
2111ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2112select * from t where a>=2;
2113a	b
21142	100
21153	100
21164	100
21175	25
21186	36
2119commit;
2120connection conn1;
2121commit;
2122connection conn2;
2123update t set b=b where a<=2;
2124update t set b=b where a>=0;
2125begin;
2126select * from t;
2127a	b
21281	175
21292	100
21303	100
21314	100
21325	25
21336	36
2134commit;
2135connection conn1;
2136connection conn1;
2137begin;
2138insert ignore t values(1, 150);
2139connection conn2;
2140update t set b=b where a<=2;
2141connection conn1;
2142commit;
2143connection conn2;
2144connection conn1;
2145begin;
2146replace t values(1, 100);
2147connection conn2;
2148select * from t where a=1 for update;
2149ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2150select * from t where a=2 for update;
2151a	b
21522	100
2153select * from t where a=3 for update;
2154a	b
21553	100
2156select * from t where a=4 for update;
2157a	b
21584	100
2159begin;
2160select * from t;
2161ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2162select * from t where a=1;
2163ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2164select * from t where a>=2;
2165a	b
21662	100
21673	100
21684	100
21695	25
21706	36
2171commit;
2172connection conn1;
2173commit;
2174connection conn2;
2175select * from t where a=1 for update;
2176a	b
21771	100
2178begin;
2179select * from t;
2180a	b
21811	100
21822	100
21833	100
21844	100
21855	25
21866	36
2187commit;
2188connection conn1;
2189connection conn1;
2190begin;
2191replace t values(1, 150);
2192connection conn2;
2193select * from t where a=1 for update;
2194connection conn1;
2195commit;
2196connection conn2;
2197a	b
21981	150
2199connection conn1;
2200begin;
2201replace t values(1, 100);
2202connection conn2;
2203update t set b=b where a=1;
2204ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2205update t set b=b where a=2;
2206update t set b=b where a=3;
2207update t set b=b where a=4;
2208begin;
2209select * from t;
2210ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2211select * from t where a=1;
2212ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2213select * from t where a>=2;
2214a	b
22152	100
22163	100
22174	100
22185	25
22196	36
2220commit;
2221connection conn1;
2222commit;
2223connection conn2;
2224update t set b=b where a=1;
2225begin;
2226select * from t;
2227a	b
22281	100
22292	100
22303	100
22314	100
22325	25
22336	36
2234commit;
2235connection conn1;
2236connection conn1;
2237begin;
2238replace t values(1, 150);
2239connection conn2;
2240update t set b=b where a=1;
2241connection conn1;
2242commit;
2243connection conn2;
2244connection conn1;
2245begin;
2246replace t values(1, 100);
2247connection conn2;
2248insert ignore t values(1, 100);
2249ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2250insert ignore t values(2, 100);
2251insert ignore t values(3, 100);
2252insert ignore t values(4, 100);
2253begin;
2254select * from t;
2255ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2256select * from t where a=1;
2257ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2258select * from t where a>=2;
2259a	b
22602	100
22613	100
22624	100
22635	25
22646	36
2265commit;
2266connection conn1;
2267commit;
2268connection conn2;
2269insert ignore t values(1, 100);
2270begin;
2271select * from t;
2272a	b
22731	100
22742	100
22753	100
22764	100
22775	25
22786	36
2279commit;
2280connection conn1;
2281connection conn1;
2282begin;
2283replace t values(1, 150);
2284connection conn2;
2285insert ignore t values(1, 175);
2286connection conn1;
2287commit;
2288connection conn2;
2289connection conn1;
2290begin;
2291replace t values(1, 100);
2292connection conn2;
2293replace t values(1, 100);
2294ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2295replace t values(2, 100);
2296replace t values(3, 100);
2297replace t values(4, 100);
2298begin;
2299select * from t;
2300ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2301select * from t where a=1;
2302ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2303select * from t where a>=2;
2304a	b
23052	100
23063	100
23074	100
23085	25
23096	36
2310commit;
2311connection conn1;
2312commit;
2313connection conn2;
2314replace t values(1, 100);
2315begin;
2316select * from t;
2317a	b
23181	100
23192	100
23203	100
23214	100
23225	25
23236	36
2324commit;
2325connection conn1;
2326connection conn1;
2327begin;
2328replace t values(1, 150);
2329connection conn2;
2330replace t values(1, 175);
2331connection conn1;
2332commit;
2333connection conn2;
2334connection conn1;
2335begin;
2336replace t values(1, 100);
2337connection conn2;
2338select * from t where a<=2 for update;
2339ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2340select * from t where a>=0 for update;
2341ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2342select * from t where a>2 for update;
2343a	b
23443	100
23454	100
23465	25
23476	36
2348begin;
2349select * from t;
2350ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2351select * from t where a=1;
2352ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2353select * from t where a>=2;
2354a	b
23552	100
23563	100
23574	100
23585	25
23596	36
2360commit;
2361connection conn1;
2362commit;
2363connection conn2;
2364select * from t where a<=2 for update;
2365a	b
23661	100
23672	100
2368select * from t where a>=0 for update;
2369a	b
23701	100
23712	100
23723	100
23734	100
23745	25
23756	36
2376begin;
2377select * from t;
2378a	b
23791	100
23802	100
23813	100
23824	100
23835	25
23846	36
2385commit;
2386connection conn1;
2387connection conn1;
2388begin;
2389replace t values(1, 150);
2390connection conn2;
2391select * from t where a<=2 for update;
2392connection conn1;
2393commit;
2394connection conn2;
2395a	b
23961	150
23972	100
2398connection conn1;
2399begin;
2400replace t values(1, 100);
2401connection conn2;
2402update t set b=b where a<=2;
2403ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2404update t set b=b where a>=0;
2405ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2406update t set b=b where a>2;
2407begin;
2408select * from t;
2409ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2410select * from t where a=1;
2411ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2412select * from t where a>=2;
2413a	b
24142	100
24153	100
24164	100
24175	25
24186	36
2419commit;
2420connection conn1;
2421commit;
2422connection conn2;
2423update t set b=b where a<=2;
2424update t set b=b where a>=0;
2425begin;
2426select * from t;
2427a	b
24281	100
24292	100
24303	100
24314	100
24325	25
24336	36
2434commit;
2435connection conn1;
2436connection conn1;
2437begin;
2438replace t values(1, 150);
2439connection conn2;
2440update t set b=b where a<=2;
2441connection conn1;
2442commit;
2443connection conn2;
2444connection conn1;
2445begin;
2446select * from t where a>=2 and a<=4 for update;
2447a	b
24482	100
24493	100
24504	100
2451connection conn2;
2452select * from t where a>=0 and a<=3 for update;
2453ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2454select * from t where a>=3 and a<=6 for update;
2455ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2456select * from t where a<=2 for update;
2457ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2458select * from t where a>=5 for update;
2459a	b
24605	25
24616	36
2462begin;
2463select * from t;
2464ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2465select * from t where a=2;
2466ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2467select * from t where a>=3 and a<=5;
2468ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2469select * from t where a>=5;
2470a	b
24715	25
24726	36
2473commit;
2474connection conn1;
2475commit;
2476connection conn2;
2477select * from t where a>=0 and a<=3 for update;
2478a	b
24791	150
24802	100
24813	100
2482select * from t where a>=3 and a<=6 for update;
2483a	b
24843	100
24854	100
24865	25
24876	36
2488select * from t where a<=2 for update;
2489a	b
24901	150
24912	100
2492begin;
2493select * from t;
2494a	b
24951	150
24962	100
24973	100
24984	100
24995	25
25006	36
2501commit;
2502connection conn1;
2503connection conn1;
2504begin;
2505select * from t where a>=2 and a<=4 for update;
2506a	b
25072	100
25083	100
25094	100
2510connection conn2;
2511select * from t where a>=0 and a<=3 for update;
2512connection conn1;
2513commit;
2514connection conn2;
2515a	b
25161	150
25172	100
25183	100
2519connection conn1;
2520begin;
2521select * from t where a>=2 and a<=4 for update;
2522a	b
25232	100
25243	100
25254	100
2526connection conn2;
2527update t set b=b where a>=0 and a<=3;
2528ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2529update t set b=b where a>=3 and a<=6;
2530ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2531update t set b=b where a<=2;
2532ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2533update t set b=b where a>=5;
2534begin;
2535select * from t;
2536ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2537select * from t where a=2;
2538ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2539select * from t where a>=3 and a<=5;
2540ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2541select * from t where a>=5;
2542a	b
25435	25
25446	36
2545commit;
2546connection conn1;
2547commit;
2548connection conn2;
2549update t set b=b where a>=0 and a<=3;
2550update t set b=b where a>=3 and a<=6;
2551update t set b=b where a<=2;
2552begin;
2553select * from t;
2554a	b
25551	150
25562	100
25573	100
25584	100
25595	25
25606	36
2561commit;
2562connection conn1;
2563connection conn1;
2564begin;
2565select * from t where a>=2 and a<=4 for update;
2566a	b
25672	100
25683	100
25694	100
2570connection conn2;
2571update t set b=b where a>=0 and a<=3;
2572connection conn1;
2573commit;
2574connection conn2;
2575connection conn1;
2576begin;
2577update t set b=b where a>=2 and a<=4;
2578connection conn2;
2579select * from t where a>=0 and a<=3 for update;
2580ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2581select * from t where a>=3 and a<=6 for update;
2582ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2583select * from t where a<=2 for update;
2584ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2585select * from t where a>=5 for update;
2586a	b
25875	25
25886	36
2589begin;
2590select * from t;
2591ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2592select * from t where a=2;
2593ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2594select * from t where a>=3 and a<=5;
2595ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2596select * from t where a>=5;
2597a	b
25985	25
25996	36
2600commit;
2601connection conn1;
2602commit;
2603connection conn2;
2604select * from t where a>=0 and a<=3 for update;
2605a	b
26061	150
26072	100
26083	100
2609select * from t where a>=3 and a<=6 for update;
2610a	b
26113	100
26124	100
26135	25
26146	36
2615select * from t where a<=2 for update;
2616a	b
26171	150
26182	100
2619begin;
2620select * from t;
2621a	b
26221	150
26232	100
26243	100
26254	100
26265	25
26276	36
2628commit;
2629connection conn1;
2630connection conn1;
2631begin;
2632update t set b=b where a>=2 and a<=4;
2633connection conn2;
2634select * from t where a>=0 and a<=3 for update;
2635connection conn1;
2636commit;
2637connection conn2;
2638a	b
26391	150
26402	100
26413	100
2642connection conn1;
2643begin;
2644update t set b=b where a>=2 and a<=4;
2645connection conn2;
2646update t set b=b where a>=0 and a<=3;
2647ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2648update t set b=b where a>=3 and a<=6;
2649ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2650update t set b=b where a<=2;
2651ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2652update t set b=b where a>=5;
2653begin;
2654select * from t;
2655ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2656select * from t where a=2;
2657ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2658select * from t where a>=3 and a<=5;
2659ERROR HY000: Lock wait timeout exceeded; try restarting transaction
2660select * from t where a>=5;
2661a	b
26625	25
26636	36
2664commit;
2665connection conn1;
2666commit;
2667connection conn2;
2668update t set b=b where a>=0 and a<=3;
2669update t set b=b where a>=3 and a<=6;
2670update t set b=b where a<=2;
2671begin;
2672select * from t;
2673a	b
26741	150
26752	100
26763	100
26774	100
26785	25
26796	36
2680commit;
2681connection conn1;
2682connection conn1;
2683begin;
2684update t set b=b where a>=2 and a<=4;
2685connection conn2;
2686update t set b=b where a>=0 and a<=3;
2687connection conn1;
2688commit;
2689connection conn2;
2690drop table t;
2691