[Pkg-mysql-commits] r1615 - in mysql-dfsg-5.1/branches/experimental/debian: . additions

Christian Hammers ch at alioth.debian.org
Sat Jul 4 00:50:54 UTC 2009


Author: ch
Date: 2009-07-04 00:50:53 +0000 (Sat, 04 Jul 2009)
New Revision: 1615

Modified:
   mysql-dfsg-5.1/branches/experimental/debian/README.Maintainer
   mysql-dfsg-5.1/branches/experimental/debian/additions/mysqlreport
   mysql-dfsg-5.1/branches/experimental/debian/changelog
   mysql-dfsg-5.1/branches/experimental/debian/mysql-server-5.1.NEWS
Log:
* Added NEWS regarding update notes
* Updated mysqlreport

mysqlreport got those two lines in addition which I also mailed
to the upstream author:

--- /tmp/mysqlreport    2009-07-04 02:38:44.000000000 +0200
+++ debian/additions/mysqlreport        2009-07-04 02:42:13.000000000
+0200 @@ -826,6 +826,7 @@
 sub perc # Percentage
 {
    my($is, $of) = @_;
+   $is = 0 if (not defined $is);
    return sprintf "%.2f", ($is * 100) / ($of ||= 1);
 }
 
@@ -993,6 +994,8 @@
 
    return if not defined $stats{'Innodb_page_size'};
 
+   $stats{'Innodb_buffer_pool_pages_latched'} = 0 if not defined $stats{'Innodb_buffer_pool_pages_latched'}; +
    $~ = 'IB';
    write;
 



Modified: mysql-dfsg-5.1/branches/experimental/debian/README.Maintainer
===================================================================
--- mysql-dfsg-5.1/branches/experimental/debian/README.Maintainer	2009-07-04 00:24:12 UTC (rev 1614)
+++ mysql-dfsg-5.1/branches/experimental/debian/README.Maintainer	2009-07-04 00:50:53 UTC (rev 1615)
@@ -3,8 +3,6 @@
 ##	FIXME for 5.1    ##
 ###########################
 
-# http://dev.mysql.com/doc/refman/5.1/en/upgrading-from-5-0.html
-* call the REPAIR TABLE statement for each table that contains any FULLTEXT  indexes.
 * put this trigger-recreation thing into the init scripts -- what?!
 * Let debian-i10n-english review all template changes before the translaters start.
 * Mark debconf translations as obsolete with debconf-updatepo.

Modified: mysql-dfsg-5.1/branches/experimental/debian/additions/mysqlreport
===================================================================
--- mysql-dfsg-5.1/branches/experimental/debian/additions/mysqlreport	2009-07-04 00:24:12 UTC (rev 1614)
+++ mysql-dfsg-5.1/branches/experimental/debian/additions/mysqlreport	2009-07-04 00:50:53 UTC (rev 1615)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-# mysqlreport v3.4a Jan 23 2008 
+# mysqlreport v3.5 Apr 16 2008
 # http://hackmysql.com/mysqlreport
 
 # mysqlreport makes an easy-to-read report of important MySQL status values.
@@ -33,7 +33,7 @@
 my %mycnf; # ~/.my.cnf
 my ($tmpfile_fh, $tmpfile);
 my ($stat_name, $stat_val, $stat_label);
-my ($major, $minor, $patch, $x); # MySQL version
+my $MySQL_version;
 my (%stats, %vars); # SHOW STATUS, SHOW VARIABLES
 my (%DMS_vals, %Com_vals, %ib_vals);
 my ($dbh, $query);
@@ -92,15 +92,18 @@
 $op{'com'} ||= 3;
 $op{'c'}   ||= 1; # Used in collect_reports() if --r given integer value
 
+$relative_live    = 0;
+$relative_infiles = 0;
+
 if(defined $op{'r'})
 {
-   if($op{r}) { $relative_live    = 1; }
+   if($op{r}) { $relative_live    = 1; }  # if -r was given an integer value
    else       { $relative_infiles = 1; }
 }
 
 # The report is written to a tmp file first.
 # Later it will be moved to $op{'outfile'} or emailed $op{'email'} if needed.
