• unknown's avatar
    Bug #44331 Restore of database with events produces warning in replication · f32c08bd
    unknown authored
    If an EVENT is created without the DEFINER clause set explicitly or with it set  
    to CURRENT_USER, the master and slaves become inconsistent. This issue stems from 
    the fact that in both cases, the DEFINER is set to the CURRENT_USER of the current 
    thread. On the master, the CURRENT_USER is the mysqld's user, while on the slave,  
    the CURRENT_USER is empty for the SQL Thread which is responsible for executing 
    the statement.
    
    To fix the problem, we do what follows. If the definer is not set explicitly,  
    a DEFINER clause is added when writing the query into binlog; if 'CURRENT_USER' is 
    used as the DEFINER, it is replaced with the value of the current user before 
    writing to binlog.
    
    mysql-test/suite/rpl/r/rpl_create_if_not_exists.result:
      Updated the result file after fixing bug#44331
    mysql-test/suite/rpl/r/rpl_drop_if_exists.result:
      Updated the result file after fixing bug#44331
    mysql-test/suite/rpl/r/rpl_events.result:
      Test result of Bug#44331
    mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result:
      Updated the result file after fixing bug#44331
    mysql-test/suite/rpl/t/rpl_events.test:
      Added test to verify if the definer is consistent between master and slave
      when the event is created without the DEFINER clause set explicitly or the
      DEFINER is set to CURRENT_USER
    sql/events.cc:
      The "create_query_string" function is added to create a new query string 
      for removing executable comments.
    sql/sql_yacc.yy:
      The remember_name token was added for recording the offset of EVENT_SYM.
    f32c08bd
rpl_events.result 10.6 KB