summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorAlfranio Correia <alfranio.correia@sun.com>2010-08-02 20:48:56 +0100
committerAlfranio Correia <alfranio.correia@sun.com>2010-08-02 20:48:56 +0100
commit1feee134fdc346bb1ad73cce54cd7e87df5c839a (patch)
tree363a0395eb448a1b3c5f37f8125af5e5d7f7ba1d /sql/sql_insert.cc
parent2aee4d8ddd736642488c5ed32fe2d2fd46061596 (diff)
downloadmariadb-git-1feee134fdc346bb1ad73cce54cd7e87df5c839a.tar.gz
BUG#55625 RBR breaks on failing 'CREATE TABLE'
A CREATE...SELECT that fails is written to the binary log if a non-transactional statement is updated. If the logging format is ROW, the CREATE statement and the changes are written to the binary log as distinct events and by consequence the created table is not rolled back in the slave. In this patch, we opted to let the slave goes out of sync by not writting to the binary log the CREATE statement. We do this by simply reseting the binary log's cache.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 35c24e7571e..83b1834da0b 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -3873,6 +3873,17 @@ void select_create::abort()
if (table)
{
+ if (thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
+ thd->current_stmt_binlog_row_based &&
+ !(thd->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
+ mysql_bin_log.is_open())
+ {
+ /*
+ This should be removed after BUG#47899.
+ */
+ mysql_bin_log.reset_gathered_updates(thd);
+ }
+
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
if (!create_info->table_existed)