Bug #32902 plugin variables don't know their names
Submitted: 1 Dec 2007 22:57 Modified: 23 Apr 2010 1:56
Reporter: Sergei Golubchik Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S3 (Non-critical)
Version:5.1+ OS:Any
Assigned to: CPU Architecture:Any

[1 Dec 2007 22:57] Sergei Golubchik
Description:
There's no way given a plugin variable (MYSQL_SYSVAR_*, MYSQL_THDVAR_*) to find its full name, only the short name (without plugin name prefix) is available.

as check and update functions only get access to the plugin variable (st_mysql_sys_var), they cannot print the error message correctly.

How to repeat:
See check_func_bool(), check_func_enum(), check_func_set(), and after a fix for bug#31177 other check_func_XXX() functions.

Suggested fix:
when a sys_var_pluginvar() is created out of st_mysql_sys_var, set st_mysql_sys_var::name to point to sys_var_pluginvar::name.

Alternatively, add a pointer to st_mysql_sys_var and (on install) set it to point to sys_var_pluginvar or st_plugin_int.
[1 Dec 2007 23:09] Sergei Golubchik
nope, we should not touch st_mysql_sys_var::name.
consider a case - one soname with two plugins. a user installs both, uninstalls one, installs it again.
[5 Dec 2007 18:58] Antony Curtis
Error message reporting is not really in critical path (does anyone benchmark how quickly errors are processed?) so it may be acceptiable to iterate through list of sysvar and find it..

for (i= 0; i < system_variable_hash.records; i++)
{
  sys_var *v= (sys_var*) hash_element(&system_variable_hash, i);
  sys_var_pluginvar *var= v->cast_pluginvar();
  if (v == NULL)
    continue;
  if (v->plugin_var == plugin_var)
  {
    /* Found it! */
    break;
  }
}
[18 Dec 2007 20:03] Antony Curtis
Patch is in cset for WL#3771
[26 Jan 2008 23:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/41285

ChangeSet@1.2661, 2008-01-26 15:36:22-08:00, acurtis@xiphis.org +4 -0
  Bug#32902
    "plugin variables don't know their names"
    Implemented new plugin support function thd_plugin_var_name() to return the logical
    name of the plugin variable.
[6 Mar 2010 11:05] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@fedora12-20091225154921-x25a5pyw1pxiwobv) (merge vers: 5.5.99) (pib:16)
[23 Apr 2010 1:56] Paul Dubois
Noted in 5.5.3 changelog.

Plugins could find the unqualified form of their system variables but
not the qualified form. For example, a plugin p with a system
variable sv could find sv but not p_sv.
[5 May 2010 13:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/107523