List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:July 22 2010 8:35am
Subject:bzr push into mysql-trunk-runtime branch (jon.hauglid:3080 to 3081) Bug#55223
View as plain text  
 3081 Jon Olav Hauglid	2010-07-22
      Bug #55223 assert in Protocol::end_statement during CREATE DATABASE
      
      The problem was that a statement could cause an assert if it was aborted by
      KILL QUERY while it waited on a metadata lock. This assert checks that a
      statement either sends OK or an error to the client. If the bug was triggered
      on release builds, it caused OK to be sent to the client instead of
      ER_QUERY_INTERRUPTED.
      
      The root cause of the problem was that there are two separate ways to tell if a
      statement is killed: thd->killed and mysys_var->abort. KILL QUERY causes both
      to be set, thd->killed before mysys_var->abort. Also, both values are reset
      at the end of statement execution. This means that it is possible for
      KILL QUERY to first set thd->killed, then have the killed statement reset
      both thd->killed and mysys_var->abort and finally have KILL QUERY set
      mysys_var->abort. This means that the connection with the killed statement
      will start executing the next statement with the two values out of sync - i.e.
      thd->killed not set but mysys_var->abort set.
      
      Since mysys_var->abort is used to check if a wait for a metadata lock should
      be aborted, the next statement would immediately abort any such waiting.
      When waiting is aborted, no OK message is sent and thd->killed is checked to
      see if ER_QUERY_INTERRUPTED should be sent to the client. But since
      the->killed had been reset, neither OK nor an error message was sent to the
      client. This then triggered the assert.
      
      This patch fixes the problem by changing the metadata lock waiting code to
      check thd->killed.
      
      No test case added as reproducing the assert is dependent on very exact timing
      of two (or more) threads. The patch has been checked using RQG and the grammar
      posted on the bug report.

    modified:
      sql/mdl.cc
      sql/mdl.h
 3080 Jon Olav Hauglid	2010-07-19 [merge]
      merge from mysql-trunk-bugfixing

    removed:
      include/config-netware.h
      include/help_end.h
      include/help_start.h
      mysys/mf_util.c
      mysys/my_netware.c
      netware/
      netware/BUILD/
      netware/BUILD/apply-patch
      netware/BUILD/compile-AUTOTOOLS
      netware/BUILD/compile-linux-tools
      netware/BUILD/compile-netware-END
      netware/BUILD/compile-netware-START
      netware/BUILD/compile-netware-all
      netware/BUILD/compile-netware-debug
      netware/BUILD/compile-netware-max
      netware/BUILD/compile-netware-max-debug
      netware/BUILD/compile-netware-src
      netware/BUILD/compile-netware-standard
      netware/BUILD/create-patch
      netware/BUILD/cron-build
      netware/BUILD/crontab
      netware/BUILD/knetware.imp
      netware/BUILD/mwasmnlm
      netware/BUILD/mwccnlm
      netware/BUILD/mwenv
      netware/BUILD/mwldnlm
      netware/BUILD/nwbuild
      netware/BUILD/openssl.imp
      netware/BUILD/save-patch
      netware/Makefile.am
      netware/comp_err.def
      netware/install_test_db.ncf
      netware/libmysql.def
      netware/libmysqlmain.c
      netware/my_manage.c
      netware/my_manage.h
      netware/my_print_defaults.def
      netware/myisam_ftdump.def
      netware/myisamchk.def
      netware/myisamlog.def
      netware/myisampack.def
      netware/mysql.def
      netware/mysql.xdc
      netware/mysql_client_test.def
      netware/mysql_fix_privilege_tables.pl
      netware/mysql_install_db.c
      netware/mysql_install_db.def
      netware/mysql_secure_installation.pl
      netware/mysql_test_run.c
      netware/mysql_test_run.def
      netware/mysql_upgrade.def
      netware/mysql_waitpid.def
      netware/mysqladmin.def
      netware/mysqlbinlog.def
      netware/mysqlcheck.def
      netware/mysqld.def
      netware/mysqld_safe.c
      netware/mysqld_safe.def
      netware/mysqldump.def
      netware/mysqlimport.def
      netware/mysqlshow.def
      netware/mysqlslap.def
      netware/mysqltest.def
      netware/perror.def
      netware/replace.def
      netware/resolve_stack_dump.def
      netware/resolveip.def
      netware/static_init_db.sql
      sql/my_lock.c
      strings/bcmp.c
    added:
      config/ac-macros/maintainer.m4
      include/my_compiler.h
      mysql-test/include/rpl_diff_tables.inc
      mysql-test/std_data/intersect-bug50389.tsv
      mysql-test/suite/perfschema/r/thread_cache.result
      mysql-test/suite/perfschema/t/thread_cache.test
      mysql-test/suite/rpl/r/rpl_current_user.result
      mysql-test/suite/rpl/t/rpl_current_user.cnf
      mysql-test/suite/rpl/t/rpl_current_user.test
    modified:
      BUILD/SETUP.sh
      BUILD/build_mccge.sh
      BUILD/check-cpu
      CMakeLists.txt*
      Makefile.am
      client/CMakeLists.txt*
      client/client_priv.h
      client/mysql.cc
      client/mysql_upgrade.c
      client/mysqladmin.cc
      client/mysqlbinlog.cc
      client/mysqlcheck.c
      client/mysqldump.c
      client/mysqlimport.c
      client/mysqlshow.c
      client/mysqlslap.c
      client/mysqltest.cc
      cmake/configure.pl
      cmake/install_layout.cmake*
      cmake/os/WindowsCache.cmake
      cmake/package_name.cmake
      cmd-line-utils/readline/Makefile.am
      config.h.cmake
      config/ac-macros/misc.m4
      configure.cmake
      configure.in
      dbug/CMakeLists.txt*
      dbug/dbug.c
      dbug/dbug_analyze.c
      extra/CMakeLists.txt*
      extra/comp_err.c
      extra/my_print_defaults.c
      extra/mysql_waitpid.c
      extra/perror.c
      extra/replace.c
      extra/resolve_stack_dump.c
      extra/resolveip.c
      extra/yassl/CMakeLists.txt*
      extra/yassl/include/yassl_int.hpp
      extra/yassl/src/crypto_wrapper.cpp
      extra/yassl/src/socket_wrapper.cpp
      extra/yassl/taocrypt/CMakeLists.txt*
      extra/yassl/taocrypt/include/blowfish.hpp
      extra/yassl/taocrypt/include/misc.hpp
      extra/yassl/taocrypt/include/runtime.hpp
      extra/yassl/taocrypt/src/aes.cpp
      extra/yassl/taocrypt/src/algebra.cpp
      extra/yassl/taocrypt/src/blowfish.cpp
      extra/yassl/taocrypt/src/integer.cpp
      extra/yassl/taocrypt/src/misc.cpp
      extra/yassl/taocrypt/src/random.cpp
      extra/yassl/taocrypt/src/twofish.cpp
      extra/yassl/testsuite/test.hpp
      include/Makefile.am
      include/config-win.h
      include/m_string.h
      include/my_alarm.h
      include/my_bitmap.h
      include/my_dbug.h
      include/my_global.h
      include/my_net.h
      include/my_pthread.h
      include/my_stacktrace.h
      include/my_sys.h
      include/my_time.h
      include/myisam.h
      include/mysql.h
      include/mysql/psi/mysql_file.h
      include/mysql/psi/mysql_thread.h
      include/mysql/psi/psi.h
      include/mysql/psi/psi_abi_v1.h.pp
      include/mysql/psi/psi_abi_v2.h.pp
      include/mysys_err.h
      libmysql/CMakeLists.txt*
      libmysql/Makefile.shared
      libmysql/dll.c
      libmysql/get_password.c
      libmysql/libmysql.c
      libmysqld/Makefile.am
      libmysqld/examples/Makefile.am
      libmysqld/lib_sql.cc
      libmysqld/libmysqld.c
      mysql-test/extra/binlog_tests/binlog.test
      mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
      mysql-test/extra/rpl_tests/rpl_conflicts.test
      mysql-test/include/diff_tables.inc
      mysql-test/include/parser_bug21114.inc*
      mysql-test/include/show_msg.inc*
      mysql-test/include/show_msg80.inc*
      mysql-test/lib/My/Handles.pm*
      mysql-test/lib/My/SafeProcess/safe_kill_win.cc*
      mysql-test/lib/My/SafeProcess/safe_process.cc
      mysql-test/lib/My/SafeProcess/safe_process_win.cc*
      mysql-test/lib/v1/mtr_misc.pl
      mysql-test/lib/v1/mysql-test-run.pl
      mysql-test/r/bug46080.result*
      mysql-test/r/ctype_eucjpms.result*
      mysql-test/r/error_simulation.result
      mysql-test/r/func_in.result
      mysql-test/r/func_like.result
      mysql-test/r/having.result
      mysql-test/r/information_schema.result
      mysql-test/r/information_schema_parameters.result
      mysql-test/r/information_schema_routines.result
      mysql-test/r/loaddata.result
      mysql-test/r/lowercase_mixed_tmpdir_innodb.result*
      mysql-test/r/lowercase_view.result
      mysql-test/r/mysql_upgrade.result
      mysql-test/r/rpl_mysqldump_slave.result
      mysql-test/r/select.result
      mysql-test/r/subselect.result
      mysql-test/suite/binlog/r/binlog_base64_flag.result
      mysql-test/suite/binlog/r/binlog_row_binlog.result
      mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
      mysql-test/suite/binlog/r/binlog_stm_binlog.result
      mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result*
      mysql-test/suite/binlog/t/binlog_base64_flag.test
      mysql-test/suite/binlog/t/binlog_killed_simulate.test
      mysql-test/suite/funcs_1/r/is_basics_mixed.result
      mysql-test/suite/funcs_1/r/is_columns_innodb.result
      mysql-test/suite/funcs_1/r/is_columns_is.result
      mysql-test/suite/funcs_1/r/is_columns_memory.result
      mysql-test/suite/funcs_1/r/is_columns_myisam.result
      mysql-test/suite/funcs_1/r/is_columns_mysql.result
      mysql-test/suite/ibmdb2i/include/have_i54.inc*
      mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result*
      mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result*
      mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test*
      mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test*
      mysql-test/suite/innodb/r/innodb_mysql.result
      mysql-test/suite/innodb/t/innodb_mysql.test
      mysql-test/suite/perfschema/r/misc.result
      mysql-test/suite/perfschema/r/myisam_file_io.result
      mysql-test/suite/perfschema/r/pfs_upgrade.result
      mysql-test/suite/perfschema/r/query_cache.result
      mysql-test/suite/perfschema/t/misc.test
      mysql-test/suite/perfschema/t/myisam_file_io.test
      mysql-test/suite/perfschema/t/query_cache.test
      mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
      mysql-test/suite/rpl/r/rpl_row_conflicts.result
      mysql-test/suite/rpl/r/rpl_stm_conflicts.result
      mysql-test/suite/rpl/r/rpl_stm_until.result
      mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
      mysql-test/suite/rpl/t/rpl_stm_until.test
      mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
      mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
      mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test
      mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test
      mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test
      mysql-test/t/error_simulation.test
      mysql-test/t/func_in.test
      mysql-test/t/func_like.test
      mysql-test/t/having.test
      mysql-test/t/information_schema.test
      mysql-test/t/loaddata.test
      mysql-test/t/lowercase_view.test
      mysql-test/t/mysql_delimiter_19799.sql*
      mysql-test/t/mysql_upgrade.test
      mysql-test/t/mysqlbinlog.test
      mysql-test/t/mysqlbinlog2.test
      mysql-test/t/rpl_mysqldump_slave.test
      mysql-test/t/select.test
      mysql-test/t/subselect.test
      mysql-test/t/windows.test*
      mysys/CMakeLists.txt*
      mysys/Makefile.am
      mysys/default.c
      mysys/errors.c
      mysys/mf_dirname.c
      mysys/mf_fn_ext.c
      mysys/mf_keycache.c
      mysys/mf_loadpath.c
      mysys/mf_pack.c
      mysys/mf_path.c
      mysys/mf_tempdir.c
      mysys/mf_tempfile.c
      mysys/mf_unixpath.c
      mysys/my_bitmap.c
      mysys/my_clock.c
      mysys/my_copy.c
      mysys/my_gethwaddr.c
      mysys/my_getopt.c
      mysys/my_getsystime.c
      mysys/my_getwd.c
      mysys/my_handler.c
      mysys/my_init.c
      mysys/my_lib.c
      mysys/my_lock.c
      mysys/my_mess.c
      mysys/my_pthread.c
      mysys/my_rdtsc.c
      mysys/my_redel.c
      mysys/my_rename.c
      mysys/my_sleep.c
      mysys/my_static.c
      mysys/my_static.h
      mysys/thr_alarm.c
      mysys/thr_lock.c
      plugin/daemon_example/Makefile.am
      plugin/semisync/Makefile.am
      regex/CMakeLists.txt*
      regex/regcomp.c
      scripts/CMakeLists.txt*
      scripts/make_binary_distribution.sh
      scripts/mysql_secure_installation.pl.in
      scripts/mysql_secure_installation.sh
      scripts/mysql_system_tables_fix.sql
      scripts/mysqlhotcopy.sh
      sql-common/client.c
      sql-common/my_time.c
      sql/CMakeLists.txt*
      sql/Makefile.am
      sql/event_scheduler.cc*
      sql/examples/CMakeLists.txt*
      sql/field.cc
      sql/ha_partition.cc
      sql/ha_partition.h
      sql/handler.h
      sql/item.cc
      sql/item_cmpfunc.cc
      sql/item_create.cc
      sql/item_func.cc
      sql/item_timefunc.cc
      sql/log.cc
      sql/log_event.cc
      sql/log_event.h
      sql/log_event_old.cc
      sql/my_decimal.cc
      sql/mysqld.cc
      sql/net_serv.cc
      sql/opt_range.cc
      sql/opt_range.h
      sql/partition_info.cc
      sql/protocol.cc
      sql/rpl_handler.cc
      sql/rpl_mi.cc
      sql/rpl_rli.cc
      sql/rpl_utility.cc
      sql/slave.cc
      sql/spatial.cc
      sql/spatial.h
      sql/sql_acl.cc
      sql/sql_analyse.cc
      sql/sql_base.cc
      sql/sql_binlog.cc
      sql/sql_bitmap.h
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_connect.cc
      sql/sql_list.h
      sql/sql_load.cc
      sql/sql_parse.cc
      sql/sql_parse.h
      sql/sql_prepare.cc
      sql/sql_repl.cc
      sql/sql_select.cc
      sql/sql_show.cc
      sql/sql_yacc.yy
      sql/sys_vars.cc
      sql/sys_vars.h
      sql/tztime.cc
      sql/udf_example.c
      sql/unireg.h
      storage/archive/Makefile.am
      storage/blackhole/Makefile.am
      storage/csv/Makefile.am
      storage/example/Makefile.am
      storage/federated/Makefile.am
      storage/federated/ha_federated.cc
      storage/heap/CMakeLists.txt*
      storage/heap/hp_hash.c
      storage/heap/hp_open.c
      storage/heap/hp_test2.c
      storage/ibmdb2i/Makefile.am
      storage/innobase/CMakeLists.txt
      storage/innobase/Makefile.am
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/include/os0file.h
      storage/innobase/include/os0file.ic
      storage/innobase/include/srv0start.h
      storage/innobase/include/sync0rw.ic
      storage/innobase/include/sync0sync.ic
      storage/innobase/include/univ.i
      storage/innobase/include/ut0dbg.h
      storage/innobase/os/os0file.c
      storage/innobase/os/os0proc.c
      storage/innobase/os/os0thread.c
      storage/innobase/row/row0merge.c
      storage/innobase/srv/srv0start.c
      storage/innobase/ut/ut0dbg.c
      storage/innobase/ut/ut0mem.c
      storage/myisam/CMakeLists.txt*
      storage/myisam/mi_create.c
      storage/myisam/mi_log.c
      storage/myisam/mi_open.c
      storage/myisam/mi_search.c
      storage/myisam/mi_static.c
      storage/myisam/mi_test2.c
      storage/myisam/mi_test3.c
      storage/myisam/mi_unique.c
      storage/myisam/myisam_ftdump.c
      storage/myisam/myisamchk.c
      storage/myisam/myisamdef.h
      storage/myisam/myisamlog.c
      storage/myisam/myisampack.c
      storage/myisam/sort.c
      storage/myisammrg/CMakeLists.txt*
      storage/myisammrg/ha_myisammrg.cc
      storage/myisammrg/myrg_open.c
      storage/ndb/src/common/portlib/NdbMutex.c
      storage/ndb/src/mgmclient/main.cpp
      storage/ndb/src/mgmsrv/main.cpp
      storage/ndb/src/ndbapi/DictCache.cpp
      storage/perfschema/CMakeLists.txt
      storage/perfschema/Makefile.am
      storage/perfschema/ha_perfschema.cc
      storage/perfschema/ha_perfschema.h
      storage/perfschema/pfs.cc
      storage/perfschema/pfs.h
      storage/perfschema/pfs_atomic.cc
      storage/perfschema/pfs_atomic.h
      storage/perfschema/pfs_check.cc
      storage/perfschema/pfs_column_types.h
      storage/perfschema/pfs_column_values.cc
      storage/perfschema/pfs_column_values.h
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_engine_table.h
      storage/perfschema/pfs_events_waits.cc
      storage/perfschema/pfs_events_waits.h
      storage/perfschema/pfs_global.cc
      storage/perfschema/pfs_global.h
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/pfs_instr_class.cc
      storage/perfschema/pfs_instr_class.h
      storage/perfschema/pfs_lock.h
      storage/perfschema/pfs_server.cc
      storage/perfschema/pfs_server.h
      storage/perfschema/pfs_stat.h
      storage/perfschema/pfs_timer.cc
      storage/perfschema/pfs_timer.h
      storage/perfschema/plug.in
      storage/perfschema/table_all_instr.cc
      storage/perfschema/table_all_instr.h
      storage/perfschema/table_events_waits.cc
      storage/perfschema/table_events_waits.h
      storage/perfschema/table_events_waits_summary.cc
      storage/perfschema/table_events_waits_summary.h
      storage/perfschema/table_file_instances.cc
      storage/perfschema/table_file_instances.h
      storage/perfschema/table_file_summary.cc
      storage/perfschema/table_file_summary.h
      storage/perfschema/table_performance_timers.cc
      storage/perfschema/table_performance_timers.h
      storage/perfschema/table_processlist.cc
      storage/perfschema/table_processlist.h
      storage/perfschema/table_setup_consumers.cc
      storage/perfschema/table_setup_consumers.h
      storage/perfschema/table_setup_instruments.cc
      storage/perfschema/table_setup_instruments.h
      storage/perfschema/table_setup_timers.cc
      storage/perfschema/table_setup_timers.h
      storage/perfschema/table_sync_instances.cc
      storage/perfschema/table_sync_instances.h
      storage/perfschema/unittest/CMakeLists.txt
      storage/perfschema/unittest/conf.txt
      storage/perfschema/unittest/pfs-t.cc
      storage/perfschema/unittest/pfs_instr-oom-t.cc
      storage/perfschema/unittest/pfs_instr-t.cc
      storage/perfschema/unittest/pfs_instr_class-oom-t.cc
      storage/perfschema/unittest/pfs_instr_class-t.cc
      storage/perfschema/unittest/pfs_timer-t.cc
      storage/perfschema/unittest/stub_pfs_global.h
      storage/perfschema/unittest/stub_print_error.h
      strings/CMakeLists.txt*
      strings/Makefile.am
      strings/ctype-big5.c
      strings/ctype-cp932.c
      strings/ctype-czech.c
      strings/ctype-euc_kr.c
      strings/ctype-eucjpms.c
      strings/ctype-gb2312.c
      strings/ctype-gbk.c
      strings/ctype-simple.c
      strings/ctype-sjis.c
      strings/ctype-tis620.c
      strings/ctype-ujis.c
      strings/ctype-win1250ch.c
      strings/do_ctype.c
      strings/int2str.c
      strings/my_strtoll10.c
      strings/str_test.c
      strings/strtol.c
      strings/strtoul.c
      strings/xml.c
      tests/CMakeLists.txt*
      tests/mysql_client_test.c
      vio/CMakeLists.txt*
      vio/test-ssl.c
      vio/viossl.c
      vio/viosslfactories.c
      win/mysql_manifest.cmake*
      zlib/CMakeLists.txt*
