diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2014-11-13 14:12:41 +0300 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2014-11-13 14:12:41 +0300 |
commit | 50c5339272403dfac435c7df632274ad8b18aaf8 (patch) | |
tree | bed49b005a87f972998b4f121f6668ee0d239aca /sql | |
parent | 58b4f52ae2d221f6841c2eaeea6203097084608b (diff) | |
download | mariadb-git-50c5339272403dfac435c7df632274ad8b18aaf8.tar.gz |
MDEV-7068: MRR accessing uninitialised bytes, test case failure main.innodb_mrr
Backport to 5.3:
- Don't call index_reader->interrupt_read() if the
index reader has returned all rows that matched its keys.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/multi_range_read.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index 6dfd8bec980..eb1de09e056 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -668,8 +668,19 @@ int Mrr_ordered_rndpos_reader::refill_from_index_reader() rowid_buffer->write_ptr2= (uchar*)&range_info; rowid_buffer->write(); } - - index_reader->interrupt_read(); + + /* + When index_reader_needs_refill=TRUE, this means we've got all of index + tuples for lookups keys that index_reader had. We are not in the middle + of an index read, so there is no need to call interrupt_read. + + Actually, we must not call interrupt_read(), because it could be that we + haven't read a single row (because all index lookups returned + HA_ERR_KEY_NOT_FOUND). In this case, interrupt_read() will cause [harmless] + valgrind warnings when trying to save garbage from table->record[0]. + */ + if (!index_reader_needs_refill) + index_reader->interrupt_read(); /* Sort the buffer contents by rowid */ rowid_buffer->sort((qsort2_cmp)rowid_cmp_reverse, (void*)file); |