• unknown's avatar
    Bug#28211 RENAME DATABASE and query cache don't play nicely together · e3559fde
    unknown authored
    When all table blocks were removed from the query cache the client session
    hung in a tight loop waiting on an impossible condition while consuming a lot
    of CPU.
    
    This patch also corrects an error which caused valid tables to sometimes be
    removed from the query cache.
    
    
    mysql-test/r/query_cache.result:
      Added test case to make sure server doesn't hang in a tight loop if last
      table block is removed from the cache.
    mysql-test/t/query_cache.test:
      Added test case to make sure server doesn't hang in a tight loop if last
      table block is removed from the cache.
    sql/sql_cache.cc:
      - Refactored loop over table blocks. The invalidate_table() function effects
        the elements over which we iterate. The previous stop condition was broken
        due to a compiler optimization error probably caused by the goto-statement
        pointing out of the loop. The effect being that tables_blocks was never
        checked for null values and thus the loop never terminated.
      - The new implementation uses two while loops instead of a goto-statement.
        The tables_blocks is a circular list which becomes null if the last table
        block is removed from the list.
    e3559fde
query_cache.result 58.4 KB