Bug #55794 ulonglong options of mysqld show wrong values.
Submitted: 6 Aug 2010 2:38 Modified: 6 Jan 2011 2:45
Reporter: Libing Song Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.0, 5.1 OS:Any
Assigned to: Tatiana Azundris Nuernberg CPU Architecture:Any
Tags: 5.0, 5.1
Triage: Triaged: D2 (Serious)

[6 Aug 2010 2:38] Libing Song
Description:
Some of ulonglong options show negative values.
They are MAX_BINLOG_CACHE_SIZE and MYISAM_MMAP_SIZE.
KEY_BUFFER_SIZE probably has the same problem, but it is difficult to verify.
As I have no enough memory and the large value hangs my machine.

The cause is probably that they are treated as signed number when showing them.

How to repeat:
SELECT @@MAX_BINLOG_CACHE_SIZE, @@MYISAM_MMAP_SIZE;
[6 Aug 2010 2:41] Libing Song
I found it on 64bit machines.
[6 Aug 2010 6:13] Valeriy Kravchuk
Verified with 64-bit binaries on Mac OS X:

macbook-pro:mysql openxs$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.48 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SELECT @@MAX_BINLOG_CACHE_SIZE, @@MYISAM_MMAP_SIZE;
+-------------------------+--------------------+
| @@MAX_BINLOG_CACHE_SIZE | @@MYISAM_MMAP_SIZE |
+-------------------------+--------------------+
|                   -4096 |                 -1 |
+-------------------------+--------------------+
1 row in set (0.00 sec)
[6 Aug 2010 6:57] Jon Stephens
Also found on 64-bit Linux in 5.1 from bzr but NOT in 5.5:

mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.1.50    |
+-----------+
1 row in set (0.00 sec)

mysql> SHOW VARIABLES LIKE '%compile%';
+-------------------------+----------------+
| Variable_name           | Value          |
+-------------------------+----------------+
| version_compile_machine | x86_64         |
| version_compile_os      | suse-linux-gnu |
+-------------------------+----------------+
2 rows in set (0.00 sec)

mysql> SELECT @@MAX_BINLOG_CACHE_SIZE, @@MYISAM_MMAP_SIZE;
+-------------------------+--------------------+
| @@MAX_BINLOG_CACHE_SIZE | @@MYISAM_MMAP_SIZE |
+-------------------------+--------------------+
|                   -4096 |                 -1 |
+-------------------------+--------------------+
1 row in set (0.00 sec)

-----

mysql> SELECT VERSION();
+-----------+           
| VERSION() |           
+-----------+           
| 5.5.6-m3  |           
+-----------+           
1 row in set (0.00 sec) 

mysql> SHOW VARIABLES LIKE '%compile%';
+-------------------------+----------------+
| Variable_name           | Value          |
+-------------------------+----------------+
| version_compile_machine | x86_64         |
| version_compile_os      | suse-linux-gnu |
+-------------------------+----------------+
2 rows in set (0.00 sec)                    

mysql> SELECT @@MAX_BINLOG_CACHE_SIZE, @@MYISAM_MMAP_SIZE;
+-------------------------+----------------------+        
| @@MAX_BINLOG_CACHE_SIZE | @@MYISAM_MMAP_SIZE   |        
+-------------------------+----------------------+        
|    18446744073709547520 | 18446744073709551615 |        
+-------------------------+----------------------+        
1 row in set (0.00 sec)                                   

Also present in 5.0-bzr for myisam_mmap_size:

mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.0.92    |
+-----------+
1 row in set (0.00 sec)

mysql> SHOW VARIABLES LIKE '%compile%';
+-------------------------+----------------+
| Variable_name           | Value          |
+-------------------------+----------------+
| version_compile_machine | x86_64         |
| version_compile_os      | suse-linux-gnu |
+-------------------------+----------------+
2 rows in set (0.02 sec)

mysql> SELECT @@MAX_BINLOG_CACHE_SIZE, @@MYISAM_MMAP_SIZE;
+-------------------------+--------------------+
| @@MAX_BINLOG_CACHE_SIZE | @@MYISAM_MMAP_SIZE |
+-------------------------+--------------------+
|    18446744073709547520 |                 -1 |
+-------------------------+--------------------+
1 row in set (0.00 sec)

Updated version tags.
[27 Sep 2010 6:05] 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/119136

3427 Tatiana A. Nurnberg	2010-09-27
      Bug#43233: Some server variables are clipped during "update," not "check" stage
      Bug#55794: ulonglong options of mysqld show wrong values.
      
      Port the few remaining system variables to the correct mechanism --
      range-check in check-stage (and throw error or warning at that point
      as needed and depending on STRICTness), update in update stage.
      Fix some signedness errors when retrieving sysvar values for display.
     @ mysql-test/r/variables.result
        Show that we throw warnings or errors depending on strictness
        even for "special" variables now.
     @ mysql-test/t/variables.test
        Show that we throw warnings or errors depending on strictness
        even for "special" variables now.
     @ sql/set_var.cc
        move range-checking from update stage to check stage for the remaining
        few sys-vars that broke the pattern
     @ sql/set_var.h
        show sys_var_ulonglong_ptr type variables as unsigned.
[11 Nov 2010 11: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/123588

3519 Tatiana A. Nurnberg	2010-11-11
      Bug#43233: Some server variables are clipped during "update," not "check" stage
      Bug#55794: ulonglong options of mysqld show wrong values.
      
      Port the few remaining system variables to the correct mechanism --
      range-check in check-stage (and throw error or warning at that point
      as needed and depending on STRICTness), update in update stage.
      Fix some signedness errors when retrieving sysvar values for display.
     @ mysql-test/r/variables.result
        Show that we throw warnings or errors depending on strictness
        even for "special" variables now.
     @ mysql-test/t/variables.test
        Show that we throw warnings or errors depending on strictness
        even for "special" variables now.
     @ sql/item_func.cc
        show sys_var_ulonglong_ptr and SHOW_LONGLONG type variables as unsigned.
     @ sql/set_var.cc
        move range-checking from update stage to check stage for the remaining
        few sys-vars that broke the pattern
     @ sql/set_var.h
        add check functions.
[5 Dec 2010 12:41] Bugs System
Pushed into mysql-trunk 5.6.1 (revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (version source revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (merge vers: 5.6.1) (pib:23)
[17 Dec 2010 12:48] Bugs System
Pushed into mysql-5.1 5.1.55 (revid:georgi.kodinov@oracle.com-20101217124435-9imm43geck5u55qw) (version source revid:mats.kindahl@oracle.com-20101201193331-1c07sjno2g7m46ix) (merge vers: 5.1.55) (pib:24)
[17 Dec 2010 12:51] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:georgi.kodinov@oracle.com-20101217124733-p1ivu6higouawv8l) (version source revid:azundris@mysql.com-20101125035016-iwt4adcyfgdvak7v) (merge vers: 5.5.8) (pib:24)
[6 Jan 2011 2:45] Paul Dubois
Noted in 5.1.55, 5.5.9 changelogs.

Some unsigned system variables could be displayed with negative values.