Bug #32902 plugin variables don't know their names
Submitted: 1 Dec 2007 23:57 Modified: 13 Nov 10:42
Reporter: Sergei Golubchik
Status: Patch pending
Category:Server: UDF Severity:S3 (Non-critical)
Version:5.1+ OS:Any
Assigned to: Sergei Golubchik Target Version:
Triage: Triaged: D4 (Minor)

[1 Dec 2007 23: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.
[2 Dec 2007 0: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 19: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 21:03] Antony Curtis
Patch is in cset for WL#3771
[27 Jan 2008 0: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.