From: Mattias Jonsson Date: January 10 2011 4:49pm Subject: bzr push into mysql-trunk branch (mattias.jonsson:3479 to 3480) List-Archive: http://lists.mysql.com/commits/128341 Message-Id: <201101101650.p0AFZ17E018404@rcsinet13.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3480 Mattias Jonsson 2011-01-10 [merge] merge modified: mysql-test/r/partition.result mysql-test/r/partition_error.result mysql-test/r/partition_range.result mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc mysql-test/suite/parts/r/part_supported_sql_func_innodb.result mysql-test/suite/parts/r/part_supported_sql_func_myisam.result mysql-test/t/partition.test mysql-test/t/partition_error.test mysql-test/t/partition_range.test sql/item.h sql/item_func.h sql/item_timefunc.h sql/sql_partition.cc sql/table.cc 3479 Jon Olav Hauglid 2011-01-10 Bug #53322 deadlock with FLUSH TABLES WITH READ LOCK and DROP FUNCTION This deadlock could occur between two connections if one connection first locked the mysql.func table (using either FLUSH TABLES WITH READ LOCK or LOCK TABLE mysql.func WRITE). If the second connection then tried to either CREATE or DROP an UDF function, a deadlock would occur when the first connection tried to use an UDF function. The reason for the deadlock was the way the THR_LOCK_udf rwlock was used in the UDF handling code. For CREATE or DROP FUNCTION (UDF), THR_LOCK_udf was write locked before mysql.func was locked and opened. This meant that another connection first locking mysql.func and later using an UDF function (and thus locking THR_LOCK_udf), could cause a deadlock. This patch fixes the problem by changing the CREATE and DROP FUNCTION (UDF) implementation to open mysql.func before locking THR_LOCK_udf. Test case added to udf.test. modified: mysql-test/r/udf.result mysql-test/t/udf.test sql/sql_udf.cc Diff too large for email (16365 lines, the limit is 10000). No bundle (reason: useless for push emails).