Bug 577528 - mytop does not show proper statistics for MySQL 5.0.2 and newer
Summary: mytop does not show proper statistics for MySQL 5.0.2 and newer
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mytop
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Terje Røsten
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-03-27 19:50 UTC by Andreas Girgensohn
Modified: 2010-04-09 04:25 UTC (History)
1 user (show)

Fixed In Version: mytop-1.7-1.b737f60.fc13
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-03-30 02:16:21 UTC


Attachments (Terms of Use)

Description Andreas Girgensohn 2010-03-27 19:50:29 UTC
Description of problem:

mytop doesn't show proper statistics with more recent MySQL server versions.

How reproducible: always

Steps to Reproduce:
1. Run mytop with a MySQL server 5.0.2 or newer.

Actual results:

qps and similar statistics are zero.

Expected results:

The statistics should have meaningful values.

Additional info:

This is due to a change in MySQL's SHOW STATUS.
http://dev.mysql.com/doc/refman/5.0/en/show-status.html

Below is a patch that fixes the problem.  The use of version comments should make mytop still work with older MySQL servers.

--- mytop.orig  2009-07-26 21:08:12.000000000 -0700
+++ mytop       2010-03-27 10:25:16.000000000 -0700
@@ -265,7 +265,7 @@
 my $db_version;
 my $have_query_cache;

-my @variables = Hashes("show variables");
+my @variables = Hashes("show /*!50002 global */ variables");

 foreach (@variables)
 {
@@ -710,7 +710,7 @@
    ##
    if ($config{header})
    {
-        my @recs = Hashes("show status");
+        my @recs = Hashes("show /*!50002 global */ status");

        ## if the server died or we lost connectivity
        if (not @recs)
@@ -755,7 +755,7 @@

        ## Query Cache info
        ##
-        ## mysql> show status like 'qcache%';
+        ## mysql> show /*!50002 global */ status like 'qcache%';
        ## +-------------------------+----------+
        ## | Variable_name           | Value    |
        ## +-------------------------+----------+
@@ -1064,7 +1064,7 @@

 sub GetQPS()
 {
-    my($data) = Hashes('SHOW STATUS LIKE "Questions"');
+    my($data) = Hashes('SHOW /*!50002 GLOBAL */ STATUS LIKE "Questions"');
    my $num   = $data->{Value};

    if (not defined $questions) ## first time?
@@ -1126,7 +1126,7 @@
    }

    # Variable_name and Value pairs come back...
-    my @data = Hashes("SHOW STATUS LIKE 'Com_%'");
+    my @data = Hashes("SHOW /*!50002 GLOBAL */ STATUS LIKE 'Com_%'");
    my %cmd_data;
    my %cmd_delta;
    my %cmd_pct;
@@ -1197,7 +1197,7 @@
        }
    }

-    my @rows = Hashes("SHOW VARIABLES");
+    my @rows = Hashes("SHOW /*!50002 GLOBAL */ VARIABLES");

    open P, "|$config{pager}" or die "$!";

@@ -1216,7 +1216,7 @@
 sub GetShowStatus()
 {
    Clear() unless $config{batchmode};
-    my @rows = Hashes("SHOW STATUS");
+    my @rows = Hashes("SHOW /*!50002 GLOBAL */ STATUS");

    printf "%32s  %10s %10s\n", 'Counter', 'Total', 'Change';
    printf "%32s  %10s %10s\n", '-------', '-----', '------';

Comment 1 Terje Røsten 2010-03-27 21:09:14 UTC
I have prepared a new package.

Could you please perform a brief test. Package is available here:

 http://koji.fedoraproject.org/koji/buildinfo?buildID=164004

With direct link:
 
 http://kojipkgs.fedoraproject.org/packages/mytop/1.7/1.b737f60.fc12/noarch/mytop-1.7-1.b737f60.fc12.noarch.rpm

Thanks in advance.

Comment 2 Andreas Girgensohn 2010-03-27 22:27:09 UTC
I downloaded and installed the new package.  It displays statistics correctly with MySQL 5.1.44.

Thanks for the quick response.

Comment 3 Fedora Update System 2010-03-28 08:33:42 UTC
mytop-1.7-1.b737f60.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/mytop-1.7-1.b737f60.fc12

Comment 4 Fedora Update System 2010-03-28 08:33:46 UTC
mytop-1.7-1.b737f60.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/mytop-1.7-1.b737f60.fc13

Comment 5 Fedora Update System 2010-03-28 08:33:51 UTC
mytop-1.7-1.b737f60.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/mytop-1.7-1.b737f60.fc11

Comment 6 Fedora Update System 2010-03-30 02:16:16 UTC
mytop-1.7-1.b737f60.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2010-03-30 02:17:16 UTC
mytop-1.7-1.b737f60.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2010-04-09 04:25:37 UTC
mytop-1.7-1.b737f60.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.