[Commits] Rev 65: Basic version of sql-bench wrappen scripts ready. in file:///Users/hakan/work/monty_program/mariadb-tools/

Hakan Kuecuekyilmaz hakan.kuecuekyilmaz at t-online.de
Thu Nov 11 23:56:12 EET 2010


At file:///Users/hakan/work/monty_program/mariadb-tools/

------------------------------------------------------------
revno: 65
revision-id: hakan at askmonty.org-20101111215609-q38kg3e1sfqk3vyv
parent: hakan at askmonty.org-20101109010402-vq74qx8bxf2goe2l
committer: Hakan Kuecuekyilmaz <hakan at askmonty.org>
branch nick: mariadb-tools
timestamp: Thu 2010-11-11 22:56:09 +0100
message:
  Basic version of sql-bench wrappen scripts ready.
-------------- next part --------------
=== added file 'sql-bench/conf/au0013.cnf'
--- a/sql-bench/conf/au0013.cnf	1970-01-01 00:00:00 +0000
+++ b/sql-bench/conf/au0013.cnf	2010-11-11 21:56:09 +0000
@@ -0,0 +1,48 @@
+# Configuration file for host: au0013
+# 
+# OS: Mac OS X 10.6.5
+# Platform: x86_64
+# CPU: Dual-core Intel Core 2 Duo @ 2.8GHz
+# RAM: 4GB
+# Disk(s): 1 x ST9500420ASG S-ATA
+
+#
+# Adjust the following variables according to your system.
+#
+
+#
+# Directories.
+#
+
+# Where to store the test results.
+$sql_bench_results = '/Users/hakan/sql-bench-results';
+
+# Where to compile the sources. You will need at least 1GB of disk space.
+$work_dir = '/tmp';
+
+#
+# Binaries.
+#
+
+# We need bzr >= 1.18.1.
+$bzr = '/usr/local/bin/bzr';
+
+$mktemp = '/sw/sbin/mktemp';
+
+$mkdir = '/sw/bin/mkdir';
+
+# Set the concurrency level (-j) to about: number of CPUs + 1.
+$make = '/sw/bin/make -j3';
+
+# Perl with DBD::MySQL.
+$perl = '/sw/bin/perl';
+
+# If you use ccache, a compiler cache, which reduces compile time,
+# then set the path here.
+my $ccache = '/sw/bin/ccache';
+
+$ENV{'CC'}  = $ccache . " " . $ENV{'CC'};
+$ENV{'CXX'} = $ccache . " " . $ENV{'CXX'};
+
+# This has to be the last line. See "perldoc -f require" for details.
+1;

=== modified file 'sql-bench/conf/sql-bench-base.cnf'
--- a/sql-bench/conf/sql-bench-base.cnf	2010-11-09 01:03:33 +0000
+++ b/sql-bench/conf/sql-bench-base.cnf	2010-11-11 21:56:09 +0000
@@ -5,33 +5,30 @@
 #
 # Hakan Kuecuekyilmaz, <hakan at askmonty dot org>, 2010-10-22.
 
-$ENV{'CC'} = "/sw/bin/ccache gcc";
+# Configure environment variables.
+# Note: ccache is checked in the host specific config file.
+$ENV{'CC'} = "gcc";
 $ENV{'CFLAGS'} = "-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wunused-parameter -O3 -fno-omit-frame-pointer";
-$ENV{'CXX'} = "/sw/bin/ccache gcc";
+$ENV{'CXX'} = "gcc";
 $ENV{'CXXFLAGS'} = "-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -O3 -fno-omit-frame-pointer";
 $ENV{'CXXLDFLAGS'} = "";
 
 $config = {
-  # The MariaDB tree to use and compile.
-  # We are also using the sql-bench directory from there.
-  mysqld_base_tree => '/Users/hakan/work/monty_program/maria-5.2',
-  
   # Configure invocation line.
   # Do not use --prefix here.
   configure_line => '--enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-plugin-maria --with-maria-tmp-tables --without-plugin-innodb_plugin --with-mysqld-ldflags=-static --with-client-ldflags=-static --with-readline --with-ssl --with-plugins=max-no-ndb --with-embedded-server --with-libevent --enable-local-infile',
 };
 
 #
-# Different test to be run with the above configuration
+# Different test to be run with the above configuration.
 # The sql-bench-test will automaticly get --suffix=_test_name as an argument
 # The different options that can be used are:
 #
