revision-id: 6f58201e1a4a18b20cd1d414b5ad3f057a622245 (fb-prod201903-167-g6f58201e1a4) parent(s): 262b3694edf641474fd64d6bc0b2ba9c6c7e1444 author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2019-09-20 20:45:06 +0300 message: Issue #790, MyRocks/MRR: fix issues found by RQG In ha_rocksdb::read_row_from_secondary_key(), get the key/value from the iterator AFTER find_icp_matching_index_rec() has navigated to the index tuple that matches the ICP. --- storage/rocksdb/ha_rocksdb.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 1ba47d0b81a..10db1e9398b 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -8022,8 +8022,6 @@ int ha_rocksdb::read_row_from_secondary_key(uchar *const buf, int rc = 0; uint pk_size; - /* Get the key columns and primary key value */ - const rocksdb::Slice &rkey = m_scan_it->key(); const rocksdb::Slice &value = m_scan_it->value(); #ifndef DBUG_OFF @@ -8041,12 +8039,14 @@ int ha_rocksdb::read_row_from_secondary_key(uchar *const buf, if (covered_lookup && m_lock_rows == RDB_LOCK_NONE) { // Due to MRR, we can have ICP enabled with covered_lookup == true if (!(rc = find_icp_matching_index_rec(move_forward, buf))) { + const rocksdb::Slice &rkey = m_scan_it->key(); + const rocksdb::Slice &rval = m_scan_it->value(); pk_size = kd.get_primary_key_tuple(table, *m_pk_descr, &rkey, m_pk_packed_tuple); if (pk_size == RDB_INVALID_KEY_LEN) { rc = HA_ERR_ROCKSDB_CORRUPT_DATA; } else { - rc = kd.unpack_record(table, buf, &rkey, &value, + rc = kd.unpack_record(table, buf, &rkey, &rval, m_converter->get_verify_row_debug_checksums()); global_stats.covered_secondary_key_lookups.inc(); }