• unknown's avatar
    Bug#14400 - Query joins wrong rows from table which is subject of "concurrent insert" · 7aa26e26
    unknown 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.
    
    
    myisam/mi_rkey.c:
      Bug#14400 - Query joins wrong rows from table which is subject of "concurrent insert"
      Added a check for exact key match before searching for
      the next key that was not concurrently inserted. If an
      exact key match finds a concurrently inserted row, this
      must be treated as "key not found".
    sql/sql_class.cc:
      Bug#14400 - Query joins wrong rows from table which is subject of "concurrent insert"
      Fixed some DBUG_ENTER strings.
    7aa26e26
sql_class.cc 22.6 KB