• Luis Soares's avatar
    BUG#39701: Mixed binlog format does not switch to row mode on · 6dff8012
    Luis Soares authored
    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.
    6dff8012
rpl_loadfile.test 1.03 KB