diff options
Diffstat (limited to 'storage/rocksdb')
47 files changed, 801 insertions, 806 deletions
diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt index e4906638f6c..703504a6682 100644 --- a/storage/rocksdb/CMakeLists.txt +++ b/storage/rocksdb/CMakeLists.txt @@ -128,10 +128,15 @@ CHECK_CXX_SOURCE_COMPILES(" #endif int main() { static __thread int tls; + tls=0; + return tls; } " HAVE_THREAD_LOCAL) if(HAVE_THREAD_LOCAL) ADD_DEFINITIONS(-DROCKSDB_SUPPORT_THREAD_LOCAL) +else() + MESSAGE(SEND_ERROR "The compiler failed the check for ROCKSDB_SUPPORT_THREAD_LOCAL. " + "MyRocks requires that feature.") endif() INCLUDE(build_rocksdb.cmake) diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index c985bd0d194..ae04a061bf2 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -3290,9 +3290,9 @@ void Rdb_snapshot_notifier::SnapshotCreated( std::multiset<Rdb_transaction *> Rdb_transaction::s_tx_list; mysql_mutex_t Rdb_transaction::s_tx_list_mutex; -static Rdb_transaction *&get_tx_from_thd(THD *const thd) { - return *reinterpret_cast<Rdb_transaction **>( - my_core::thd_ha_data(thd, rocksdb_hton)); +static Rdb_transaction *get_tx_from_thd(THD *const thd) { + return reinterpret_cast<Rdb_transaction *>( + my_core::thd_get_ha_data(thd, rocksdb_hton)); } namespace { @@ -3339,7 +3339,7 @@ class Rdb_perf_context_guard { */ static Rdb_transaction *get_or_create_tx(THD *const thd) { - Rdb_transaction *&tx = get_tx_from_thd(thd); + Rdb_transaction *tx = get_tx_from_thd(thd); // TODO: this is called too many times.. O(#rows) if (tx == nullptr) { bool rpl_skip_tx_api= false; // MARIAROCKS_NOT_YET. @@ -3354,6 +3354,7 @@ static Rdb_transaction *get_or_create_tx(THD *const thd) { } tx->set_params(THDVAR(thd, lock_wait_timeout), THDVAR(thd, max_row_locks)); tx->start_tx(); + my_core::thd_set_ha_data(thd, rocksdb_hton, tx); } else { tx->set_params(THDVAR(thd, lock_wait_timeout), THDVAR(thd, max_row_locks)); if (!tx->is_tx_started()) { @@ -3365,7 +3366,7 @@ static Rdb_transaction *get_or_create_tx(THD *const thd) { } static int rocksdb_close_connection(handlerton *const hton, THD *const thd) { - Rdb_transaction *&tx = get_tx_from_thd(thd); + Rdb_transaction *tx = get_tx_from_thd(thd); if (tx != nullptr) { int rc = tx->finish_bulk_load(false); if (rc != 0) { @@ -3376,7 +3377,6 @@ static int rocksdb_close_connection(handlerton *const hton, THD *const thd) { } delete tx; - tx = nullptr; } return HA_EXIT_SUCCESS; } @@ -3444,7 +3444,7 @@ static int rocksdb_prepare(handlerton* hton, THD* thd, bool prepare_tx) { bool async=false; // This is "ASYNC_COMMIT" feature which is only present in webscalesql - Rdb_transaction *&tx = get_tx_from_thd(thd); + Rdb_transaction *tx = get_tx_from_thd(thd); if (!tx->can_prepare()) { return HA_EXIT_FAILURE; } @@ -3695,7 +3695,7 @@ static void rocksdb_commit_ordered(handlerton *hton, THD* thd, bool all) // Same assert as InnoDB has DBUG_ASSERT(all || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))); - Rdb_transaction *&tx = get_tx_from_thd(thd); + Rdb_transaction *tx = get_tx_from_thd(thd); if (!tx->is_two_phase()) { /* ordered_commit is supposedly slower as it is done sequentially @@ -3727,7 +3727,7 @@ static int rocksdb_commit(handlerton* hton, THD* thd, bool commit_tx) rocksdb::StopWatchNano timer(rocksdb::Env::Default(), true); /* note: h->external_lock(F_UNLCK) is called after this function is called) */ - Rdb_transaction *&tx = get_tx_from_thd(thd); + Rdb_transaction *tx = get_tx_from_thd(thd); /* this will trigger saving of perf_context information */ Rdb_perf_context_guard guard(tx, rocksdb_perf_context_level(thd)); @@ -3800,7 +3800,7 @@ static int rocksdb_commit(handlerton* hton, THD* thd, bool commit_tx) static int rocksdb_rollback(handlerton *const hton, THD *const thd, bool rollback_tx) { - Rdb_transaction *&tx = get_tx_from_thd(thd); + Rdb_transaction *tx = get_tx_from_thd(thd); Rdb_perf_context_guard guard(tx, rocksdb_perf_context_level(thd)); if (tx != nullptr) { @@ -4607,7 +4607,7 @@ static int rocksdb_savepoint(handlerton *const hton, THD *const thd, static int rocksdb_rollback_to_savepoint(handlerton *const hton, THD *const thd, void *const savepoint) { - Rdb_transaction *&tx = get_tx_from_thd(thd); + Rdb_transaction *tx = get_tx_from_thd(thd); return tx->rollback_to_savepoint(savepoint); } @@ -5347,49 +5347,6 @@ static int rocksdb_done_func(void *const p) { } /* - MariaDB: When the plugin is unloaded with UNINSTALL SONAME command, some - connections may still have Rdb_transaction objects. - - These objects are not genuine transactions (as SQL layer makes sure that - a plugin that is being unloaded has no open tables), they are empty - Rdb_transaction objects that were left there to save on object - creation/deletion. - - Go through the list and delete them. - */ - { - class Rdb_trx_deleter: public Rdb_tx_list_walker { - public: - std::set<Rdb_transaction*> rdb_trxs; - - void process_tran(const Rdb_transaction *const tx) override { - /* - Check if the transaction is really empty. We only check - non-WriteBatch-based transactions, because there is no easy way to - check WriteBatch-based transactions. - */ - if (!tx->is_writebatch_trx()) { - const auto tx_impl = static_cast<const Rdb_transaction_impl *>(tx); - DBUG_ASSERT(tx_impl); - if (tx_impl->get_rdb_trx()) - DBUG_ASSERT(0); - } - rdb_trxs.insert((Rdb_transaction*)tx); - }; - } deleter; - - Rdb_transaction::walk_tx_list(&deleter); - - for (std::set<Rdb_transaction*>::iterator it= deleter.rdb_trxs.begin(); - it != deleter.rdb_trxs.end(); - ++it) - { - // When a transaction is deleted, it removes itself from s_tx_list. - delete *it; - } - } - - /* destructors for static objects can be called at _exit(), but we want to free the memory at dlclose() */ @@ -13833,7 +13790,7 @@ int rocksdb_check_bulk_load( return 1; } - Rdb_transaction *&tx = get_tx_from_thd(thd); + Rdb_transaction *tx = get_tx_from_thd(thd); if (tx != nullptr) { const int rc = tx->finish_bulk_load(); if (rc != 0) { diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues.result index d160b81f10e..84c93481c79 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues.result @@ -1,674 +1 @@ - ------------------------------------------------------------------------ -- Locking issues case 1.1: -- Locking rows that do not exist when using all primary key columns in -- a WHERE clause -- using REPEATABLE READ transaction isolation level ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2)); -INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0); -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE; -id1 id2 value -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -INSERT INTO t0 VALUES (1,5,0); -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -connection con1; -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 1.1: -- Locking rows that do not exist when using all primary key columns in -- a WHERE clause -- using READ COMMITTED transaction isolation level ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2)); -INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0); -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE; -id1 id2 value -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -INSERT INTO t0 VALUES (1,5,0); -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -connection con1; -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 1.2: -- Locking rows that do not exist without using all primary key -- columns in a WHERE clause -- using REPEATABLE READ transaction isolation level ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2)); -INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0); -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -SELECT * FROM t0 WHERE id1=1 FOR UPDATE; -id1 id2 value -1 1 0 -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -SELECT * FROM t0 WHERE id1=1 AND id2=4 FOR UPDATE; -id1 id2 value -INSERT INTO t0 VALUES (1,5,0); -connection con1; -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 1.2: -- Locking rows that do not exist without using all primary key -- columns in a WHERE clause -- using READ COMMITTED transaction isolation level ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2)); -INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0); -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -SELECT * FROM t0 WHERE id1=1 FOR UPDATE; -id1 id2 value -1 1 0 -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -SELECT * FROM t0 WHERE id1=1 AND id2=4 FOR UPDATE; -id1 id2 value -INSERT INTO t0 VALUES (1,5,0); -connection con1; -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 2: -- Rows that are scanned but do not match the WHERE are not locked -- using REPEATABLE READ transaction isolation level unless -- rocksdb_lock_scanned_rows is on ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -SELECT @@global.rocksdb_lock_scanned_rows; -@@global.rocksdb_lock_scanned_rows -0 -CREATE TABLE t0(id INT PRIMARY KEY, value INT); -INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1); -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -connection con1; -SELECT * FROM t0 WHERE value > 0 FOR UPDATE; -id value -2 1 -5 1 -connection con2; -UPDATE t0 SET VALUE=10 WHERE id=1; -UPDATE t0 SET VALUE=10 WHERE id=5; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -connection con1; -UPDATE t0 SET value=100 WHERE id in (4,5) and value>0; -connection con2; -SELECT * FROM t0 WHERE id=4 FOR UPDATE; -id value -4 0 -COMMIT; -SELECT * FROM t0; -id value -1 10 -2 1 -3 0 -4 0 -5 1 -connection con1; -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 2: -- Rows that are scanned but do not match the WHERE are not locked -- using READ COMMITTED transaction isolation level unless -- rocksdb_lock_scanned_rows is on ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -SELECT @@global.rocksdb_lock_scanned_rows; -@@global.rocksdb_lock_scanned_rows -0 -CREATE TABLE t0(id INT PRIMARY KEY, value INT); -INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1); -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -connection con1; -SELECT * FROM t0 WHERE value > 0 FOR UPDATE; -id value -2 1 -5 1 -connection con2; -UPDATE t0 SET VALUE=10 WHERE id=1; -UPDATE t0 SET VALUE=10 WHERE id=5; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -connection con1; -UPDATE t0 SET value=100 WHERE id in (4,5) and value>0; -connection con2; -SELECT * FROM t0 WHERE id=4 FOR UPDATE; -id value -4 0 -COMMIT; -SELECT * FROM t0; -id value -1 10 -2 1 -3 0 -4 0 -5 1 -connection con1; -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 2: -- Rows that are scanned but do not match the WHERE are not locked -- using REPEATABLE READ transaction isolation level unless -- rocksdb_lock_scanned_rows is on ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -SELECT @@global.rocksdb_lock_scanned_rows; -@@global.rocksdb_lock_scanned_rows -0 -SET GLOBAL rocksdb_lock_scanned_rows=ON; -CREATE TABLE t0(id INT PRIMARY KEY, value INT); -INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1); -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -connection con1; -SELECT * FROM t0 WHERE value > 0 FOR UPDATE; -id value -2 1 -5 1 -connection con2; -UPDATE t0 SET VALUE=10 WHERE id=1; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -connection con1; -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; -SET GLOBAL rocksdb_lock_scanned_rows=0; - ------------------------------------------------------------------------ -- Locking issues case 2: -- Rows that are scanned but do not match the WHERE are not locked -- using READ COMMITTED transaction isolation level unless -- rocksdb_lock_scanned_rows is on ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -SELECT @@global.rocksdb_lock_scanned_rows; -@@global.rocksdb_lock_scanned_rows -0 -SET GLOBAL rocksdb_lock_scanned_rows=ON; -CREATE TABLE t0(id INT PRIMARY KEY, value INT); -INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1); -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -connection con1; -SELECT * FROM t0 WHERE value > 0 FOR UPDATE; -id value -2 1 -5 1 -connection con2; -UPDATE t0 SET VALUE=10 WHERE id=1; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -connection con1; -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; -SET GLOBAL rocksdb_lock_scanned_rows=0; - ------------------------------------------------------------------------ -- Locking issues case 3: -- After creating a snapshot, other clients updating rows -- using REPEATABLE READ transaction isolation level ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); -Inserting 200,000 rows -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -SELECT * FROM t0 WHERE value > 0 FOR UPDATE; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -UPDATE t0 SET VALUE=VALUE+1 WHERE id=190000; -connection con1; -ERROR: 1213 -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 3: -- After creating a snapshot, other clients updating rows -- using READ COMMITTED transaction isolation level ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); -Inserting 200,000 rows -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -SELECT * FROM t0 WHERE value > 0 FOR UPDATE; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -UPDATE t0 SET VALUE=VALUE+1 WHERE id=190000; -connection con1; -id value -190000 1 -ERROR: 0 -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 4: -- Phantom rows -- using REPEATABLE READ transaction isolation level ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); -Inserting 200,000 rows -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -SELECT * FROM t0 WHERE value > 0 FOR UPDATE; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -INSERT INTO t0 VALUES(200001,1), (-1,1); -connection con1; -id value -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 4: -- Phantom rows -- using READ COMMITTED transaction isolation level ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); -Inserting 200,000 rows -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -SELECT * FROM t0 WHERE value > 0 FOR UPDATE; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -INSERT INTO t0 VALUES(200001,1), (-1,1); -connection con1; -id value -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 5: -- Deleting primary key -- using REPEATABLE READ transaction isolation level ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); -Inserting 200,000 rows -UPDATE t0 SET value=100 WHERE id=190000; -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -SELECT * FROM t0 WHERE value > 0 FOR UPDATE; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -DELETE FROM t0 WHERE id=190000; -COMMIT; -connection con1; -ERROR: 1213 -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 5: -- Deleting primary key -- using READ COMMITTED transaction isolation level ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); -Inserting 200,000 rows -UPDATE t0 SET value=100 WHERE id=190000; -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -SELECT * FROM t0 WHERE value > 0 FOR UPDATE; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -DELETE FROM t0 WHERE id=190000; -COMMIT; -connection con1; -id value -ERROR: 0 -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 6: -- Changing primary key -- using REPEATABLE READ transaction isolation level ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); -Inserting 200,000 rows -UPDATE t0 SET value=100 WHERE id=190000; -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -SELECT * FROM t0 WHERE value > 0 FOR UPDATE; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -UPDATE t0 SET id=200001 WHERE id=190000; -COMMIT; -connection con1; -ERROR: 1213 -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 6: -- Changing primary key -- using READ COMMITTED transaction isolation level ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t0; -CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); -Inserting 200,000 rows -UPDATE t0 SET value=100 WHERE id=190000; -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -SELECT * FROM t0 WHERE value > 0 FOR UPDATE; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -UPDATE t0 SET id=200001 WHERE id=190000; -COMMIT; -connection con1; -id value -ERROR: 0 -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t0; - ------------------------------------------------------------------------ -- Locking issues case 7: -- Rows that are scanned as part of a query but not in the table being -- updated should not be locked unless rocksdb_lock_scanned_rows is on ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t1, t2; -SELECT @@global.rocksdb_lock_scanned_rows; -@@global.rocksdb_lock_scanned_rows -0 -CREATE TABLE t1(id INT PRIMARY KEY, value INT); -CREATE TABLE t2(id INT PRIMARY KEY, value INT); -INSERT INTO t1 VALUES (1,1), (2,2), (3,3); -INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -lock_scanned_rows is 0 -connection con1; -UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3; -connection con2; -UPDATE t2 SET value=value+100; -SELECT * FROM t2; -id value -1 101 -2 102 -3 103 -4 104 -5 105 -connection con1; -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t1; -DROP TABLE t2; - ------------------------------------------------------------------------ -- Locking issues case 7: -- Rows that are scanned as part of a query but not in the table being -- updated should not be locked unless rocksdb_lock_scanned_rows is on ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t1, t2; -SELECT @@global.rocksdb_lock_scanned_rows; -@@global.rocksdb_lock_scanned_rows -0 -CREATE TABLE t1(id INT PRIMARY KEY, value INT); -CREATE TABLE t2(id INT PRIMARY KEY, value INT); -INSERT INTO t1 VALUES (1,1), (2,2), (3,3); -INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -lock_scanned_rows is 0 -connection con1; -UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3; -connection con2; -UPDATE t2 SET value=value+100; -SELECT * FROM t2; -id value -1 101 -2 102 -3 103 -4 104 -5 105 -connection con1; -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t1; -DROP TABLE t2; - ------------------------------------------------------------------------ -- Locking issues case 7: -- Rows that are scanned as part of a query but not in the table being -- updated should not be locked unless rocksdb_lock_scanned_rows is on ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t1, t2; -SELECT @@global.rocksdb_lock_scanned_rows; -@@global.rocksdb_lock_scanned_rows -0 -SET GLOBAL rocksdb_lock_scanned_rows=ON; -CREATE TABLE t1(id INT PRIMARY KEY, value INT); -CREATE TABLE t2(id INT PRIMARY KEY, value INT); -INSERT INTO t1 VALUES (1,1), (2,2), (3,3); -INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -BEGIN; -lock_scanned_rows is 1 -connection con1; -UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3; -connection con2; -UPDATE t2 SET value=value+100 WHERE id=3; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -UPDATE t2 SET value=value+100 WHERE id IN (1,2,4,5); -SELECT * FROM t2; -id value -1 101 -2 102 -3 3 -4 104 -5 105 -connection con1; -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t1; -DROP TABLE t2; -SET GLOBAL rocksdb_lock_scanned_rows=0; - ------------------------------------------------------------------------ -- Locking issues case 7: -- Rows that are scanned as part of a query but not in the table being -- updated should not be locked unless rocksdb_lock_scanned_rows is on ------------------------------------------------------------------------ -DROP TABLE IF EXISTS t1, t2; -SELECT @@global.rocksdb_lock_scanned_rows; -@@global.rocksdb_lock_scanned_rows -0 -SET GLOBAL rocksdb_lock_scanned_rows=ON; -CREATE TABLE t1(id INT PRIMARY KEY, value INT); -CREATE TABLE t2(id INT PRIMARY KEY, value INT); -INSERT INTO t1 VALUES (1,1), (2,2), (3,3); -INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -BEGIN; -lock_scanned_rows is 1 -connection con1; -UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3; -connection con2; -UPDATE t2 SET value=value+100 WHERE id=3; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -UPDATE t2 SET value=value+100 WHERE id IN (1,2,4,5); -SELECT * FROM t2; -id value -1 101 -2 102 -3 3 -4 104 -5 105 -connection con1; -COMMIT; -connection default; -disconnect con1; -disconnect con2; -DROP TABLE t1; -DROP TABLE t2; -SET GLOBAL rocksdb_lock_scanned_rows=0; +tests moved to rocksdb.locking_issues_case* diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_1_rc.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_1_rc.result new file mode 100644 index 00000000000..a47aa3c7d90 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_1_rc.result @@ -0,0 +1,30 @@ + +----------------------------------------------------------------------- +- Locking issues case 1.1: +- Locking rows that do not exist when using all primary key columns in +- a WHERE clause +- using READ COMMITTED transaction isolation level +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2)); +INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE; +id1 id2 value +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +INSERT INTO t0 VALUES (1,5,0); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con1; +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_1_rr.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_1_rr.result new file mode 100644 index 00000000000..c923c34c98e --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_1_rr.result @@ -0,0 +1,30 @@ + +----------------------------------------------------------------------- +- Locking issues case 1.1: +- Locking rows that do not exist when using all primary key columns in +- a WHERE clause +- using REPEATABLE READ transaction isolation level +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2)); +INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE; +id1 id2 value +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +INSERT INTO t0 VALUES (1,5,0); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t0 WHERE id1=1 AND id2=5 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con1; +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_2_rc.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_2_rc.result new file mode 100644 index 00000000000..01c4e7e3b2f --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_2_rc.result @@ -0,0 +1,30 @@ + +----------------------------------------------------------------------- +- Locking issues case 1.2: +- Locking rows that do not exist without using all primary key +- columns in a WHERE clause +- using READ COMMITTED transaction isolation level +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2)); +INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +SELECT * FROM t0 WHERE id1=1 FOR UPDATE; +id1 id2 value +1 1 0 +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +SELECT * FROM t0 WHERE id1=1 AND id2=4 FOR UPDATE; +id1 id2 value +INSERT INTO t0 VALUES (1,5,0); +connection con1; +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_2_rr.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_2_rr.result new file mode 100644 index 00000000000..798fd15b76e --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case1_2_rr.result @@ -0,0 +1,30 @@ + +----------------------------------------------------------------------- +- Locking issues case 1.2: +- Locking rows that do not exist without using all primary key +- columns in a WHERE clause +- using REPEATABLE READ transaction isolation level +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +CREATE TABLE t0(id1 INT, id2 INT, value INT, PRIMARY KEY(id1, id2)); +INSERT INTO t0 VALUES (1,1,0), (3,3,0), (4,4,0), (6,6,0); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +SELECT * FROM t0 WHERE id1=1 FOR UPDATE; +id1 id2 value +1 1 0 +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +SELECT * FROM t0 WHERE id1=1 AND id2=4 FOR UPDATE; +id1 id2 value +INSERT INTO t0 VALUES (1,5,0); +connection con1; +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rc.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rc.result new file mode 100644 index 00000000000..16480da8e80 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rc.result @@ -0,0 +1,50 @@ + +----------------------------------------------------------------------- +- Locking issues case 2: +- Rows that are scanned but do not match the WHERE are not locked +- using READ COMMITTED transaction isolation level unless +- rocksdb_lock_scanned_rows is on +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +SELECT @@global.rocksdb_lock_scanned_rows; +@@global.rocksdb_lock_scanned_rows +0 +CREATE TABLE t0(id INT PRIMARY KEY, value INT); +INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +connection con1; +SELECT * FROM t0 WHERE value > 0 FOR UPDATE; +id value +2 1 +5 1 +connection con2; +UPDATE t0 SET VALUE=10 WHERE id=1; +UPDATE t0 SET VALUE=10 WHERE id=5; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con1; +UPDATE t0 SET value=100 WHERE id in (4,5) and value>0; +connection con2; +SELECT * FROM t0 WHERE id=4 FOR UPDATE; +id value +4 0 +COMMIT; +SELECT * FROM t0; +id value +1 10 +2 1 +3 0 +4 0 +5 1 +connection con1; +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rc_lsr.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rc_lsr.result new file mode 100644 index 00000000000..330cd09d33e --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rc_lsr.result @@ -0,0 +1,37 @@ + +----------------------------------------------------------------------- +- Locking issues case 2: +- Rows that are scanned but do not match the WHERE are not locked +- using READ COMMITTED transaction isolation level unless +- rocksdb_lock_scanned_rows is on +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +SELECT @@global.rocksdb_lock_scanned_rows; +@@global.rocksdb_lock_scanned_rows +0 +SET GLOBAL rocksdb_lock_scanned_rows=ON; +CREATE TABLE t0(id INT PRIMARY KEY, value INT); +INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +connection con1; +SELECT * FROM t0 WHERE value > 0 FOR UPDATE; +id value +2 1 +5 1 +connection con2; +UPDATE t0 SET VALUE=10 WHERE id=1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con1; +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; +SET GLOBAL rocksdb_lock_scanned_rows=0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rr.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rr.result new file mode 100644 index 00000000000..3e6b63afaa8 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rr.result @@ -0,0 +1,50 @@ + +----------------------------------------------------------------------- +- Locking issues case 2: +- Rows that are scanned but do not match the WHERE are not locked +- using REPEATABLE READ transaction isolation level unless +- rocksdb_lock_scanned_rows is on +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +SELECT @@global.rocksdb_lock_scanned_rows; +@@global.rocksdb_lock_scanned_rows +0 +CREATE TABLE t0(id INT PRIMARY KEY, value INT); +INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +connection con1; +SELECT * FROM t0 WHERE value > 0 FOR UPDATE; +id value +2 1 +5 1 +connection con2; +UPDATE t0 SET VALUE=10 WHERE id=1; +UPDATE t0 SET VALUE=10 WHERE id=5; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con1; +UPDATE t0 SET value=100 WHERE id in (4,5) and value>0; +connection con2; +SELECT * FROM t0 WHERE id=4 FOR UPDATE; +id value +4 0 +COMMIT; +SELECT * FROM t0; +id value +1 10 +2 1 +3 0 +4 0 +5 1 +connection con1; +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rr_lsr.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rr_lsr.result new file mode 100644 index 00000000000..088e975ebc5 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case2_rr_lsr.result @@ -0,0 +1,37 @@ + +----------------------------------------------------------------------- +- Locking issues case 2: +- Rows that are scanned but do not match the WHERE are not locked +- using REPEATABLE READ transaction isolation level unless +- rocksdb_lock_scanned_rows is on +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +SELECT @@global.rocksdb_lock_scanned_rows; +@@global.rocksdb_lock_scanned_rows +0 +SET GLOBAL rocksdb_lock_scanned_rows=ON; +CREATE TABLE t0(id INT PRIMARY KEY, value INT); +INSERT INTO t0 VALUES (1,0), (2,1), (3,0), (4,0), (5,1); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +connection con1; +SELECT * FROM t0 WHERE value > 0 FOR UPDATE; +id value +2 1 +5 1 +connection con2; +UPDATE t0 SET VALUE=10 WHERE id=1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con1; +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; +SET GLOBAL rocksdb_lock_scanned_rows=0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case3_rc.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case3_rc.result new file mode 100644 index 00000000000..9a6f02cd41d --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case3_rc.result @@ -0,0 +1,25 @@ + +----------------------------------------------------------------------- +- Locking issues case 3: +- After creating a snapshot, other clients updating rows +- using READ COMMITTED transaction isolation level +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); +Inserting 200,000 rows +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT * FROM t0 WHERE value > 0 FOR UPDATE; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +UPDATE t0 SET VALUE=VALUE+1 WHERE id=190000; +connection con1; +id value +190000 1 +ERROR: 0 +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case3_rr.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case3_rr.result new file mode 100644 index 00000000000..fdd4d8fcaca --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case3_rr.result @@ -0,0 +1,23 @@ + +----------------------------------------------------------------------- +- Locking issues case 3: +- After creating a snapshot, other clients updating rows +- using REPEATABLE READ transaction isolation level +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); +Inserting 200,000 rows +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT * FROM t0 WHERE value > 0 FOR UPDATE; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +UPDATE t0 SET VALUE=VALUE+1 WHERE id=190000; +connection con1; +ERROR: 1213 +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case4_rc.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case4_rc.result new file mode 100644 index 00000000000..1a35d276192 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case4_rc.result @@ -0,0 +1,23 @@ + +----------------------------------------------------------------------- +- Locking issues case 4: +- Phantom rows +- using READ COMMITTED transaction isolation level +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); +Inserting 200,000 rows +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT * FROM t0 WHERE value > 0 FOR UPDATE; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +INSERT INTO t0 VALUES(200001,1), (-1,1); +connection con1; +id value +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case4_rr.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case4_rr.result new file mode 100644 index 00000000000..7ecb1ac5f7a --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case4_rr.result @@ -0,0 +1,23 @@ + +----------------------------------------------------------------------- +- Locking issues case 4: +- Phantom rows +- using REPEATABLE READ transaction isolation level +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); +Inserting 200,000 rows +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT * FROM t0 WHERE value > 0 FOR UPDATE; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +INSERT INTO t0 VALUES(200001,1), (-1,1); +connection con1; +id value +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case5_rc.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case5_rc.result new file mode 100644 index 00000000000..4d707e83eec --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case5_rc.result @@ -0,0 +1,29 @@ + +----------------------------------------------------------------------- +- Locking issues case 5: +- Deleting primary key +- using READ COMMITTED transaction isolation level +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); +Inserting 200,000 rows +UPDATE t0 SET value=100 WHERE id=190000; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +SELECT * FROM t0 WHERE value > 0 FOR UPDATE; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +DELETE FROM t0 WHERE id=190000; +COMMIT; +connection con1; +id value +ERROR: 0 +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case5_rr.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case5_rr.result new file mode 100644 index 00000000000..0ebfe8e6079 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case5_rr.result @@ -0,0 +1,28 @@ + +----------------------------------------------------------------------- +- Locking issues case 5: +- Deleting primary key +- using REPEATABLE READ transaction isolation level +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); +Inserting 200,000 rows +UPDATE t0 SET value=100 WHERE id=190000; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +SELECT * FROM t0 WHERE value > 0 FOR UPDATE; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +DELETE FROM t0 WHERE id=190000; +COMMIT; +connection con1; +ERROR: 1213 +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case6_rc.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case6_rc.result new file mode 100644 index 00000000000..f16ffbeaa63 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case6_rc.result @@ -0,0 +1,29 @@ + +----------------------------------------------------------------------- +- Locking issues case 6: +- Changing primary key +- using READ COMMITTED transaction isolation level +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); +Inserting 200,000 rows +UPDATE t0 SET value=100 WHERE id=190000; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +SELECT * FROM t0 WHERE value > 0 FOR UPDATE; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +UPDATE t0 SET id=200001 WHERE id=190000; +COMMIT; +connection con1; +id value +ERROR: 0 +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case6_rr.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case6_rr.result new file mode 100644 index 00000000000..c2323937d15 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case6_rr.result @@ -0,0 +1,28 @@ + +----------------------------------------------------------------------- +- Locking issues case 6: +- Changing primary key +- using REPEATABLE READ transaction isolation level +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t0; +CREATE TABLE t0(id INT AUTO_INCREMENT PRIMARY KEY, value INT); +Inserting 200,000 rows +UPDATE t0 SET value=100 WHERE id=190000; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +SELECT * FROM t0 WHERE value > 0 FOR UPDATE; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +UPDATE t0 SET id=200001 WHERE id=190000; +COMMIT; +connection con1; +ERROR: 1213 +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rc.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rc.result new file mode 100644 index 00000000000..f30dbab045d --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rc.result @@ -0,0 +1,41 @@ + +----------------------------------------------------------------------- +- Locking issues case 7: +- Rows that are scanned as part of a query but not in the table being +- updated should not be locked unless rocksdb_lock_scanned_rows is on +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t1, t2; +SELECT @@global.rocksdb_lock_scanned_rows; +@@global.rocksdb_lock_scanned_rows +0 +CREATE TABLE t1(id INT PRIMARY KEY, value INT); +CREATE TABLE t2(id INT PRIMARY KEY, value INT); +INSERT INTO t1 VALUES (1,1), (2,2), (3,3); +INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +lock_scanned_rows is 0 +connection con1; +UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3; +connection con2; +UPDATE t2 SET value=value+100; +SELECT * FROM t2; +id value +1 101 +2 102 +3 103 +4 104 +5 105 +connection con1; +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t1; +DROP TABLE t2; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rc_lsr.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rc_lsr.result new file mode 100644 index 00000000000..d43e3efbfe0 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rc_lsr.result @@ -0,0 +1,45 @@ + +----------------------------------------------------------------------- +- Locking issues case 7: +- Rows that are scanned as part of a query but not in the table being +- updated should not be locked unless rocksdb_lock_scanned_rows is on +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t1, t2; +SELECT @@global.rocksdb_lock_scanned_rows; +@@global.rocksdb_lock_scanned_rows +0 +SET GLOBAL rocksdb_lock_scanned_rows=ON; +CREATE TABLE t1(id INT PRIMARY KEY, value INT); +CREATE TABLE t2(id INT PRIMARY KEY, value INT); +INSERT INTO t1 VALUES (1,1), (2,2), (3,3); +INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +lock_scanned_rows is 1 +connection con1; +UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3; +connection con2; +UPDATE t2 SET value=value+100 WHERE id=3; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +UPDATE t2 SET value=value+100 WHERE id IN (1,2,4,5); +SELECT * FROM t2; +id value +1 101 +2 102 +3 3 +4 104 +5 105 +connection con1; +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t1; +DROP TABLE t2; +SET GLOBAL rocksdb_lock_scanned_rows=0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rr.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rr.result new file mode 100644 index 00000000000..dbcb0a03aef --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rr.result @@ -0,0 +1,41 @@ + +----------------------------------------------------------------------- +- Locking issues case 7: +- Rows that are scanned as part of a query but not in the table being +- updated should not be locked unless rocksdb_lock_scanned_rows is on +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t1, t2; +SELECT @@global.rocksdb_lock_scanned_rows; +@@global.rocksdb_lock_scanned_rows +0 +CREATE TABLE t1(id INT PRIMARY KEY, value INT); +CREATE TABLE t2(id INT PRIMARY KEY, value INT); +INSERT INTO t1 VALUES (1,1), (2,2), (3,3); +INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +lock_scanned_rows is 0 +connection con1; +UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3; +connection con2; +UPDATE t2 SET value=value+100; +SELECT * FROM t2; +id value +1 101 +2 102 +3 103 +4 104 +5 105 +connection con1; +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t1; +DROP TABLE t2; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rr_lsr.result b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rr_lsr.result new file mode 100644 index 00000000000..d9f7e333d3c --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/locking_issues_case7_rr_lsr.result @@ -0,0 +1,45 @@ + +----------------------------------------------------------------------- +- Locking issues case 7: +- Rows that are scanned as part of a query but not in the table being +- updated should not be locked unless rocksdb_lock_scanned_rows is on +----------------------------------------------------------------------- +DROP TABLE IF EXISTS t1, t2; +SELECT @@global.rocksdb_lock_scanned_rows; +@@global.rocksdb_lock_scanned_rows +0 +SET GLOBAL rocksdb_lock_scanned_rows=ON; +CREATE TABLE t1(id INT PRIMARY KEY, value INT); +CREATE TABLE t2(id INT PRIMARY KEY, value INT); +INSERT INTO t1 VALUES (1,1), (2,2), (3,3); +INSERT INTO t2 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +connection con2; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +BEGIN; +lock_scanned_rows is 1 +connection con1; +UPDATE t1 JOIN t2 ON t1.id = t2.id SET t1.value=t1.value+100 WHERE t2.id=3; +connection con2; +UPDATE t2 SET value=value+100 WHERE id=3; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +UPDATE t2 SET value=value+100 WHERE id IN (1,2,4,5); +SELECT * FROM t2; +id value +1 101 +2 102 +3 3 +4 104 +5 105 +connection con1; +COMMIT; +connection default; +disconnect con1; +disconnect con2; +DROP TABLE t1; +DROP TABLE t2; +SET GLOBAL rocksdb_lock_scanned_rows=0; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result index 6ab7ab003fd..6d6cb1db54e 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result @@ -2,14 +2,18 @@ # MDEV-14843: Assertion `s_tx_list.size() == 0' failed in myrocks::Rdb_transaction::term_mutex # INSTALL SONAME 'ha_rocksdb'; +connect con1,localhost,root,,test; CREATE TABLE t1 (i INT) ENGINE=RocksDB; insert into t1 values (1); -connect con1,localhost,root,,; -connection con1; -insert into test.t1 values (1); -connection default; DROP TABLE t1; +connection default; UNINSTALL SONAME 'ha_rocksdb'; +Warnings: +Warning 1620 Plugin is busy and will be uninstalled on shutdown +SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ROCKSDB'; +ENGINE SUPPORT +ROCKSDB NO +disconnect con1; # # MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash # diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues.test index 18a796573d1..41e2f69578a 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues.test @@ -1,67 +1,3 @@ --source include/have_rocksdb.inc -let $isolation_level = REPEATABLE READ; ---source include/locking_issues_case1_1.inc - -let $isolation_level = READ COMMITTED; ---source include/locking_issues_case1_1.inc - -let $isolation_level = REPEATABLE READ; ---source include/locking_issues_case1_2.inc - -let $isolation_level = READ COMMITTED; ---source include/locking_issues_case1_2.inc - -let $lock_scanned_rows=0; -let $isolation_level = REPEATABLE READ; ---source include/locking_issues_case2.inc - -let $isolation_level = READ COMMITTED; ---source include/locking_issues_case2.inc - -# Rerun the case2 tests with rocksdb_lock_scanned_rows on -let $lock_scanned_rows=1; -let $isolation_level = REPEATABLE READ; ---source include/locking_issues_case2.inc - -let $isolation_level = READ COMMITTED; ---source include/locking_issues_case2.inc - -let $isolation_level = REPEATABLE READ; ---source include/locking_issues_case3.inc - -let $isolation_level = READ COMMITTED; ---source include/locking_issues_case3.inc - -let $isolation_level = REPEATABLE READ; ---source include/locking_issues_case4.inc - -let $isolation_level = READ COMMITTED; ---source include/locking_issues_case4.inc - -let $isolation_level = REPEATABLE READ; ---source include/locking_issues_case5.inc - -let $isolation_level = READ COMMITTED; ---source include/locking_issues_case5.inc - -let $isolation_level = REPEATABLE READ; ---source include/locking_issues_case6.inc - -let $isolation_level = READ COMMITTED; ---source include/locking_issues_case6.inc - -let $lock_scanned_rows=0; -let $isolation_level = REPEATABLE READ; ---source include/locking_issues_case7.inc - -let $isolation_level = READ COMMITTED; ---source include/locking_issues_case7.inc - -# Rerun the case7 tests with rocksdb_lock_scanned_rows on -let $lock_scanned_rows=1; -let $isolation_level = REPEATABLE READ; ---source include/locking_issues_case7.inc - -let $isolation_level = READ COMMITTED; ---source include/locking_issues_case7.inc +--echo tests moved to rocksdb.locking_issues_case* diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_1_rc.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_1_rc.test new file mode 100644 index 00000000000..3fd183bf4dd --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_1_rc.test @@ -0,0 +1,4 @@ +--source include/have_rocksdb.inc + +let $isolation_level = READ COMMITTED; +--source include/locking_issues_case1_1.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_1_rr.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_1_rr.test new file mode 100644 index 00000000000..cd4a0bd3c9d --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_1_rr.test @@ -0,0 +1,4 @@ +--source include/have_rocksdb.inc + +let $isolation_level = REPEATABLE READ; +--source include/locking_issues_case1_1.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_2_rc.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_2_rc.test new file mode 100644 index 00000000000..3fe052a4099 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_2_rc.test @@ -0,0 +1,4 @@ +--source include/have_rocksdb.inc + +let $isolation_level = READ COMMITTED; +--source include/locking_issues_case1_2.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_2_rr.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_2_rr.test new file mode 100644 index 00000000000..02263273ba5 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case1_2_rr.test @@ -0,0 +1,4 @@ +--source include/have_rocksdb.inc + +let $isolation_level = REPEATABLE READ; +--source include/locking_issues_case1_2.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rc.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rc.test new file mode 100644 index 00000000000..d780b5247bc --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rc.test @@ -0,0 +1,5 @@ +--source include/have_rocksdb.inc + +let $lock_scanned_rows=0; +let $isolation_level = READ COMMITTED; +--source include/locking_issues_case2.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rc_lsr.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rc_lsr.test new file mode 100644 index 00000000000..bd46f93a76c --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rc_lsr.test @@ -0,0 +1,5 @@ +--source include/have_rocksdb.inc + +let $lock_scanned_rows=1; +let $isolation_level = READ COMMITTED; +--source include/locking_issues_case2.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rr.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rr.test new file mode 100644 index 00000000000..b820fddb979 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rr.test @@ -0,0 +1,5 @@ +--source include/have_rocksdb.inc + +let $lock_scanned_rows=0; +let $isolation_level = REPEATABLE READ; +--source include/locking_issues_case2.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rr_lsr.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rr_lsr.test new file mode 100644 index 00000000000..33d3b752098 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case2_rr_lsr.test @@ -0,0 +1,5 @@ +--source include/have_rocksdb.inc + +let $lock_scanned_rows=1; +let $isolation_level = REPEATABLE READ; +--source include/locking_issues_case2.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case3_rc.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case3_rc.test new file mode 100644 index 00000000000..7dc7f8784ea --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case3_rc.test @@ -0,0 +1,4 @@ +--source include/have_rocksdb.inc + +let $isolation_level = READ COMMITTED; +--source include/locking_issues_case3.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case3_rr.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case3_rr.test new file mode 100644 index 00000000000..7c81daccebc --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case3_rr.test @@ -0,0 +1,4 @@ +--source include/have_rocksdb.inc + +let $isolation_level = REPEATABLE READ; +--source include/locking_issues_case3.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case4_rc.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case4_rc.test new file mode 100644 index 00000000000..edc1111b0a5 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case4_rc.test @@ -0,0 +1,4 @@ +--source include/have_rocksdb.inc + +let $isolation_level = READ COMMITTED; +--source include/locking_issues_case4.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case4_rr.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case4_rr.test new file mode 100644 index 00000000000..8c26c2d1e19 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case4_rr.test @@ -0,0 +1,4 @@ +--source include/have_rocksdb.inc + +let $isolation_level = REPEATABLE READ; +--source include/locking_issues_case4.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case5_rc.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case5_rc.test new file mode 100644 index 00000000000..10bedcf2cca --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case5_rc.test @@ -0,0 +1,4 @@ +--source include/have_rocksdb.inc + +let $isolation_level = READ COMMITTED; +--source include/locking_issues_case5.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case5_rr.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case5_rr.test new file mode 100644 index 00000000000..6de3847cb66 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case5_rr.test @@ -0,0 +1,4 @@ +--source include/have_rocksdb.inc + +let $isolation_level = REPEATABLE READ; +--source include/locking_issues_case5.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case6_rc.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case6_rc.test new file mode 100644 index 00000000000..9409bde0c58 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case6_rc.test @@ -0,0 +1,4 @@ +--source include/have_rocksdb.inc + +let $isolation_level = READ COMMITTED; +--source include/locking_issues_case6.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case6_rr.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case6_rr.test new file mode 100644 index 00000000000..0c7a8a116c3 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case6_rr.test @@ -0,0 +1,4 @@ +--source include/have_rocksdb.inc + +let $isolation_level = REPEATABLE READ; +--source include/locking_issues_case6.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rc.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rc.test new file mode 100644 index 00000000000..f8e874a135c --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rc.test @@ -0,0 +1,5 @@ +--source include/have_rocksdb.inc + +let $lock_scanned_rows=0; +let $isolation_level = READ COMMITTED; +--source include/locking_issues_case7.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rc_lsr.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rc_lsr.test new file mode 100644 index 00000000000..0f97ca2f00f --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rc_lsr.test @@ -0,0 +1,5 @@ +--source include/have_rocksdb.inc + +let $lock_scanned_rows=1; +let $isolation_level = READ COMMITTED; +--source include/locking_issues_case7.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rr.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rr.test new file mode 100644 index 00000000000..c8cec956893 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rr.test @@ -0,0 +1,5 @@ +--source include/have_rocksdb.inc + +let $lock_scanned_rows=0; +let $isolation_level = REPEATABLE READ; +--source include/locking_issues_case7.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rr_lsr.test b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rr_lsr.test new file mode 100644 index 00000000000..875e81a1e05 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/locking_issues_case7_rr_lsr.test @@ -0,0 +1,5 @@ +--source include/have_rocksdb.inc + +let $lock_scanned_rows=1; +let $isolation_level = REPEATABLE READ; +--source include/locking_issues_case7.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test index 1a3d505f81a..0cf56c0cbd5 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test @@ -1,5 +1,6 @@ --source include/have_log_bin.inc --source include/have_binlog_format_row.inc +--source include/not_windows.inc --echo # --echo # MDEV-14843: Assertion `s_tx_list.size() == 0' failed in myrocks::Rdb_transaction::term_mutex @@ -14,18 +15,21 @@ INSTALL SONAME 'ha_rocksdb'; --enable_warnings +connect (con1,localhost,root,,test); CREATE TABLE t1 (i INT) ENGINE=RocksDB; insert into t1 values (1); - -connect (con1,localhost,root,,); -connection con1; -insert into test.t1 values (1); +DROP TABLE t1; connection default; - # Cleanup -DROP TABLE t1; UNINSTALL SONAME 'ha_rocksdb'; +SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ROCKSDB'; +disconnect con1; +# Unfortunately this is the only more or less reliable way to wait until +# connection done ha_close_connections(). It doesn't work on Windows due +# to different thread handling. +let $wait_condition= SELECT VARIABLE_VALUE=1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Threads_cached'; +--source include/wait_condition.inc --echo # --echo # MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash diff --git a/storage/rocksdb/rdb_utils.h b/storage/rocksdb/rdb_utils.h index cdc7651e3c4..44d90d78437 100644 --- a/storage/rocksdb/rdb_utils.h +++ b/storage/rocksdb/rdb_utils.h @@ -52,8 +52,8 @@ namespace myrocks { Since we cannot or don't want to change the API in any way, we can use this mechanism to define readability tokens that look like C++ namespaces, but are not enforced in any way by the compiler, since the pre-compiler strips them - out. However, on the calling side, code looks like my_core::thd_ha_data() - rather than plain a thd_ha_data() call. This technique adds an immediate + out. However, on the calling side, code looks like my_core::thd_get_ha_data() + rather than plain a thd_get_ha_data() call. This technique adds an immediate visible cue on what type of API we are calling into. */ |