Skip to content

Commit e7b9f07

Browse files
committed
Merge branch 'mysql-5.7' into mysql-8.0
2 parents c35acd8 + e2376ab commit e7b9f07

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

sql/sql_audit.cc

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License, version 2.0,
@@ -1024,15 +1024,23 @@ static bool acquire_plugins(THD *thd, plugin_ref plugin, void *arg) {
10241024
return false;
10251025
}
10261026

1027-
/* Copy subscription mask from the plugin into the array. */
1028-
add_audit_mask(evt->subscribed_mask, data->class_mask);
1029-
10301027
/* Prevent from adding the same plugin more than one time. */
1031-
if (thd->audit_class_plugins.exists(plugin)) return false;
1028+
if (!thd->audit_class_plugins.exists(plugin)) {
1029+
/* lock the plugin and add it to the list */
1030+
plugin = my_plugin_lock(NULL, &plugin);
1031+
1032+
/* The plugin could not be acquired. */
1033+
if (plugin == NULL) {
1034+
/* Add this plugin mask to non subscribed mask. */
1035+
add_audit_mask(evt->not_subscribed_mask, data->class_mask);
1036+
return false;
1037+
}
10321038

1033-
/* lock the plugin and add it to the list */
1034-
plugin = my_plugin_lock(NULL, &plugin);
1035-
thd->audit_class_plugins.push_back(plugin);
1039+
thd->audit_class_plugins.push_back(plugin);
1040+
}
1041+
1042+
/* Copy subscription mask from the plugin into the array. */
1043+
add_audit_mask(evt->subscribed_mask, data->class_mask);
10361044

10371045
return false;
10381046
}

0 commit comments

Comments
 (0)