[Commits] Rev 4348: MDEV-7068: MRR accessing uninitialised bytes, test case failure main.innodb_mrr in file:///home/psergey/dev2/5.5/

Sergey Petrunya psergey at askmonty.org
Thu Nov 13 12:58:24 EET 2014


At file:///home/psergey/dev2/5.5/

------------------------------------------------------------
revno: 4348
revision-id: psergey at askmonty.org-20141113105635-zjtfstqsdd04yi2l
parent: jplindst at mariadb.org-20141113092419-p6t1e7sf15nuo3xl
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: 5.5
timestamp: Thu 2014-11-13 13:56:35 +0300
message:
  MDEV-7068: MRR accessing uninitialised bytes, test case failure main.innodb_mrr
  - Don't call index_reader->interrupt_read() if the
    index reader has returned all rows that matched its keys.
=== modified file 'sql/multi_range_read.cc'
--- a/sql/multi_range_read.cc	2014-10-29 10:22:48 +0000
+++ b/sql/multi_range_read.cc	2014-11-13 10:56:35 +0000
@@ -684,8 +684,19 @@ int Mrr_ordered_rndpos_reader::refill_fr
     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);
 



More information about the commits mailing list