32bit counters in user statistics

Bug #714925 reported by Peter Zaitsev
32
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
Medium
Laurynas Biveinis
5.1
Fix Released
Medium
Laurynas Biveinis
5.5
Fix Released
Medium
Laurynas Biveinis
5.6
Fix Released
Medium
Laurynas Biveinis

Bug Description

Hi,

Percona Server 11.6 on RHEL5 64bit (from RPM)

Note the numbers for s lot of counters from SHOW USER STATISTICS are showing as max 32bit integer.

I'm observing same behavior for show table_statistics for number of rows x number of indexes. show index_statistics is also affected

                  User: #mysql_system#
     Total_connections: 1
Concurrent_connections: 0
        Connected_time: 2084781
             Busy_time: 1104079
              Cpu_time: 268182
        Bytes_received: 0
            Bytes_sent: 0
  Binlog_bytes_written: 2147483647
          Rows_fetched: 0
          Rows_updated: 2147483647
       Table_rows_read: 796477
       Select_commands: 0
       Update_commands: 2147483647
        Other_commands: 2147483647
   Commit_transactions: 2147483647
 Rollback_transactions: 0
    Denied_connections: 0
      Lost_connections: 0
         Access_denied: 0
         Empty_queries: 0

I

Related branches

Stewart Smith (stewart)
Changed in percona-server:
status: New → Confirmed
importance: Undecided → Medium
Stewart Smith (stewart)
tags: added: low-hanging-fruit
Stewart Smith (stewart)
Changed in percona-server:
status: Confirmed → Triaged
Changed in percona-server:
assignee: nobody → Laurynas Biveinis (laurynas-biveinis)
Changed in percona-server:
status: Triaged → In Progress
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

What exact commands should reproduce this?
If I do
SET GLOBAL userstat_running=ON;
then immediately
SHOW USER_STATISTICS;
SELECT * FROM INFORMATION_SCHEMA.USER_STATISTICS;

I see zeros and not 32-bit uint max values there, same for other stat tables.

Changed in percona-server:
status: In Progress → Incomplete
Revision history for this message
Olaf van Zandwijk (olafz) wrote :

This issue still exists in 5.5.18.

Howto reproduce: after enabling userstats and waiting for a while (on a busy server it might not take that long ;)) several counters run to the 32bit counter maximum:

mysql> SELECT ... FROM INFORMATION_SCHEMA.USER_STATISTICS WHERE (...)\G
*************************** 1. row ***************************
BYTES_RECEIVED: 2147483647
BYTES_SENT: 2147483647
TABLE_ROWS_READ: 2147483647

etc.

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Thank you. Originally I misunderstood the issue to be that counters have 32bit maxints upon server startup.

Changed in percona-server:
status: Incomplete → Triaged
assignee: Laurynas Biveinis (laurynas-biveinis) → nobody
Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

The issue seems to be that even though the structures are unlonglong and longlong is stored, the schema seems to be MYSQL_TYPE_LONG

  {"BYTES_RECEIVED", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Bytes_received", SKIP_OPEN_TABLE},
  {"BYTES_SENT", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Bytes_sent", SKIP_OPEN_TABLE},
  {"BINLOG_BYTES_WRITTEN", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Binlog_bytes_written", SKIP_OPEN_TABLE},

Also,

      table->field[6]->store((longlong)user_stats->bytes_received);
      table->field[7]->store((longlong)user_stats->bytes_sent);
      table->field[8]->store((longlong)user_stats->binlog_bytes_written);

So, MYSQL_TYPE_LONGLONG needs to used instead of MYSQL_TYPE_LONG and ulonglong instead of longlong in ->store()

Same for other fields and other similar tables.

tags: added: overflow
tags: added: userstat
Jervin R (revin)
tags: added: i32205
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-98

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.