forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MyRocks: Returning an error on ROLLBACK TO SAVEPOINT if modifying rows (
facebook#52) Summary: MyRocks did neither rollback nor return an error on ROLLBACK TO SAVEPOINT, which was confusing to users. This diff makes MyRocks return an error on ROLLBACK TO SAVEPOINT if modifying rows. Users can at least know that. Real fix is to support rollback on savepoint, not to return an error, which will happen in future release. Test Plan: mtr Reviewers: hermanlee4, jkedgar, spetrunia Subscribers: webscalesql-eng Differential Revision: https://reviews.facebook.net/D53055 Differential Revision: https://reviews.facebook.net/D55011 Differential Revision: https://reviews.facebook.net/D55161
- Loading branch information
1 parent
05ca0a0
commit c00fa75
Showing
10 changed files
with
336 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
include/master-slave.inc | ||
Warnings: | ||
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. | ||
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. | ||
[connection master] | ||
drop table if exists t1; | ||
create table t1 (id int primary key, value int); | ||
insert into t1 values (1,1), (2,2), (3,3); | ||
begin; | ||
insert into t1 values (11, 1); | ||
savepoint a; | ||
insert into t1 values (12, 1); | ||
rollback to savepoint a; | ||
ERROR HY000: MyRocks currently does not support ROLLBACK TO SAVEPOINT if modifying rows. | ||
commit; | ||
ERROR HY000: This transaction was rolled back and cannot be committed. Only supported operation is to roll it back, so all pending changes will be discarded. Please restart another transaction. | ||
commit; | ||
select * from t1; | ||
id value | ||
1 1 | ||
2 2 | ||
3 3 | ||
include/sync_slave_sql_with_master.inc | ||
select * from t1; | ||
id value | ||
1 1 | ||
2 2 | ||
3 3 | ||
begin; | ||
insert into t1 values (21, 1); | ||
savepoint a; | ||
insert into t1 values (22, 1); | ||
rollback to savepoint a; | ||
ERROR HY000: MyRocks currently does not support ROLLBACK TO SAVEPOINT if modifying rows. | ||
insert into t1 values (23, 1); | ||
ERROR HY000: This transaction was rolled back and cannot be committed. Only supported operation is to roll it back, so all pending changes will be discarded. Please restart another transaction. | ||
commit; | ||
ERROR HY000: This transaction was rolled back and cannot be committed. Only supported operation is to roll it back, so all pending changes will be discarded. Please restart another transaction. | ||
commit; | ||
select * from t1; | ||
id value | ||
1 1 | ||
2 2 | ||
3 3 | ||
include/sync_slave_sql_with_master.inc | ||
select * from t1; | ||
id value | ||
1 1 | ||
2 2 | ||
3 3 | ||
begin; | ||
insert into t1 values (31, 1); | ||
savepoint a; | ||
insert into t1 values (32, 1); | ||
savepoint b; | ||
insert into t1 values (33, 1); | ||
rollback to savepoint a; | ||
ERROR HY000: MyRocks currently does not support ROLLBACK TO SAVEPOINT if modifying rows. | ||
insert into t1 values (34, 1); | ||
ERROR HY000: This transaction was rolled back and cannot be committed. Only supported operation is to roll it back, so all pending changes will be discarded. Please restart another transaction. | ||
rollback; | ||
select * from t1; | ||
id value | ||
1 1 | ||
2 2 | ||
3 3 | ||
include/sync_slave_sql_with_master.inc | ||
select * from t1; | ||
id value | ||
1 1 | ||
2 2 | ||
3 3 | ||
SET autocommit=off; | ||
select * from t1; | ||
id value | ||
1 1 | ||
2 2 | ||
3 3 | ||
SAVEPOINT A; | ||
select * from t1; | ||
id value | ||
1 1 | ||
2 2 | ||
3 3 | ||
SAVEPOINT A; | ||
insert into t1 values (35, 35); | ||
ROLLBACK TO SAVEPOINT A; | ||
ERROR HY000: MyRocks currently does not support ROLLBACK TO SAVEPOINT if modifying rows. | ||
START TRANSACTION; | ||
ERROR HY000: This transaction was rolled back and cannot be committed. Only supported operation is to roll it back, so all pending changes will be discarded. Please restart another transaction. | ||
select * from t1; | ||
id value | ||
1 1 | ||
2 2 | ||
3 3 | ||
include/sync_slave_sql_with_master.inc | ||
select * from t1; | ||
id value | ||
1 1 | ||
2 2 | ||
3 3 | ||
drop table t1; | ||
include/rpl_end.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
!include suite/rpl/my.cnf | ||
|
||
[mysqld.1] | ||
binlog_format=row | ||
[mysqld.2] | ||
binlog_format=row | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--source include/have_rocksdb.inc | ||
|
||
source include/master-slave.inc; | ||
|
||
connection master; | ||
--disable_warnings | ||
drop table if exists t1; | ||
--enable_warnings | ||
|
||
connection master; | ||
|
||
create table t1 (id int primary key, value int); | ||
insert into t1 values (1,1), (2,2), (3,3); | ||
|
||
begin; | ||
insert into t1 values (11, 1); | ||
savepoint a; | ||
insert into t1 values (12, 1); | ||
--error ER_UNKNOWN_ERROR | ||
rollback to savepoint a; | ||
--error ER_UNKNOWN_ERROR | ||
commit; | ||
commit; | ||
select * from t1; | ||
|
||
--source include/sync_slave_sql_with_master.inc | ||
connection slave; | ||
|
||
select * from t1; | ||
|
||
connection master; | ||
begin; | ||
insert into t1 values (21, 1); | ||
savepoint a; | ||
insert into t1 values (22, 1); | ||
--error ER_UNKNOWN_ERROR | ||
rollback to savepoint a; | ||
--error ER_UNKNOWN_ERROR | ||
insert into t1 values (23, 1); | ||
--error ER_UNKNOWN_ERROR | ||
commit; | ||
commit; | ||
select * from t1; | ||
|
||
--source include/sync_slave_sql_with_master.inc | ||
connection slave; | ||
select * from t1; | ||
|
||
|
||
connection master; | ||
begin; | ||
insert into t1 values (31, 1); | ||
savepoint a; | ||
insert into t1 values (32, 1); | ||
savepoint b; | ||
insert into t1 values (33, 1); | ||
--error ER_UNKNOWN_ERROR | ||
rollback to savepoint a; | ||
--error ER_UNKNOWN_ERROR | ||
insert into t1 values (34, 1); | ||
rollback; | ||
select * from t1; | ||
|
||
--source include/sync_slave_sql_with_master.inc | ||
connection slave; | ||
select * from t1; | ||
|
||
### GitHub Issue#195 | ||
connection master; | ||
SET autocommit=off; | ||
select * from t1; | ||
SAVEPOINT A; | ||
select * from t1; | ||
SAVEPOINT A; | ||
insert into t1 values (35, 35); | ||
--error ER_UNKNOWN_ERROR | ||
ROLLBACK TO SAVEPOINT A; | ||
--error ER_UNKNOWN_ERROR | ||
START TRANSACTION; | ||
select * from t1; | ||
--source include/sync_slave_sql_with_master.inc | ||
connection slave; | ||
select * from t1; | ||
|
||
|
||
connection master; | ||
drop table t1; | ||
|
||
--source include/rpl_end.inc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.