summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/tokudb/t/tokudb_mrr.test
diff options
context:
space:
mode:
Diffstat (limited to 'storage/tokudb/mysql-test/tokudb/t/tokudb_mrr.test')
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/tokudb_mrr.test73
1 files changed, 73 insertions, 0 deletions
diff --git a/storage/tokudb/mysql-test/tokudb/t/tokudb_mrr.test b/storage/tokudb/mysql-test/tokudb/t/tokudb_mrr.test
new file mode 100644
index 00000000000..6130933b279
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb/t/tokudb_mrr.test
@@ -0,0 +1,73 @@
+#
+# MRR/Tokudb tests, taken from mysqltest/t/innodb_mrr.test
+# (Turns off all other 6.0 optimizer switches than MRR)
+#
+
+--source include/have_tokudb.inc
+--source include/have_mrr.inc
+
+set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
+set default_storage_engine=TokuDB;
+
+--source include/mrr_tests.inc
+
+
+# taken from include/mrr_innodb_tests.inc
+
+--source include/count_sessions.inc
+
+# MRR tests that are special for InnoDB (and copied for TokuDB)
+
+--echo #
+--echo # Bug#41029 "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)"
+--echo #
+
+# This test verifies that a SELECT FOR UPDATE statement executed in
+# REPEATABLE READ isolation will lock the entire read interval by verifying
+# that a second transaction trying to update data within this interval will
+# be blocked.
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+
+SET AUTOCOMMIT=0;
+
+CREATE TABLE t1 (
+ dummy INT PRIMARY KEY,
+ a INT UNIQUE,
+ b INT
+) ENGINE=TokuDB;
+
+INSERT INTO t1 VALUES (1,1,1),(3,3,3),(5,5,5);
+COMMIT;
+
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+SELECT @@tx_isolation;
+START TRANSACTION;
+
+EXPLAIN SELECT * FROM t1 WHERE a >= 2 FOR UPDATE;
+
+SELECT * FROM t1 WHERE a >= 2 FOR UPDATE;
+
+connection con2;
+
+SET AUTOCOMMIT=0;
+SET TOKUDB_LOCK_TIMEOUT=2;
+START TRANSACTION;
+
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES (2,2,2);
+ROLLBACK;
+
+connection con1;
+
+ROLLBACK;
+DROP TABLE t1;
+
+connection default;
+disconnect con1;
+disconnect con2;
+
+--source include/wait_until_count_sessions.inc