• unknown's avatar
    First commit for fixing BUG#1100 · 1542fffb
    unknown authored
    "LOAD DATA INFILE is badly filtered by binlog-*-db rules".
    There will probably be a second final one to merge Dmitri's changes
    to rpl_log.result and mine.
    2 new tests:
    rpl_loaddata_rule_m : test of logging of LOAD DATA INFILE when the master has binlog-*-db rules,
    rpl_loaddata_rule_s : test of logging of LOAD DATA INFILE when the slave has binlog-*-db rules and --log-slave-updates.
    
    
    mysql-test/r/rpl_loaddata.result:
      Test that logging of LOAD DATA INFILE is done on the slave
    mysql-test/t/rpl_loaddata.test:
      Test that logging of LOAD DATA is done on the slave
    sql/log.cc:
      debug info
    sql/log_event.cc:
      * Append_block, Exec_load and Delete_file now have a member 'db' like Create_file.
      This member is filled by mysql_load(). It is used for filtering by binlog-*-db rules,
      that's all. It's not written to the binlog, and so can't be read from the binlog.
      In other words, that's temporary info which is stored in the event and lost when
      it is written and deleted.
      * Better error messages in Append_block et al. events.
      * The slave now logs (log-slave-updates) the Create_file et al. events in mysql_load()
      (they are not directly copied from the events in the relay log, because this
      prevented filtering by binlog-*-db rules). Before, mysql_load() in the slave
      did no logging, now it does the logging, as in any regular thread.
    sql/log_event.h:
      New member 'db' for Append_block et al. events.
    sql/slave.cc:
      Removed useless code. Why was it useless:
      - CREATE_FILE_EVENT is not defined in 3.23. It appeared in 4.0.
      - in queue_old_event(), which is called only if the master is 3.23, we had a
      case CREATE_FILE_EVENT:
      so this case can be removed.
      - this case was the only caller of process_io_create_file() so this function
      can be removed.
    sql/sql_load.cc:
      Pass the db to events, so that they can be well filtered.
    sql/sql_repl.cc:
      Pass the db to events so that they can be well filtered.
    1542fffb
log.cc 45.5 KB