Bug #25615 Status command doesn't report anymore the Queries per second avg
Submitted: 14 Jan 2007 22:02 Modified: 4 Jan 2008 10:14
Reporter: jocelyn fournier (Silver Quality Contributor) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1.14-beta, 5.2.1-alpha bk OS:Linux (Linux)
Assigned to: CPU Architecture:Any
Tags: Contribution, PatchRefused, qc

[14 Jan 2007 22:02] jocelyn fournier
Description:
Hi,

With MySQL 5.1.14-beta and 5.2.1-alpha, using the mysql client, 'status' command doesn't report anymore the number of queries per second avg. Instead, a '%' is displayed.

5.0.27 is working properly.

Regards,
  Jocelyn Fournier
  http://www.mesdiscussions.net

How to repeat:
mysql> status
--------------
mysql  Ver 14.13 Distrib 5.1.14-beta, for unknown-linux-gnu (x86_64) using readline 5.0

Connection id:          40336675
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.1.14-beta-log MySQL Community Server (GPL)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1
UNIX socket:            /var/tmp/mysql.sock
Uptime:                 22 days 5 hours 23 min 38 sec

Threads: 50  Questions: 1484405811  Slow queries: 2907  Opens: 5935272  Flush tables: 1  Open tables: 4468  Queries per second avg: %

mysql> status
--------------
mysql  Ver 14.13 Distrib 5.2.1-falcon-alpha, for pc-linux-gnu (i686) using readline 5.0

Connection id:          11904
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.2.1-falcon-alpha-debug Source distribution
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1
UNIX socket:            /tmp/mysql.sock
Uptime:                 2 days 1 hour 42 min 35 sec

Threads: 1  Questions: 30060  Slow queries: 5  Opens: 164  Flush tables: 3  Open tables: 62  Queries per second avg: %
--------------
[14 Jan 2007 23:07] MySQL Verification Team
Thank you for the bug report.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.15-beta-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> status
--------------
bin/mysql  Ver 14.13 Distrib 5.1.15-beta, for pc-linux-gnu (i686) using readline 5.0

Connection id:          1
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.1.15-beta-debug Source distribution
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1
UNIX socket:            /tmp/mysql.sock
Uptime:                 1 min 8 sec

Threads: 1  Questions: 4  Slow queries: 0  Opens: 15  Flush tables: 1  Open tables: 8  Queries per second avg: %
--------------

mysql> 
-------------------------------------------------------------------------------------------------------
miguel@light:~/dbs/5.0$ bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.34-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> status
--------------
bin/mysql  Ver 14.12 Distrib 5.0.34, for pc-linux-gnu (i686) using readline 5.0

Connection id:          1
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.0.34-debug Source distribution
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1
UNIX socket:            /tmp/mysql.sock
Uptime:                 17 sec

Threads: 1  Questions: 4  Slow queries: 0  Opens: 12  Flush tables: 1  Open tables: 6  Queries per second avg: 0.235  Memory in use: 8471K  Max memory used: 8487K
--------------

mysql>
[3 Mar 2007 17:03] jocelyn fournier
Hi,

Proposed patch :

http://lists.mysql.com/internals/34359

  Jocelyn
[20 Mar 2007 15:09] Chad MILLER
Patch suggested isn't the right approach.  Instead, we should implement "%f" in our my_snprintf().
[31 Mar 2007 0:27] jocelyn fournier
Hi,

New proposed patch :

http://lists.mysql.com/internals/34450

Regards,
  Jocelyn
[19 Apr 2007 23:16] jocelyn fournier
Hi,

Latest patch available here :

http://lists.mysql.com/internals/34515

Regards,
  Jocelyn
[29 Aug 2007 11:25] jocelyn fournier
Hi,

It seems the bug has already been fixed with another approch :

    length= my_snprintf((char*) buff, buff_len - 1,
                        "Uptime: %lu  Threads: %d  Questions: %lu  "
                        "Slow queries: %lu  Opens: %lu  Flush tables: %lu  "
                        "Open tables: %u  Queries per second avg: %u.%u",
                        uptime,
                        (int) thread_count, (ulong) thd->query_id,
                        current_global_status_var.long_query_count,
                        current_global_status_var.opened_tables,
                        refresh_version,
                        cached_open_tables(),
                        (uint) (queries_per_second1000 / 1000),
                        (uint) (queries_per_second1000 % 1000));

(although this doesn't add %f support in my_snprintf with this approch)

Regards,
  Jocelyn
[4 Jan 2008 10:01] Valeriy Kravchuk
Looks like this is already fixed:

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -uroot -proot test -P3310
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.21-beta-community-debug MySQL Community Server - Debug (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> status
--------------
mysql  Ver 14.14 Distrib 5.1.21-beta, for Win32 (ia32)

Connection id:          2
Current database:       test
Current user:           root@localhost
SSL:                    Not in use
Using delimiter:        ;
Server version:         5.1.21-beta-community-debug MySQL Community Server - Deb
ug (GPL)
Protocol version:       10
Connection:             localhost via TCP/IP
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
TCP port:               3310
Uptime:                 29 sec

Threads: 1  Questions: 8  Slow queries: 0  Opens: 14  Flush tables: 1  Open tabl
es: 7  Queries per second avg: 0.275
--------------
[4 Jan 2008 10:14] jocelyn fournier
Hi,

Yes, this has been fixed with another approch, although it doesn't add %f support in my_snprintf.

Regards,
  Jocelyn