List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:May 23 2011 12:39pm
Subject:bzr commit into mysql-5.5-mtr branch (bjorn.munch:3216) Bug#11750043
View as plain text  
#At file:///home/bm136801/my/gzcore-55/ based on revid:bjorn.munch@stripped

 3216 Bjorn Munch	2011-05-23
      Bug #11750043 40340: USE GZIPPED CORE FILES TO SAVE SPACE
      Use [g]zip on core file if available, ignore if not

    modified:
      mysql-test/lib/mtr_misc.pl
      mysql-test/mysql-test-run.pl
=== modified file 'mysql-test/lib/mtr_misc.pl'
--- a/mysql-test/lib/mtr_misc.pl	2011-04-07 08:12:52 +0000
+++ b/mysql-test/lib/mtr_misc.pl	2011-05-23 12:38:37 +0000
@@ -31,6 +31,7 @@ sub mtr_script_exists(@);
 sub mtr_file_exists(@);
 sub mtr_exe_exists(@);
 sub mtr_exe_maybe_exists(@);
+sub mtr_compress_file($);
 sub mtr_milli_sleep($);
 sub start_timer($);
 sub has_expired($);
@@ -199,6 +200,33 @@ sub mtr_exe_exists (@) {
   }
 }
 
+#
+# Try to compress file using tools that might be available.
+# If zip/gzip is not available, just silently ignore.
+#
+
+sub mtr_compress_file ($) {
+  my ($filename)= @_;
+
+  mtr_error ("File to compress not found: $filename") unless -f $filename;
+
+  if (IS_WINDOWS)
+  {
+    # Capture stderr
+    my $ziperr= `zip $filename.zip $filename 2>&1`;
+    unlink($filename) if ! $?;
+    print "$ziperr\n"
+      if $? && $ziperr !~ /recognized as an internal or external/;
+  }
+  else
+  {
+    my $gzres= system("gzip $filename");
+    if ($gzres && $gzres != -1) {
+      mtr_error ("Error: have gzip but it fails to compress core file");
+    }
+  }
+}
+
 
 sub mtr_milli_sleep ($) {
   die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1;

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-05-12 13:19:59 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-05-23 12:38:37 +0000
@@ -657,6 +657,8 @@ sub run_test_server ($$$) {
 			     mtr_report(" - deleting it, already saved",
 					"$opt_max_save_core");
 			     unlink("$core_file");
+			   } else {
+			     mtr_compress_file($core_file);
 			   }
 			   ++$num_saved_cores;
 			 }


Attachment: [text/bzr-bundle] bzr/bjorn.munch@oracle.com-20110523123837-7rnd9g0vshan6qx1.bundle
Thread
bzr commit into mysql-5.5-mtr branch (bjorn.munch:3216) Bug#11750043Bjorn Munch23 May