summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <mats@mysql.com>2006-02-16 08:46:45 +0100
committerunknown <mats@mysql.com>2006-02-16 08:46:45 +0100
commit43fb02009924eb102ffe64dbcc4f7c0ddc1b3db7 (patch)
tree3f960f1eee8ec7454fbf52e22f645085d4b004dd /sql/sql_base.cc
parenta8158aeac013db001ad0ba4109987712efb634fb (diff)
parent2b466692095c8e6163da8af4fa6df4b19634f534 (diff)
downloadmariadb-git-43fb02009924eb102ffe64dbcc4f7c0ddc1b3db7.tar.gz
Merge mysql.com:/home/bkroot/mysql-5.1-new
into mysql.com:/home/bk/w3023-mysql-5.1-new mysql-test/extra/binlog_tests/ctype_cp932.test: Auto merged mysql-test/r/binlog_row_blackhole.result: Auto merged mysql-test/r/binlog_stm_ctype_cp932.result: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/lock.cc: Auto merged sql/log.cc: Auto merged sql/log.h: Auto merged sql/log_event.h: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.cc: Auto merged sql/parse_file.cc: Auto merged sql/slave.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_insert.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_update.cc: Auto merged sql/table.h: Auto merged sql/log_event.cc: Merge with mysql-5.1-new
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 2d6576bff8b..98dff78a09a 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1033,21 +1033,18 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived)
/* Fallthrough */
}
- /*
- For RBR: before calling close_thread_tables(), storage engines
- should autocommit. Hence if there is a a pending event, it belongs
- to a non-transactional engine, which writes directly to the table,
- and should therefore be flushed before unlocking and closing the
- tables. The test above for locked tables will not be triggered
- since RBR locks and unlocks tables on a per-event basis.
-
- TODO (WL#3023): Change the semantics so that RBR does not lock and
- unlock tables on a per-event basis.
- */
- thd->binlog_flush_pending_rows_event(true);
-
if (thd->lock)
{
+ /*
+ For RBR we flush the pending event just before we unlock all the
+ tables. This means that we are at the end of a topmost
+ statement, so we ensure that the STMT_END_F flag is set on the
+ pending event. For statements that are *inside* stored
+ functions, the pending event will not be flushed: that will be
+ handled either before writing a query log event (inside
+ binlog_query()) or when preparing a pending event.
+ */
+ thd->binlog_flush_pending_rows_event(true);
mysql_unlock_tables(thd, thd->lock);
thd->lock=0;
}
@@ -1059,7 +1056,8 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived)
saves some work in 2pc too)
see also sql_parse.cc - dispatch_command()
*/
- bzero(&thd->transaction.stmt, sizeof(thd->transaction.stmt));
+ if (!(thd->state_flags & Open_tables_state::BACKUPS_AVAIL))
+ bzero(&thd->transaction.stmt, sizeof(thd->transaction.stmt));
if (!thd->active_transaction())
thd->transaction.xid_state.xid.null();