1--source include/have_rocksdb.inc
2
3source include/have_binlog_format_row.inc;
4source include/master-slave.inc;
5
6connection master;
7--disable_warnings
8drop table if exists t1;
9--enable_warnings
10
11connection master;
12
13create table t1 (id int primary key, value int);
14insert into t1 values (1,1), (2,2), (3,3);
15
16begin;
17insert into t1 values (11, 1);
18savepoint a;
19insert into t1 values (12, 1);
20--error ER_ROLLBACK_TO_SAVEPOINT
21rollback to savepoint a;
22--error ER_ROLLBACK_ONLY
23commit;
24commit;
25select * from t1;
26
27--source include/sync_slave_sql_with_master.inc
28connection slave;
29
30select * from t1;
31
32connection master;
33begin;
34insert into t1 values (21, 1);
35savepoint a;
36insert into t1 values (22, 1);
37--error ER_ROLLBACK_TO_SAVEPOINT
38rollback to savepoint a;
39--error ER_ROLLBACK_ONLY
40insert into t1 values (23, 1);
41--error ER_ROLLBACK_ONLY
42commit;
43commit;
44select * from t1;
45
46--source include/sync_slave_sql_with_master.inc
47connection slave;
48select * from t1;
49
50
51connection master;
52begin;
53insert into t1 values (31, 1);
54savepoint a;
55insert into t1 values (32, 1);
56savepoint b;
57insert into t1 values (33, 1);
58--error ER_ROLLBACK_TO_SAVEPOINT
59rollback to savepoint a;
60--error ER_ROLLBACK_ONLY
61insert into t1 values (34, 1);
62rollback;
63select * from t1;
64
65--source include/sync_slave_sql_with_master.inc
66connection slave;
67select * from t1;
68
69### GitHub Issue#195
70connection master;
71SET autocommit=off;
72select * from t1;
73SAVEPOINT A;
74select * from t1;
75SAVEPOINT A;
76insert into t1 values (35, 35);
77--error ER_ROLLBACK_TO_SAVEPOINT
78ROLLBACK TO SAVEPOINT A;
79--error ER_ROLLBACK_ONLY
80START TRANSACTION;
81select * from t1;
82--source include/sync_slave_sql_with_master.inc
83connection slave;
84select * from t1;
85
86
87connection master;
88drop table t1;
89
90--source include/rpl_end.inc
91
92