• Jon Olav Hauglid's avatar
    Bug#14621627 THREAD CACHE IS UNFAIR · 58de1660
    Jon Olav Hauglid authored
    When a client connects to a MySQL server, first a THD object is created.
    If there are any idle server threads waiting, the THD object is then added
    to a list and a server thread is woken up. This thread then retrieves the 
    THD object from the list and starts executing.
    
    The problem was that this list of THD objects waiting for a server thread,
    was not working in a FIFO fashion, but rather LIFO. This is unfair, as it means
    that the last THD added (=last client connected) will be assigned a  server 
    thread first.
    
    Note however that for this to be a problem, several clients must be able
    to connect and have THD objects constructed before any server threads
    manages to be woken up. This is not a very likely scenario.
    
    This patch fixes the problem by changing the THD list to work FIFO
    rather than LIFO.
    
    This is the 5.1/5.5 version of the patch.
    58de1660
mysqld.cc 321 KB