• svoj@april.(none)'s avatar
    Bug#18544 - LOCK TABLES timeout causes MyISAM table corruption · 806cd415
    svoj@april.(none) authored
    After a locking error the open table(s) were not fully
    cleaned up for reuse. But they were put into the open table
    cache even before the lock was tried. The next statement
    reused the table(s) with a wrong lock type set up. This
    tricked MyISAM into believing that it don't need to update
    the table statistics. Hence CHECK TABLE reported a mismatch
    of record count and table size.
    
    Fortunately nothing worse has been detected yet. The effect
    of the test case was that the insert worked on a read locked
    table. (!)
    
    I added a new function that clears the lock type from all
    tables that were prepared for a lock. I call this function
    when a lock failes.
    
    No test case. One test would add 50 seconds to the
    test suite. Another test requires file mode modifications.
    I added a test script to the bug report. It contains three
    cases for failing locks. All could reproduce a table
    corruption. All are fixed by this patch.
    
    This bug was not lock timeout specific.
    806cd415
lock.cc 34 KB