• Guangbao Ni's avatar
    Bug #42217 mysql.procs_priv does not get replicated · 15d24779
    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.
    15d24779
sql_parse.cc 229 KB