Description:
For plugin variables that have negative values, they are displayed incorrrectly when SHOW VARIABLES is run..
This isn't a problem in any plugins shipped by mysql (innodb), but could be an issue for external plugins.
How to repeat:
This should work with any plugin (eg. audit), but I'm using innodb here.
If you modify innodb with the following diff to change default value to negative:
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 23f7118d0cb..d9d8104c3ed 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -19642,7 +19642,7 @@ static MYSQL_SYSVAR_BOOL(
static MYSQL_SYSVAR_LONG(fill_factor, innobase_fill_factor, PLUGIN_VAR_RQCMDARG,
"Percentage of B-tree page filled during bulk insert",
- NULL, NULL, 100, 10, 100, 0);
+ NULL, NULL, -1, -1, 100, 0);
static MYSQL_SYSVAR_BOOL(
ft_enable_diag_print, fts_enable_diag_print, PLUGIN_VAR_OPCMDARG,
Then run show variables:
mysql> show variables like '%fill_factor%';
+--------------------+----------------------+
| Variable_name | Value |
+--------------------+----------------------+
| innodb_fill_factor | 18446744073709551615 |
+--------------------+----------------------+
1 row in set (0.01 sec)
This should show -1.
Suggested fix:
There are a few places where the correct plumbing is missing for showing signed integers for plugins. Roughly:
1. In addition to SHOW_SIGNED_LONG, we need SHOW_SIGNED_INT and SHOW_SIGNED_LONGLONG
2. In pluginvar_show_type, we need to check plugin_var->flags & PLUGIN_VAR_UNSIGNED and return the SIGNED version.
3. get_one_variable_ext needs to be updated to print out the signed version of the number.
Description: For plugin variables that have negative values, they are displayed incorrrectly when SHOW VARIABLES is run.. This isn't a problem in any plugins shipped by mysql (innodb), but could be an issue for external plugins. How to repeat: This should work with any plugin (eg. audit), but I'm using innodb here. If you modify innodb with the following diff to change default value to negative: diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 23f7118d0cb..d9d8104c3ed 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19642,7 +19642,7 @@ static MYSQL_SYSVAR_BOOL( static MYSQL_SYSVAR_LONG(fill_factor, innobase_fill_factor, PLUGIN_VAR_RQCMDARG, "Percentage of B-tree page filled during bulk insert", - NULL, NULL, 100, 10, 100, 0); + NULL, NULL, -1, -1, 100, 0); static MYSQL_SYSVAR_BOOL( ft_enable_diag_print, fts_enable_diag_print, PLUGIN_VAR_OPCMDARG, Then run show variables: mysql> show variables like '%fill_factor%'; +--------------------+----------------------+ | Variable_name | Value | +--------------------+----------------------+ | innodb_fill_factor | 18446744073709551615 | +--------------------+----------------------+ 1 row in set (0.01 sec) This should show -1. Suggested fix: There are a few places where the correct plumbing is missing for showing signed integers for plugins. Roughly: 1. In addition to SHOW_SIGNED_LONG, we need SHOW_SIGNED_INT and SHOW_SIGNED_LONGLONG 2. In pluginvar_show_type, we need to check plugin_var->flags & PLUGIN_VAR_UNSIGNED and return the SIGNED version. 3. get_one_variable_ext needs to be updated to print out the signed version of the number.