• He Zhenxing's avatar
    BUG#37051 Replication rules not evaluated correctly · 6cbdbc47
    He Zhenxing authored
    The problem of this bug is that we need to get the list of tables
    to be updated for a multi-table update statement, which requires to
    open all the tables referenced by the statement and resolve all
    the fields involved in update in order to figure out the list of
    tables for update. However if there are replicate filter rules,
    some tables might not exist on slave and result in a failure
    before we could examine the filter rules.
    
    I think the whole problem can not be solved on slave alone,
    the master must record and send the information of tables
    involved for update to slave, so that the slave do not need to
    open all the tables referenced by the multi-table update statement to
    figure out which tables are involved for update.
    
    So a status variable is added to Query_log event to store the
    value of table map for update on master. And on slave, it will
    try to get the value of this variable and use it to examine
    filter rules without opening any tables on slave, if this values
    is not available, the old approach is used and thus the bug will
    still occur for when replicating from old masters.
    
    
    sql/sql_class.h:
      add member table_map_for_update to THD
    sql/sql_parse.cc:
      check filter rules by using table_map_for_update value
    sql/sql_update.cc:
      save the value of table_map_for_update
    6cbdbc47
sql_parse.cc 222 KB