Commit af67056f authored by Luis Soares's avatar Luis Soares

Manual merge from mysql-next-mr bug branch.

Conflicts
=========
  Text conflict in sql/sql_base.cc
parents 7f83359a f4f4a2c7
...@@ -744,8 +744,9 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY' ...@@ -744,8 +744,9 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=3 master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(2)) master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 3 */; select count(*) from t1 /* must be 3 */;
count(*) count(*)
...@@ -761,8 +762,9 @@ count(*) ...@@ -761,8 +762,9 @@ count(*)
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=4 master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Query # # use `test`; delete from t2 where a=bug27417(3) master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 5 */; select count(*) from t1 /* must be 5 */;
count(*) count(*)
...@@ -784,6 +786,10 @@ insert into t2 values (bug27417(1)); ...@@ -784,6 +786,10 @@ insert into t2 values (bug27417(1));
ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 1 */; select count(*) from t1 /* must be 1 */;
count(*) count(*)
1 1
...@@ -795,6 +801,10 @@ insert into t2 select bug27417(1) union select bug27417(2); ...@@ -795,6 +801,10 @@ insert into t2 select bug27417(1) union select bug27417(2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY' ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 2 */; select count(*) from t1 /* must be 2 */;
count(*) count(*)
2 2
...@@ -806,8 +816,11 @@ ERROR 23000: Duplicate entry '4' for key 'b' ...@@ -806,8 +816,11 @@ ERROR 23000: Duplicate entry '4' for key 'b'
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=4 master-bin.000001 # Table_map # # table_id: # (test.t3)
master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1) master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 2 */; select count(*) from t1 /* must be 2 */;
count(*) count(*)
...@@ -821,6 +834,10 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ...@@ -821,6 +834,10 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY' ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 4 */; select count(*) from t1 /* must be 4 */;
count(*) count(*)
4 4
...@@ -834,7 +851,7 @@ UPDATE t3,t4 SET t3.a=t4.a + bug27417(1); ...@@ -834,7 +851,7 @@ UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY' ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
select count(*) from t1 /* must be 1 */; select count(*) from t1 /* must be 1 */;
count(*) count(*)
1 2
drop table t4; drop table t4;
delete from t1; delete from t1;
delete from t2; delete from t2;
...@@ -848,6 +865,11 @@ delete from t2; ...@@ -848,6 +865,11 @@ delete from t2;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t3)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 1 */; select count(*) from t1 /* must be 1 */;
count(*) count(*)
1 1
...@@ -864,6 +886,10 @@ delete t2.* from t2,t5 where t2.a=t5.a + 1; ...@@ -864,6 +886,10 @@ delete t2.* from t2,t5 where t2.a=t5.a + 1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 1 */; select count(*) from t1 /* must be 1 */;
count(*) count(*)
1 1
...@@ -881,6 +907,10 @@ count(*) ...@@ -881,6 +907,10 @@ count(*)
2 2
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
drop trigger trg_del_t2; drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5; drop table t1,t2,t3,t4,t5;
drop function bug27417; drop function bug27417;
...@@ -1053,7 +1053,7 @@ update_timing_fields_for_event(THD *thd, ...@@ -1053,7 +1053,7 @@ update_timing_fields_for_event(THD *thd,
Turn off row binlogging of event timing updates. These are not used Turn off row binlogging of event timing updates. These are not used
for RBR of events replicated to the slave. for RBR of events replicated to the slave.
*/ */
save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
thd->clear_current_stmt_binlog_format_row(); thd->clear_current_stmt_binlog_format_row();
DBUG_ASSERT(thd->security_ctx->master_access & SUPER_ACL); DBUG_ASSERT(thd->security_ctx->master_access & SUPER_ACL);
...@@ -1097,7 +1097,9 @@ update_timing_fields_for_event(THD *thd, ...@@ -1097,7 +1097,9 @@ update_timing_fields_for_event(THD *thd,
if (table) if (table)
close_thread_tables(thd); close_thread_tables(thd);
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(test(ret)); DBUG_RETURN(test(ret));
} }
......
...@@ -335,7 +335,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, ...@@ -335,7 +335,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
Turn off row binlogging of this statement and use statement-based Turn off row binlogging of this statement and use statement-based
so that all supporting tables are updated for CREATE EVENT command. so that all supporting tables are updated for CREATE EVENT command.
*/ */
save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
thd->clear_current_stmt_binlog_format_row(); thd->clear_current_stmt_binlog_format_row();
mysql_mutex_lock(&LOCK_event_metadata); mysql_mutex_lock(&LOCK_event_metadata);
...@@ -377,7 +377,9 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, ...@@ -377,7 +377,9 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
sql_print_error("Event Error: An error occurred while creating query string, " sql_print_error("Event Error: An error occurred while creating query string, "
"before writing it into binary log."); "before writing it into binary log.");
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
/* If the definer is not set or set to CURRENT_USER, the value of CURRENT_USER /* If the definer is not set or set to CURRENT_USER, the value of CURRENT_USER
...@@ -387,7 +389,9 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, ...@@ -387,7 +389,9 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
} }
mysql_mutex_unlock(&LOCK_event_metadata); mysql_mutex_unlock(&LOCK_event_metadata);
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
...@@ -471,7 +475,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, ...@@ -471,7 +475,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
Turn off row binlogging of this statement and use statement-based Turn off row binlogging of this statement and use statement-based
so that all supporting tables are updated for UPDATE EVENT command. so that all supporting tables are updated for UPDATE EVENT command.
*/ */
save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
thd->clear_current_stmt_binlog_format_row(); thd->clear_current_stmt_binlog_format_row();
mysql_mutex_lock(&LOCK_event_metadata); mysql_mutex_lock(&LOCK_event_metadata);
...@@ -509,7 +513,9 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, ...@@ -509,7 +513,9 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
} }
mysql_mutex_unlock(&LOCK_event_metadata); mysql_mutex_unlock(&LOCK_event_metadata);
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
...@@ -570,7 +576,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists) ...@@ -570,7 +576,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
Turn off row binlogging of this statement and use statement-based so Turn off row binlogging of this statement and use statement-based so
that all supporting tables are updated for DROP EVENT command. that all supporting tables are updated for DROP EVENT command.
*/ */
save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
thd->clear_current_stmt_binlog_format_row(); thd->clear_current_stmt_binlog_format_row();
mysql_mutex_lock(&LOCK_event_metadata); mysql_mutex_lock(&LOCK_event_metadata);
...@@ -585,7 +591,9 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists) ...@@ -585,7 +591,9 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
} }
mysql_mutex_unlock(&LOCK_event_metadata); mysql_mutex_unlock(&LOCK_event_metadata);
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
......
...@@ -927,7 +927,7 @@ sp_create_routine(THD *thd, int type, sp_head *sp) ...@@ -927,7 +927,7 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
row-based replication. The flag will be reset at the end of the row-based replication. The flag will be reset at the end of the
statement. statement.
*/ */
save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
thd->clear_current_stmt_binlog_format_row(); thd->clear_current_stmt_binlog_format_row();
saved_count_cuted_fields= thd->count_cuted_fields; saved_count_cuted_fields= thd->count_cuted_fields;
...@@ -1136,7 +1136,9 @@ sp_create_routine(THD *thd, int type, sp_head *sp) ...@@ -1136,7 +1136,9 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
close_thread_tables(thd); close_thread_tables(thd);
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
...@@ -1174,7 +1176,7 @@ sp_drop_routine(THD *thd, int type, sp_name *name) ...@@ -1174,7 +1176,7 @@ sp_drop_routine(THD *thd, int type, sp_name *name)
row-based replication. The flag will be reset at the end of the row-based replication. The flag will be reset at the end of the
statement. statement.
*/ */
save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
thd->clear_current_stmt_binlog_format_row(); thd->clear_current_stmt_binlog_format_row();
if (!(table= open_proc_table_for_update(thd))) if (!(table= open_proc_table_for_update(thd)))
...@@ -1194,7 +1196,9 @@ sp_drop_routine(THD *thd, int type, sp_name *name) ...@@ -1194,7 +1196,9 @@ sp_drop_routine(THD *thd, int type, sp_name *name)
close_thread_tables(thd); close_thread_tables(thd);
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
...@@ -1233,7 +1237,7 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) ...@@ -1233,7 +1237,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 row-based replication. The flag will be reset at the end of the
statement. statement.
*/ */
save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
thd->clear_current_stmt_binlog_format_row(); thd->clear_current_stmt_binlog_format_row();
if (!(table= open_proc_table_for_update(thd))) if (!(table= open_proc_table_for_update(thd)))
...@@ -1269,7 +1273,9 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) ...@@ -1269,7 +1273,9 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
close_thread_tables(thd); close_thread_tables(thd);
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
......
This diff is collapsed.
...@@ -5180,10 +5180,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen) ...@@ -5180,10 +5180,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
*/ */
if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables && if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables &&
has_write_table_with_auto_increment(thd->lex->first_not_own_table())) has_write_table_with_auto_increment(thd->lex->first_not_own_table()))
{
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_AUTOINC_COLUMNS); thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_AUTOINC_COLUMNS);
thd->set_current_stmt_binlog_format_row_if_mixed();
}
} }
DEBUG_SYNC(thd, "before_lock_tables_takes_lock"); DEBUG_SYNC(thd, "before_lock_tables_takes_lock");
......
...@@ -1723,7 +1723,6 @@ class THD :public Statement, ...@@ -1723,7 +1723,6 @@ class THD :public Statement,
bool slave_thread, one_shot_set; bool slave_thread, one_shot_set;
/* tells if current statement should binlog row-based(1) or stmt-based(0) */ /* tells if current statement should binlog row-based(1) or stmt-based(0) */
bool current_stmt_binlog_row_based;
bool locked, some_tables_deleted; bool locked, some_tables_deleted;
bool last_cuted_field; bool last_cuted_field;
bool no_errors, password; bool no_errors, password;
......
...@@ -461,7 +461,7 @@ int mysql_create_function(THD *thd,udf_func *udf) ...@@ -461,7 +461,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
Turn off row binlogging of this statement and use statement-based Turn off row binlogging of this statement and use statement-based
so that all supporting tables are updated for CREATE FUNCTION command. so that all supporting tables are updated for CREATE FUNCTION command.
*/ */
save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
thd->clear_current_stmt_binlog_format_row(); thd->clear_current_stmt_binlog_format_row();
mysql_rwlock_wrlock(&THR_LOCK_udf); mysql_rwlock_wrlock(&THR_LOCK_udf);
...@@ -533,11 +533,15 @@ int mysql_create_function(THD *thd,udf_func *udf) ...@@ -533,11 +533,15 @@ int mysql_create_function(THD *thd,udf_func *udf)
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length())) if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
{ {
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(1); DBUG_RETURN(1);
} }
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
...@@ -545,7 +549,9 @@ int mysql_create_function(THD *thd,udf_func *udf) ...@@ -545,7 +549,9 @@ int mysql_create_function(THD *thd,udf_func *udf)
dlclose(dl); dlclose(dl);
mysql_rwlock_unlock(&THR_LOCK_udf); mysql_rwlock_unlock(&THR_LOCK_udf);
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -573,7 +579,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name) ...@@ -573,7 +579,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
Turn off row binlogging of this statement and use statement-based Turn off row binlogging of this statement and use statement-based
so that all supporting tables are updated for DROP FUNCTION command. so that all supporting tables are updated for DROP FUNCTION command.
*/ */
save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
thd->clear_current_stmt_binlog_format_row(); thd->clear_current_stmt_binlog_format_row();
mysql_rwlock_wrlock(&THR_LOCK_udf); mysql_rwlock_wrlock(&THR_LOCK_udf);
...@@ -617,16 +623,22 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name) ...@@ -617,16 +623,22 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length())) if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
{ {
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(1); DBUG_RETURN(1);
} }
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
mysql_rwlock_unlock(&THR_LOCK_udf); mysql_rwlock_unlock(&THR_LOCK_udf);
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
if (save_binlog_row_based)
thd->set_current_stmt_binlog_format_row();
DBUG_RETURN(1); DBUG_RETURN(1);
} }
......
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