1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Merging with mysql-5.1-new-rpl tree

This commit is contained in:
mats@romeo.(none)
2006-08-16 15:59:41 +02:00
4 changed files with 86 additions and 21 deletions

View File

@@ -2652,7 +2652,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);
/*
@@ -2718,6 +2723,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:
/*
@@ -2731,25 +2751,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: