[Commits] 3678471e225: Range Locking: don't call kd.successor on range bound.
revision-id: 3678471e22559f53dc0f238844fb50dbbb0b55cb (fb-prod201801-184-g3678471e225) parent(s): 2616e6de9adea8d80156484838106e6b9bb4201a author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2019-01-06 22:19:55 +0300 message: Range Locking: don't call kd.successor on range bound. This will cause incorrect range locking to be constructed. The change of this patch is: move the get_or_create_tx() call (which may create a transaction) and set_range_lock() call before the kd.successor() call. --- storage/rocksdb/ha_rocksdb.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 72dd31bbb85..9720fc0bd3b 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -8397,6 +8397,15 @@ int ha_rocksdb::index_read_map_impl(uchar *const buf, const uchar *const key, memcpy(m_sk_match_prefix, m_sk_packed_tuple, packed_size); } + + Rdb_transaction *const tx = get_or_create_tx(table->in_use); + const bool is_new_snapshot = !tx->has_snapshot(); + + set_range_lock(tx, kd, find_flag, + rocksdb::Slice(reinterpret_cast<const char *>(m_sk_packed_tuple), + packed_size), + end_key); + int bytes_changed_by_succ = 0; if (find_flag == HA_READ_PREFIX_LAST_OR_PREV || find_flag == HA_READ_PREFIX_LAST || find_flag == HA_READ_AFTER_KEY) { @@ -8416,12 +8425,6 @@ int ha_rocksdb::index_read_map_impl(uchar *const buf, const uchar *const key, if (find_flag == HA_READ_KEY_EXACT && my_count_bits(keypart_map) == kd.get_key_parts()) use_all_keys = true; - - Rdb_transaction *const tx = get_or_create_tx(table->in_use); - const bool is_new_snapshot = !tx->has_snapshot(); - - set_range_lock(tx, kd, find_flag, slice, end_key); - // Loop as long as we get a deadlock error AND we end up creating the // snapshot here (i.e. it did not exist prior to this) for (;;) {
participants (1)
-
Sergei Petrunia