Skip to content

Commit

Permalink
Fixing index_merge query returning wrong results (#624)
Browse files Browse the repository at this point in the history
Summary:
This diff fixed MyRocks returning missing rows if index
merge query plan was used. When index merge is selected,
table->read_map is cleared at
QUICK_RANGE_SELECT::init_ror_merged_scan(). Then
ha_rocksdb::setup_read_decoders() wrongly decided not to decode
all fields, which made MySQL layer decide that keys did not match.
This diff changes ha_rocksdb::setup_read_decoders() to
always decode if read_map is cleared. A side effect is decoding
all fetched fields on index merge. There is a slight performance
penalty but much better than returning wrong results.

This diff reuses index_merge_ror.inc and index_merge_2sweeps.inc
test cases for MyRocks. Since MyRocks query plan is less stable than
InnoDB, it skips using explain and just verifies data correctness.
Closes facebook/mysql-5.6#626

Reviewed By: hermanlee

Differential Revision: D5088547

Pulled By: yoshinorim

fbshipit-source-id: f025617
  • Loading branch information
yoshinorim authored and Gunnar Kudrjavets committed Jul 21, 2017
1 parent 9bcd4aa commit fc14359
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions storage/rocksdb/ha_rocksdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4433,7 +4433,9 @@ void ha_rocksdb::setup_read_decoders() {
continue;
}

// bitmap is cleared on index merge, but it still needs to decode columns
if (m_lock_rows == RDB_LOCK_WRITE || m_verify_row_debug_checksums ||
bitmap_is_clear_all(table->read_set) ||
bitmap_is_set(table->read_set, table->field[i]->field_index)) {
// We will need to decode this field
m_decoders_vect.push_back({&m_encoder_arr[i], true, skip_size});
Expand Down

0 comments on commit fc14359

Please sign in to comment.