From: Date: February 13 2007 6:25pm Subject: bk commit into 5.1 tree (thek:1.2379) BUG#25422 List-Archive: http://lists.mysql.com/commits/19778 X-Bug: 25422 Message-Id: <200702131725.l1DHPoBq025787@kpdesk.mysql.com> Below is the list of changes that have just been committed into a local 5.1 repository of thek. When thek does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-02-13 18:25:43+01:00, thek@stripped +1 -0 Bug#25422 Hang with log tables - Truncate table can dead lock - Moved mutex LOGGER:lock to include the table lock. sql/sql_delete.cc@stripped, 2007-02-13 18:25:40+01:00, thek@stripped +19 -5 Bug#25422 Hang with log tables - Concurrent calls to mysql_truncate can dead lock on the LOGGER::lock and a named table lock. - Moved mutex LOGGER:lock to include the table lock which resolves the dead lock. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: thek # Host: kpdesk.mysql.com # Root: /home/thek/dev/bug25422/my51-bug25422 --- 1.205/sql/sql_delete.cc 2007-02-13 18:25:50 +01:00 +++ 1.206/sql/sql_delete.cc 2007-02-13 18:25:50 +01:00 @@ -895,6 +895,15 @@ bool mysql_truncate(THD *thd, TABLE_LIST path_length= build_table_filename(path, sizeof(path), table_list->db, table_list->table_name, reg_ext, 0); + log_type= check_if_log_table(table_list->db_length, table_list->db, + table_list->table_name_length, + table_list->table_name, 1); + if (log_type) + { + lock_logger= 1; + logger.lock(); + } + if (!dont_send_ok) { enum legacy_db_type table_type; @@ -903,24 +912,29 @@ bool mysql_truncate(THD *thd, TABLE_LIST { my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db, table_list->table_name); + if (lock_logger) + logger.unlock(); DBUG_RETURN(TRUE); } if (!ha_check_storage_engine_flag(ha_resolve_by_legacy_type(thd, table_type), HTON_CAN_RECREATE)) + { + if (lock_logger) + logger.unlock(); goto trunc_by_del; + } if (lock_and_wait_for_table_name(thd, table_list)) + { + if (lock_logger) + logger.unlock(); DBUG_RETURN(TRUE); + } } - log_type= check_if_log_table(table_list->db_length, table_list->db, - table_list->table_name_length, - table_list->table_name, 1); /* close log tables in use */ if (log_type) { - lock_logger= 1; - logger.lock(); logger.close_log_table(log_type, FALSE); closed_log_tables= closed_log_tables | log_type; }