• ingo@mysql.com's avatar
    Bug#14400 - Query joins wrong rows from table which is subject of "concurrent insert" · 99ad23ec
    ingo@mysql.com authored
    It was possible that fetching a record by an exact key value 
    (including the record pointer) could return a record with a 
    different key value. This happened only if a concurrent insert 
    added a record with the searched key value after the fetching 
    statement locked the table for read.
    
    The search succeded on the key value, but the record was
    rejected as it was past the file length that was remembered
    at start of the fetching statement. With other words it was 
    rejected as being a concurrently inserted record.
    
    The action to recover from this problem was to fetch the 
    record that is pointed at by the next key of the index. 
    This was repeated until a record below the file length was 
    found.
    
    I do now avoid this loop if an exact match was searched. 
    If this match is beyond the file length, it is now treated 
    as "key not found". There cannot be another key with the 
    same record pointer.
    99ad23ec
sql_class.cc 22.6 KB