From: Nuno Carvalho Date: January 23 2012 4:52pm Subject: bzr push into mysql-5.5 branch (nuno.carvalho:3699 to 3700) Bug#12364404 List-Archive: http://lists.mysql.com/commits/142527 X-Bug: 12364404 Message-Id: <201201231652.q0NGqUhW003978@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3700 Nuno Carvalho 2012-01-23 BUG#12364404 - UNDETERMINISTIC WAIT LOOP IN WAIT_FOR_NDB_TO_BINLOG.INC The wait_for_ndb_to_binlog.inc include file used by the blow rpl_tests common for rpl and rpl_ndb suite is simply doing a "sleep 5", this is not deterministic and wastes lot of test time uneccessarily. The test should be rewritten to check if the condition it wait for has been reached or not. For NDB engine all events will be added by NDB injector so tests only can continue after injector is ready, this test waits for proper injector thread state. modified: mysql-test/include/wait_for_ndb_to_binlog.inc 3699 Manish Kumar 2012-01-23 BUG#11752315 - 43460: STOP SLAVE UNABLE TO COMPLETE WHEN SLAVE THREAD IS TRYING TO RECONNECT TO Problem : The basic problem is the way the thread sleeps in mysql-5.5 and also in mysql-5.1 when we execute a stop slave on windows platform. On windows platform if the stop slave is executed after the master dies, we have this long wait before the stop slave return a value. This is because there is a sleep of the thread. The sleep is uninterruptable in the two above version, which was fixed by Davi patch for the BUG#11765860 for mysql-trunk. Backporting his patch for mysql-5.5 fixes the problem. Solution : A new pair of mutex and condition variable is introduced to synchronize thread sleep and finalization. A new mutex is required because the slave threads are terminated while holding the slave thread locks (run_lock), which can not be relinquished during termination as this would affect the lock order. @ mysql-test/suite/rpl/r/rpl_start_stop_slave.result The result file associated with the test added. @ mysql-test/suite/rpl/t/rpl_start_stop_slave.test A test to check the new functionality. @ sql/rpl_mi.cc The constructor using the new mutex and condition variables for the master_info. @ sql/rpl_mi.h The condition variable and mutex have been added for the master_info. @ sql/rpl_rli.cc The constructor using the new mutex and condition variables for the realy_log_info. @ sql/rpl_rli.h The condition variable and mutex have been added for the relay_log_info. @ sql/slave.cc Use a timed wait on a condition variable to implement a interruptible sleep. The wait is registered with the THD object so that the thread will be woken up if killed. added: mysql-test/suite/rpl/r/rpl_start_stop_slave.result mysql-test/suite/rpl/t/rpl_start_stop_slave.test modified: sql/mysqld.cc sql/mysqld.h sql/rpl_mi.cc sql/rpl_mi.h sql/rpl_rli.cc sql/rpl_rli.h sql/slave.cc === modified file 'mysql-test/include/wait_for_ndb_to_binlog.inc' --- a/mysql-test/include/wait_for_ndb_to_binlog.inc 2009-11-26 23:32:01 +0000 +++ b/mysql-test/include/wait_for_ndb_to_binlog.inc 2012-01-23 16:50:54 +0000 @@ -1,13 +1,11 @@ # ==== Purpose ==== # -# Several test primitives from mysql-test/extra/rpl_tests -# shared for test cases for MyISAM, InnoDB, NDB and other -# engines. But for NDB all events will be added by NDB -# injector and now there are no way to detect the state of -# NDB injector therefore this primitive waits 5 sec -# if engine type is NDB. -# In future that should be fixed by waiting of proper -# state of NDB injector. +# Several test primitives from mysql-test/extra/rpl_tests +# are shared for test cases for MyISAM, InnoDB, NDB and +# other engines. +# For NDB engine all events will be added by NDB injector +# so tests only can continue after injector is ready, +# this test waits for proper injector thread state. # # ==== Usage ==== # @@ -17,25 +15,12 @@ # ==== Parameters ===== # # $engine_type -# Type of engine. If type is NDB then it waits $wait_time sec -# -# $wait_time -# Test will wait $wait_time seconds - -let $_wait_time= 5; - -if (!$wait_time) { - let $_wait_time= $wait_time; -} +# Type of engine. If type is NDB then it waits for injector +# thread proper state. if (`SELECT UPPER(LEFT('$engine_type',3)) = 'NDB'`) { - while (!$_wait_time) { - let $_wait_time_internal= 10; - while (!$_wait_time_internal) { - sleep 0.1; - dec $_wait_time_internal; - } - dec $_wait_time; - } + let $show_statement= SHOW PROCESSLIST; + let $field= State; + let $condition= = 'Waiting for event from ndbcluster'; + source include/wait_show_condition.inc; } - No bundle (reason: useless for push emails).