mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
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.
This commit is contained in:
@ -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;
|
||||
}
|
||||
@ -241,6 +242,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.
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user