• Sergey Petrunya's avatar
    BUG#707925: Wrong result with join_cache_level=6 optimizer_use_mrr = force (incremental, BKA join) · 8ef094fe
    Sergey Petrunya authored
    - The problem was that Mrr_ordered_index_reader's interrupt_read() and resume_read() would 
      save and restore 1) index tuple  2) the rowid (as bytes returned by handler->position()).  Clustered 
      primary key columns were not saved/restored. 
      They are not explicitly present in the index tuple (i.e. table->key_info[secondary_key].key_parts 
      doesn't list them), but they are actually there, in particular 
      table->field[clustered_primary_key_member].part_of_key(secondary_key) == 1. Index condition pushdown
      code [correctly] uses the latter as inidication that pushed index condition can refer to clustered PK
      members. 
    
      The fix was to make interrupt_read()/resume_read() to save/restore clustered primary key members as well,
      so that we get correct values for them when evaluating pushed index condition.
    [3rd attempt: remove the debugging aids, fix comments in testcase]
    8ef094fe
multi_range_read.h 21.1 KB