Bug #92107 Negative numbers in plugin variables not displayed correctly.
Submitted: 21 Aug 2018 17:44 Modified: 29 Oct 2018 13:55
Reporter: Manuel Ung Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S3 (Non-critical)
Version:8.0.11 OS:Any
Assigned to: CPU Architecture:Any

[21 Aug 2018 17:44] Manuel Ung
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.
[21 Aug 2018 19:31] MySQL Verification Team
Thank you for the bug report.
[29 Oct 2018 13:55] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.0.14 release, and here's the changelog entry:

Plugin variables with signed values were displayed incorrectly.