-($tmpfile_fh, $tmpfile) = tempfile() or die("Cannot open temporary file for writing: $!\n");
+($tmpfile_fh, $tmpfile) = tempfile() or die "Cannot open temporary file for writing: $!\n";
 
 if($op{'detach'})
 {
@@ -122,30 +125,12 @@
 select $tmpfile_fh;
 $| = 1 if ($op{'detach'} || $relative_live);
 
+print "tmp file: $tmpfile\n" if $op{debug};
+
 # Connect to MySQL
 if(!$op{'infile'} && !$relative_infiles)
 {
-   my $dsn;
-
-   if($mycnf{'socket'} && -S $mycnf{'socket'})
-   {
-      $dsn = "DBI:mysql:mysql_socket=$mycnf{socket}";
-   }
-   elsif($mycnf{'host'})
-   {
-      $dsn = "DBI:mysql:host=$mycnf{host}" . ($mycnf{port} ? ";port=$mycnf{port}" : "");
-   }
-   else
-   {
-      $dsn = "DBI:mysql:host=localhost";
-   }
-
-   if($op{debug})
-   {
-      print "DBI DSN: $dsn\n";
-   }
-
-   $dbh = DBI->connect($dsn, $mycnf{'user'}, $mycnf{'pass'}) or die;
+   connect_to_MySQL();
 }
 
 $have_innodb_vals = 1; # This might be set to 0 later in get_MySQL_version()
@@ -192,7 +177,7 @@
 sub show_help_and_exit
 {
    print <<"HELP";
-mysqlreport v3.4a Jan 23 2008
+mysqlreport v3.5 Apr 16 2008
 mysqlreport makes an easy-to-read report of important MySQL status values.
 
 Command line options (abbreviations work):
@@ -224,6 +209,8 @@
 
 sub get_user_mycnf
 {
+   print "get_user_mycnf\n" if $op{debug};
+
    return if $WIN;
    open MYCNF, "$ENV{HOME}/.my.cnf" or return;
    while(<MYCNF>)
@@ -238,8 +225,34 @@
    close MYCNF;
 }
 
+sub connect_to_MySQL
+{
+   print "connect_to_MySQL\n" if $op{debug};
+
+   my $dsn;
+
+   if($mycnf{'socket'} && -S $mycnf{'socket'})
+   {
+      $dsn = "DBI:mysql:mysql_socket=$mycnf{socket}";
+   }
+   elsif($mycnf{'host'})
+   {
+      $dsn = "DBI:mysql:host=$mycnf{host}" . ($mycnf{port} ? ";port=$mycnf{port}" : "");
+   }
+   else
+   {
+      $dsn = "DBI:mysql:host=localhost";
+   }
+
+   print "connect_to_MySQL: DBI DSN: $dsn\n" if $op{debug};
+
+   $dbh = DBI->connect($dsn, $mycnf{'user'}, $mycnf{'pass'}) or die;
+}
+
 sub collect_reports
 {
+   print "collect_reports\n" if $op{debug};
+
    my $i;
 
    get_vals();
@@ -258,8 +271,12 @@
 
    for($i = 0; $i < $op{'c'}; $i++)
    {
+      $dbh->disconnect();
+
       sleep($op{'r'});
 
+      connect_to_MySQL();
+
       print "\n#\n# Interval report " , $i + 1 , ", +", sec_to_dhms(($i + 1) * $op{'r'}), "\n#\n";
 
       get_vals();
@@ -270,6 +287,8 @@
 
 sub read_relative_infiles
 {
+   print "read_relative_infiles\n" if $op{debug};
+
    my $slurp;    # Used to check infiles for multiple sets of status values
    my $n_stats;  # Number of multiple sets of status values in an infile
    my $infile;
@@ -309,12 +328,12 @@
          for($i = 0; $i < $n_stats; $i++)
          {
             my ($fh, $name) = tempfile()
-               or die("read_relative_infiles: cannot open temporary file for writing: $!\n");
+               or die "read_relative_infiles: cannot open temporary file for writing: $!\n";
 
             push(@tmpfile_fh, $fh);
             push(@tmpfile_name, $name);
 
-            print "read_relative_infiles: created tmp file '$name'\n" if $op{debug};
+            print "read_relative_infiles: created tmp file '$name' for set $i\n" if $op{debug};
          }
 
          $i = 0;
@@ -322,31 +341,27 @@
 
          select $tmpfile_fh[$i];
 
-         # Read infile again and copy each set of status values
-         # to seperate tmp files
+         # Read infile again and copy each set of status values to seperate tmp files
          open INFILE, "< $infile" or warn and next;
          while(<INFILE>)
          {
             next if /^\+/;
             next if /^$/;
 
-            print;
+            # The infile must begin with the system variable values.
+            # Therefore, the first occurance of Aborted_clients indicates the beginning
+            # of the first set of status values if no sets have occured yet ($stat_n == 0).
+            # In this case, the following status values are printed to the current fh,
+            # along with the system variable values read thus far, until Aborted_clients
+            # occurs again. Then begins the second and subsequent sets of status values.
 
             if(/Aborted_clients/)
             {
-               # The infile should begin with manually inserted system
-               # var values (like key_buffer_size = 128M). Therefore,
-               # the first occurance of /Aborted_clients/ indicates
-               # the first set of status values only if no sets have
-               # occured yet ($stat_n = 0). In this case, the following
-               # status values are printed to the current fh along with
-               # the system var values read so far until /Aborted_clients/
-               # occurs again. Then begins the second and subsequent sets
-               # of status values.
-               next if $stat_n++ == 0;
-
+               print and next if $stat_n++ == 0;
                select $tmpfile_fh[++$i];
             }
+
+            print;
          }
          close INFILE;
 
@@ -357,13 +372,16 @@
          {
             close $tmpfile_fh[$i];
 
+            print "read_relative_infiles: reading set $i tmp file '$tmpfile_name[$i]'\n"
+               if $op{debug};
+
             read_infile($tmpfile_name[$i]);
             relative_infile_report($report_n++);
 
             if($WIN) { `del $tmpfile_name[$i]`;   }
             else     { `rm -f $tmpfile_name[$i]`; }
 
-            print "read_relative_infiles: deleted tmp file '$tmpfile_name[$i]'\n"
+            print "read_relative_infiles: deleted set $i tmp file '$tmpfile_name[$i]'\n"
                if $op{debug};
          }
 
@@ -373,6 +391,8 @@
 
 sub relative_infile_report
 {
+   print "relative_infile_report\n" if $op{debug};
+
    my $report_n = shift;
 
    if($report_n == 1)
@@ -400,10 +420,12 @@
 
 sub get_vals
 {
+   print "get_vals\n" if $op{debug};
+
    my @row;
 
    # Get status values
-   if($major >= 5 && (($minor == 0 && $patch >= 2) || $minor > 0))
+   if($MySQL_version >= 50002)
    {
       $query = $dbh->prepare("SHOW GLOBAL STATUS;");
    }
@@ -419,6 +441,8 @@
 
 sub get_vars
 {
+   print "get_vars\n" if $op{debug};
+
    my @row;
 
    # Get server system variables
@@ -427,7 +451,7 @@
    while(@row = $query->fetchrow_array()) { $vars{$row[0]} = $row[1]; }
 
    # table_cache was renamed to table_open_cache in MySQL 5.1.3
-   if($major >= 5 && (($minor == 1 && $patch >= 3) || $minor > 1))
+   if($MySQL_version >= 50103)
    {
       $vars{'table_cache'} = $vars{'table_open_cache'};
    }
@@ -435,9 +459,14 @@
 
 sub read_infile
 {
+   print "read_infile\n" if $op{debug};
+
    my $infile = shift;
 
-   # Default values if not set in INFILE
+   # Default required system variable values if not set in INFILE.
+   # As of mysqlreport v3.5 the direct output from SHOW VARIABLES;
+   # can be put into INFILE instead. See http://hackmysql.com/mysqlreportdoc
+   # for details.
    $vars{'version'} = "0.0.0"         if !exists $vars{'version'};
    $vars{'table_cache'} = 64          if !exists $vars{'table_cache'};
    $vars{'max_connections'} = 100     if !exists $vars{'max_connections'};
@@ -450,34 +479,80 @@
    # One should also add:
    #    key_cache_block_size
    #    query_cache_size
-   # to their infile if needed.
+   # to INFILE if needed.
 
-   open INFILE, "< $infile" or warn;
+   open INFILE, "< $infile" or die "Cannot open INFILE '$infile': $!\n";
+
    while(<INFILE>)
    {
-      next if /^\+\-/;
-      next if /^$/;
+      last if !defined $_;
 
-      chomp;
+      next if /^\+/;  # skip divider lines 
+      next if /^$/;   # skip blank lines
 
-      if(/([A-Za-z_]+)[\s\t|]+(\d+)/)
+      next until /(Aborted_clients|back_log|=)/;
+
+      if($1 eq 'Aborted_clients')  # status values
       {
-         $stats{$1} = $2;
-         next;
+         print "read_infile: start stats\n" if $op{debug};
+
+         while($_)
+         {
+            chomp;
+            if(/([A-Za-z_]+)[\s\t|]+(\d+)/)
+            {
+               $stats{$1} = $2;
+               print "read_infile: save $1 = $2\n" if $op{debug};
+            }
+            else { print "read_infile: ignore '$_'\n" if $op{debug}; }
+
+            last if $1 eq 'Uptime';  # exit while() if end of status values
+            $_ = <INFILE>; # otherwise, read next line of status values
+         }
       }
+      elsif($1 eq  'back_log')  # system variable values
+      {
+         print "read_infile: start vars\n" if $op{debug};
 
-      # Explicit var = val (e.g. key_buffer_size = 128M)
-      if( /^\s*(\w+)\s*=\s*([0-9.]+)(M*)\s*$/ )
+         while($_)
+         {
+            chomp;
+            if(/([A-Za-z_]+)[\s\t|]+([\w\.\-]+)/)  # This will exclude some vars
+            {                                      # like pid_file which we don't need
+               $vars{$1} = $2;
+               print "read_infile: save $1 = $2\n" if $op{debug};
+            }
+            else { print "read_infile: ignore '$_'\n" if $op{debug}; }
+
+            last if $1 eq 'wait_timeout';  # exit while() if end of vars
+            $_ = <INFILE>; # otherwise, read next line of vars
+         }
+      }
+      elsif($1 eq '=')  # old style, manually added system variable values
       {
-         $vars{$1} = ($3 ? $2 * 1024 * 1024 : $2);
-         print "read_infile: read '$_' as $1 = $vars{$1}\n" if $op{debug};
-         next;
+         print "read_infile: start old vars\n" if $op{debug};
+
+         while($_ && $_ =~ /=/)
+         {
+            chomp;
+            if(/^\s*(\w+)\s*=\s*([0-9.]+)(M*)\s*$/)  # e.g.: key_buffer_size = 128M
+            {
+               $vars{$1} = ($3 ? $2 * 1024 * 1024 : $2);
+               print "read_infile: read '$_' as $1 = $vars{$1}\n" if $op{debug};
+            }
+            else { print "read_infile: ignore '$_'\n" if $op{debug}; }
+
+            $_ = <INFILE>; # otherwise, read next line of old vars
+         }
+
+         redo;
       }
       else
       {
          print "read_infile: unrecognized line: '$_'\n" if $op{debug};
       }
    }
+
    close INFILE;
 
    $real_uptime = $stats{'Uptime'};
@@ -489,8 +564,12 @@
 
 sub get_MySQL_version
 {
-   return if $major;
+   print "get_MySQL_version\n" if $op{debug};
 
+   return if $MySQL_version;
+
+   my ($major, $minor, $patch);
+
    if($op{'infile'} || $relative_infiles)
    {
       ($major, $minor, $patch) = ($vars{'version'} =~ /(\d{1,2})\.(\d{1,2})\.(\d{1,2})/);
@@ -505,8 +584,10 @@
       ($major, $minor, $patch) = ($row[1] =~ /(\d{1,2})\.(\d{1,2})\.(\d{1,2})/);
    }
 
+   $MySQL_version = sprintf("%d%02d%02d", $major, $minor, $patch);
+
    # Innodb_ status values were added in 5.0.2
-   if($major <= 4 || $patch < 2)
+   if($MySQL_version < 50002)
    {
       $have_innodb_vals = 0;
       print "get_MySQL_version: no InnoDB reports because MySQL version is older than 5.0.2\n" if $op{debug};
@@ -515,6 +596,8 @@
 
 sub set_myisam_vals
 {
+   print "set_myisam_vals\n" if $op{debug};
+
    $questions = $stats{'Questions'};
 
    $key_read_ratio = sprintf "%.2f",
@@ -554,12 +637,14 @@
 
    $dms = $DMS_vals{SELECT} + $DMS_vals{INSERT} + $DMS_vals{REPLACE} + $DMS_vals{UPDATE} + $DMS_vals{DELETE};
 
-   $slow_query_t = "($vars{long_query_time})";
+   $slow_query_t = format_u_time($vars{long_query_time});
 
 }
 
 sub set_ib_vals
 {
+   print "set_ib_vals\n" if $op{debug};
+
    $ib_bp_used  = ($stats{'Innodb_buffer_pool_pages_total'} -
                    $stats{'Innodb_buffer_pool_pages_free'}) *
                    $stats{'Innodb_page_size'};
@@ -575,65 +660,69 @@
 
 sub write_relative_report
 {
-      %stats_present = %stats;
+   print "write_relative_report\n" if $op{debug};
 
-      for(keys %stats)
+   %stats_present = %stats;
+
+   for(keys %stats)
+   {
+      if($stats_past{$_} =~ /\d+/)
       {
-         if($stats_past{$_} =~ /\d+/)
+         if($stats_present{$_} >= $stats_past{$_}) # Avoid negative values
          {
-            if($stats_present{$_} >= $stats_past{$_}) # Avoid negative values
-            {
-               $stats{$_} = $stats_present{$_} - $stats_past{$_};
-            }
+            $stats{$_} = $stats_present{$_} - $stats_past{$_};
          }
       }
+   }
 
-      # These values are either "at present" or "high water marks".
-      # Therefore, it is more logical to not relativize these values.
-      # Doing otherwise causes strange and misleading values.
-      $stats{'Key_blocks_used'}      = $stats_present{'Key_blocks_used'};
-      $stats{'Open_tables'}          = $stats_present{'Open_tables'};
-      $stats{'Max_used_connections'} = $stats_present{'Max_used_connections'};
-      $stats{'Threads_running'}      = $stats_present{'Threads_running'};
-      $stats{'Threads_connected'}    = $stats_present{'Threads_connected'};
-      $stats{'Threads_cached'}       = $stats_present{'Threads_cached'};
-      $stats{'Qcache_free_blocks'}   = $stats_present{'Qcache_free_blocks'};
-      $stats{'Qcache_total_blocks'}  = $stats_present{'Qcache_total_blocks'};
-      $stats{'Qcache_free_memory'}   = $stats_present{'Qcache_free_memory'};
-      if($have_innodb_vals)
+   # These values are either "at present" or "high water marks".
+   # Therefore, it is more logical to not relativize these values.
+   # Doing otherwise causes strange and misleading values.
+   $stats{'Key_blocks_used'}      = $stats_present{'Key_blocks_used'};
+   $stats{'Open_tables'}          = $stats_present{'Open_tables'};
+   $stats{'Max_used_connections'} = $stats_present{'Max_used_connections'};
+   $stats{'Threads_running'}      = $stats_present{'Threads_running'};
+   $stats{'Threads_connected'}    = $stats_present{'Threads_connected'};
+   $stats{'Threads_cached'}       = $stats_present{'Threads_cached'};
+   $stats{'Qcache_free_blocks'}   = $stats_present{'Qcache_free_blocks'};
+   $stats{'Qcache_total_blocks'}  = $stats_present{'Qcache_total_blocks'};
+   $stats{'Qcache_free_memory'}   = $stats_present{'Qcache_free_memory'};
+   if($have_innodb_vals)
+   {
+      $stats{'Innodb_page_size'}                 = $stats_present{'Innodb_page_size'};
+      $stats{'Innodb_buffer_pool_pages_data'}    = $stats_present{'Innodb_buffer_pool_pages_data'};
+      $stats{'Innodb_buffer_pool_pages_dirty'}   = $stats_present{'Innodb_buffer_pool_pages_dirty'};
+      $stats{'Innodb_buffer_pool_pages_free'}    = $stats_present{'Innodb_buffer_pool_pages_free'};
+      $stats{'Innodb_buffer_pool_pages_latched'} = $stats_present{'Innodb_buffer_pool_pages_latched'};
+      $stats{'Innodb_buffer_pool_pages_misc'}    = $stats_present{'Innodb_buffer_pool_pages_misc'};
+      $stats{'Innodb_buffer_pool_pages_total'}   = $stats_present{'Innodb_buffer_pool_pages_total'};
+      $stats{'Innodb_data_pending_fsyncs'}       = $stats_present{'Innodb_data_pending_fsyncs'};
+      $stats{'Innodb_data_pending_reads'}        = $stats_present{'Innodb_data_pending_reads'};
+      $stats{'Innodb_data_pending_writes'}       = $stats_present{'Innodb_data_pending_writes'};
+
+      # Innodb_row_lock_ values were added in MySQL 5.0.3
+      if($MySQL_version >= 50003)
       {
-         $stats{'Innodb_page_size'}                 = $stats_present{'Innodb_page_size'};
-         $stats{'Innodb_buffer_pool_pages_data'}    = $stats_present{'Innodb_buffer_pool_pages_data'};
-         $stats{'Innodb_buffer_pool_pages_dirty'}   = $stats_present{'Innodb_buffer_pool_pages_dirty'};
-         $stats{'Innodb_buffer_pool_pages_free'}    = $stats_present{'Innodb_buffer_pool_pages_free'};
-         $stats{'Innodb_buffer_pool_pages_latched'} = $stats_present{'Innodb_buffer_pool_pages_latched'};
-         $stats{'Innodb_buffer_pool_pages_misc'}    = $stats_present{'Innodb_buffer_pool_pages_misc'};
-         $stats{'Innodb_buffer_pool_pages_total'}   = $stats_present{'Innodb_buffer_pool_pages_total'};
-         $stats{'Innodb_data_pending_fsyncs'}       = $stats_present{'Innodb_data_pending_fsyncs'};
-         $stats{'Innodb_data_pending_reads'}        = $stats_present{'Innodb_data_pending_reads'};
-         $stats{'Innodb_data_pending_writes'}       = $stats_present{'Innodb_data_pending_writes'};
-
-         # Innodb_row_lock_ values were added in MySQL 5.0.3
-         if((($minor == 0 && $patch >= 3) || $minor > 0))
-         {
-            $stats{'Innodb_row_lock_current_waits'} = $stats_present{'Innodb_row_lock_current_waits'};
-            $stats{'Innodb_row_lock_time_avg'}      = $stats_present{'Innodb_row_lock_time_avg'};
-            $stats{'Innodb_row_lock_time_max'}      = $stats_present{'Innodb_row_lock_time_max'};
-         }
+         $stats{'Innodb_row_lock_current_waits'} = $stats_present{'Innodb_row_lock_current_waits'};
+         $stats{'Innodb_row_lock_time_avg'}      = $stats_present{'Innodb_row_lock_time_avg'};
+         $stats{'Innodb_row_lock_time_max'}      = $stats_present{'Innodb_row_lock_time_max'};
       }
+   }
 
-      get_Com_values();
+   get_Com_values();
 
-      %stats_past = %stats_present;
+   %stats_past = %stats_present;
 
-      set_myisam_vals();
-      set_ib_vals() if $have_innodb_vals;
+   set_myisam_vals();
+   set_ib_vals() if $have_innodb_vals;
 
-      write_report();
+   write_report();
 }
 
 sub write_report
 {
+   print "write_report\n" if $op{debug};
+
    $~ = 'MYSQL_TIME', write;
    $~ = 'KEY_BUFF_MAX', write;
    if($key_buffer_usage != -1) { $~ = 'KEY_BUFF_USAGE', write }
@@ -692,9 +781,52 @@
    return $short;
 }
 
+# What began as a simple but great idea has become the new standard:
+# long_query_time in microseconds. For MySQL 5.1.21+ and 6.0.4+ this
+# is now standard. For 4.1 and 5.0 patches, the architects of this
+# idea provide: http://www.mysqlperformanceblog.com/mysql-patches/
+# Relevant notes in MySQL manual:
+# http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html
+# http://dev.mysql.com/doc/refman/6.0/en/slow-query-log.html
+#
+# The format_u_time sub simply beautifies long_query_time.
+
+sub format_u_time  # format microsecond (µ) time value
+{
+   # 0.000000 - 0.000999 = 0 - 999 µ
+   # 0.001000 - 0.999999 = 1 ms - 999.999 ms
+   # 1.000000 - n.nnnnnn = 1 s - n.nnnnn s
+
+   my $t = shift;
+   my $f;  # formatted µ time
+   my $u = chr(($WIN ? 230 : 181));
+
+   $t = 0 if $t < 0;
+
+   if($t > 0 && $t <= 0.000999)
+   {
+      $f = ($t * 1000000) . " $u";
+   }
+   elsif($t >= 0.001000 && $t <= 0.999999)
+   {
+      $f = ($t * 1000) . ' ms';
+   }
+   elsif($t >= 1)
+   {
+      $f = ($t * 1) . ' s';  # * 1 to remove insignificant zeros
+   }
+   else
+   {
+      $f = 0;  # $t should = 0 at this point
+   }
+
+   return $f;
+}
+
 sub perc # Percentage
 {
    my($is, $of) = @_;
+   $is = 0 if (not defined $is);
    return sprintf "%.2f", ($is * 100) / ($of ||= 1);
 }
 
@@ -707,6 +839,8 @@
 
 sub email_report # Email given report to $op{'email'}
 {
+   print "email_report\n" if $op{debug};
+
    return if $WIN;
 
    my $report = shift;
@@ -721,6 +855,8 @@
 
 sub cat_report # Print given report to screen
 {
+   print "cat_report\n" if $op{debug};
+
    my $report = shift;
    my @report;
 
@@ -732,6 +868,8 @@
 
 sub get_Com_values
 {
+   print "get_Com_values\n" if $op{debug};
+
    %Com_vals = ();
 
    # Make copy of just the Com_ values
@@ -758,6 +896,8 @@
 
 sub write_DTQ # Write DTQ report in descending order by values
 {
+   print "write_DTQ\n" if $op{debug};
+
    $~ = 'DTQ';
 
    my %DTQ;
@@ -792,6 +932,8 @@
 
 sub write_DMS # Write DMS report in descending order by values
 {
+   print "write_DMS\n" if $op{debug};
+
    $~ = 'DMS';
 
    for(sort { $DMS_vals{$b} <=> $DMS_vals{$a} } keys(%DMS_vals))
@@ -804,6 +946,8 @@
 
 sub write_Com # Write COM report in descending order by values
 {
+   print "write_Com\n" if $op{debug};
+
    my $i = $op{'com'};
 
    $~ = 'COM_1';
@@ -829,6 +973,8 @@
 
 sub write_qcache
 {
+   print "write_qcache\n" if $op{debug};
+
    # Query cache was added in 4.0.1, but have_query_cache was added in 4.0.2,
    # ergo this method is slightly more reliable
    return if not exists $vars{'query_cache_size'};
@@ -844,18 +990,17 @@
 
 sub write_InnoDB
 {
-   # Innodb_ status values were added in MySQL 5.0.2
-   if(! ($major >= 5 && (($minor == 0 && $patch >= 2) || $minor > 0)) )
-   {
-      # In case infile has Innodb_ values but didn't specify the MySQL version
-      if(not defined $stats{'Innodb_page_size'}) { return; }
-   }
+   print "write_InnoDB\n" if $op{debug};
 
+   return if not defined $stats{'Innodb_page_size'};
+
+   $stats{'Innodb_buffer_pool_pages_latched'} = 0 if not defined $stats{'Innodb_buffer_pool_pages_latched'};
+
    $~ = 'IB';
    write;
 
    # Innodb_row_lock_ values were added in MySQL 5.0.3
-   if((($minor == 0 && $patch >= 3) || $minor > 0))
+   if($MySQL_version >= 50003)
    {
       $~ = 'IB_LOCK';
       write;
@@ -882,6 +1027,8 @@
 
 sub exit_tasks_and_cleanup
 {
+   print "exit_tasks_and_cleanup\n" if $op{debug};
+
    close $tmpfile_fh;
    select STDOUT unless $op{'detach'};
 
@@ -951,7 +1098,7 @@
 .
 
 format SLOW_DMS =
-Slow @<<<<< @>>>>>>>>  @>>>>>/s          @>>>>>  %DMS: @>>>>>  Log: @>> 
+Slow @<<<<<<< @>>>>>>  @>>>>>/s          @>>>>>  %DMS: @>>>>>  Log: @>> 
 $slow_query_t, make_short($stats{'Slow_queries'}), t($stats{'Slow_queries'}), perc($stats{'Slow_queries'}, $questions), perc($stats{'Slow_queries'}, $dms), $vars{'log_slow_queries'}
 DMS         @>>>>>>>>  @>>>>>/s          @>>>>>
 make_short($dms), t($dms), perc($dms, $questions)

Modified: mysql-dfsg-5.1/branches/experimental/debian/changelog
===================================================================
--- mysql-dfsg-5.1/branches/experimental/debian/changelog	2009-07-04 00:24:12 UTC (rev 1614)
+++ mysql-dfsg-5.1/branches/experimental/debian/changelog	2009-07-04 00:50:53 UTC (rev 1615)
@@ -1,4 +1,4 @@
-mysql-dfsg-5.1 (5.1.36-0.1) experimental; urgency=low
+mysql-dfsg-5.1 (5.1.36-1) experimental; urgency=low
 
   * Ex-maintainer upload :)
   * New upstream release. 
@@ -16,6 +16,7 @@
     to pipe all mysqld output into the syslog. The reason for not letting dpkg
     handle it via a normal config file change was that my.cnf is usually
     heavily tuned by the admin so the setting would go lost too easily.
+  * Updated mysqlreport to version 3.5 (including two minor patches by me).
 
  -- Christian Hammers <ch at debian.org>  Wed, 01 Jul 2009 20:54:58 +0200
 

Modified: mysql-dfsg-5.1/branches/experimental/debian/mysql-server-5.1.NEWS
===================================================================
--- mysql-dfsg-5.1/branches/experimental/debian/mysql-server-5.1.NEWS	2009-07-04 00:24:12 UTC (rev 1614)
+++ mysql-dfsg-5.1/branches/experimental/debian/mysql-server-5.1.NEWS	2009-07-04 00:50:53 UTC (rev 1615)
@@ -1,3 +1,11 @@
+mysql-dfsg-5.1 (5.1.38-1) unstable; urgency=low
+
+  * Please read http://dev.mysql.com/doc/refman/5.1/en/upgrading-from-5-0.html
+  * Make sure to do a REPAIR TABLE on all tables that use UTF-8 and have a
+    FULLTEXT index.
+
+ -- Christian Hammers <ch at debian.org>  Sat,  4 Jul 2009 02:31:21 +0200
+
 mysql-dfsg-5.0 (5.1.14beta-2) unstable; urgency=low
 
   * The BerkeleyDB Storage Engine is no longer supported. If the options




More information about the Pkg-mysql-commits mailing list