summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
author <Dao-Gang.Qu@sun.com>2009-12-31 11:33:10 +0800
committer <Dao-Gang.Qu@sun.com>2009-12-31 11:33:10 +0800
commitccc3a468562d195505ee458faad71897889d58fe (patch)
tree0bced839669de9bd3bce45310e9b04f1008c7022 /sql/log_event.cc
parent6c16fb6d4ebcaff9d27278edc74c1cacae313d19 (diff)
downloadmariadb-git-ccc3a468562d195505ee458faad71897889d58fe.tar.gz
Bug #49137 Replication failure on SBR/MBR + multi-table DROP TEMPORARY TABLE
In statement-based or mixed-mode replication, use DROP TEMPORARY TABLE to drop multiple tables causes different errors on master and slave, when one or more of these tables do not exist. Because when executed on slave, it would automatically add IF EXISTS to the query to ignore all ER_BAD_TABLE_ERROR errors. To fix the problem, do not add IF EXISTS when executing DROP TEMPORARY TABLE on the slave, and clear the ER_BAD_TABLE_ERROR error after execution if the query does not expect any errors.
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 40e29e58ab6..35d53c4fede 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2103,7 +2103,17 @@ START SLAVE; . Query: '%s'", expected_error, thd->query);
compare_errors:
- /*
+ /*
+ In the slave thread, we may sometimes execute some DROP / * 40005
+ TEMPORARY * / TABLE that come from parts of binlogs (likely if we
+ use RESET SLAVE or CHANGE MASTER TO), while the temporary table
+ has already been dropped. To ignore such irrelevant "table does
+ not exist errors", we silently clear the error if TEMPORARY was used.
+ */
+ if (thd->lex->drop_temporary &&
+ thd->net.last_errno == ER_BAD_TABLE_ERROR && !expected_error)
+ thd->clear_error();
+ /*
If we expected a non-zero error code, and we don't get the same error
code, and none of them should be ignored.
*/