-# mysqld_start_options       Options given to the mysqld that is started
-#                            This is prefixed with --skip-grant
-# mysqld_init_command        SQL commands given to mysqld before tests starts
-# sql_bench_options          Options given to sql-bench
+# mysqld_start_options    Options given to the mysqld that is started.
+#                         This is prefixed with --skip-grant.
+# mysqld_init_command     SQL commands given to mysqld before tests starts.
+# sql_bench_options       Options given to sql-bench.
 #
-
 $sql_bench_test->{'base'} = {
   mysqld_start_options => '',
   mysqld_init_command => '',
@@ -47,7 +44,7 @@
 $sql_bench_test->{'profile'} = {
   mysqld_start_options => '',
   mysqld_init_command => '',
-  sql_bench_option => '--connect_command="set profile=1" --comment="set profile"',
+  sql_bench_options => '--connect-command="set profile=1" --comment="set profile"',
 };
 
 $sql_bench_test->{'grant'} = {
@@ -64,7 +61,7 @@
 
 $sql_bench_test->{'grant-column'} = {
   mysqld_start_options => '',
-  mysqld_init_command => 'GRANT ALL PRIVILEGES on test.* to \'test at localhost\' ; CREATE table test.foo (a int); GRANT SELECT (a) on test.t1 to \'test at localhost\';',
+  mysqld_init_command => 'GRANT ALL PRIVILEGES on test.* to \'test at localhost\'; CREATE table test.foo (a int); GRANT SELECT (a) on test.t1 to \'test at localhost\';',
   sql_bench_options => '--comment="grant to database and column level grants"',
 };
 
@@ -77,7 +74,6 @@
 #
 # Tests with different storage engines
 #
-
 $sql_bench_test->{'myisam'} = {
   mysqld_start_options => '--default-storage-engine=myisam --key-buffer-size=256M',
   mysqld_init_command => '',

=== modified file 'sql-bench/run-sql-bench.pl'
--- a/sql-bench/run-sql-bench.pl	2010-11-09 01:03:33 +0000
+++ b/sql-bench/run-sql-bench.pl	2010-11-11 21:56:09 +0000
@@ -12,43 +12,48 @@
 use Getopt::Long;
 
 # Parameters from the command line.
-my ($config_file);
-my ($repository);
-my ($suffix);
-my ($help);
+# The base configuration file.
+my $config_file;
+
+# The MariaDB tree to use and compile.
+# We are also using the sql-bench directory from there.
+my $repository;
+my $suffix;
+my $help;
 
 # Variables, which we are using in our configuration file.
-our ($config);
-our ($sql_bench_test);
-
-# Config file we read.
-# TODO: Make the config file a parameter.
-#my $config_file = './conf/sql-bench-base.cnf';
-
-#
-# Directories.
-#
-my $sql_bench_results='/home/hakan/sql-bench-results';
-my $work_dir='/tmp';
+our $config;
+our $sql_bench_test;
+
+# Variables, which we are using in our host specific configuration file.
+our $sql_bench_results;
+our $work_dir;
+our $bzr;
+our $mktemp;
+our $mkdir;
+our $make;
+our $perl;
 
 #
 # Variables.
 #
 # We need at least 1 GB disk space in our $work_dir.
-my $space_limit=1000000;
-my $mysqladmin_options='--no-defaults';
-my $machine=qx(hostname);
-my $run_date=qx(date +%Y-%m-%d);
+my $space_limit = 1000000;
+my $mysql_options = '--no-defaults';
+my $mysqladmin_options = '--no-defaults';
+my $machine = qx(/bin/hostname -s);
+chomp($machine);
+my $run_date = qx(date +%Y-%m-%d);
+chomp($run_date);
 
 # Timeout in seconds for waiting for mysqld to start.
-my $timeout=100;
+my $timeout = 100;
 
 #
 # Binaries.
 #
-my $bzr='/usr/local/bin/bzr';
-#my $bzr='/usr/bin/bzr';
-my $mysqladmin='bin/mysqladmin';
+my $mysql = 'bin/mysql';
+my $mysqladmin = 'bin/mysqladmin';
 
 my $run_by = qx(whoami);
 if ($run_by eq 'root')
@@ -74,8 +79,12 @@
   exit;
 }
 
+# Base config file.
 require $config_file;
 
+# Host specific config file;
+require './conf/' . $machine . '.cnf';
+
 #
 # For debugging the config file parsing.
 #
@@ -83,7 +92,7 @@
 #    print "The value of $key is $config->{$key}\n";
 #}
 
-print "\n";
+#print "\n";
 
 #foreach my $sql_bench_test_name (keys %{$sql_bench_test}) {
 #    print "The value of $sql_bench_test_name is $sql_bench_test->{$sql_bench_test_name}\n";
@@ -95,17 +104,30 @@
 #    
 #    print "\n";
 #}
+#my $now = '';
+#foreach my $test_name (keys %{$sql_bench_test}) {
+#  $now = qx(date "+%Y-%m-%d %H:%M:%S");
+#  chomp($now);
+#  print "[$now]: Starting $test_name\n";
+#  print "\n";
+#  print "mysqld_start_options: $sql_bench_test->{$test_name}->{mysqld_start_options}\n";
+#  print "mysqld_init_command: $sql_bench_test->{$test_name}->{mysqld_init_command}\n";
+#  print "sql_bench_options: $sql_bench_test->{$test_name}->{sql_bench_options}\n";
+#  print "\n";
+#}
+
+#exit 1;
 
 #
 # Check system.
 #
 # We should at least have $space_limit in $workdir.
-my $available=qx(df $work_dir | grep -v Filesystem | awk '{ print \$4 }');
+my $available = qx(df $work_dir | grep -v Filesystem | awk '{ print \$4 }');
 
 if ($available < $space_limit)
 {
   print "[ERROR]: We need at least $space_limit space in $work_dir.";
-  print 'Exiting.';
+  print '  Exiting.';
 
   exit 1;
 }
@@ -118,7 +140,7 @@
 {
   print "[ERROR]: bzr version-info failed. Please provide\n";
   print "  a working bzr repository (--repository)\n";
-  print "Exiting.\n";
+  print "  Exiting.\n";
 
   exit 1;
 }
@@ -127,7 +149,7 @@
   or die
   "[ERROR]: cd to $work_dir failed.\n";
   "  Does your $work_dir directory exists?\n";
-    "  Exiting.\n";
+  "  Exiting.\n";
 
 # Clean up of previous runs.
 qx(killall -9 mysqld);
@@ -135,7 +157,7 @@
 #my $temp_dir = qx(mktemp --directory);
 # For Mac OS X.
 $ENV{'TMPDIR'} = "/tmp";
-my $temp_dir = qx(/sw/sbin/mktemp -d);
+my $temp_dir = qx($mktemp -d);
 if ($? != 0)
 {
   print "[ERROR]: mktemp in $work_dir failed.\n";
@@ -147,6 +169,8 @@
 # Get rid of any newline.
 chomp($temp_dir);
 
+my $mariadb_datadir = "$temp_dir/data";
+
 # bzr export refuses to export to an existing directory,
 # therefore we use a build directory.
 my $now = qx(date "+%Y-%m-%d %H:%M:%S");
@@ -174,7 +198,7 @@
   or die
   "[ERROR]: cd to $temp_dir/build failed.\n";
   "  Does your $temp_dir/build directory exists?\n";
-    "  Exiting.\n";
+  "  Exiting.\n";
 
 qx(BUILD/autorun.sh);
 if ($? != 0)
@@ -187,18 +211,18 @@
 }
 
 # We need --prefix for running make install. Otherwise
-# mysql_install_db does not work properly.
+# mysql_install_db will not work properly.
 qx(./configure $config->{configure_line} --prefix=$temp_dir/install);
 if ($? != 0)
 {
   print "[ERROR]: ./configure $config->{configure_line} failed.\n";
-  print "  Please check your $config->{configure_line}.\n";
+  print "  Please check your '$config->{configure_line}'.\n";
   print "  Exiting.\n";
 
   exit 1;
 }
 
-qx(make -j4);
+qx($make);
 if ($? != 0)
 {
   print "[ERROR]: make failed.\n";
@@ -212,100 +236,157 @@
 chomp($now);
 print "[$now]: Finished compiling.\n";
 
-qx(make install);
+qx($make install);
 if ($? != 0)
 {
-  print "[ERROR]: make install.\n";
+  print "[ERROR]: make install failed.\n";
   print "  Please check your build logs.\n";
   print "  Exiting.\n";
 
-  exit 1
+  exit 1;
 }
 
 chdir("$temp_dir/install")
   or die
   "[ERROR]: cd to $temp_dir/install failed.\n";
   "  Does your $temp_dir/install directory exists?\n";
-    "  Exiting.\n";
+  "  Exiting.\n";
 
 # Install system tables.
-qx(bin/mysql_install_db --no-defaults --basedir=$temp_dir/install --datadir=$temp_dir/data);
-
-# Start mysqld.
-$now = qx(date "+%Y-%m-%d %H:%M:%S");
-chomp($now);
-print "[$now]: Starting mysqld, ...\n";
+qx(bin/mysql_install_db --no-defaults --basedir=$temp_dir/install --datadir=$mariadb_datadir);
 
 my $mariadb_socket = "$temp_dir/mysql.sock";
-my $mariadb_options = '';
-$mariadb_options = "$mariadb_options --datadir=$temp_dir/data --tmpdir=$temp_dir --socket=$mariadb_socket";
+my $mariadb_options = "--no-defaults --datadir=$mariadb_datadir --tmpdir=$temp_dir --socket=$mariadb_socket";
 
-$mysqladmin_options = "$mysqladmin_options --socket=$mariadb_socket";
+$mysql_options = "$mysql_options -uroot --socket=$mariadb_socket";
+$mysqladmin_options = "$mysqladmin_options -uroot --socket=$mariadb_socket";
 
 # Determine mysqld version for result file naming.
 my $mariadb_version = qx(libexec/mysqld --version | awk '{ print $3 }');
 $suffix = "$suffix" . "-" . "$mariadb_version";
 
-system "libexec/mysqld $mariadb_options &";
-
-my $j = 0;
-my $started = -1;
-while ($j < $timeout) {
-  qx($mysqladmin $mysqladmin_options -uroot ping > /dev/null 2>&1);
-  if ($? == 0)
-  {
-    $started = 0;
-    last;
-   }
-   
-   sleep 1;
-   $j++;
-}
-
-if ($started != 0)
-{
-  print "[ERROR]: Start of mysqld failed.\n";
-  print "  Please check your error log.\n";
-  print "  Exiting.\n";
-
-  exit 1;
-}
-
-$now = qx(date "+%Y-%m-%d %H:%M:%S");
-chomp($now);
-print "[$now]: Started mysqld!\n";
-
-$now = qx(date "+%Y-%m-%d %H:%M:%S");
-chomp($now);
-print "[$now]: Starting sql-bench run, ...\n";
-
-# Run sql-bench tests configurations in a loop.
-chdir("sql-bench")
-  or die
-  "[ERROR]: cd to sql-bench failed.\n";
-  "  Does your sql-bench directory exists?\n";
-  "  Exiting.\n";
-
-#my $comments = "Revision used: $REVISION_ID\nConfigure: $mariadb_config\nServer options: $mariadb_options";
+sub kill_mysqld
+{
+  qx(killall -9 mysqld);
+  qx(rm -rf $mariadb_datadir);
+  qx(rm -f $mariadb_socket);
+
+  qx($mkdir $mariadb_datadir);
+  # Install system tables.
+  qx($temp_dir/install/bin/mysql_install_db --no-defaults --basedir=$temp_dir/install --datadir=$mariadb_datadir);
+}
+
+sub start_mysqld($$)
+{
+  my $start_options = shift;
+  my $init_command = shift;
+
+  $now = qx(date "+%Y-%m-%d %H:%M:%S");
+  chomp($now);
+  print "[$now]: Starting mysqld, ...\n";
+  
+  chdir("$temp_dir/install")
+    or die
+    "[ERROR]: cd to $temp_dir/install failed.\n";
+    "  Does your $temp_dir/install directory exists?\n";
+    "  Exiting.\n";
+
+  $mariadb_options .= " $start_options";
+
+  system "$temp_dir/install/libexec/mysqld $mariadb_options &";
+
+  my $j = 0;
+  my $started = -1;
+  while ($j < $timeout) {
+    qx($temp_dir/install/$mysqladmin $mysqladmin_options ping > /dev/null 2>&1);
+    if ($? == 0)
+    {
+      $started = 0;
+      last;
+     }
+     
+     sleep 1;
+     $j++;
+  }
+
+  if ($init_command != '')
+  {
+    qx(echo $init_command | $temp_dir/install/$mysql $mysql_options);
+
+    if ($? != 0)
+    {
+      print "[WARNING]: $init_command failed.\n";
+      print "  Please check your '$init_command'.\n";
+    }
+  }
+
+  if ($started != 0)
+  {
+    print "[ERROR]: Start of mysqld failed.\n";
+    print "  Please check your error log.\n";
+    print "  Exiting.\n";
+  
+    exit 1;
+  }
+
+  $now = qx(date "+%Y-%m-%d %H:%M:%S");
+  chomp($now);
+  print "[$now]: Started mysqld!\n";
+}
+
+$now = qx(date "+%Y-%m-%d %H:%M:%S");
+chomp($now);
+print "[$now]: Starting sql-bench run for $config_file, ...\n";
+
+my $comments = "Revision used: $revision_id\nConfigure: $config->{configure_line}\nServer options: $mariadb_options";
 
 # TODO: Add --comments="$comments".
-#my $sqlbench_options = "$sqlbench_options --socket=$mariadb_socket --suffix=$suffix";
-#my $sqlbench_options = "--socket=$mariadb_socket --suffix=$suffix";
-my $sqlbench_options = "--socket=$mariadb_socket";
-
-#qx(./run-all-tests $sqlbench_options);
-print "/sw/bin/perl ./run-all-tests $sqlbench_options\n";
-
-qx(/sw/bin/perl ./run-all-tests $sqlbench_options);
-if ($? != 0)
-{
-  print "[ERROR]: run-all-tests produced errors.\n";
-  print "  Please check your sql-bench error logs.\n";
-  print "  Exiting.\n";
-
-  exit 1;
+#my $sql_bench_options = "--socket=$mariadb_socket --suffix=$suffix";
+
+# Run sql-bench test configurations in a loop.
+
+my $sql_bench_options = '';
+my $current_dir = '';
+my $output_dir =  '';
+foreach my $test_name (keys %{$sql_bench_test}) {
+  $now = qx(date "+%Y-%m-%d %H:%M:%S");
+  chomp($now);
+  print "[$now]: Starting test configuration: $test_name\n";
+
+  start_mysqld($sql_bench_test->{$test_name}->{mysqld_start_options},
+               $sql_bench_test->{$test_name}->{mysqld_init_command});
+
+  $sql_bench_options = "$sql_bench_test->{$test_name}->{sql_bench_options} --socket=$mariadb_socket";
+
+  chdir("$temp_dir/install/sql-bench")
+    or die
+    "[ERROR]: cd to sql-bench failed.\n";
+    "  Does your sql-bench directory exists?\n";
+    "  Exiting.\n";
+
+  $current_dir = qx(pwd);
+  chomp($current_dir);
+  print "Current dir is: $current_dir\n";
+
+  $output_dir = "$sql_bench_results/$machine/$run_date/$test_name";
+  qx($mkdir -p $output_dir);
+
+  print "$perl ./run-all-tests $sql_bench_options --dir $output_dir --log\n";
+
+  qx($perl ./run-all-tests $sql_bench_options --dir $output_dir --log);
+  if ($? != 0)
+  {
+    print "[WARNING]: run-all-tests for $test_name produced errors.\n";
+    print "  Please check your sql-bench error logs.\n";
+  }
+
+  kill_mysqld();
+
+  $now = qx(date "+%Y-%m-%d %H:%M:%S");
+  chomp($now);
+  print "[$now]: Finished $test_name\n";
 }
 
 $now = qx(date "+%Y-%m-%d %H:%M:%S");
 chomp($now);
-print "[$now]: Finished sql-bench!\n";
+print "[$now]: Finished sql-bench run for $config_file!\n";

=== modified file 'sysbench/conf/pitbull.inc'
--- a/sysbench/conf/pitbull.inc	2010-11-01 18:43:28 +0000
+++ b/sysbench/conf/pitbull.inc	2010-11-11 21:56:09 +0000
@@ -3,7 +3,7 @@
 # OS: Ubuntu 10.10
 # Platform: x86_64
 # CPU: Two socket hexa-core Intel Xeon X5660 @ 2.80GHz
-# RAM: 28GB
+# RAM: 23GB
 # Disk(s): 1 x ST3500320NS S-ATA
 
 #



More information about the commits mailing list