Commit b0547006 authored by Sergei Golubchik's avatar Sergei Golubchik

speed up fill_effective_table_privileges() - avoid calling expensive acl_get()

parent 02a72919
...@@ -10202,11 +10202,18 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, ...@@ -10202,11 +10202,18 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant,
DBUG_VOID_RETURN; // it is slave DBUG_VOID_RETURN; // it is slave
} }
/* db privileges */ if (!thd->db || strcmp(db, thd->db))
grant->privilege|= acl_get(sctx->host, sctx->ip, sctx->priv_user, db, 0); {
/* db privileges for role */ /* db privileges */
if (sctx->priv_role[0]) grant->privilege|= acl_get(sctx->host, sctx->ip, sctx->priv_user, db, 0);
grant->privilege|= acl_get("", "", sctx->priv_role, db, 0); /* db privileges for role */
if (sctx->priv_role[0])
grant->privilege|= acl_get("", "", sctx->priv_role, db, 0);
}
else
{
grant->privilege|= sctx->db_access;
}
/* table privileges */ /* table privileges */
mysql_rwlock_rdlock(&LOCK_grant); mysql_rwlock_rdlock(&LOCK_grant);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment