Bug #72981 com_status wraps at 2^32
Submitted: 12 Jun 2014 7:51
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.1.73 OS:Any
Assigned to: CPU Architecture:Any

[12 Jun 2014 7:51] Shane Bester
Description:
the status variables com_% wrap at 2^32

How to repeat:
ulong com_stat[(uint) SQLCOM_END];

Suggested fix:
unsigned long long com_stat[(uint) SQLCOM_END];
[12 Jun 2014 10:23] Peter Laursen
I reported this long-long ago with several status variables. MySQL decided at that time to fix from MySQL 5.6 and not in older versions.
[12 Jun 2014 10:24] Peter Laursen
Here is my report:
http://bugs.mysql.com/bug.php?id=42698
[13 Jun 2014 11:58] MySQL Verification Team
As a good citizen, I made a testcase.

mysql> delimiter $
mysql> create procedure p1()
    -> begin
    ->   declare i bigint unsigned default 0;
    ->   repeat
    ->     do 1;
    ->  set i:=i+1;
    ->   until i > 4294967294 end repeat;
    -> end $
Query OK, 0 rows affected (0.00 sec)

mysql> delimiter ;
mysql> show status like 'com_do';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_do        | 0     |
+---------------+-------+
1 row in set (0.00 sec)

mysql> call p1();
Query OK, 0 rows affected (2 hours 25 min 7.75 sec)

mysql> show status like 'com_do';
+---------------+------------+
| Variable_name | Value      |
+---------------+------------+
| Com_do        | 4294967295 |
+---------------+------------+
1 row in set (0.00 sec)

mysql> do 1;
Query OK, 0 rows affected (0.00 sec)

mysql> show status like 'com_do';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_do        | 0     |
+---------------+-------+
1 row in set (0.00 sec)