1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-31 22:22:30 +03:00
Files
mariadb/mysql-test/include
Sergey Glukhov 31a38c0fc5 Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB
Subselect executes twice, at JOIN::optimize stage
and at JOIN::execute stage. At optimize stage
Innodb prebuilt struct which is used for the
retrieval of column values is initialized in.
ha_innobase::index_read(), prebuilt->sql_stat_start is true.
After QUICK_ROR_INTERSECT_SELECT finished his job it
restores read_set/write_set bitmaps with initial values
and deactivates one of the handlers used by
QUICK_ROR_INTERSECT_SELECT in JOIN::cleanup
(it's the case when we reuse original handler as one of
 handlers required by QUICK_ROR_INTERSECT_SELECT object).
On second subselect execution inactive handler is activated
in  QUICK_RANGE_SELECT::reset, file->ha_index_init().
In ha_index_init Innodb prebuilt struct is reinitialized
with inappropriate read_set/write_set bitmaps. Further
reinitialization in ha_innobase::index_read() does not
happen as prebuilt->sql_stat_start is false.
It leads to partial retrieval of required field values
and we get a mix of field values from different records
in the record buffer.
The fix is to reset
read_set/write_set bitmaps as these values
are required for proper intialization of
internal InnoDB struct which is used for
the retrieval of column values
(see build_template(), ha_innodb.cc)


mysql-test/include/index_merge_ror_cpk.inc:
  test case
mysql-test/r/index_merge_innodb.result:
  test case
mysql-test/r/index_merge_myisam.result:
  test case
sql/opt_range.cc:
  if ROR merge scan is used we need to reset
  read_set/write_set bitmaps as these values
  are required for proper intialization of
  internal InnoDB struct which is used for
  the retrieval of column values
  (see build_template(), ha_innodb.cc)
2010-09-16 16:13:53 +04:00
..
2003-08-28 06:08:17 +03:00
2008-11-24 16:56:48 -05:00
2008-03-17 14:26:00 +03:00
2005-07-06 17:16:22 +05:00
2007-12-12 18:19:24 +01:00
2010-07-04 16:17:53 +08:00
2007-06-28 21:34:54 +04:00
2007-06-28 21:34:54 +04:00
2007-06-28 21:34:54 +04:00
2008-08-04 07:04:47 +02:00
2006-01-12 19:51:02 +01:00
2007-06-28 21:34:54 +04:00
2009-06-15 17:36:51 +03:00
2009-12-10 11:44:19 +08:00
2008-12-02 11:05:56 +01:00
2008-05-08 20:13:39 +02:00
2007-12-12 18:19:24 +01:00
2007-02-19 15:31:55 +03:00
2009-03-15 18:39:48 -04:00
2007-09-05 18:02:46 +02:00
2007-12-12 18:19:24 +01:00
2007-12-12 18:19:24 +01:00
2007-04-10 18:01:29 +03:00
2006-01-12 19:51:02 +01:00
2004-12-13 21:00:43 +01:00
2008-09-20 17:00:05 +03:00
2006-08-16 19:29:49 +02:00
2009-08-12 13:31:56 +08:00
2007-06-21 21:58:59 +02:00
2008-01-14 15:38:02 +08:00
2008-01-14 15:38:02 +08:00
2006-11-20 22:42:06 +02:00
2006-12-11 11:44:03 -05:00
2007-12-12 18:19:24 +01:00
2007-06-21 21:58:59 +02:00
2007-06-21 21:58:59 +02:00
2008-06-25 16:59:38 +02:00
2008-12-02 11:05:56 +01:00