From 30a82dfb7d6784b1121f23f37ee81d9cfedec08e Mon Sep 17 00:00:00 2001
From: unknown <gbichot@quadita2.mysql.com>
Date: Mon, 11 Apr 2005 16:46:03 +0200
Subject: Fix for BUG#9149 "OPTIMIZE TABLE statement on InnoDB table is logged
 twice in the binary log" if we fall back to mysql_alter_table() (for InnoDB),
 don't do binlogging in mysql_alter_table(), as mysql_admin_table() is not
 supposed to do any binlogging (it is done by the caller).

sql/sql_table.cc:
  When optimizing a table, if we fall back to mysql_alter_table()
  (for InnoDB), don't do binlogging in mysql_alter_table(), as mysql_admin_table()
  is not supposed to do any binlogging (it is done by the caller).
---
 sql/sql_table.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 84f51a95691..f3f8511026b 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2041,7 +2041,9 @@ send_result_message:
       close_thread_tables(thd);
       TABLE_LIST *save_next= table->next;
       table->next= 0;
+      tmp_disable_binlog(thd); // binlogging is done by caller if wanted
       result_code= mysql_recreate_table(thd, table, 0);
+      reenable_binlog(thd);
       close_thread_tables(thd);
       if (!result_code) // recreation went ok
       {
-- 
cgit v1.2.1