1# 2# MRR/Tokudb tests, taken from mysqltest/t/innodb_mrr.test 3# (Turns off all other 6.0 optimizer switches than MRR) 4# 5 6--source include/have_tokudb.inc 7--source include/have_mrr.inc 8 9set optimizer_switch='mrr=on,mrr_cost_based=off'; 10 11--disable_query_log 12if (`select locate('semijoin', @@optimizer_switch) > 0`) 13{ 14 set optimizer_switch='semijoin=off'; 15} 16if (`select locate('materialization', @@optimizer_switch) > 0`) 17{ 18 set optimizer_switch='materialization=off'; 19} 20if (`select locate('index_condition_pushdown', @@optimizer_switch) > 0`) 21{ 22 set optimizer_switch='index_condition_pushdown=off'; 23} 24--enable_query_log 25 26set default_storage_engine=TokuDB; 27 28--source include/mrr_tests.inc 29 30 31# taken from include/mrr_innodb_tests.inc 32 33--source include/count_sessions.inc 34 35# MRR tests that are special for InnoDB (and copied for TokuDB) 36 37--echo # 38--echo # Bug#41029 "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)" 39--echo # 40 41# This test verifies that a SELECT FOR UPDATE statement executed in 42# REPEATABLE READ isolation will lock the entire read interval by verifying 43# that a second transaction trying to update data within this interval will 44# be blocked. 45 46connect (con1,localhost,root,,); 47connect (con2,localhost,root,,); 48 49connection con1; 50 51SET AUTOCOMMIT=0; 52 53CREATE TABLE t1 ( 54 dummy INT PRIMARY KEY, 55 a INT UNIQUE, 56 b INT 57) ENGINE=TokuDB; 58 59INSERT INTO t1 VALUES (1,1,1),(3,3,3),(5,5,5); 60COMMIT; 61 62SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; 63SELECT @@tx_isolation; 64START TRANSACTION; 65 66EXPLAIN SELECT * FROM t1 WHERE a >= 2 FOR UPDATE; 67 68SELECT * FROM t1 WHERE a >= 2 FOR UPDATE; 69 70connection con2; 71 72SET AUTOCOMMIT=0; 73SET TOKUDB_LOCK_TIMEOUT=2; 74START TRANSACTION; 75 76--error ER_LOCK_WAIT_TIMEOUT 77INSERT INTO t1 VALUES (2,2,2); 78ROLLBACK; 79 80connection con1; 81 82ROLLBACK; 83DROP TABLE t1; 84 85connection default; 86disconnect con1; 87disconnect con2; 88 89--source include/wait_until_count_sessions.inc 90