• Guangbao Ni's avatar
    Bug #42217 mysql.procs_priv does not get replicated · 0ba1cc25
    Guangbao Ni authored
    mysql.procs_priv table itself does not get replicated.
    Inserting routine privilege record into mysql.procs_priv table
    is triggered by creating function/procedure statements
    according to current user's privileges.
    Because the current user of SQL thread has GLOBAL_ACL,
    which doesn't need any check mysql.procs_priv privilege
    when create/alter/execute routines.
    Corresponding GLOBAL_ACL privilege user
    doesn't insert routine privilege record into
    mysql.procs_priv when creating a routine.
    
    Fixed by switching the current user of SQL thread to definer user if
    the definer user exists on slave.
    That populates procs_priv, otherwise to keep the SQL thread
    user and procs_priv remains unchanged.
    
    
    mysql-test/suite/rpl/r/rpl_do_grant.result:
      Test case result for routine privilege when definer user exist or not on slave
    mysql-test/suite/rpl/t/rpl_do_grant.test:
      Test case result for routine privilege when definer user exist or not on slave
    sql/sql_parse.cc:
      Switch current user of SQL thread to definer user if the definer user
      existes on slave when checking whether the routine privilege is
      needed to insert mysql.procs_priv table or not.
    0ba1cc25
rpl_do_grant.test 5.91 KB