From f6bd1992587da9e9aa01aa61b5bb68b22b6e5bef Mon Sep 17 00:00:00 2001 From: Yoshinori Matsunobu Date: Tue, 13 Jan 2015 15:45:10 -0800 Subject: [PATCH] Add testcases for issue#19 Summary: This is a testcase for issue#19 -- modifications are not visible within transaction. Issue#19 should be kept opened until passing this test case. Test Plan: N/A Reviewers: hermanlee4, maykov, jonahcohen Reviewed By: jonahcohen Differential Revision: https://reviews.facebook.net/D31467 --- mysql-test/suite/rocksdb/transaction.result | 936 ++++++++++++++++++ mysql-test/suite/rocksdb/transaction.test | 103 ++ .../suite/rocksdb/transaction_select.inc | 15 + 3 files changed, 1054 insertions(+) create mode 100644 mysql-test/suite/rocksdb/transaction.result create mode 100644 mysql-test/suite/rocksdb/transaction.test create mode 100644 mysql-test/suite/rocksdb/transaction_select.inc diff --git a/mysql-test/suite/rocksdb/transaction.result b/mysql-test/suite/rocksdb/transaction.result new file mode 100644 index 000000000000..c24ef9fc1c81 --- /dev/null +++ b/mysql-test/suite/rocksdb/transaction.result @@ -0,0 +1,936 @@ +create table t1 (id int primary key, value int, value2 varchar(100), index(value)) engine=rocksdb; +insert into t1 values (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),(6,6,6),(8,8,8),(9,9,9),(10,10,10); +begin; +insert into t1 values (11,11,11); +select * from t1 where id=1; +id value value2 +1 1 1 +select * from t1 where value=1; +id value value2 +1 1 1 +select value from t1 where value=1; +value +1 +select * from t1 where value2=1; +id value value2 +1 1 1 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +1 1 1 +2 2 2 +select * from t1 where value < 3; +id value value2 +1 1 1 +2 2 2 +select value from t1 where value < 3; +value +1 +2 +select * from t1 where value2 < 3; +id value value2 +1 1 1 +2 2 2 +select * from t1; +id value value2 +1 1 1 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +11 11 11 +select value from t1; +value +1 +2 +3 +4 +5 +6 +8 +9 +10 +11 +rollback; +begin; +insert into t1 values (7,7,7); +select * from t1 where id=1; +id value value2 +1 1 1 +select * from t1 where value=1; +id value value2 +1 1 1 +select value from t1 where value=1; +value +1 +select * from t1 where value2=1; +id value value2 +1 1 1 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +1 1 1 +2 2 2 +select * from t1 where value < 3; +id value value2 +1 1 1 +2 2 2 +select value from t1 where value < 3; +value +1 +2 +select * from t1 where value2 < 3; +id value value2 +1 1 1 +2 2 2 +select * from t1; +id value value2 +1 1 1 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +7 7 7 +8 8 8 +9 9 9 +10 10 10 +select value from t1; +value +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +rollback; +begin; +update t1 set value2=100 where id=1; +select * from t1 where id=1; +id value value2 +1 1 100 +select * from t1 where value=1; +id value value2 +1 1 100 +select value from t1 where value=1; +value +1 +select * from t1 where value2=1; +id value value2 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +1 1 100 +2 2 2 +select * from t1 where value < 3; +id value value2 +1 1 100 +2 2 2 +select value from t1 where value < 3; +value +1 +2 +select * from t1 where value2 < 3; +id value value2 +2 2 2 +select * from t1; +id value value2 +1 1 100 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +select value from t1; +value +1 +2 +3 +4 +5 +6 +8 +9 +10 +rollback; +begin; +update t1 set value=100 where id=1; +select * from t1 where id=1; +id value value2 +1 100 1 +select * from t1 where value=1; +id value value2 +select value from t1 where value=1; +value +select * from t1 where value2=1; +id value value2 +1 100 1 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +1 100 1 +2 2 2 +select * from t1 where value < 3; +id value value2 +2 2 2 +select value from t1 where value < 3; +value +2 +select * from t1 where value2 < 3; +id value value2 +1 100 1 +2 2 2 +select * from t1; +id value value2 +1 100 1 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +select value from t1; +value +2 +3 +4 +5 +6 +8 +9 +10 +100 +rollback; +begin; +update t1 set id=100 where id=1; +select * from t1 where id=1; +id value value2 +select * from t1 where value=1; +id value value2 +100 1 1 +select value from t1 where value=1; +value +1 +select * from t1 where value2=1; +id value value2 +100 1 1 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +2 2 2 +select * from t1 where value < 3; +id value value2 +100 1 1 +2 2 2 +select value from t1 where value < 3; +value +1 +2 +select * from t1 where value2 < 3; +id value value2 +2 2 2 +100 1 1 +select * from t1; +id value value2 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +100 1 1 +select value from t1; +value +1 +2 +3 +4 +5 +6 +8 +9 +10 +rollback; +begin; +update t1 set value2=100 where value=1; +select * from t1 where id=1; +id value value2 +1 1 100 +select * from t1 where value=1; +id value value2 +1 1 100 +select value from t1 where value=1; +value +1 +select * from t1 where value2=1; +id value value2 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +1 1 100 +2 2 2 +select * from t1 where value < 3; +id value value2 +1 1 100 +2 2 2 +select value from t1 where value < 3; +value +1 +2 +select * from t1 where value2 < 3; +id value value2 +2 2 2 +select * from t1; +id value value2 +1 1 100 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +select value from t1; +value +1 +2 +3 +4 +5 +6 +8 +9 +10 +rollback; +begin; +update t1 set value=100 where value=1; +select * from t1 where id=1; +id value value2 +1 100 1 +select * from t1 where value=1; +id value value2 +select value from t1 where value=1; +value +select * from t1 where value2=1; +id value value2 +1 100 1 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +1 100 1 +2 2 2 +select * from t1 where value < 3; +id value value2 +2 2 2 +select value from t1 where value < 3; +value +2 +select * from t1 where value2 < 3; +id value value2 +1 100 1 +2 2 2 +select * from t1; +id value value2 +1 100 1 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +select value from t1; +value +2 +3 +4 +5 +6 +8 +9 +10 +100 +rollback; +begin; +update t1 set id=100 where value=1; +select * from t1 where id=1; +id value value2 +select * from t1 where value=1; +id value value2 +100 1 1 +select value from t1 where value=1; +value +1 +select * from t1 where value2=1; +id value value2 +100 1 1 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +2 2 2 +select * from t1 where value < 3; +id value value2 +100 1 1 +2 2 2 +select value from t1 where value < 3; +value +1 +2 +select * from t1 where value2 < 3; +id value value2 +2 2 2 +100 1 1 +select * from t1; +id value value2 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +100 1 1 +select value from t1; +value +1 +2 +3 +4 +5 +6 +8 +9 +10 +rollback; +begin; +update t1 set value2=100 where value2=1; +select * from t1 where id=1; +id value value2 +1 1 100 +select * from t1 where value=1; +id value value2 +1 1 100 +select value from t1 where value=1; +value +1 +select * from t1 where value2=1; +id value value2 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +1 1 100 +2 2 2 +select * from t1 where value < 3; +id value value2 +1 1 100 +2 2 2 +select value from t1 where value < 3; +value +1 +2 +select * from t1 where value2 < 3; +id value value2 +2 2 2 +select * from t1; +id value value2 +1 1 100 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +select value from t1; +value +1 +2 +3 +4 +5 +6 +8 +9 +10 +rollback; +begin; +update t1 set value=100 where value2=1; +select * from t1 where id=1; +id value value2 +1 100 1 +select * from t1 where value=1; +id value value2 +select value from t1 where value=1; +value +select * from t1 where value2=1; +id value value2 +1 100 1 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +1 100 1 +2 2 2 +select * from t1 where value < 3; +id value value2 +2 2 2 +select value from t1 where value < 3; +value +2 +select * from t1 where value2 < 3; +id value value2 +1 100 1 +2 2 2 +select * from t1; +id value value2 +1 100 1 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +select value from t1; +value +2 +3 +4 +5 +6 +8 +9 +10 +100 +rollback; +begin; +update t1 set id=100 where value2=1; +select * from t1 where id=1; +id value value2 +select * from t1 where value=1; +id value value2 +100 1 1 +select value from t1 where value=1; +value +1 +select * from t1 where value2=1; +id value value2 +100 1 1 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +2 2 2 +select * from t1 where value < 3; +id value value2 +100 1 1 +2 2 2 +select value from t1 where value < 3; +value +1 +2 +select * from t1 where value2 < 3; +id value value2 +2 2 2 +100 1 1 +select * from t1; +id value value2 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +100 1 1 +select value from t1; +value +1 +2 +3 +4 +5 +6 +8 +9 +10 +rollback; +begin; +delete from t1 where id=1; +select * from t1 where id=1; +id value value2 +select * from t1 where value=1; +id value value2 +select value from t1 where value=1; +value +select * from t1 where value2=1; +id value value2 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +2 2 2 +select * from t1 where value < 3; +id value value2 +2 2 2 +select value from t1 where value < 3; +value +2 +select * from t1 where value2 < 3; +id value value2 +2 2 2 +select * from t1; +id value value2 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +select value from t1; +value +2 +3 +4 +5 +6 +8 +9 +10 +rollback; +begin; +delete from t1 where value=1; +select * from t1 where id=1; +id value value2 +select * from t1 where value=1; +id value value2 +select value from t1 where value=1; +value +select * from t1 where value2=1; +id value value2 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +2 2 2 +select * from t1 where value < 3; +id value value2 +2 2 2 +select value from t1 where value < 3; +value +2 +select * from t1 where value2 < 3; +id value value2 +2 2 2 +select * from t1; +id value value2 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +select value from t1; +value +2 +3 +4 +5 +6 +8 +9 +10 +rollback; +begin; +delete from t1 where value2=1; +select * from t1 where id=1; +id value value2 +select * from t1 where value=1; +id value value2 +select value from t1 where value=1; +value +select * from t1 where value2=1; +id value value2 +select * from t1 where id=5; +id value value2 +5 5 5 +select * from t1 where value=5; +id value value2 +5 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +5 5 5 +select * from t1 where id < 3; +id value value2 +2 2 2 +select * from t1 where value < 3; +id value value2 +2 2 2 +select value from t1 where value < 3; +value +2 +select * from t1 where value2 < 3; +id value value2 +2 2 2 +select * from t1; +id value value2 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +8 8 8 +9 9 9 +10 10 10 +select value from t1; +value +2 +3 +4 +5 +6 +8 +9 +10 +rollback; +begin; +insert into t1 values (11,11,11); +insert into t1 values (12,12,12); +insert into t1 values (13,13,13); +delete from t1 where id=9; +delete from t1 where value=8; +update t1 set id=100 where value2=5; +update t1 set value=103 where value=4; +update t1 set id=115 where id=3; +select * from t1 where id=1; +id value value2 +1 1 1 +select * from t1 where value=1; +id value value2 +1 1 1 +select value from t1 where value=1; +value +1 +select * from t1 where value2=1; +id value value2 +1 1 1 +select * from t1 where id=5; +id value value2 +select * from t1 where value=5; +id value value2 +100 5 5 +select value from t1 where value=5; +value +5 +select * from t1 where value2=5; +id value value2 +100 5 5 +select * from t1 where id < 3; +id value value2 +1 1 1 +2 2 2 +select * from t1 where value < 3; +id value value2 +1 1 1 +2 2 2 +select value from t1 where value < 3; +value +1 +2 +select * from t1 where value2 < 3; +id value value2 +1 1 1 +2 2 2 +select * from t1; +id value value2 +1 1 1 +2 2 2 +4 103 4 +6 6 6 +10 10 10 +11 11 11 +12 12 12 +13 13 13 +100 5 5 +115 3 3 +select value from t1; +value +1 +2 +3 +5 +6 +10 +11 +12 +13 +103 +rollback; +drop table t1; diff --git a/mysql-test/suite/rocksdb/transaction.test b/mysql-test/suite/rocksdb/transaction.test new file mode 100644 index 000000000000..f3f858591b6d --- /dev/null +++ b/mysql-test/suite/rocksdb/transaction.test @@ -0,0 +1,103 @@ +create table t1 (id int primary key, value int, value2 varchar(100), index(value)) engine=rocksdb; + +insert into t1 values (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),(6,6,6),(8,8,8),(9,9,9),(10,10,10); + +# insert +begin; +insert into t1 values (11,11,11); +--source transaction_select.inc +rollback; + +# insert in the middle +begin; +insert into t1 values (7,7,7); +--source transaction_select.inc +rollback; + +# update non-index column by primary key +begin; +update t1 set value2=100 where id=1; +--source transaction_select.inc +rollback; + +# update secondary key by primary key +begin; +update t1 set value=100 where id=1; +--source transaction_select.inc +rollback; + +# update primary key by primary key +begin; +update t1 set id=100 where id=1; +--source transaction_select.inc +rollback; + +# update non-index column key by secondary key +begin; +update t1 set value2=100 where value=1; +--source transaction_select.inc +rollback; + +# update secondary key by secondary key +begin; +update t1 set value=100 where value=1; +--source transaction_select.inc +rollback; + +# update primary key by secondary key +begin; +update t1 set id=100 where value=1; +--source transaction_select.inc +rollback; + +# update non-index column by non-index column +begin; +update t1 set value2=100 where value2=1; +--source transaction_select.inc +rollback; + +# update secondary key by non-index column +begin; +update t1 set value=100 where value2=1; +--source transaction_select.inc +rollback; + +# update primary key column by non-index column +begin; +update t1 set id=100 where value2=1; +--source transaction_select.inc +rollback; + + +# delete by primary key +begin; +delete from t1 where id=1; +--source transaction_select.inc +rollback; + +# delete by secondary key +begin; +delete from t1 where value=1; +--source transaction_select.inc +rollback; + +# delete by non-index column +begin; +delete from t1 where value2=1; +--source transaction_select.inc +rollback; + +# mixed +begin; +insert into t1 values (11,11,11); +insert into t1 values (12,12,12); +insert into t1 values (13,13,13); +delete from t1 where id=9; +delete from t1 where value=8; +update t1 set id=100 where value2=5; +update t1 set value=103 where value=4; +update t1 set id=115 where id=3; +--source transaction_select.inc +rollback; + +drop table t1; diff --git a/mysql-test/suite/rocksdb/transaction_select.inc b/mysql-test/suite/rocksdb/transaction_select.inc new file mode 100644 index 000000000000..4feb427be499 --- /dev/null +++ b/mysql-test/suite/rocksdb/transaction_select.inc @@ -0,0 +1,15 @@ +select * from t1 where id=1; +select * from t1 where value=1; +select value from t1 where value=1; +select * from t1 where value2=1; +select * from t1 where id=5; +select * from t1 where value=5; +select value from t1 where value=5; +select * from t1 where value2=5; +select * from t1 where id < 3; +select * from t1 where value < 3; +select value from t1 where value < 3; +select * from t1 where value2 < 3; +select * from t1; +select value from t1; +