=== modified file 'sql/mdl.cc'
--- a/sql/mdl.cc	2010-07-13 18:01:54 +0000
+++ b/sql/mdl.cc	2010-07-22 08:00:32 +0000
@@ -881,67 +881,6 @@ uint MDL_ticket::get_deadlock_weight() c
 }
 
 
-/**
-  Helper functions and macros to be used for killable waiting in metadata
-  locking subsystem.
-
-  @sa THD::enter_cond()/exit_cond()/killed.
-
-  @note We can't use THD::enter_cond()/exit_cond()/killed directly here
-        since this will make metadata subsystem dependent on THD class
-        and thus prevent us from writing unit tests for it. And usage of
-        wrapper functions to access THD::killed/enter_cond()/exit_cond()
-        will probably introduce too much overhead.
-*/
-
-#define MDL_ENTER_COND(A, B, C, D) \
-        mdl_enter_cond(A, B, C, D, __func__, __FILE__, __LINE__)
-
-static inline const char *mdl_enter_cond(THD *thd,
-                                         st_my_thread_var *mysys_var,
-                                         mysql_cond_t *cond,
-                                         mysql_mutex_t *mutex,
-                                         const char *calling_func,
-                                         const char *calling_file,
-                                         const unsigned int calling_line)
-{
-  mysql_mutex_assert_owner(mutex);
-
-  mysys_var->current_mutex= mutex;
-  mysys_var->current_cond= cond;
-
-  DEBUG_SYNC(thd, "mdl_enter_cond");
-
-  return set_thd_proc_info(thd, "Waiting for table",
-                           calling_func, calling_file, calling_line);
-}
-
-#define MDL_EXIT_COND(A, B, C, D) \
-        mdl_exit_cond(A, B, C, D, __func__, __FILE__, __LINE__)
-
-static inline void mdl_exit_cond(THD *thd,
-                                 st_my_thread_var *mysys_var,
-                                 mysql_mutex_t *mutex,
-                                 const char* old_msg,
-                                 const char *calling_func,
-                                 const char *calling_file,
-                                 const unsigned int calling_line)
-{
-  DBUG_ASSERT(mutex == mysys_var->current_mutex);
-
-  mysql_mutex_unlock(mutex);
-  mysql_mutex_lock(&mysys_var->mutex);
-  mysys_var->current_mutex= NULL;
-  mysys_var->current_cond= NULL;
-  mysql_mutex_unlock(&mysys_var->mutex);
-
-  DEBUG_SYNC(thd, "mdl_exit_cond");
-
-  (void) set_thd_proc_info(thd, old_msg, calling_func,
-                           calling_file, calling_line);
-}
-
-
 /** Construct an empty wait slot. */
 
 MDL_wait::MDL_wait()
