diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2019-06-15 01:02:55 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2019-06-15 01:02:55 +0400 |
commit | 65e0c9b91b46e2dfb4388c8c5c1bc76dd9f8fbd8 (patch) | |
tree | 0d2d67b2cc8b1baaf89111d6d3d80a52a744cb59 /sql/sql_audit.cc | |
parent | 5b65d61d9384a45ea1b8df79694493fbb1a14e4a (diff) | |
download | mariadb-git-65e0c9b91b46e2dfb4388c8c5c1bc76dd9f8fbd8.tar.gz |
MDEV-18661 loading the audit plugin causes performance regression.
Plugin fixed to not lock the LOCK_operations when not active.
Server fixed to lock the LOCK_plugin less - do it once per
thread and then only if a plugin was installed/uninstalled.
Diffstat (limited to 'sql/sql_audit.cc')
-rw-r--r-- | sql/sql_audit.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/sql_audit.cc b/sql/sql_audit.cc index dd98e3cf9b1..cee0ac2287c 100644 --- a/sql/sql_audit.cc +++ b/sql/sql_audit.cc @@ -212,6 +212,7 @@ void mysql_audit_acquire_plugins(THD *thd, ulong *event_class_mask) { plugin_foreach(thd, acquire_plugins, MYSQL_AUDIT_PLUGIN, event_class_mask); add_audit_mask(thd->audit_class_mask, event_class_mask); + thd->audit_plugin_version= global_plugin_version; } DBUG_VOID_RETURN; } @@ -242,6 +243,20 @@ void mysql_audit_notify(THD *thd, uint event_class, uint event_subtype, ...) /** + Check if there were changes in the state of plugins + so we need to do the mysql_audit_release asap. + + @param[in] thd + +*/ + +my_bool mysql_audit_release_required(THD *thd) +{ + return thd && (thd->audit_plugin_version != global_plugin_version); +} + + +/** Release any resources associated with the current thd. @param[in] thd @@ -276,6 +291,7 @@ void mysql_audit_release(THD *thd) /* Reset the state of thread values */ reset_dynamic(&thd->audit_class_plugins); bzero(thd->audit_class_mask, sizeof(thd->audit_class_mask)); + thd->audit_plugin_version= -1; } |