1SET DEFAULT_STORAGE_ENGINE = 'TokuDB';
2DROP TABLE IF EXISTS t1;
3set autocommit=0;
4set session transaction isolation level read uncommitted;
5create table t1 (n int);
6begin;
7savepoint `my_savepoint`;
8insert into t1 values (7);
9savepoint `savept2`;
10insert into t1 values (3);
11select n from t1;
12n
137
143
15savepoint savept3;
16rollback to savepoint savept2;
17rollback to savepoint savept3;
18ERROR 42000: SAVEPOINT savept3 does not exist
19rollback to savepoint savept2;
20release savepoint `my_savepoint`;
21select n from t1;
22n
237
24rollback to savepoint `my_savepoint`;
25ERROR 42000: SAVEPOINT my_savepoint does not exist
26rollback to savepoint savept2;
27ERROR 42000: SAVEPOINT savept2 does not exist
28insert into t1 values (8);
29savepoint sv;
30commit;
31savepoint sv;
32set autocommit=1;
33rollback;
34drop table t1;
35create table t1 (a int, b int, primary key (a));
36begin;
37insert into t1 values (1,10);
38select * from t1;
39a	b
401	10
41savepoint a;
42insert into t1 values (2,20);
43select * from t1;
44a	b
451	10
462	20
47savepoint b;
48insert into t1 values (3,30);
49rollback to savepoint a;
50select * From t1;
51a	b
521	10
53rollback;
54select * from t1;
55a	b
56drop table t1;
57create table t1 (a int, b int, primary key (a));
58begin;
59insert into t1 values (1,10);
60select * from t1;
61a	b
621	10
63savepoint a;
64insert into t1 values (2,20);
65select * from t1;
66a	b
671	10
682	20
69savepoint b;
70insert into t1 values (3,30);
71release savepoint a;
72select * From t1;
73a	b
741	10
752	20
763	30
77rollback;
78select * from t1;
79a	b
80drop table t1;
81create table t1 (a int, b int, primary key (a));
82begin;
83insert into t1 values (1,10);
84select * from t1;
85a	b
861	10
87savepoint a;
88replace into t1 values (1,100);
89select * from t1;
90a	b
911	100
92savepoint b;
93delete from t1 where a=1;
94select * from t1;
95a	b
96savepoint c;
97update t1 set b=1000 where a=1;
98select * from t1;
99a	b
100rollback to savepoint c;
101select * From t1;
102a	b
103rollback to savepoint b;
104select * from t1;
105a	b
1061	100
107rollback to savepoint a;
108select * from t1;
109a	b
1101	10
111rollback;
112select * from t1;
113a	b
114drop table t1;
115create table t1 (a int, b int, primary key (a));
116insert into t1 values (1,1);
117select * from t1;
118a	b
1191	1
120begin;
121replace into t1 values (1,10);
122select * from t1;
123a	b
1241	10
125savepoint a;
126replace into t1 values (1,100);
127select * from t1;
128a	b
1291	100
130savepoint b;
131delete from t1 where a=1;
132select * from t1;
133a	b
134savepoint c;
135update t1 set b=1000 where a=1;
136select * from t1;
137a	b
138rollback to savepoint c;
139select * From t1;
140a	b
141rollback to savepoint b;
142select * from t1;
143a	b
1441	100
145rollback to savepoint a;
146select * from t1;
147a	b
1481	10
149rollback;
150select * from t1;
151a	b
1521	1
153drop table t1;
154create table t1 (a int, b int, primary key (a));
155begin;
156insert into t1 values (1,10);
157select * from t1;
158a	b
1591	10
160savepoint a;
161replace into t1 values (1,100);
162select * from t1;
163a	b
1641	100
165savepoint b;
166delete from t1 where a=1;
167select * from t1;
168a	b
169savepoint c;
170insert into t1 values (2,20);
171select * from t1;
172a	b
1732	20
174release savepoint c;
175select * From t1;
176a	b
1772	20
178release savepoint b;
179select * from t1;
180a	b
1812	20
182release savepoint a;
183select * from t1;
184a	b
1852	20
186commit;
187select * from t1;
188a	b
1892	20
190drop table t1;
191create table t1 (a int, b int, primary key (a));
192begin;
193insert into t1 values (1,10);
194select * from t1;
195a	b
1961	10
197savepoint a;
198replace into t1 values (1,100);
199select * from t1;
200a	b
2011	100
202savepoint b;
203delete from t1 where a=1;
204select * from t1;
205a	b
206savepoint c;
207insert into t1 values (2,20);
208select * from t1;
209a	b
2102	20
211release savepoint c;
212select * From t1;
213a	b
2142	20
215rollback to savepoint b;
216select * from t1;
217a	b
2181	100
219release savepoint a;
220select * from t1;
221a	b
2221	100
223rollback;
224select * from t1;
225a	b
226drop table t1;
227create table t1 (a int, b int, primary key (a));
228begin;
229insert into t1 values (1,10);
230insert into t1 values (2,20);
231savepoint a;
232insert into t1 values (3,30),(4,40);
233insert into t1 values (5,50),(6,60), (3,333), (7,70);
234ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
235select * from t1;
236a	b
2371	10
2382	20
2393	30
2404	40
241savepoint b;
242insert ignore into t1 values (8,80),(1,100),(9,90);
243select * from t1;
244a	b
2451	10
2462	20
2473	30
2484	40
2498	80
2509	90
251rollback to savepoint b;
252select * from t1;
253a	b
2541	10
2552	20
2563	30
2574	40
258rollback to savepoint a;
259select * from t1;
260a	b
2611	10
2622	20
263insert into t1 value (10,100);
264savepoint c;
265select * from t1;
266a	b
2671	10
2682	20
26910	100
270release savepoint a;
271rollback to savepoint c;
272ERROR 42000: SAVEPOINT c does not exist
273commit;
274select * from t1;
275a	b
2761	10
2772	20
27810	100
279drop table t1;
280