[Commits] c523d5bd0e7: Range Locking: let RocksDB use user-provided comparator
revision-id: c523d5bd0e776a88495405dc9ba305da9fe17600 (fb-prod201801-227-gc523d5bd0e7) parent(s): 70e12615732d658939972b24da162de8d57086f0 author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2019-04-29 16:54:38 +0300 message: Range Locking: let RocksDB use user-provided comparator The order of endpoints in GetRangeLock() call must match the used ordering --- mysql-test/suite/rocksdb/r/range_locking_rev_cf.result | 4 ++-- rocksdb | 2 +- storage/rocksdb/ha_rocksdb.cc | 15 ++++++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/rocksdb/r/range_locking_rev_cf.result b/mysql-test/suite/rocksdb/r/range_locking_rev_cf.result index 444c51162cd..c2f8064c6b7 100644 --- a/mysql-test/suite/rocksdb/r/range_locking_rev_cf.result +++ b/mysql-test/suite/rocksdb/r/range_locking_rev_cf.result @@ -97,8 +97,8 @@ COLUMN_FAMILY_ID TRANSACTION_ID KEY MODE delete from t1 where pk between 25 and 40; select * from information_schema.rocksdb_locks; COLUMN_FAMILY_ID TRANSACTION_ID KEY MODE -0 15 000000010780000019 - 010000010780000028 X 0 15 00000001078000000a X +0 15 000000010780000028 - 010000010780000019 X rollback; begin; # The following will show a range lock on 2-9 and also a point lock on 10. @@ -107,8 +107,8 @@ select * from t1 where pk between 2 and 9 for update; pk a select * from information_schema.rocksdb_locks; COLUMN_FAMILY_ID TRANSACTION_ID KEY MODE +0 16 000000010780000009 - 010000010780000002 X 0 16 00000001078000000a X -0 16 000000010780000002 - 010000010780000009 X rollback; drop table t1; # diff --git a/rocksdb b/rocksdb index 9af13f0e966..d334cf12818 160000 --- a/rocksdb +++ b/rocksdb @@ -1 +1 @@ -Subproject commit 9af13f0e966171ef8688484b2da7fa576a1b4574 +Subproject commit d334cf12818bfd2d44dc06c7bbe78c3a18bca543 diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index dea7fb9e53f..0c4dea535ca 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -8245,9 +8245,18 @@ int ha_rocksdb::set_range_lock(Rdb_transaction *tx, end_has_inf_suffix= true; } - auto s= tx->lock_range(kd.get_cf(), - rocksdb::Endpoint(slice, start_has_inf_suffix), - rocksdb::Endpoint(end_slice, end_has_inf_suffix)); + rocksdb::Endpoint start_endp; + rocksdb::Endpoint end_endp; + if (kd.m_is_reverse_cf) { + // Flip the endpoints + start_endp =rocksdb::Endpoint(end_slice, !end_has_inf_suffix); + end_endp = rocksdb::Endpoint(slice, !start_has_inf_suffix); + } else { + start_endp= rocksdb::Endpoint(slice, start_has_inf_suffix); + end_endp= rocksdb::Endpoint(end_slice, end_has_inf_suffix); + } + + auto s= tx->lock_range(kd.get_cf(), start_endp, end_endp); if (!s.ok()) { return (tx->set_status_error(table->in_use, s, kd, m_tbl_def, m_table_handler));
participants (1)
-
Sergei Petrunia