• V Narayanan's avatar
    Bug#40675 MySQL 5.1 crash with index merge algorithm and Merge tables · d325957f
    V Narayanan authored
                
    A Query in the MyISAM merge table was crashing 
    if the index merge algorithm was being used
    
    Index Merge optimization requires the reading of 
    multiple indexes at the same time. Reading multiple 
    indexes at once with current SE API means that we 
    need to have handler instance for each to-be-read 
    index. This is done by creating clones of the handlers 
    instances. The clone internally does a open of the handler.
    
    The open for a MERGE engine is handled in the following 
    phases
    
    1) open parent table
    2) generate list of underlying
       table
    3) attach underlying tables
    
    But the current implementation does only the first 
    phase (i.e.) open parent table.
    
    The current patch fixes this at the MERGE engine level, 
    by handling the clone operation within the MERGE engine 
    rather than in the storage engine API. It opens and 
    attaches the MyISAM tables on the MyISAM storage engine 
    interface directly within the MERGE engine. The new MyISAM 
    table instances, as well as the MERGE clone itself, are not 
    visible in the table cache. This is not a problem because
    all locking is handled by the original MERGE table from which
    this is cloned of.
    d325957f
myrg_open.c 16.5 KB