• unknown's avatar
    Bug#29838 - myisam corruption using concurrent select ... and update · 4158e75d
    unknown authored
    When using concurrent insert with parallel index reads, it could
    happen that reading sessions found keys that pointed to records
    yet to be written to the data file. The result was a report of
    a corrupted table. But it was false alert.
    
    When inserting a record in a table with indexes, the keys are
    inserted into the indexes before the record is written to the data
    file. When the insert happens concurrently to selects, an
    index read can find a key that references the record that is not
    yet written to the data file. To avoid any access to such record,
    the select saves the current end of file position when it starts.
    Since concurrent inserts are always appended at end of the data
    file, the select can easily ignore any concurrently inserted record.
    
    The problem was that the ignore was only done for non-exact key
    searches (partial key or using >, >=, < or <=).
    
    The fix is to ignore concurrently inserted records also for
    exact key searches.
    
    No test case. Concurrent inserts cannot be tested with the test
    suite. Test cases are attached to the bug report.
    
    
    myisam/mi_rkey.c:
      Bug#29838 - myisam corruption using concurrent select ... and update
      Fixed mi_rkey() to always ignore records beyond saved eof.
    4158e75d
mi_rkey.c 6.93 KB