Skip to content

Commit 37bf41a

Browse files
author
guilhem@mysql.com
committed
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
2 parents 20b6051 + 88e00cd commit 37bf41a

File tree

4 files changed

+35
-12
lines changed

4 files changed

+35
-12
lines changed

client/mysqlbinlog.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -723,8 +723,8 @@ static int dump_remote_log_entries(const char* logname)
723723
*/
724724
if (old_off)
725725
old_off+= len-1;
726-
else
727-
old_off= BIN_LOG_HEADER_SIZE;
726+
else // first event, so it's a fake Rotate event
727+
old_off= position;
728728
}
729729
return 0;
730730
}

mysql-test/r/rpl_drop.result

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
slave stop;
2+
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
3+
reset master;
4+
reset slave;
5+
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
6+
slave start;
7+
drop table if exists t1, t2;
8+
create table t1 (a int);
9+
drop table t1, t2;
10+
Unknown table 't2'

mysql-test/t/rpl_drop.test

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Testcase for BUG#4552 (DROP on two tables, one of which does not
2+
# exist, must be binlogged with a non-zero error code)
3+
source include/master-slave.inc;
4+
drop table if exists t1, t2;
5+
create table t1 (a int);
6+
--error 1051;
7+
drop table t1, t2;
8+
save_master_pos;
9+
connection slave;
10+
sync_with_master;

sql/sql_table.cc

+13-10
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,17 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
230230
wrong_tables.append(String(table->real_name));
231231
}
232232
}
233+
234+
error= 0;
235+
if (wrong_tables.length())
236+
{
237+
if (!foreign_key_error)
238+
my_error(ER_BAD_TABLE_ERROR,MYF(0),wrong_tables.c_ptr());
239+
else
240+
my_error(ER_ROW_IS_REFERENCED,MYF(0));
241+
error= 1;
242+
}
243+
233244
if (some_tables_deleted || tmp_table_deleted)
234245
{
235246
query_cache_invalidate3(thd, tables, 0);
@@ -238,7 +249,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
238249
mysql_update_log.write(thd, thd->query,thd->query_length);
239250
if (mysql_bin_log.is_open())
240251
{
241-
thd->clear_error();
252+
if (!error)
253+
thd->clear_error();
242254
Query_log_event qinfo(thd, thd->query, thd->query_length,
243255
tmp_table_deleted && !some_tables_deleted);
244256
mysql_bin_log.write(&qinfo);
@@ -247,15 +259,6 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
247259
}
248260

249261
unlock_table_names(thd, tables);
250-
error= 0;
251-
if (wrong_tables.length())
252-
{
253-
if (!foreign_key_error)
254-
my_error(ER_BAD_TABLE_ERROR,MYF(0),wrong_tables.c_ptr());
255-
else
256-
my_error(ER_ROW_IS_REFERENCED,MYF(0));
257-
error= 1;
258-
}
259262
DBUG_RETURN(error);
260263
}
261264

0 commit comments

Comments
 (0)