diff options
author | Michael Widenius <monty@mariadb.org> | 2014-03-20 00:59:13 +0200 |
---|---|---|
committer | Michael Widenius <monty@mariadb.org> | 2014-03-20 00:59:13 +0200 |
commit | c4bb7cd6dcd83a8c1dc15794d51cfacd10980855 (patch) | |
tree | d6559352812f952e401e48f0e98b79f501b84d47 /sql/log.cc | |
parent | d1655ba6c42fd0fff13077587711b0d6f048146d (diff) | |
download | mariadb-git-c4bb7cd6dcd83a8c1dc15794d51cfacd10980855.tar.gz |
Fix for MDEV-5589: "Discrepancy in binlog on half-failed CREATE OR REPLACE"
Now if CREATE OR REPLACE fails but we have deleted a table already, we will generate a DROP TABLE in the binary log.
This fixes this issue.
In addition, for a failing CREATE OR REPLACE TABLE ... SELECT we don't generate a log of all the inserted rows, only the DROP TABLE.
I added code for not logging DROP TEMPORARY TABLE for tables where the CREATE TABLE was not logged. This code will be activated in 10.1
by removing the code protected by DONT_LOG_DROP_OF_TEMPORARY_TABLES.
mysql-test/suite/rpl/r/create_or_replace_mix.result:
More test cases
mysql-test/suite/rpl/r/create_or_replace_row.result:
More test cases
mysql-test/suite/rpl/r/create_or_replace_statement.result:
More test cases
mysql-test/suite/rpl/t/create_or_replace.inc:
More test cases
sql/log.cc:
Added binlog_reset_cache() to clear the binary log.
sql/log.h:
Added prototype
sql/sql_insert.cc:
If CREATE OR REPLACE TABLE ... SELECT fails:
- Don't log anything if nothing changed
- If table was deleted, log a DROP TABLE.
Remember if we table creation of temporary tables was logged.
sql/sql_table.cc:
Added log_drop_table()
Remember if we table creation of temporary tables was logged.
If CREATE OR REPLACE TABLE ... SELECT fails and a table was deleted, log a DROP TABLE.
sql/sql_table.h:
Added prototype
sql/sql_truncate.cc:
Remember if we table creation of temporary tables was logged.
sql/table.h:
Added table_creation_was_logged
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/log.cc b/sql/log.cc index ebfbba953fa..1943be2817f 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2052,6 +2052,19 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all) DBUG_RETURN(error); } + +void binlog_reset_cache(THD *thd) +{ + binlog_cache_mngr *const cache_mngr= + (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); + DBUG_ENTER("binlog_reset_cache"); + thd->binlog_remove_pending_rows_event(TRUE, TRUE); + cache_mngr->reset(true, true); + thd->clear_binlog_table_maps(); + DBUG_VOID_RETURN; +} + + void MYSQL_BIN_LOG::set_write_error(THD *thd, bool is_transactional) { DBUG_ENTER("MYSQL_BIN_LOG::set_write_error"); |