← Back to team overview

maria-developers team mailing list archive

Re: Forked mytop - conflicts, issues | fullqueries overflow bug patch

 

 

Hi, 

I attached to this message a patch to fix the overflow when
fullqueries is activated and full queries are taking more than a line
that might be resulting in a page overflow (the informations shown on
mytop will exceed the terminal height). 

As for the latest commit
upstream (21, mar 2013
https://github.com/jzawodn/mytop/commit/437f2ef8d3fce02eafe935ddbf860d1dfbc43f7d)
its only a small fix that seems to already have been fixed on the
MariaDB version. 

Regards. 
--- mytop	2013-05-14 12:56:54.179472126 +0200
+++ mytop.patched	2013-05-14 12:58:46.270797181 +0200
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 #
-# $Id: mytop,v 1.91 2012/01/18 16:49:12 mgrennan Exp $
+# $Id: mytop,v 1.91-maria1 2013/05/14 12:57:12 mgrennan Exp $
 
 =pod
 
@@ -20,7 +20,7 @@
 use List::Util qw(min max);
 use File::Basename;
 
-$main::VERSION = "1.91a";
+$main::VERSION = "1.91a-maria1";
 my $path_for_script= dirname($0);
 
 $|=1;
@@ -1298,6 +1298,10 @@
             if ($config{fullqueries})
             {
                 $smInfo = $thread->{Info};
+		if (length($smInfo) > $free)
+		{
+			$lines_left -= int((length($smInfo) - $free)/$width) + 1;
+		}
             } else {
                 $smInfo = substr $thread->{Info}, 0, $free;
             }
@@ -1311,6 +1315,9 @@
             $smInfo = "";
         }
 
+        $lines_left--;
+	last if $lines_left < 0;
+
         if ($HAS_COLOR)
         {
             print YELLOW() if $thread->{Command} eq 'Query';
@@ -1325,11 +1332,6 @@
             $thread->{Time}, $thread->{Progress}, $thread->{Command}, $thread->{State}, $smInfo;
 
         print RESET() if $HAS_COLOR;
-
-        $lines_left--;
-
-        last if $lines_left == 0;
-
     }
 
 }