summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorunknown <Dao-Gang.Qu@sun.com>2009-12-31 12:04:19 +0800
committerunknown <Dao-Gang.Qu@sun.com>2009-12-31 12:04:19 +0800
commitbe397eb40061afdc924cabb96efca0ec736b5181 (patch)
treee3c946bce1ed210af4829507affba2df88dbf061 /sql/log_event.cc
parent041baac3262a8d42452c83216d790ef1557668c3 (diff)
parent2b2ce3d6cb01a36cd35191e8670dcb023420c84e (diff)
downloadmariadb-git-be397eb40061afdc924cabb96efca0ec736b5181.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. mysql-test/suite/rpl/r/rpl_drop_temp.result: Updated for the patch of bug#49137. mysql-test/suite/rpl/t/rpl_drop_temp.test: Added the test file to verify if DROP MULTI TEMPORARY TABLE will cause different errors on master and slave, when one or more of these tables do not exist. sql/log_event.cc: Added code to handle above cases which are removed from sql_parse.cc sql/sql_parse.cc: Remove the code to issue the 'Unknown table' error, if the temporary table does not exist when dropping it on slave. The above cases decribed in comments will be handled later in log_event.cc.
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 9552bfad27f..c028db3476d 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -3171,7 +3171,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->is_error() &&
+ thd->main_da.sql_errno() == ER_BAD_TABLE_ERROR && !expected_error)
+ thd->main_da.reset_diagnostics_area();
+ /*
If we expected a non-zero error code, and we don't get the same error
code, and it should be ignored or is related to a concurrency issue.
*/