@@ -1021,15 +960,14 @@ MDL_wait::timed_wait(THD *thd, struct ti
 {
   const char *old_msg;
   enum_wait_status result;
-  st_my_thread_var *mysys_var= my_thread_var;
   int wait_result= 0;
 
   mysql_mutex_lock(&m_LOCK_wait_status);
 
-  old_msg= MDL_ENTER_COND(thd, mysys_var, &m_COND_wait_status,
-                          &m_LOCK_wait_status);
+  old_msg= thd_enter_cond(thd, &m_COND_wait_status, &m_LOCK_wait_status,
+                          "Waiting for table");
 
-  while (!m_wait_status && !mysys_var->abort &&
+  while (!m_wait_status && !thd_killed(thd) &&
          wait_result != ETIMEDOUT && wait_result != ETIME)
     wait_result= mysql_cond_timedwait(&m_COND_wait_status, &m_LOCK_wait_status,
                                       abs_timeout);
@@ -1048,14 +986,14 @@ MDL_wait::timed_wait(THD *thd, struct ti
       false, which means that the caller intends to restart the
       wait.
     */
-    if (mysys_var->abort)
+    if (thd_killed(thd))
       m_wait_status= KILLED;
     else if (set_status_on_timeout)
       m_wait_status= TIMEOUT;
   }
   result= m_wait_status;
 
-  MDL_EXIT_COND(thd, mysys_var, &m_LOCK_wait_status, old_msg);
+  thd_exit_cond(thd, old_msg);
 
   return result;
 }

=== modified file 'sql/mdl.h'
--- a/sql/mdl.h	2010-07-13 18:01:54 +0000
+++ b/sql/mdl.h	2010-07-22 08:00:32 +0000
@@ -721,10 +721,10 @@ void mdl_destroy();
 
 extern bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
                                                    bool needs_thr_lock_abort);
-extern "C" const char *set_thd_proc_info(void *thd_arg, const char *info,
-                                         const char *calling_function,
-                                         const char *calling_file,
-                                         const unsigned int calling_line);
+extern "C" const char* thd_enter_cond(MYSQL_THD thd, mysql_cond_t *cond,
+                                      mysql_mutex_t *mutex, const char *msg);
+extern "C" void thd_exit_cond(MYSQL_THD thd, const char *old_msg);
+
 #ifndef DBUG_OFF
 extern mysql_mutex_t LOCK_open;
 #endif


Attachment: [text/bzr-bundle] bzr/jon.hauglid@oracle.com-20100722080032-tx4c71abu8tbihhk.bundle
Thread
bzr push into mysql-trunk-runtime branch (jon.hauglid:3080 to 3081) Bug#55223Jon Olav Hauglid22 Jul