Skip to content
  • Mattias Jonsson's avatar
    a2bb8464
    Bug#18167648: WRONG RESULTS WITH PARTITIONING, · a2bb8464
    Mattias Jonsson authored
    INDEX_MERGE AND NO PK
    
    Index merge intersect/union expects rowid-ordered-retrieval, sorted like
    handler::cmp_ref compares records.
    I.e. after sorting by KEY it should also be sorted by handler::ref (rowid).
    
    The partitioning engine only sorts by KEY, unless clustered primary key
    exists, when it also sorts by PK in case the KEY values are compares as
    equal.
    
    This means that for InnoDB tables without primary key or any other engine,
    which not clusters by primary key, index merge intersect/union can return
    wrong results.
    
    The fix is to also sort by handler::ref if KEY values compares as equal.
    
    To avoid extra sorting when not needed (where rowid-ordered-retrieval is not
    needed, like ordinary secondary key scanning)
    ha_extra(HA_EXTRA_SECONDARY_SORT_ROWID) is added for index merge
    intersect/union.
    a2bb8464
    Bug#18167648: WRONG RESULTS WITH PARTITIONING,
    Mattias Jonsson authored
    INDEX_MERGE AND NO PK
    
    Index merge intersect/union expects rowid-ordered-retrieval, sorted like
    handler::cmp_ref compares records.
    I.e. after sorting by KEY it should also be sorted by handler::ref (rowid).
    
    The partitioning engine only sorts by KEY, unless clustered primary key
    exists, when it also sorts by PK in case the KEY values are compares as
    equal.
    
    This means that for InnoDB tables without primary key or any other engine,
    which not clusters by primary key, index merge intersect/union can return
    wrong results.
    
    The fix is to also sort by handler::ref if KEY values compares as equal.
    
    To avoid extra sorting when not needed (where rowid-ordered-retrieval is not
    needed, like ordinary secondary key scanning)
    ha_extra(HA_EXTRA_SECONDARY_SORT_ROWID) is added for index merge
    intersect/union.
Loading