mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge mysql.com:/users/lthalmann/bkroot/mysql-5.1-new-rpl
into mysql.com:/users/lthalmann/bk/MERGE/mysql-5.1-merge
This commit is contained in:
@ -2134,7 +2134,9 @@ void THD::reset_sub_statement_state(Sub_statement_state *backup,
|
||||
|
||||
if ((!lex->requires_prelocking() || is_update_query(lex->sql_command)) &&
|
||||
!current_stmt_binlog_row_based)
|
||||
{
|
||||
options&= ~OPTION_BIN_LOG;
|
||||
}
|
||||
/* Disable result sets */
|
||||
client_capabilities &= ~CLIENT_MULTI_RESULTS;
|
||||
in_sub_stmt|= new_state;
|
||||
@ -2642,31 +2644,6 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end)
|
||||
|
||||
error= mysql_bin_log.flush_and_set_pending_rows_event(this, 0);
|
||||
}
|
||||
else if (stmt_end && binlog_table_maps > 0)
|
||||
{ /* there is no pending event at this point */
|
||||
/*
|
||||
If pending is null and we are going to end the statement, we
|
||||
have to write an extra, empty, binrow event so that the slave
|
||||
knows to discard the tables it has received. Otherwise, the
|
||||
table maps written this far will be included in the table maps
|
||||
for the following statement.
|
||||
|
||||
TODO: Remove the need for a dummy event altogether. It can be
|
||||
fixed if we can write table maps to a memory buffer before
|
||||
writing the first binrow event. We can then flush and clear the
|
||||
memory buffer with table map events before writing the first
|
||||
binrow event. In the event of a crash, nothing is lost since
|
||||
the table maps are only needed if there are binrow events.
|
||||
*/
|
||||
|
||||
Rows_log_event *ev=
|
||||
new Write_rows_log_event(this, 0, ~0UL, 0, FALSE);
|
||||
ev->set_flags(Rows_log_event::STMT_END_F);
|
||||
binlog_set_pending_rows_event(ev);
|
||||
|
||||
error= mysql_bin_log.flush_and_set_pending_rows_event(this, 0);
|
||||
binlog_table_maps= 0;
|
||||
}
|
||||
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
@ -2724,6 +2701,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype,
|
||||
to how you treat this.
|
||||
*/
|
||||
case THD::ROW_QUERY_TYPE:
|
||||
#ifdef HAVE_ROW_BASED_REPLICATION
|
||||
if (current_stmt_binlog_row_based)
|
||||
{
|
||||
/*
|
||||
@ -2744,6 +2722,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype,
|
||||
#endif /*HAVE_ROW_BASED_REPLICATION*/
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
/* Otherwise, we fall through */
|
||||
case THD::STMT_QUERY_TYPE:
|
||||
/*
|
||||
@ -2752,7 +2731,9 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype,
|
||||
*/
|
||||
{
|
||||
Query_log_event qinfo(this, query, query_len, is_trans, suppress_use);
|
||||
#ifdef HAVE_ROW_BASED_REPLICATION
|
||||
qinfo.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
|
||||
#endif
|
||||
/*
|
||||
Binlog table maps will be irrelevant after a Query_log_event
|
||||
(they are just removed on the slave side) so after the query
|
||||
|
Reference in New Issue
Block a user