revision-id: aaa8e2bf45cdebcbbb10fb33e87503a2f4064c33 parent(s): da9a1d55dc38e76ec6d87ab5248349db0038d559 committer: Sergei Petrunia branch nick: mysql-5.6-rocksdb-rangelocking2 timestamp: 2018-09-24 17:48:33 +0300 message: Getting tests to pass with range locking - Set lock wait timeout correctly - Make waits KILL-able with KILL command --- rocksdb | 2 +- storage/rocksdb/ha_rocksdb.cc | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/rocksdb b/rocksdb index 2fa28d5..d629f93 160000 --- a/rocksdb +++ b/rocksdb @@ -1 +1 @@ -Subproject commit 2fa28d505b745ffbac9235e4b8f235202bc75b69 +Subproject commit d629f934d907f506bd114d9d48852e6570d333da diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index ed9a57b..94baf27 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -4199,6 +4199,28 @@ static int rocksdb_start_tx_and_assign_read_view( return HA_EXIT_SUCCESS; } + +static void +rocksdb_kill_connection(handlerton* hton, + THD* thd) +{ + //TODO: db_env->kill_waiter(db_env, thd); + // locktree_manager::kill_waiter(void *extra) + Rdb_transaction *const tx = get_tx_from_thd(thd); + + // tx can be zero if that thread doesn't have a RocksDB transaction + // TODO: how do we know if things that are done in this function are + // thread-safe? e.g. the transaction doesn't disappear while execution + // is right on this line? + if (tx && !tx->is_writebatch_trx()) + { + Rdb_transaction_impl *tx_impl= (Rdb_transaction_impl*) tx; + const rocksdb::Transaction *rdb_trx = tx_impl->get_rdb_trx(); + rdb->KillLockWait((void*)rdb_trx->GetID()); + } +} + + static int rocksdb_start_tx_with_shared_read_view( handlerton *const hton, /*!< in: RocksDB handlerton */ THD *const thd, /*!< in: MySQL thread handle of the @@ -4538,6 +4560,8 @@ static int rocksdb_init_func(void *const p) { rocksdb_hton->update_table_stats = rocksdb_update_table_stats; rocksdb_hton->flush_logs = rocksdb_flush_wal; + rocksdb_hton->kill_connection= rocksdb_kill_connection; + rocksdb_hton->flags = HTON_TEMPORARY_NOT_SUPPORTED | HTON_SUPPORTS_EXTENDED_KEYS | HTON_CAN_RECREATE;