• unknown's avatar
    Bug#35103 mysql_client_test::test_bug29948 causes sporadic failures · 2e4d2601
    unknown authored
    The problem was that the COM_STMT_SEND_LONG_DATA was sending a response
    packet if the prepared statement wasn't found in the server (due to
    reconnection). The commands COM_STMT_SEND_LONG_DATA and COM_STMT_CLOSE
    should not send any packets, even error packets should not be sent since
    they are not expected by the client API.
    
    The solution is to clear generated during the execution of the aforementioned
    commands and to skip resend of prepared statement commands. Another fix is
    that if the connection breaks during the send of prepared statement command,
    the command is not sent again since the prepared statement is no longer in the
    server.
    
    
    libmysql/libmysql.c:
      The mysql handle might be reset after a reconnection.
      Pass the now used stmt argument to cli_advanced_command.
    sql-common/client.c:
      Don't resend command if the connection broke and it's a prepared
      statement command. If the session is broken, prepared statements
      on the server are gone, set the error accordanly.
    sql/sql_prepare.cc:
      Clear any error set during the execution of the request
      command.
    tests/mysql_client_test.c:
      Fix memory leak by freeing result associated with statement.
      Remove test case for Bug 29948 because it's not reliable in
      5.0 (fixed in 5.1) due to KILL queries sending two packets for
      a thread that kills itself.
    2e4d2601
client.c 92.3 KB