diff options
author | unknown <monty@mysql.com/narttu.mysql.fi> | 2007-04-16 17:08:29 +0300 |
---|---|---|
committer | unknown <monty@mysql.com/narttu.mysql.fi> | 2007-04-16 17:08:29 +0300 |
commit | 48892844a9eab3c69143e1ae45690de3e947b650 (patch) | |
tree | 66913f618e8d3460513451fab5622e144183cd15 | |
parent | 0a3abcf20d1497f2b4b9a0fdba2b280120a3b0f5 (diff) | |
download | mariadb-git-48892844a9eab3c69143e1ae45690de3e947b650.tar.gz |
Clear field_alloc when it's moved to result set (allows us to always call free_root on field_alloc)
Change to use remove_file instead of 'system rm' in a lot of tests. (Should fix some windows test problems)
Removed memory leak in mysql_test if sync_with_master fails.
Do not terminate ndb_cluster_binary_log before the util thread has finnished. This should fix a shutdown bug where a thread is accessing injector_mutex after it's freed.
Patch may fix Bug#27622 "mysqld shutdown, util thread continues, while binlog thread exits"
client/mysqltest.c:
Added missing 'mysql_free_result' (fixed confusing memory leak when sync_with_master fails)ug
mysql-test/mysql-test-run.pl:
Add the test case name to the instance manager log files
mysql-test/r/rpl_log_pos.result:
Made test more portable (for powermac)
mysql-test/t/disabled.def:
Disabled im_life_cycle (added bug#27851)
mysql-test/t/myisam-system.test:
Use remove_file instead of "system rm"
mysql-test/t/ndb_autodiscover.test:
Use remove_file instead of "system rm"
mysql-test/t/ndb_loaddatalocal.test:
Use remove_file instead of "system rm"
mysql-test/t/rpl_loaddatalocal.test:
Use remove_file instead of "system rm"
mysql-test/t/rpl_log_pos.test:
Made test more portable (for powermac)
mysql-test/t/rpl_misc_functions.test:
Use remove_file instead of "system rm"
mysql-test/t/rpl_rbr_to_sbr.test:
Use remove_file instead of "system rm"
mysql-test/t/rpl_row_NOW.test:
Use remove_file instead of "system rm"
mysql-test/t/rpl_row_sp001.test:
Use remove_file instead of "system rm"
mysql-test/t/rpl_row_sp011.test:
Use remove_file instead of "system rm"
mysql-test/t/show_check.test:
Use remove_file instead of "system rm"
mysys/my_alloc.c:
Don't return on zero argument, as this may hide other errors
server-tools/instance-manager/log.cc:
Log errors to both stdout and stderr (to know in which context we got the error)
server-tools/instance-manager/thread_registry.cc:
Log error before common assert (to know in which context we fail)
sql/ha_ndbcluster.cc:
Do not terminate ndb_cluster_binary_log before the util thread has finnished.
sql/ha_ndbcluster.h:
Do not terminate ndb_cluster_binary_log before the util thread has finnished.
sql/ha_ndbcluster_binlog.cc:
Do not terminate ndb_cluster_binary_log before the util thread has finnished.
sql-common/client.c:
Clear field_alloc when it's moved to result set (allows us to always call free_root on field_alloc)
-rw-r--r-- | client/mysqltest.c | 5 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 14 | ||||
-rw-r--r-- | mysql-test/r/rpl_log_pos.result | 2 | ||||
-rw-r--r-- | mysql-test/t/disabled.def | 1 | ||||
-rw-r--r-- | mysql-test/t/myisam-system.test | 6 | ||||
-rw-r--r-- | mysql-test/t/ndb_autodiscover.test | 32 | ||||
-rw-r--r-- | mysql-test/t/ndb_loaddatalocal.test | 8 | ||||
-rw-r--r-- | mysql-test/t/rpl_loaddatalocal.test | 4 | ||||
-rw-r--r-- | mysql-test/t/rpl_log_pos.test | 2 | ||||
-rw-r--r-- | mysql-test/t/rpl_misc_functions.test | 4 | ||||
-rw-r--r-- | mysql-test/t/rpl_rbr_to_sbr.test | 4 | ||||
-rw-r--r-- | mysql-test/t/rpl_row_NOW.test | 4 | ||||
-rw-r--r-- | mysql-test/t/rpl_row_sp001.test | 4 | ||||
-rw-r--r-- | mysql-test/t/rpl_row_sp011.test | 4 | ||||
-rw-r--r-- | mysql-test/t/show_check.test | 3 | ||||
-rw-r--r-- | mysys/my_alloc.c | 2 | ||||
-rw-r--r-- | server-tools/instance-manager/log.cc | 8 | ||||
-rw-r--r-- | server-tools/instance-manager/thread_registry.cc | 7 | ||||
-rw-r--r-- | sql-common/client.c | 4 | ||||
-rw-r--r-- | sql/ha_ndbcluster.cc | 2 | ||||
-rw-r--r-- | sql/ha_ndbcluster.h | 4 | ||||
-rw-r--r-- | sql/ha_ndbcluster_binlog.cc | 22 |
22 files changed, 92 insertions, 54 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index e4eb06953e2..8b5c657f75f 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2498,17 +2498,20 @@ wait_for_position: if (!(res= mysql_store_result(mysql))) die("mysql_store_result() returned NULL for '%s'", query_buf); if (!(row= mysql_fetch_row(res))) + { + mysql_free_result(res); die("empty result in %s", query_buf); + } if (!row[0]) { /* It may be that the slave SQL thread has not started yet, though START SLAVE has been issued ? */ + mysql_free_result(res); if (tries++ == 30) die("could not sync with master ('%s' returned NULL)", query_buf); sleep(1); /* So at most we will wait 30 seconds and make 31 tries */ - mysql_free_result(res); goto wait_for_position; } mysql_free_result(res); diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 46938ea7cde..7f775bd0942 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3278,9 +3278,9 @@ sub do_after_run_mysqltest($) } -sub run_testcase_mark_logs($) +sub run_testcase_mark_logs($$) { - my ($log_msg)= @_; + my ($tinfo, $log_msg)= @_; # Write a marker to all log files @@ -3293,6 +3293,12 @@ sub run_testcase_mark_logs($) mtr_tofile($mysqld->{path_myerr}, $log_msg); } + if ( $tinfo->{'component_id'} eq 'im') + { + mtr_tofile($instance_manager->{path_err}, $log_msg); + mtr_tofile($instance_manager->{path_log}, $log_msg); + } + # ndbcluster log file mtr_tofile($path_ndb_testrun_log, $log_msg); @@ -3419,7 +3425,7 @@ sub run_testcase ($) { } # Write to all log files to indicate start of testcase - run_testcase_mark_logs("CURRENT_TEST: $tinfo->{name}\n"); + run_testcase_mark_logs($tinfo, "CURRENT_TEST: $tinfo->{name}\n"); my $died= mtr_record_dead_children(); if ($died or $master_restart or $slave_restart) @@ -3493,7 +3499,7 @@ sub run_testcase ($) { # Stop Instance Manager if we are processing an IM-test case. # ---------------------------------------------------------------------- if ( $tinfo->{'component_id'} eq 'im' and - !mtr_im_stop($instance_manager, $tinfo->{'name'}) ) + !mtr_im_stop($instance_manager, $tinfo->{'name'})) { mtr_error("Failed to stop Instance Manager.") } diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result index 60fba96fb6a..28ddbaf33a0 100644 --- a/mysql-test/r/rpl_log_pos.result +++ b/mysql-test/r/rpl_log_pos.result @@ -27,7 +27,7 @@ change master to master_log_pos=178; start slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 178 # # master-bin.000001 No Yes 0 0 178 # None 0 No # No +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 178 # # master-bin.000001 # Yes 0 0 178 # None 0 No # No show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 106 <Binlog_Ignore_DB> diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 121d0dabf3c..dc949df6795 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -12,6 +12,7 @@ user_limits : Bug#23921 random failure of user_limits.test im_options : Bug#20294 2006-07-24 stewart Instance manager test im_options fails randomly +im_life_cycle : BUG#27851 Instance manager dies on ASSERT in ~Thread_registry() or from not being able to close a mysqld instance. concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog diff --git a/mysql-test/t/myisam-system.test b/mysql-test/t/myisam-system.test index 43fbaabf698..c4a7651ac7d 100644 --- a/mysql-test/t/myisam-system.test +++ b/mysql-test/t/myisam-system.test @@ -7,14 +7,14 @@ drop table if exists t1,t2; --enable_warnings create table t1 (a int) engine=myisam; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI drop table if exists t1; create table t1 (a int) engine=myisam; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI --error 1051,6 drop table t1; create table t1 (a int) engine=myisam; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYD ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD --error 1105,6,29 drop table t1; --error 1051 diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test index 7424687cd8a..06d47693c10 100644 --- a/mysql-test/t/ndb_autodiscover.test +++ b/mysql-test/t/ndb_autodiscover.test @@ -24,7 +24,7 @@ create table t1( insert into t1 values(1, "Autodiscover"); flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm select * from t1; show status like 'handler_discover%'; @@ -33,13 +33,13 @@ show status like 'handler_discover%'; # flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm insert into t1 values (2, "Auto 2"); show status like 'handler_discover%'; insert into t1 values (3, "Discover 3"); show status like 'handler_discover%'; flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm select * from t1 order by id; show status like 'handler_discover%'; @@ -48,7 +48,7 @@ show status like 'handler_discover%'; # flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm update t1 set name="Autodiscover" where id = 2; show status like 'handler_discover%'; select * from t1 order by id; @@ -59,7 +59,7 @@ show status like 'handler_discover%'; # flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm delete from t1 where id = 3; select * from t1 order by id; show status like 'handler_discover%'; @@ -111,7 +111,7 @@ show status like 'handler_discover%'; flush tables; # Remove the frm file from disk -system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm --error 1050 create table t3( @@ -168,14 +168,14 @@ show status like 'handler_discover%'; # Remove the frm file from disk flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm show tables from test; show status like 'handler_discover%'; # Remove the frm file from disk again flush tables; -system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm --replace_column 6 # 7 # 8 # 9 # 12 # 13 # 15 # 18 # show table status; @@ -290,8 +290,8 @@ insert into t9 values (9); system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 >> $NDB_TOOLS_OUTPUT ; system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >> $NDB_TOOLS_OUTPUT ; # Remove t6, t7 from disk -system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ; -system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm +--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm SHOW TABLES; @@ -332,8 +332,8 @@ insert into t9 values (9); system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ; system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ; # Remove t6, t7 from disk -system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ; -system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm +--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm SHOW TABLES LIKE 't6'; @@ -375,9 +375,9 @@ insert into t3 values (3, "ndb table 3"); insert into t4 values (4); # Remove t1, t2, t3 from disk -system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm > /dev/null ; -system rm $MYSQLTEST_VARDIR/master-data/test/t2.frm > /dev/null ; -system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm > /dev/null ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm +--remove_file $MYSQLTEST_VARDIR/master-data/test/t2.frm +--remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm flush tables; # Select from the table which only exists in NDB. @@ -530,7 +530,7 @@ CREATE TABLE t9 ( insert t9 values(1, 2), (2,3), (3, 4), (4, 5); #Don't drop the table, instead remove the frm file -system rm $MYSQLTEST_VARDIR/master-data/test/t9.frm ; +--remove_file $MYSQLTEST_VARDIR/master-data/test/t9.frm # Now leave test case, when ndb_autodiscover2 will run, this # MySQL Server will have been restarted because it has a diff --git a/mysql-test/t/ndb_loaddatalocal.test b/mysql-test/t/ndb_loaddatalocal.test index 47054ecfbf5..3eae3891f43 100644 --- a/mysql-test/t/ndb_loaddatalocal.test +++ b/mysql-test/t/ndb_loaddatalocal.test @@ -25,7 +25,7 @@ create table t1(a int) engine=ndb; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; select count(*) from t1; -system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile ; +--remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile drop table t1; create table t1(a int) engine=myisam; @@ -37,7 +37,7 @@ drop table t1; create table t1(a int primary key) engine=ndb; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; -system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile; +--remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile select * from t1 order by a; drop table t1; @@ -50,7 +50,7 @@ drop table t1; create table t1(a int primary key) engine=ndb; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; -system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile; +--remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile select * from t1 order by a; drop table t1; @@ -63,7 +63,7 @@ drop table t1; create table t1(a int primary key) engine=ndb; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; -system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile; +--remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile select * from t1 order by a; drop table t1; diff --git a/mysql-test/t/rpl_loaddatalocal.test b/mysql-test/t/rpl_loaddatalocal.test index 758ac94af24..b10603e7195 100644 --- a/mysql-test/t/rpl_loaddatalocal.test +++ b/mysql-test/t/rpl_loaddatalocal.test @@ -25,7 +25,7 @@ eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.sele truncate table t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1; -system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ; +--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile save_master_pos; connection slave; sync_with_master; @@ -52,7 +52,7 @@ drop table t1; create table t1(a int primary key); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1; -system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ; +--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile SELECT * FROM t1 ORDER BY a; save_master_pos; connection slave; diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test index ec1c83a9718..b98d89c1dc3 100644 --- a/mysql-test/t/rpl_log_pos.test +++ b/mysql-test/t/rpl_log_pos.test @@ -37,7 +37,7 @@ change master to master_log_pos=178; start slave; sleep 2; --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 8 # 9 # 23 # 33 # +--replace_column 1 # 8 # 9 # 11 # 23 # 33 # show slave status; connection master; --replace_column 3 <Binlog_Ignore_DB> diff --git a/mysql-test/t/rpl_misc_functions.test b/mysql-test/t/rpl_misc_functions.test index f00beff583a..db9b557baad 100644 --- a/mysql-test/t/rpl_misc_functions.test +++ b/mysql-test/t/rpl_misc_functions.test @@ -99,5 +99,5 @@ DROP TABLE IF EXISTS t1; --sync_slave_with_master # If all is good, when can cleanup our dump files. ---system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql ---system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql +--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql +--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql diff --git a/mysql-test/t/rpl_rbr_to_sbr.test b/mysql-test/t/rpl_rbr_to_sbr.test index 4def515eb13..4f72996671d 100644 --- a/mysql-test/t/rpl_rbr_to_sbr.test +++ b/mysql-test/t/rpl_rbr_to_sbr.test @@ -43,5 +43,5 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql $MYSQLTEST_VARDIR/tmp # If all is good, we can remove the files -system rm $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql; -system rm $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql; +--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql +--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql diff --git a/mysql-test/t/rpl_row_NOW.test b/mysql-test/t/rpl_row_NOW.test index d0272b35c1f..c28b714277e 100644 --- a/mysql-test/t/rpl_row_NOW.test +++ b/mysql-test/t/rpl_row_NOW.test @@ -67,8 +67,8 @@ DROP DATABASE mysqltest1; diff_files $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave.sql; # If all is good, when can cleanup our dump files. -system rm $MYSQLTEST_VARDIR/tmp/NOW_master.sql; -system rm $MYSQLTEST_VARDIR/tmp/NOW_slave.sql; +--remove_file $MYSQLTEST_VARDIR/tmp/NOW_master.sql +--remove_file $MYSQLTEST_VARDIR/tmp/NOW_slave.sql sync_slave_with_master; # End of 5.1 test case diff --git a/mysql-test/t/rpl_row_sp001.test b/mysql-test/t/rpl_row_sp001.test index c6fc29e3750..c12e73b6861 100644 --- a/mysql-test/t/rpl_row_sp001.test +++ b/mysql-test/t/rpl_row_sp001.test @@ -140,7 +140,7 @@ sync_slave_with_master; diff_files $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_slave.sql; # If all is good, when can cleanup our dump files. -system rm $MYSQLTEST_VARDIR/tmp/sp001_master.sql; -system rm $MYSQLTEST_VARDIR/tmp/sp001_slave.sql; +--remove_file $MYSQLTEST_VARDIR/tmp/sp001_master.sql +--remove_file $MYSQLTEST_VARDIR/tmp/sp001_slave.sql # End of 5.0 test case diff --git a/mysql-test/t/rpl_row_sp011.test b/mysql-test/t/rpl_row_sp011.test index fb87249d93c..25c2fc9ad26 100644 --- a/mysql-test/t/rpl_row_sp011.test +++ b/mysql-test/t/rpl_row_sp011.test @@ -105,7 +105,7 @@ sync_slave_with_master; diff_files $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_slave.sql; # If all is good, when can cleanup our dump files. -system rm $MYSQLTEST_VARDIR/tmp/sp011_master.sql; -system rm $MYSQLTEST_VARDIR/tmp/sp011_slave.sql; +--remove_file $MYSQLTEST_VARDIR/tmp/sp011_master.sql +--remove_file $MYSQLTEST_VARDIR/tmp/sp011_slave.sql # End of 5.0 test case diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 91832ee8af4..60e680c63f3 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -392,7 +392,8 @@ SHOW TABLE STATUS like 't1'; --error 1033 show create table t1; drop table if exists t1; -system rm -f $MYSQLTEST_VARDIR/master-data/test/t1.frm ; +--error 1,0 +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm # # BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index 5a0ac7b87f7..edf1be1b2b6 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -330,8 +330,6 @@ void free_root(MEM_ROOT *root, myf MyFlags) DBUG_ENTER("free_root"); DBUG_PRINT("enter",("root: 0x%lx flags: %u", (long) root, (uint) MyFlags)); - if (!root) /* QQ: Should be deleted */ - DBUG_VOID_RETURN; /* purecov: inspected */ if (MyFlags & MY_MARK_BLOCKS_FREE) { mark_blocks_free(root); diff --git a/server-tools/instance-manager/log.cc b/server-tools/instance-manager/log.cc index 145f99db521..9f276523e49 100644 --- a/server-tools/instance-manager/log.cc +++ b/server-tools/instance-manager/log.cc @@ -134,7 +134,10 @@ void log_init() /* The function is intended to log error messages. It precedes a message - with date, time and [ERROR] tag and print it to the stderr. + with date, time and [ERROR] tag and print it to the stderr and stdout. + + We want to print it on stdout to be able to know in which context we got the + error SYNOPSIS log_error() @@ -146,7 +149,10 @@ void log_error(const char *format, ...) { va_list args; va_start(args, format); + log(stdout, "ERROR", format, args); + fflush(stdout); log(stderr, "ERROR", format, args); + fflush(stderr); va_end(args); } diff --git a/server-tools/instance-manager/thread_registry.cc b/server-tools/instance-manager/thread_registry.cc index f3a67c5e127..700ed22afe7 100644 --- a/server-tools/instance-manager/thread_registry.cc +++ b/server-tools/instance-manager/thread_registry.cc @@ -18,12 +18,9 @@ #endif #include "thread_registry.h" - -#include <my_global.h> #include <thr_alarm.h> - #include <signal.h> - +#include "log.h" #ifndef __WIN__ /* Kick-off signal handler */ @@ -67,6 +64,8 @@ Thread_registry::~Thread_registry() /* Check that no one uses the repository. */ pthread_mutex_lock(&LOCK_thread_registry); + if (head.next != &head) + log_error("Not all threads died properly\n"); /* All threads must unregister */ DBUG_ASSERT(head.next == &head); diff --git a/sql-common/client.c b/sql-common/client.c index d6fd98a1ed2..2c09498d8f4 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -2604,7 +2604,7 @@ static void mysql_close_free(MYSQL *mysql) */ void mysql_detach_stmt_list(LIST **stmt_list __attribute__((unused)), - const char *func_name) + const char *func_name __attribute__((unused))) { #ifdef MYSQL_CLIENT /* Reset connection handle in all prepared statements. */ @@ -2828,6 +2828,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql) result->field_count= mysql->field_count; /* The rest of result members is bzeroed in malloc */ mysql->fields=0; /* fields is now in result */ + clear_alloc_root(&mysql->field_alloc); /* just in case this was mistakenly called after mysql_stmt_execute() */ mysql->unbuffered_fetch_owner= 0; DBUG_RETURN(result); /* Data fetched */ @@ -2877,6 +2878,7 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql) result->handle= mysql; result->current_row= 0; mysql->fields=0; /* fields is now in result */ + clear_alloc_root(&mysql->field_alloc); mysql->status=MYSQL_STATUS_USE_RESULT; mysql->unbuffered_fetch_owner= &result->unbuffered_fetch_cancelled; DBUG_RETURN(result); /* Data is read to be fetched */ diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 9721b877e01..8a3675483ef 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -133,7 +133,7 @@ static uint ndbcluster_alter_table_flags(uint flags) } static int ndbcluster_inited= 0; -static int ndbcluster_terminating= 0; +int ndbcluster_terminating= 0; static Ndb* g_ndb= NULL; Ndb_cluster_connection* g_ndb_cluster_connection= NULL; diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index fe79135a47d..72e03fc2edd 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -1004,4 +1004,6 @@ void ndbcluster_print_error(int error, const NdbOperation *error_op); static const char ndbcluster_hton_name[]= "ndbcluster"; static const int ndbcluster_hton_name_length=sizeof(ndbcluster_hton_name)-1; - +extern int ndbcluster_terminating; +extern int ndb_util_thread_running; +extern pthread_cond_t COND_ndb_util_ready; diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 1c5db73ef6e..95b72cba64a 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -582,10 +582,30 @@ static int ndbcluster_binlog_end(THD *thd) ndbcluster_binlog_inited= 0; #ifdef HAVE_NDB_BINLOG + if (ndb_util_thread_running > 0) + { + /* + Wait for util thread to die (as this uses the injector mutex) + There is a very small change that ndb_util_thread dies and the + following mutex is freed before it's accessed. This shouldn't + however be a likely case as the ndbcluster_binlog_end is supposed to + be called before ndb_cluster_end(). + */ + pthread_mutex_lock(&LOCK_ndb_util_thread); + /* Ensure mutex are not freed if ndb_cluster_end is running at same time */ + ndb_util_thread_running++; + ndbcluster_terminating= 1; + pthread_cond_signal(&COND_ndb_util_thread); + while (ndb_util_thread_running > 1) + pthread_cond_wait(&COND_ndb_util_ready, &LOCK_ndb_util_thread); + ndb_util_thread_running--; + pthread_mutex_unlock(&LOCK_ndb_util_thread); + } + /* wait for injector thread to finish */ ndbcluster_binlog_terminating= 1; - pthread_cond_signal(&injector_cond); pthread_mutex_lock(&injector_mutex); + pthread_cond_signal(&injector_cond); while (ndb_binlog_thread_running > 0) pthread_cond_wait(&injector_cond, &injector_mutex); pthread_mutex_unlock(&injector_mutex); |