diff options
author | Luis Soares <luis.soares@sun.com> | 2009-03-24 18:27:33 +0000 |
---|---|---|
committer | Luis Soares <luis.soares@sun.com> | 2009-03-24 18:27:33 +0000 |
commit | 6dff8012845b497615a4ab37e5b11c287494f06f (patch) | |
tree | 4fdd6f71a984f1c2a07a7e8688b690b698d6c66c /sql/item_create.cc | |
parent | 7b7d5b5b43836b89f048c44a44cef32ec201bc15 (diff) | |
download | mariadb-git-6dff8012845b497615a4ab37e5b11c287494f06f.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.
Diffstat (limited to 'sql/item_create.cc')
-rw-r--r-- | sql/item_create.cc | 1 |
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); } |