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"
parent 455b325b
...@@ -2498,17 +2498,20 @@ void do_sync_with_master2(long offset) ...@@ -2498,17 +2498,20 @@ void do_sync_with_master2(long offset)
if (!(res= mysql_store_result(mysql))) if (!(res= mysql_store_result(mysql)))
die("mysql_store_result() returned NULL for '%s'", query_buf); die("mysql_store_result() returned NULL for '%s'", query_buf);
if (!(row= mysql_fetch_row(res))) if (!(row= mysql_fetch_row(res)))
{
mysql_free_result(res);
die("empty result in %s", query_buf); die("empty result in %s", query_buf);
}
if (!row[0]) if (!row[0])
{ {
/* /*
It may be that the slave SQL thread has not started yet, though START It may be that the slave SQL thread has not started yet, though START
SLAVE has been issued ? SLAVE has been issued ?
*/ */
mysql_free_result(res);
if (tries++ == 30) if (tries++ == 30)
die("could not sync with master ('%s' returned NULL)", query_buf); 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 */ sleep(1); /* So at most we will wait 30 seconds and make 31 tries */
mysql_free_result(res);
goto wait_for_position; goto wait_for_position;
} }
mysql_free_result(res); mysql_free_result(res);
......
...@@ -3278,9 +3278,9 @@ sub do_after_run_mysqltest($) ...@@ -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 # Write a marker to all log files
...@@ -3293,6 +3293,12 @@ sub run_testcase_mark_logs($) ...@@ -3293,6 +3293,12 @@ sub run_testcase_mark_logs($)
mtr_tofile($mysqld->{path_myerr}, $log_msg); 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 # ndbcluster log file
mtr_tofile($path_ndb_testrun_log, $log_msg); mtr_tofile($path_ndb_testrun_log, $log_msg);
...@@ -3419,7 +3425,7 @@ sub run_testcase ($) { ...@@ -3419,7 +3425,7 @@ sub run_testcase ($) {
} }
# Write to all log files to indicate start of 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(); my $died= mtr_record_dead_children();
if ($died or $master_restart or $slave_restart) if ($died or $master_restart or $slave_restart)
...@@ -3493,7 +3499,7 @@ sub run_testcase ($) { ...@@ -3493,7 +3499,7 @@ sub run_testcase ($) {
# Stop Instance Manager if we are processing an IM-test case. # Stop Instance Manager if we are processing an IM-test case.
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
if ( $tinfo->{'component_id'} eq 'im' and 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.") mtr_error("Failed to stop Instance Manager.")
} }
......
...@@ -27,7 +27,7 @@ change master to master_log_pos=178; ...@@ -27,7 +27,7 @@ change master to master_log_pos=178;
start slave; start slave;
show slave status; 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 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; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106 <Binlog_Ignore_DB> master-bin.000001 106 <Binlog_Ignore_DB>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
user_limits : Bug#23921 random failure of user_limits.test 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_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 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_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 ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
......
...@@ -7,14 +7,14 @@ drop table if exists t1,t2; ...@@ -7,14 +7,14 @@ drop table if exists t1,t2;
--enable_warnings --enable_warnings
create table t1 (a int) engine=myisam; 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; drop table if exists t1;
create table t1 (a int) engine=myisam; 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 --error 1051,6
drop table t1; drop table t1;
create table t1 (a int) engine=myisam; 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 --error 1105,6,29
drop table t1; drop table t1;
--error 1051 --error 1051
......
...@@ -24,7 +24,7 @@ create table t1( ...@@ -24,7 +24,7 @@ create table t1(
insert into t1 values(1, "Autodiscover"); insert into t1 values(1, "Autodiscover");
flush tables; flush tables;
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ; --remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
select * from t1; select * from t1;
show status like 'handler_discover%'; show status like 'handler_discover%';
...@@ -33,13 +33,13 @@ show status like 'handler_discover%'; ...@@ -33,13 +33,13 @@ show status like 'handler_discover%';
# #
flush tables; 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"); insert into t1 values (2, "Auto 2");
show status like 'handler_discover%'; show status like 'handler_discover%';
insert into t1 values (3, "Discover 3"); insert into t1 values (3, "Discover 3");
show status like 'handler_discover%'; show status like 'handler_discover%';
flush tables; 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; select * from t1 order by id;
show status like 'handler_discover%'; show status like 'handler_discover%';
...@@ -48,7 +48,7 @@ show status like 'handler_discover%'; ...@@ -48,7 +48,7 @@ show status like 'handler_discover%';
# #
flush tables; 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; update t1 set name="Autodiscover" where id = 2;
show status like 'handler_discover%'; show status like 'handler_discover%';
select * from t1 order by id; select * from t1 order by id;
...@@ -59,7 +59,7 @@ show status like 'handler_discover%'; ...@@ -59,7 +59,7 @@ show status like 'handler_discover%';
# #
flush tables; 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; delete from t1 where id = 3;
select * from t1 order by id; select * from t1 order by id;
show status like 'handler_discover%'; show status like 'handler_discover%';
...@@ -111,7 +111,7 @@ show status like 'handler_discover%'; ...@@ -111,7 +111,7 @@ show status like 'handler_discover%';
flush tables; flush tables;
# Remove the frm file from disk # 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 --error 1050
create table t3( create table t3(
...@@ -168,14 +168,14 @@ show status like 'handler_discover%'; ...@@ -168,14 +168,14 @@ show status like 'handler_discover%';
# Remove the frm file from disk # Remove the frm file from disk
flush tables; 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 tables from test;
show status like 'handler_discover%'; show status like 'handler_discover%';
# Remove the frm file from disk again # Remove the frm file from disk again
flush tables; 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 # --replace_column 6 # 7 # 8 # 9 # 12 # 13 # 15 # 18 #
show table status; show table status;
...@@ -290,8 +290,8 @@ insert into t9 values (9); ...@@ -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 t3 >> $NDB_TOOLS_OUTPUT ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >> $NDB_TOOLS_OUTPUT ; system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >> $NDB_TOOLS_OUTPUT ;
# Remove t6, t7 from disk # Remove t6, t7 from disk
system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ; --remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm
system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ; --remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
SHOW TABLES; SHOW TABLES;
...@@ -332,8 +332,8 @@ insert into t9 values (9); ...@@ -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 t3 > /dev/null ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ; system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
# Remove t6, t7 from disk # Remove t6, t7 from disk
system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ; --remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm
system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ; --remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
SHOW TABLES LIKE 't6'; SHOW TABLES LIKE 't6';
...@@ -375,9 +375,9 @@ insert into t3 values (3, "ndb table 3"); ...@@ -375,9 +375,9 @@ insert into t3 values (3, "ndb table 3");
insert into t4 values (4); insert into t4 values (4);
# Remove t1, t2, t3 from disk # Remove t1, t2, t3 from disk
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm > /dev/null ; --remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
system rm $MYSQLTEST_VARDIR/master-data/test/t2.frm > /dev/null ; --remove_file $MYSQLTEST_VARDIR/master-data/test/t2.frm
system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm > /dev/null ; --remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm
flush tables; flush tables;
# Select from the table which only exists in NDB. # Select from the table which only exists in NDB.
...@@ -530,7 +530,7 @@ CREATE TABLE t9 ( ...@@ -530,7 +530,7 @@ CREATE TABLE t9 (
insert t9 values(1, 2), (2,3), (3, 4), (4, 5); insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
#Don't drop the table, instead remove the frm file #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 # Now leave test case, when ndb_autodiscover2 will run, this
# MySQL Server will have been restarted because it has a # MySQL Server will have been restarted because it has a
......
...@@ -25,7 +25,7 @@ create table t1(a int) engine=ndb; ...@@ -25,7 +25,7 @@ create table t1(a int) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
select count(*) from 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; drop table t1;
create table t1(a int) engine=myisam; create table t1(a int) engine=myisam;
...@@ -37,7 +37,7 @@ drop table t1; ...@@ -37,7 +37,7 @@ drop table t1;
create table t1(a int primary key) engine=ndb; create table t1(a int primary key) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; 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; select * from t1 order by a;
drop table t1; drop table t1;
...@@ -50,7 +50,7 @@ drop table t1; ...@@ -50,7 +50,7 @@ drop table t1;
create table t1(a int primary key) engine=ndb; create table t1(a int primary key) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; 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; select * from t1 order by a;
drop table t1; drop table t1;
...@@ -63,7 +63,7 @@ drop table t1; ...@@ -63,7 +63,7 @@ drop table t1;
create table t1(a int primary key) engine=ndb; create table t1(a int primary key) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1; 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; select * from t1 order by a;
drop table t1; drop table t1;
......
...@@ -25,7 +25,7 @@ eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.sele ...@@ -25,7 +25,7 @@ eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.sele
truncate table t1; truncate table t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1; 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; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
...@@ -52,7 +52,7 @@ drop table t1; ...@@ -52,7 +52,7 @@ drop table t1;
create table t1(a int primary key); create table t1(a int primary key);
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1; 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; SELECT * FROM t1 ORDER BY a;
save_master_pos; save_master_pos;
connection slave; connection slave;
......
...@@ -37,7 +37,7 @@ change master to master_log_pos=178; ...@@ -37,7 +37,7 @@ change master to master_log_pos=178;
start slave; start slave;
sleep 2; sleep 2;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 8 # 9 # 11 # 23 # 33 #
show slave status; show slave status;
connection master; connection master;
--replace_column 3 <Binlog_Ignore_DB> --replace_column 3 <Binlog_Ignore_DB>
......
...@@ -99,5 +99,5 @@ DROP TABLE IF EXISTS t1; ...@@ -99,5 +99,5 @@ DROP TABLE IF EXISTS t1;
--sync_slave_with_master --sync_slave_with_master
# If all is good, when can cleanup our dump files. # If all is good, when can cleanup our dump files.
--system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql --remove_file $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql
--system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql --remove_file $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql
...@@ -43,5 +43,5 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql $MYSQLTEST_VARDIR/tmp ...@@ -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 # If all is good, we can remove the files
system rm $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql; --remove_file $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_slave.sql
...@@ -67,8 +67,8 @@ DROP DATABASE mysqltest1; ...@@ -67,8 +67,8 @@ DROP DATABASE mysqltest1;
diff_files $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave.sql; diff_files $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave.sql;
# If all is good, when can cleanup our dump files. # If all is good, when can cleanup our dump files.
system rm $MYSQLTEST_VARDIR/tmp/NOW_master.sql; --remove_file $MYSQLTEST_VARDIR/tmp/NOW_master.sql
system rm $MYSQLTEST_VARDIR/tmp/NOW_slave.sql; --remove_file $MYSQLTEST_VARDIR/tmp/NOW_slave.sql
sync_slave_with_master; sync_slave_with_master;
# End of 5.1 test case # End of 5.1 test case
...@@ -140,7 +140,7 @@ sync_slave_with_master; ...@@ -140,7 +140,7 @@ sync_slave_with_master;
diff_files $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_slave.sql; diff_files $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
# If all is good, when can cleanup our dump files. # If all is good, when can cleanup our dump files.
system rm $MYSQLTEST_VARDIR/tmp/sp001_master.sql; --remove_file $MYSQLTEST_VARDIR/tmp/sp001_master.sql
system rm $MYSQLTEST_VARDIR/tmp/sp001_slave.sql; --remove_file $MYSQLTEST_VARDIR/tmp/sp001_slave.sql
# End of 5.0 test case # End of 5.0 test case
...@@ -105,7 +105,7 @@ sync_slave_with_master; ...@@ -105,7 +105,7 @@ sync_slave_with_master;
diff_files $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_slave.sql; diff_files $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_slave.sql;
# If all is good, when can cleanup our dump files. # If all is good, when can cleanup our dump files.
system rm $MYSQLTEST_VARDIR/tmp/sp011_master.sql; --remove_file $MYSQLTEST_VARDIR/tmp/sp011_master.sql
system rm $MYSQLTEST_VARDIR/tmp/sp011_slave.sql; --remove_file $MYSQLTEST_VARDIR/tmp/sp011_slave.sql
# End of 5.0 test case # End of 5.0 test case
...@@ -392,7 +392,8 @@ SHOW TABLE STATUS like 't1'; ...@@ -392,7 +392,8 @@ SHOW TABLE STATUS like 't1';
--error 1033 --error 1033
show create table t1; show create table t1;
drop table if exists 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 # BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar
......
...@@ -330,8 +330,6 @@ void free_root(MEM_ROOT *root, myf MyFlags) ...@@ -330,8 +330,6 @@ void free_root(MEM_ROOT *root, myf MyFlags)
DBUG_ENTER("free_root"); DBUG_ENTER("free_root");
DBUG_PRINT("enter",("root: 0x%lx flags: %u", (long) root, (uint) MyFlags)); 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) if (MyFlags & MY_MARK_BLOCKS_FREE)
{ {
mark_blocks_free(root); mark_blocks_free(root);
......
...@@ -134,7 +134,10 @@ void log_init() ...@@ -134,7 +134,10 @@ void log_init()
/* /*
The function is intended to log error messages. It precedes a message 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 SYNOPSIS
log_error() log_error()
...@@ -146,7 +149,10 @@ void log_error(const char *format, ...) ...@@ -146,7 +149,10 @@ void log_error(const char *format, ...)
{ {
va_list args; va_list args;
va_start(args, format); va_start(args, format);
log(stdout, "ERROR", format, args);
fflush(stdout);
log(stderr, "ERROR", format, args); log(stderr, "ERROR", format, args);
fflush(stderr);
va_end(args); va_end(args);
} }
......
...@@ -18,12 +18,9 @@ ...@@ -18,12 +18,9 @@
#endif #endif
#include "thread_registry.h" #include "thread_registry.h"
#include <my_global.h>
#include <thr_alarm.h> #include <thr_alarm.h>
#include <signal.h> #include <signal.h>
#include "log.h"
#ifndef __WIN__ #ifndef __WIN__
/* Kick-off signal handler */ /* Kick-off signal handler */
...@@ -67,6 +64,8 @@ Thread_registry::~Thread_registry() ...@@ -67,6 +64,8 @@ Thread_registry::~Thread_registry()
/* Check that no one uses the repository. */ /* Check that no one uses the repository. */
pthread_mutex_lock(&LOCK_thread_registry); pthread_mutex_lock(&LOCK_thread_registry);
if (head.next != &head)
log_error("Not all threads died properly\n");
/* All threads must unregister */ /* All threads must unregister */
DBUG_ASSERT(head.next == &head); DBUG_ASSERT(head.next == &head);
......
...@@ -2604,7 +2604,7 @@ static void mysql_close_free(MYSQL *mysql) ...@@ -2604,7 +2604,7 @@ static void mysql_close_free(MYSQL *mysql)
*/ */
void mysql_detach_stmt_list(LIST **stmt_list __attribute__((unused)), void mysql_detach_stmt_list(LIST **stmt_list __attribute__((unused)),
const char *func_name) const char *func_name __attribute__((unused)))
{ {
#ifdef MYSQL_CLIENT #ifdef MYSQL_CLIENT
/* Reset connection handle in all prepared statements. */ /* Reset connection handle in all prepared statements. */
...@@ -2828,6 +2828,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql) ...@@ -2828,6 +2828,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql)
result->field_count= mysql->field_count; result->field_count= mysql->field_count;
/* The rest of result members is bzeroed in malloc */ /* The rest of result members is bzeroed in malloc */
mysql->fields=0; /* fields is now in result */ 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() */ /* just in case this was mistakenly called after mysql_stmt_execute() */
mysql->unbuffered_fetch_owner= 0; mysql->unbuffered_fetch_owner= 0;
DBUG_RETURN(result); /* Data fetched */ DBUG_RETURN(result); /* Data fetched */
...@@ -2877,6 +2878,7 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql) ...@@ -2877,6 +2878,7 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql)
result->handle= mysql; result->handle= mysql;
result->current_row= 0; result->current_row= 0;
mysql->fields=0; /* fields is now in result */ mysql->fields=0; /* fields is now in result */
clear_alloc_root(&mysql->field_alloc);
mysql->status=MYSQL_STATUS_USE_RESULT; mysql->status=MYSQL_STATUS_USE_RESULT;
mysql->unbuffered_fetch_owner= &result->unbuffered_fetch_cancelled; mysql->unbuffered_fetch_owner= &result->unbuffered_fetch_cancelled;
DBUG_RETURN(result); /* Data is read to be fetched */ DBUG_RETURN(result); /* Data is read to be fetched */
......
...@@ -133,7 +133,7 @@ static uint ndbcluster_alter_table_flags(uint flags) ...@@ -133,7 +133,7 @@ static uint ndbcluster_alter_table_flags(uint flags)
} }
static int ndbcluster_inited= 0; static int ndbcluster_inited= 0;
static int ndbcluster_terminating= 0; int ndbcluster_terminating= 0;
static Ndb* g_ndb= NULL; static Ndb* g_ndb= NULL;
Ndb_cluster_connection* g_ndb_cluster_connection= NULL; Ndb_cluster_connection* g_ndb_cluster_connection= NULL;
......
...@@ -1004,4 +1004,6 @@ void ndbcluster_print_error(int error, const NdbOperation *error_op); ...@@ -1004,4 +1004,6 @@ void ndbcluster_print_error(int error, const NdbOperation *error_op);
static const char ndbcluster_hton_name[]= "ndbcluster"; static const char ndbcluster_hton_name[]= "ndbcluster";
static const int ndbcluster_hton_name_length=sizeof(ndbcluster_hton_name)-1; 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;
...@@ -582,10 +582,30 @@ static int ndbcluster_binlog_end(THD *thd) ...@@ -582,10 +582,30 @@ static int ndbcluster_binlog_end(THD *thd)
ndbcluster_binlog_inited= 0; ndbcluster_binlog_inited= 0;
#ifdef HAVE_NDB_BINLOG #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 */ /* wait for injector thread to finish */
ndbcluster_binlog_terminating= 1; ndbcluster_binlog_terminating= 1;
pthread_cond_signal(&injector_cond);
pthread_mutex_lock(&injector_mutex); pthread_mutex_lock(&injector_mutex);
pthread_cond_signal(&injector_cond);
while (ndb_binlog_thread_running > 0) while (ndb_binlog_thread_running > 0)
pthread_cond_wait(&injector_cond, &injector_mutex); pthread_cond_wait(&injector_cond, &injector_mutex);
pthread_mutex_unlock(&injector_mutex); pthread_mutex_unlock(&injector_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment