summaryrefslogtreecommitdiff
path: root/sql/sql_admin.cc
diff options
context:
space:
mode:
authorsachin <sachin.setiya@mariadb.com>2018-05-14 17:29:06 +0530
committersachin <sachin.setiya@mariadb.com>2018-05-14 17:32:07 +0530
commitf45b88d687d38b882439c85b8de366102bdae9b8 (patch)
tree1d50df7a93ccc411b610efda751e16490e51f3c6 /sql/sql_admin.cc
parent42fac3241368ad72f8cfef2b8521269e6c173558 (diff)
downloadmariadb-git-bb-mdev-9266.tar.gz
MDEV-9266 Creating index on temporaray table breaks replicationbb-mdev-9266
Problem:- Create index was logged into binlog. Goal:- Operation on temporary table should not be binlog when binlog format is row. Solution:- 1st- We should add CF_FORCE_ORIGINAL_BINLOG_FORMAT when there is ddl on temp table. 2nd- For optimize, analyze and repair we dont check if binlog format is row and this is tmp table, we dont need to log that.
Diffstat (limited to 'sql/sql_admin.cc')
-rw-r--r--sql/sql_admin.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 06a453e1bb7..9310e710bad 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -1197,7 +1197,10 @@ bool Sql_cmd_analyze_table::execute(THD *thd)
"analyze", lock_type, 1, 0, 0, 0,
&handler::ha_analyze, 0);
/* ! we write after unlocking the table */
- if (!res && !m_lex->no_write_to_binlog)
+ if (!res && !m_lex->no_write_to_binlog &&
+ !(thd->is_current_stmt_binlog_format_row() &&
+ first_table->table &&
+ first_table->table->s->tmp_table != NO_TMP_TABLE ))
{
/*
Presumably, ANALYZE and binlog writing doesn't require synchronization
@@ -1254,7 +1257,10 @@ bool Sql_cmd_optimize_table::execute(THD *thd)
"optimize", TL_WRITE, 1, 0, 0, 0,
&handler::ha_optimize, 0);
/* ! we write after unlocking the table */
- if (!res && !m_lex->no_write_to_binlog)
+ if (!res && !m_lex->no_write_to_binlog &&
+ !(thd->is_current_stmt_binlog_format_row() &&
+ first_table->table &&
+ first_table->table->s->tmp_table != NO_TMP_TABLE ))
{
/*
Presumably, OPTIMIZE and binlog writing doesn't require synchronization
@@ -1287,7 +1293,10 @@ bool Sql_cmd_repair_table::execute(THD *thd)
&handler::ha_repair, &view_repair);
/* ! we write after unlocking the table */
- if (!res && !m_lex->no_write_to_binlog)
+ if (!res && !m_lex->no_write_to_binlog &&
+ !(thd->is_current_stmt_binlog_format_row() &&
+ first_table->table &&
+ first_table->table->s->tmp_table != NO_TMP_TABLE ))
{
/*
Presumably, REPAIR and binlog writing doesn't require synchronization