summaryrefslogtreecommitdiff
path: root/sql/item_create.cc
diff options
context:
space:
mode:
authorLuis Soares <luis.soares@sun.com>2009-03-24 18:27:33 +0000
committerLuis Soares <luis.soares@sun.com>2009-03-24 18:27:33 +0000
commited1e9d214c6a4c026f07fb000706ec5012681cc2 (patch)
tree4fdd6f71a984f1c2a07a7e8688b690b698d6c66c /sql/item_create.cc
parentf3a08d56ba5b601808ea825c6eb8ea0caa95a1ab (diff)
downloadmariadb-git-ed1e9d214c6a4c026f07fb000706ec5012681cc2.tar.gz
BUG#39701: Mixed binlog format does not switch to row mode on
LOAD_FILE LOAD_FILE is not safe to replicate in STATEMENT mode, because it depends on a file (which is loaded on master and may not exist in slave(s)). This leads to scenarios on which the slave replicates the statement with 'load_file' and it will try to load the file from local file system. Given that the file may not exist in the slave filesystem the operation will not succeed (probably returning NULL), causing master and slave(s) to diverge. However, when using MIXED mode replication, this can be made to work, if the statement including LOAD_FILE is marked as unsafe, triggering a switch to ROW mode, meaning that the contents of the file are written to binlog as row events. Consequently, the contents from the file in the master will reach the slave via the binlog. This patch addresses this bug by marking the load_file function as unsafe. When in mixed mode and when LOAD_FILE is issued, there will be a switch to row mode. Furthermore, when in statement mode, the LOAD_FILE will raise a warning that the statement is unsafe in that mode. mysql-test/extra/rpl_tests/rpl_loadfile.test: Extra file that is "sourced" on both rpl_loadfile and rpl_stm_loadfile test files. mysql-test/suite/rpl/r/rpl_loadfile.result: Updated with the results from the test case added to this file. mysql-test/suite/rpl/r/rpl_stm_loadfile.result: Result file for rpl_loadfile test split with the warnings in statement mode. mysql-test/suite/rpl/t/rpl_loadfile.test: After splitting the original rpl_loadfile file, this one is only required to be executed in mixed or row format. Appended the test for 39701 to this file. mysql-test/suite/rpl/t/rpl_stm_loadfile.test: Split the original rpl_loadfile test because load_file now raises a warning when in statement mode. The goal of this split is two-fold: i) make the test case more resilient; ii) assert that warnings are indeed raised when in statement mode. sql/item_create.cc: Added the set_stmt_unsafe call to lex.
Diffstat (limited to 'sql/item_create.cc')
-rw-r--r--sql/item_create.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 349c47816ad..bf359b10caa 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -3791,6 +3791,7 @@ Create_func_load_file Create_func_load_file::s_singleton;
Item*
Create_func_load_file::create(THD *thd, Item *arg1)
{
+ thd->lex->set_stmt_unsafe();
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
return new (thd->mem_root) Item_load_file(arg1);
}