revision-id: a1c29cecdb17578ef6364ec9021fd9222097923c (fb-prod201903-171-ga1c29cecdb1) parent(s): 71f5fa77faeae64d653012db88f0a9e224227d5f author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2019-10-15 20:48:46 +0300 message: Issue #790, MyRocks/MRR: address review input part 3 - in ha_rocksdb::index_end(), call mrr_free() only if we are in an MRR scan. - added a comment. --- storage/rocksdb/ha_rocksdb.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 2735d9d6adb..1ae5c1d6989 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -8013,6 +8013,9 @@ int ha_rocksdb::read_row_from_secondary_key(uchar *const buf, #ifndef DBUG_OFF m_keyread_only = save_keyread_only; #endif + // Due to MRR, now an index-only scan have pushed index condition. + // (If it does, we follow non-index only code path here, except that + // we don't fetch the row). bool have_icp = (pushed_idx_cond && pushed_idx_cond_keyno == active_index); if (covered_lookup && m_lock_rows == RDB_LOCK_NONE && !have_icp) { @@ -10569,7 +10572,8 @@ int ha_rocksdb::index_end() { active_index = MAX_KEY; in_range_check_pushed_down = FALSE; - mrr_free(); + if (mrr_rowid_reader) + mrr_free(); DBUG_RETURN(HA_EXIT_SUCCESS); } @@ -15520,6 +15524,8 @@ int ha_rocksdb::multi_range_read_next(char **range_info) { while (1) { while (1) { + if (table->in_use->killed) return HA_ERR_QUERY_INTERRUPTED; + if (mrr_read_index >= mrr_n_elements) { if (mrr_rowid_reader->eof() || !mrr_n_elements) { table->status = STATUS_NOT_FOUND; // not sure if this is necessary? @@ -15527,8 +15533,6 @@ int ha_rocksdb::multi_range_read_next(char **range_info) { return HA_ERR_END_OF_FILE; } - if (table->in_use->killed) return HA_ERR_QUERY_INTERRUPTED; - if ((rc = mrr_fill_buffer())) { if (rc == HA_ERR_END_OF_FILE) table->status = STATUS_NOT_FOUND; return rc;