• Kristian Nielsen's avatar
    MDEV-4393: show_explain.test times out randomly · d79cce86
    Kristian Nielsen authored
    The problem was a race between the debug code in the server and the SHOW
    EXPLAIN FOR in the test case.
    
    The test case would wait for a query to reach the first point of interest
    (inside dbug_serve_apcs()), then send it a SHOW EXPLAIN FOR, then wait for the
    query to reach the next point of interest. However, the second wait was
    insufficient. It was possible for the the second wait to complete immediately,
    causing both the first and the second SHOW EXPLAIN FOR to hit the same
    invocation of dbug_server_apcs(). Then a later invocation would miss its
    intended SHOW EXPLAIN FOR and hang, and the test case would eventually time
    out.
    
    Fix is to make sure that the second wait can not trigger during the first
    invocation of dbug_server_apcs(). We do this by clearing the thd_proc_info
    (that the wait is looking for) before processing the SHOW EXPLAIN FOR; this
    way the second wait can not start until the thd_proc_info from the first
    invocation has been cleared.
    d79cce86
sql_select.cc 811 KB