summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2011-01-26 15:35:03 +0100
committerunknown <knielsen@knielsen-hq.org>2011-01-26 15:35:03 +0100
commit6dbd796074a2b55410aaad3fd24192b628b990ac (patch)
tree952e514c4cff9a717d28510335286594de965e3b /sql/handler.cc
parent2cbfdfc210ac5132de7c197c99b18990ec8c954a (diff)
parent79a8e5f61ba345af4f188075f6af60dc59ffee25 (diff)
downloadmariadb-git-6dbd796074a2b55410aaad3fd24192b628b990ac.tar.gz
Merge three Percona patches into mariadb-5.2-rpl:
- MWL#47, allowing to annotate row-based binlog events with the SQL test of the originating query (eg. in mysqlbinlog output). - row_based_replication_without_primary_key.patch, providing more intelligent selection of index to use on slave when applying row-based binlog events for tables with no primary key. - Make mysqlbinlog omit redundant `use` around BEGIN/SAVEPOINT/COMMIT/ ROLLBACK in 5.0 binlogs.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index f69e576bf0b..a9084b5ff61 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -4742,7 +4742,8 @@ static bool check_table_binlog_row_based(THD *thd, TABLE *table)
/** @brief
Write table maps for all (manually or automatically) locked tables
- to the binary log.
+ to the binary log. Also, if binlog_annotate_rows_events is ON,
+ write Annotate_rows event before the first table map.
SYNOPSIS
write_locked_table_maps()
@@ -4779,6 +4780,9 @@ static int write_locked_table_maps(THD *thd)
locks[0]= thd->extra_lock;
locks[1]= thd->lock;
locks[2]= thd->locked_tables;
+ my_bool with_annotate= thd->variables.binlog_annotate_rows_events &&
+ thd->query() && thd->query_length();
+
for (uint i= 0 ; i < sizeof(locks)/sizeof(*locks) ; ++i )
{
MYSQL_LOCK const *const lock= locks[i];
@@ -4796,7 +4800,8 @@ static int write_locked_table_maps(THD *thd)
check_table_binlog_row_based(thd, table))
{
int const has_trans= table->file->has_transactions();
- int const error= thd->binlog_write_table_map(table, has_trans);
+ int const error= thd->binlog_write_table_map(table, has_trans,
+ &with_annotate);
/*
If an error occurs, it is the responsibility of the caller to
roll back the transaction.