mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 15:45:33 +02:00
Bug #49132 Replication failure on temporary table + DDL
In RBR, DDL statement will change binlog format to non row-based format before it is binlogged, but the binlog format was not be restored, and then manipulating a temporary table can not reset binlog format to row-based format rightly. So that the manipulated statement is binlogged with statement-based format. To fix the problem, restore the state of binlog format after the DDL statement is binlogged.
This commit is contained in:
parent
0482b6ebca
commit
25a436bdc4
11 changed files with 526 additions and 34 deletions
13
sql/sp.cc
13
sql/sp.cc
|
|
@ -896,6 +896,8 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
|
|||
|
||||
bool store_failed= FALSE;
|
||||
|
||||
bool save_binlog_row_based;
|
||||
|
||||
DBUG_ENTER("sp_create_routine");
|
||||
DBUG_PRINT("enter", ("type: %d name: %.*s",type, (int) sp->m_name.length,
|
||||
sp->m_name.str));
|
||||
|
|
@ -913,6 +915,7 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
|
|||
row-based replication. The flag will be reset at the end of the
|
||||
statement.
|
||||
*/
|
||||
save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
thd->clear_current_stmt_binlog_row_based();
|
||||
|
||||
saved_count_cuted_fields= thd->count_cuted_fields;
|
||||
|
|
@ -1118,6 +1121,8 @@ done:
|
|||
thd->variables.sql_mode= saved_mode;
|
||||
|
||||
close_thread_tables(thd);
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
|
@ -1142,6 +1147,7 @@ sp_drop_routine(THD *thd, int type, sp_name *name)
|
|||
{
|
||||
TABLE *table;
|
||||
int ret;
|
||||
bool save_binlog_row_based;
|
||||
DBUG_ENTER("sp_drop_routine");
|
||||
DBUG_PRINT("enter", ("type: %d name: %.*s",
|
||||
type, (int) name->m_name.length, name->m_name.str));
|
||||
|
|
@ -1154,6 +1160,7 @@ sp_drop_routine(THD *thd, int type, sp_name *name)
|
|||
row-based replication. The flag will be reset at the end of the
|
||||
statement.
|
||||
*/
|
||||
save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
thd->clear_current_stmt_binlog_row_based();
|
||||
|
||||
if (!(table= open_proc_table_for_update(thd)))
|
||||
|
|
@ -1171,6 +1178,8 @@ sp_drop_routine(THD *thd, int type, sp_name *name)
|
|||
}
|
||||
|
||||
close_thread_tables(thd);
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
|
@ -1197,6 +1206,7 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
|
|||
{
|
||||
TABLE *table;
|
||||
int ret;
|
||||
bool save_binlog_row_based;
|
||||
DBUG_ENTER("sp_update_routine");
|
||||
DBUG_PRINT("enter", ("type: %d name: %.*s",
|
||||
type, (int) name->m_name.length, name->m_name.str));
|
||||
|
|
@ -1208,6 +1218,7 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
|
|||
row-based replication. The flag will be reset at the end of the
|
||||
statement.
|
||||
*/
|
||||
save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
thd->clear_current_stmt_binlog_row_based();
|
||||
|
||||
if (!(table= open_proc_table_for_update(thd)))
|
||||
|
|
@ -1241,6 +1252,8 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
|
|||
}
|
||||
|
||||
close_thread_tables(thd);
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue