Bug #47168 Strange behaviour of status variables in plugin if using them not as expected.
Submitted: 7 Sep 2009 10:45 Modified: 7 Sep 2009 17:48
Reporter: Horst Hunger Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server: Storage Engine API Severity:S3 (Non-critical)
Version:azalea OS:Any
Assigned to: CPU Architecture:Any
Tags: API, plugin, status variable, storage engine

[7 Sep 2009 10:45] Horst Hunger
In a status variable declaration the name of the variable needs to be identical in the string (first component, indepentent of upper and lower case) and the reference (second component, except the &), e.g.

static struct st_mysql_show_var tse_status_variables[]=
  {"Number_of_table_scans", (char *)&number_of_table_scans, SHOW_INT},

If that is not the case, the variable will not be handled appropriate, e.g.

static struct st_mysql_show_var tse_status_variables[]=
  {"Number_of_tabel_scans", (char *)&number_of_table_scans, SHOW_INT},

see tabel/table as typo.

How to repeat:
Change the "tse_status_variables.h" in "storage/tse" as mentioned above and run "tse_status_vars.test", can be found in "test-plugin".

All can be found soon in "mysql-azalea-wl4939" on bk-internal.

Suggested fix:
Create a macro as exist for system variables and describe it in the storage engine API.
[7 Sep 2009 12:59] Sveta Smirnova
Thank you for the report.

Verified as described.
[7 Sep 2009 17:48] Sveta Smirnova
This is not a bug really: variable name is Number_of_tabel_scans while you issue SHOW STATUS LIKE 'Number_of_table_scans'; If change SHOW STATUS query to SHOW STATUS LIKE 'Number_of_tab___scans'; you get correct value.