• unknown's avatar
    Bug#27606 GRANT statement should be replicated with DEFINER information · 06c49d57
    unknown authored
    "Grantor" columns' data is lost when replicating mysql.tables_priv.
    Slave SQL thread used its default user ''@'' as the grantor of GRANT|REVOKE
    statements executing on it.
    
    In this patch, current user is put in query log event for all GRANT and REVOKE
    statement, SQL thread uses the user in query log event as grantor.
    
    
    mysql-test/suite/rpl/r/rpl_do_grant.result:
      Add test for this bug.
    mysql-test/suite/rpl/t/rpl_do_grant.test:
      Add test for this bug.
    sql/log_event.cc:
      Refactoring THD::current_user_used and related functions.
      current_user_used is used to judge if current user should be
      binlogged in query log event. So it is better to call it m_binlog_invoker.
      The related functions are renamed too.
    sql/sql_class.cc:
      Refactoring THD::current_user_used and related functions.
      current_user_used is used to judge if current user should be
      binlogged in query log event. So it is better to call it m_binlog_invoker.
      The related functions are renamed too.
    sql/sql_class.h:
      Refactoring THD::current_user_used and related functions.
      current_user_used is used to judge if current user should be
      binlogged in query log event. So it is better to call it m_binlog_invoker.
      The related functions are renamed too.
    sql/sql_parse.cc:
      Call binlog_invoker() for GRANT and REVOKE statements.
    06c49d57
sql_parse.cc 236 KB