mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Merge mysql.com:/users/lthalmann/bkroot/mysql-5.1-new-rpl
into mysql.com:/users/lthalmann/bk/MERGE/mysql-5.1-merge BitKeeper/deleted/.del-rpl_heap.test: Auto merged Makefile.am: Auto merged mysql-test/extra/binlog_tests/binlog.test: Auto merged mysql-test/r/binlog_stm_binlog.result: Auto merged mysql-test/r/rpl_switch_stm_row_mixed.result: Auto merged mysql-test/t/date_formats.test: Auto merged mysql-test/t/mysqlbinlog.test: Auto merged mysql-test/t/rpl_trigger.test: Auto merged sql/CMakeLists.txt: Auto merged sql/Makefile.am: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_insert.cc: Auto merged storage/innobase/handler/ha_innodb.cc: Auto merged unittest/README.txt: Auto merged unittest/unit.pl: Auto merged mysql-test/t/disabled.def: Merge (main -> rpl 5.1)
This commit is contained in:
@@ -2660,7 +2660,12 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans,
|
||||
int THD::binlog_flush_pending_rows_event(bool stmt_end)
|
||||
{
|
||||
DBUG_ENTER("THD::binlog_flush_pending_rows_event");
|
||||
if (!current_stmt_binlog_row_based || !mysql_bin_log.is_open())
|
||||
/*
|
||||
We shall flush the pending event even if we are not in row-based
|
||||
mode: it might be the case that we left row-based mode before
|
||||
flushing anything (e.g., if we have explicitly locked tables).
|
||||
*/
|
||||
if (!mysql_bin_log.is_open())
|
||||
DBUG_RETURN(0);
|
||||
|
||||
/*
|
||||
@@ -2726,6 +2731,21 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype,
|
||||
DBUG_PRINT("enter", ("qtype=%d, query='%s'", qtype, query));
|
||||
DBUG_ASSERT(query && mysql_bin_log.is_open());
|
||||
|
||||
/*
|
||||
If we are not in prelocked mode, mysql_unlock_tables() will be
|
||||
called after this binlog_query(), so we have to flush the pending
|
||||
rows event with the STMT_END_F set to unlock all tables at the
|
||||
slave side as well.
|
||||
|
||||
If we are in prelocked mode, the flushing will be done inside the
|
||||
top-most close_thread_tables().
|
||||
*/
|
||||
#ifdef HAVE_ROW_BASED_REPLICATION
|
||||
if (this->prelocked_mode == NON_PRELOCKED)
|
||||
if (int error= binlog_flush_pending_rows_event(TRUE))
|
||||
DBUG_RETURN(error);
|
||||
#endif /*HAVE_ROW_BASED_REPLICATION*/
|
||||
|
||||
switch (qtype) {
|
||||
case THD::MYSQL_QUERY_TYPE:
|
||||
/*
|
||||
@@ -2739,25 +2759,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype,
|
||||
case THD::ROW_QUERY_TYPE:
|
||||
#ifdef HAVE_ROW_BASED_REPLICATION
|
||||
if (current_stmt_binlog_row_based)
|
||||
{
|
||||
/*
|
||||
If thd->lock is set, then we are not inside a stored function.
|
||||
In that case, mysql_unlock_tables() will be called after this
|
||||
binlog_query(), so we have to flush the pending rows event
|
||||
with the STMT_END_F set to unlock all tables at the slave side
|
||||
as well.
|
||||
|
||||
We will not flush the pending event, if thd->lock is NULL.
|
||||
This means that we are inside a stored function or trigger, so
|
||||
the flushing will be done inside the top-most
|
||||
close_thread_tables().
|
||||
*/
|
||||
#ifdef HAVE_ROW_BASED_REPLICATION
|
||||
if (this->lock)
|
||||
DBUG_RETURN(binlog_flush_pending_rows_event(TRUE));
|
||||
#endif /*HAVE_ROW_BASED_REPLICATION*/
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
/* Otherwise, we fall through */
|
||||
case THD::STMT_QUERY_TYPE:
|
||||
|
||||
Reference in New Issue
Block a user