#At file:///media/sda3/work/mysql/bzrwork/b37137/5.1-rpl/
2661 He Zhenxing 2008-08-22
BUG#37137 Func/proc calling func/proc written incorrectly to binlog
In RBL, when a function calls other functions or procedures that modifies
the same table, Table_map event of the same table was written several
times.
This patch fixed it by check if the Table_map event of given table
map id has been written before and skip writeing Table_map event of
current table map id if it has been written.
modified:
sql/handler.cc
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2008-07-21 10:01:22 +0000
+++ b/sql/handler.cc 2008-08-22 03:31:00 +0000
@@ -4399,6 +4399,7 @@ static int write_locked_table_maps(THD *
locks[0]= thd->extra_lock;
locks[1]= thd->lock;
locks[2]= thd->locked_tables;
+ table_map written_table_map= 0;
for (uint i= 0 ; i < sizeof(locks)/sizeof(*locks) ; ++i )
{
MYSQL_LOCK const *const lock= locks[i];
@@ -4412,6 +4413,12 @@ static int write_locked_table_maps(THD *
{
TABLE *const table= *table_ptr;
DBUG_PRINT("info", ("Checking table %s", table->s->table_name.str));
+
+ table_map t= (1 << table->s->table_map_id);
+ if (written_table_map & t)
+ continue;
+ written_table_map |= t;
+
if (table->current_lock == F_WRLCK &&
check_table_binlog_row_based(thd, table))
{