mirror of
https://github.com/MariaDB/server.git
synced 2025-12-03 05:41:09 +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/etc/ignore: auto-union Makefile.am: Auto merged client/mysqldump.c: Auto merged mysql-test/r/information_schema.result: Auto merged mysql-test/t/disabled.def: Auto merged sql/CMakeLists.txt: Auto merged sql/Makefile.am: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_insert.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.h: Auto merged storage/innobase/handler/ha_innodb.cc: Auto merged mysql-test/r/mysqldump.result: Restoring rpl tree mysqldump test file to main tree test files mysql-test/r/status.result: Manual merge mysql-test/t/mysqldump.test: Restoring rpl tree mysqldump test file to main tree test files
This commit is contained in:
@@ -634,6 +634,12 @@ bool THD::store_globals()
|
||||
|
||||
void THD::cleanup_after_query()
|
||||
{
|
||||
if (!in_sub_stmt) /* stored functions and triggers are a special case */
|
||||
{
|
||||
/* Forget those values, for next binlogger: */
|
||||
stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
|
||||
auto_inc_intervals_in_cur_stmt_for_binlog.empty();
|
||||
}
|
||||
if (first_successful_insert_id_in_cur_stmt > 0)
|
||||
{
|
||||
/* set what LAST_INSERT_ID() will return */
|
||||
@@ -2661,7 +2667,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);
|
||||
|
||||
/*
|
||||
@@ -2727,6 +2738,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:
|
||||
/*
|
||||
@@ -2740,25 +2766,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