diff --git a/mysql-test/suite/rpl/r/rpl_events.result b/mysql-test/suite/rpl/r/rpl_events.result index 18fe72a9879..273004b0a43 100644 --- a/mysql-test/suite/rpl/r/rpl_events.result +++ b/mysql-test/suite/rpl/r/rpl_events.result @@ -195,9 +195,11 @@ test slave_terminate SLAVESIDE_DISABLED 2 DROP EVENT test.slave_terminate; "Cleanup" DROP TABLE t1; +CREATE TABLE t28953 (a INT); CREATE EVENT event1 ON SCHEDULE EVERY 1 YEAR DO BEGIN -select * from t1; +select * from t28953; END;| ALTER EVENT event1 RENAME TO event2; DROP EVENT event2; +DROP TABLE t28953; diff --git a/mysql-test/suite/rpl/t/rpl_events.test b/mysql-test/suite/rpl/t/rpl_events.test index 62ffead7dcb..2a9cf86fe55 100644 --- a/mysql-test/suite/rpl/t/rpl_events.test +++ b/mysql-test/suite/rpl/t/rpl_events.test @@ -28,10 +28,12 @@ set binlog_format=statement; connection master; +CREATE TABLE t28953 (a INT); + DELIMITER |; CREATE EVENT event1 ON SCHEDULE EVERY 1 YEAR DO BEGIN - select * from t1; + select * from t28953; END;| DELIMITER ;| @@ -45,3 +47,9 @@ DROP EVENT event2; sync_slave_with_master; +# Doing cleanup of the table referred to in the event to guarantee +# that there is no bad timing cauing it to try to access the table. + +connection master; +DROP TABLE t28953; +sync_slave_with_master; diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test index 4541ee1eb36..a5133166495 100644 --- a/mysql-test/t/events_scheduling.test +++ b/mysql-test/t/events_scheduling.test @@ -76,11 +76,22 @@ let $wait_condition=select count(*) = 0 from information_schema.events where event_name='event_4' and status='enabled'; --source include/wait_condition.inc -# check the data +# Wait for the events to fire and check the data afterwards +let $wait_condition=SELECT SUM(a) >= 4 FROM table_1; +source include/wait_condition.inc; SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1; + +let $wait_condition=SELECT SUM(a) >= 5 FROM table_2; +source include/wait_condition.inc; SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2; + +let $wait_condition=SELECT SUM(a) >= 1 FROM table_3; +source include/wait_condition.inc; SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3; + +let $wait_condition=SELECT SUM(a) >= 1 FROM table_4; +source include/wait_condition.inc; SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_4; SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 08ecc025332..9c4e6f9e2a2 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1869,9 +1869,9 @@ bool one_thread_per_connection_end(THD *thd, bool put_in_cache) /* It's safe to broadcast outside a lock (COND... is not deleted here) */ DBUG_PRINT("signal", ("Broadcasting COND_thread_count")); + my_thread_end(); (void) pthread_cond_broadcast(&COND_thread_count); - my_thread_end(); pthread_exit(0); DBUG_RETURN(0); // Impossible }