Comment 5 for bug 491097

Revision history for this message
Michael Widenius (monty) wrote :

The problem is that someone moved in MySQL 5.1 mysql_unlock_tables() from mysql_insert to close_thread_tables().

There is two solutions how to fix this:
a) Move that we call close_thread_tables() before sending the result to the client (as you suggested)
b) Move out the mysql_unlock_tables() + thd->binlog_flush_pending_rows_event from close_threaded_tables() to it's own function (unlock_thread_tables() ?) and call this before we call net_end_statement() in sql_parse.cc

I would suggest we do b) because this enables the client to get some work done while the server is doing end-of-statement cleanup, which results in higher throughput in many cases.