Bug #42048 Discrepancy between MyISAM and Maria's Index condition pushdown implementation
Submitted: 12 Jan 2009 12:45 Modified: 20 Nov 2010 0:07
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Maria storage engine Severity:S3 (Non-critical)
Version:6.0-bzr OS:Any
Assigned to: CPU Architecture:Any

[12 Jan 2009 12:45] Guilhem Bichot
Description:
When comparing MyISAM and Maria, in 6.0, a few differences were spotted which need investigation and fixing:
- HA_NEED_READ_RANGE_BUFFER and HA_MRR_CANT_SORT should be entirely removed (Sergey committed http://lists.mysql.com/commits/62859 to fix this)
- ha_myisam::read_range_first, ha_myisam::read_range_next are not used, should be removed (same commit as above)
- ha_maria::keys_with_parts is not used and it's not normal (no commit yet)
- ha_myisam::index_flags() tests keys_with_parts.is_set(inx) but ha_maria::index_flags() does not (no commit yet)

How to repeat:
code inspection
[12 Jan 2009 15:55] Sergey Petrunya
The first two were fixed by this changeset:

revno: 2804
committer: Sergey Petrunia <sergefp@mysql.com>
branch nick: mysql-6.0-fix-mrr
timestamp: Fri 2009-01-09 19:38:52 +0300
message:
  MRR interface cleanup: remove unused constants and dummy code.

This has already been pushed.
[12 Jan 2009 17:37] Sergey Petrunya
The difference in index_flags() is due to the following: 

MyISAM prevents IndexConditionPushdown from being used for indexes that cover certain columns only partially. This was needed in order to work with the first version of IndexConditionPushdown which would attempt to push conditions that refer to partially-covered columns.  

In subsequent versions, ICP code got smarter and now it does not attempt to do push down index conditions that refer to partially-covered columns (see sql_select.cc, make_cond_for_index() and  uses_index_fields_only())

Maria code [correctly] relies on the new behavior and doesn't have keys_with_parts or check in index_flags().

MyISAM should be updated to trust SQL layer part of ICP to do the right thing when the index has partially-covered columns.
[12 Jan 2009 17:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/63019

2806 Sergey Petrunia	2009-01-12
      BUG#42048 Discrepancy between MyISAM and Maria's ICP implementation
      - Remove unused ha_mysam::keys_with_parts, it is not needed anymore. Now SQL layer part of 
        ICP won't push index conditions that refer to partially-covered columns.
[24 Jan 2009 15:02] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/63984

2808 Sergey Petrunia	2009-01-24
      BUG#42048: Discrepancy between MyISAM and Maria's ICP implementation
      - Make m{i,aria}_rnext_same() account for the fact that m{i,a}_check_index_cond()
        may reset HA_STATE_RNEXT_SAME flag.
      - Update test results
      - Better comments
[25 Jan 2009 16:59] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/64000

2808 Sergey Petrunia	2009-01-25
      BUG#42048: Discrepancy between MyISAM and Maria's ICP implementation, 
      Fix pushbuild failure:
      - Add a parameter to _m{i,a}_put_key_in_record() which tells it not to
        unpack blobs because unpacking blobs from index condition check function
        modifies MyISAM/Maria's internal state in a way that's not expected by the
        rest of its code. 
      - More comments and extra safety.
[2 Feb 2009 16:07] Bugs System
Pushed into 6.0.10-alpha (revid:sergefp@mysql.com-20090202090240-dlkxhmc1asrar5rl) (version source revid:sergefp@mysql.com-20090125165907-e3veaevraj2i924g) (merge vers: 6.0.10-alpha) (pib:6)
[7 May 2009 8:01] MC Brown
Internal only. No changelog entry required.
[16 Jul 2010 11:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/113749

3215 Evgeny Potemkin	2010-07-16
      Fixed the test case for bug#42048 failing due to unstable
      InnoDB statistics.
[16 Aug 2010 6:35] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100816062819-bluwgdq8q4xysmlg) (version source revid:alik@sun.com-20100816062612-enatdwnv809iw3s9) (pib:20)
[13 Nov 2010 16:22] Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (merge vers: 5.6.99-m4) (pib:21)