MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Vladislav Vaintroub Date:April 28 2009 10:44am
Subject:bzr push into mysql-6.0-mtr branch (vvaintroub:2763 to 2764)
View as plain text  
 2764 Vladislav Vaintroub	2009-04-28 [merge]
      merge --parallel fix for Windows from 5.1-mtr

    modified:
      mysql-test/lib/My/SafeProcess/Base.pm
      mysql-test/lib/mtr_unique.pm
      mysql-test/mysql-test-run.pl
 2763 Bjorn Munch	2009-04-27 [merge]
      merge from main

    added:
      mysql-test/collections/backup.rqg-weekly
      mysql-test/include/have_rqg.inc
      mysql-test/mysql-test-lcov.pl
      mysql-test/r/plugin_notembedded.result
      mysql-test/suite/backup/include/backup_ext.inc
      mysql-test/suite/backup/include/have_dbi.inc
      mysql-test/suite/backup/r/backup_default_debug.result
      mysql-test/suite/backup/r/backup_external.result
      mysql-test/suite/backup/r/backup_external_non_win.result
      mysql-test/suite/backup/r/backup_intr_errors.result
      mysql-test/suite/backup/r/backup_namecase.result
      mysql-test/suite/backup/t/backup_default_debug.test
      mysql-test/suite/backup/t/backup_external.test
      mysql-test/suite/backup/t/backup_external_non_win.test
      mysql-test/suite/backup/t/backup_intr_errors.test
      mysql-test/suite/backup/t/backup_namecase-master.opt
      mysql-test/suite/backup/t/backup_namecase.test
      mysql-test/suite/backup_engines/include/backup_restore_interrupt.inc
      mysql-test/suite/backup_engines/r/backup_interruption.result
      mysql-test/suite/backup_engines/t/backup_interruption.test
      mysql-test/suite/backup_extra/
      mysql-test/suite/backup_extra/include/
      mysql-test/suite/backup_extra/r/
      mysql-test/suite/backup_extra/r/backup_consistency_falcon.result
      mysql-test/suite/backup_extra/r/backup_consistency_innodb.result
      mysql-test/suite/backup_extra/t/
      mysql-test/suite/backup_extra/t/backup_consistency.inc
      mysql-test/suite/backup_extra/t/backup_consistency_falcon.test
      mysql-test/suite/backup_extra/t/backup_consistency_innodb.test
      mysql-test/suite/falcon/r/falcon_bug_41890.result
      mysql-test/suite/falcon/t/falcon_bug_41890.test
      mysql-test/t/plugin_notembedded-master.opt
      mysql-test/t/plugin_notembedded.test
      storage/mysql_storage_engine.cmake
    modified:
      .bzrignore
      CMakeLists.txt
      configure.in
      include/lf.h
      include/m_ctype.h
      include/my_global.h
      include/my_sys.h
      include/mysql/plugin.h
      include/mysql/plugin.h.pp
      include/mysql/plugin_audit.h
      include/mysql/plugin_ftparser.h
      libmysqld/CMakeLists.txt
      mysql-test/include/locktrans.inc
      mysql-test/mysql-test-run.pl
      mysql-test/r/join_cache.result
      mysql-test/r/join_outer.result
      mysql-test/r/join_outer_jcl6.result
      mysql-test/r/locktrans_innodb.result
      mysql-test/r/myisam_keycache_coverage.result
      mysql-test/r/select_jcl6.result
      mysql-test/r/subselect_sj2.result
      mysql-test/r/subselect_sj2_jcl6.result
      mysql-test/suite/backup/include/bml_test.inc
      mysql-test/suite/backup/r/backup_bml.result
      mysql-test/suite/backup/r/backup_client.result
      mysql-test/suite/backup/r/backup_client_binlog.result
      mysql-test/suite/backup/r/backup_myisam_sync.result
      mysql-test/suite/backup/r/backup_triggers_and_events.result
      mysql-test/suite/backup/t/backup_bml.test
      mysql-test/suite/backup/t/backup_myisam_sync.test
      mysql-test/suite/backup/t/backup_triggers_and_events.test
      mysql-test/suite/backup/t/disabled.def
      mysql-test/suite/backup_engines/t/backup_partition.test
      mysql-test/suite/backup_engines/t/backup_partitioning.test
      mysql-test/suite/funcs_1/r/is_columns_mysql.result
      mysql-test/suite/funcs_1/r/is_tables_mysql.result
      mysql-test/suite/rpl/r/rpl_locktrans_innodb.result
      mysql-test/t/join_cache.test
      mysql-test/t/join_outer.test
      mysql-test/t/myisam_keycache_coverage.test
      mysql-test/t/plugin.test
      mysql-test/t/plugin_load-master.opt
      mysql-test/t/subselect_sj2.test
      mysys/mf_keycache.c
      scripts/mysql_system_tables.sql
      scripts/mysql_system_tables_fix.sql
      sql/CMakeLists.txt
      sql/backup/backup_engine.h
      sql/backup/backup_kernel.h
      sql/backup/be_default.cc
      sql/backup/be_default.h
      sql/backup/be_snapshot.h
      sql/backup/be_thread.cc
      sql/backup/be_thread.h
      sql/backup/data_backup.cc
      sql/backup/image_info.cc
      sql/backup/kernel.cc
      sql/backup/logger.cc
      sql/backup/logger.h
      sql/backup/stream.cc
      sql/backup/stream.h
      sql/ha_ndbcluster.cc
      sql/handler.h
      sql/log.cc
      sql/mysql_priv.h
      sql/mysqld.cc
      sql/protocol.cc
      sql/set_var.cc
      sql/share/errmsg.txt
      sql/sql_audit.h
      sql/sql_class.h
      sql/sql_join_cache.cc
      sql/sql_list.h
      sql/sql_parse.cc
      sql/sql_plugin.cc
      sql/sql_prepare.cc
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_show.cc
      storage/Makefile.am
      storage/archive/CMakeLists.txt
      storage/blackhole/CMakeLists.txt
      storage/csv/CMakeLists.txt
      storage/example/CMakeLists.txt
      storage/falcon/CMakeLists.txt
      storage/falcon/Context.cpp
      storage/falcon/CycleLock.cpp
      storage/falcon/CycleManager.cpp
      storage/falcon/CycleManager.h
      storage/falcon/DataPage.cpp
      storage/falcon/Database.cpp
      storage/falcon/Index.cpp
      storage/falcon/Record.cpp
      storage/falcon/Record.h
      storage/falcon/RecordLeaf.cpp
      storage/falcon/RecordVersion.cpp
      storage/falcon/RecordVersion.h
      storage/falcon/RecoveryObjects.h
      storage/falcon/SRLBlobDelete.cpp
      storage/falcon/SRLBlobUpdate.cpp
      storage/falcon/SRLOverflowPages.cpp
      storage/falcon/SRLOverflowPages.h
      storage/falcon/SRLVersion.h
      storage/falcon/Section.cpp
      storage/falcon/SerialLog.cpp
      storage/falcon/SerialLog.h
      storage/falcon/SerialLogWindow.cpp
      storage/falcon/Socket.cpp
      storage/falcon/Statement.cpp
      storage/falcon/StorageDatabase.cpp
      storage/falcon/StorageHandler.cpp
      storage/falcon/StorageTable.cpp
      storage/falcon/StorageVersion.h
      storage/falcon/Table.cpp
      storage/falcon/TransactionManager.cpp
      storage/federated/CMakeLists.txt
      storage/federated/ha_federated.cc
      storage/heap/CMakeLists.txt
      storage/innobase/CMakeLists.txt
      storage/maria/CMakeLists.txt
      storage/myisam/CMakeLists.txt
      storage/myisam/mi_examine_log.c
      storage/myisam/myisamlog.c
      storage/myisammrg/CMakeLists.txt
      support-files/my-huge.cnf.sh
      support-files/my-innodb-heavy-4G.cnf.sh
      support-files/my-large.cnf.sh
      support-files/my-medium.cnf.sh
      support-files/my-small.cnf.sh
      win/Makefile.am
      win/configure.js
      win/create_def_file.js
=== modified file 'mysql-test/lib/My/SafeProcess/Base.pm'
--- a/mysql-test/lib/My/SafeProcess/Base.pm	2008-10-08 20:06:10 +0000
+++ b/mysql-test/lib/My/SafeProcess/Base.pm	2009-04-23 11:35:02 +0000
@@ -83,6 +83,13 @@ sub exit_status {
   };
 }
 
+# threads.pm may not exist everywhere, so use only on Windows.
+
+use if $^O eq "MSWin32", "threads";
+use if $^O eq "MSWin32", "threads::shared";
+
+my $win32_spawn_lock :shared;
+
 
 #
 # Create a new process
@@ -104,6 +111,8 @@ sub create_process {
 
   if ($^O eq "MSWin32"){
 
+    lock($win32_spawn_lock);
+
     #printf STDERR "stdin %d, stdout %d, stderr %d\n",
     #    fileno STDIN, fileno STDOUT, fileno STDERR;
 

=== modified file 'mysql-test/lib/mtr_unique.pm'
--- a/mysql-test/lib/mtr_unique.pm	2009-03-11 17:17:00 +0000
+++ b/mysql-test/lib/mtr_unique.pm	2009-04-28 10:42:25 +0000
@@ -28,32 +28,36 @@ sub msg {
  # print "### unique($$) - ", join(" ", @_), "\n";
 }
 
-my $file;
+my $dir;
 
 if(!IS_WINDOWS)
 {
-  $file= "/tmp/mysql-test-ports";
+  $dir= "/tmp/mysql-unique-ids";
 }
 else
 {
-  $file= $ENV{'TEMP'}."/mysql-test-ports";
+  # Try to use machine-wide directory location for unique IDs,
+  # $ALLUSERSPROFILE . IF it is not available, fallback to $TEMP
+  # which is typically a per-user temporary directory
+  if (exists $ENV{'ALLUSERSPROFILE'} && -w $ENV{'ALLUSERSPROFILE'})
+  {
+    $dir= $ENV{'ALLUSERSPROFILE'}."/mysql-unique-ids";
+  }
+  else
+  {
+    $dir= $ENV{'TEMP'}."/mysql-unique-ids";
+  }
 }
-  
 
-my %mtr_unique_ids;
+my $mtr_unique_fh = undef;
 
-END {
-  my $allocated_id= $mtr_unique_ids{$$};
-  if (defined $allocated_id)
-  {
-    mtr_release_unique_id($allocated_id);
-  }
-  delete $mtr_unique_ids{$$};
+END
+{
+  mtr_release_unique_id();
 }
 
 #
-# Get a unique, numerical ID, given a file name (where all
-# requested IDs are stored), a minimum and a maximum value.
+# Get a unique, numerical ID in a specified range.
 #
 # If no unique ID within the specified parameters can be
 # obtained, return undef.
@@ -61,135 +65,63 @@ END {
 sub mtr_get_unique_id($$) {
   my ($min, $max)= @_;;
 
-  msg("get, '$file', $min-$max");
-
-  die "Can only get one unique id per process!" if $mtr_unique_ids{$$};
+  msg("get $min-$max, $$");
 
-  my $ret = undef;
-  my $changed = 0;
-
-  if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
-    die 'lock file is a symbolic link';
-  }
+  die "Can only get one unique id per process!" if defined $mtr_unique_fh;
 
-  chmod 0777, "$file.sem";
-  open SEM, ">", "$file.sem" or die "can't write to $file.sem";
-  flock SEM, LOCK_EX or die "can't lock $file.sem";
-  if(! -e $file) {
-    open FILE, ">", $file or die "can't create $file";
-    close FILE;
-  }
 
-  msg("HAVE THE LOCK");
+  # Make sure our ID directory exists
+  if (! -d $dir)
+  {
+    # If there is a file with the reserved
+    # directory name, just delete the file.
+    if (-e $dir)
+    {
+      unlink($dir);
+    }
 
-  if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
-    die 'lock file is a symbolic link';
-  }
+    mkdir $dir;
+    chmod 0777, $dir;
 
-  chmod 0777, $file;
-  open FILE, "+<", $file or die "can't open $file";
-  #select undef,undef,undef,0.2;
-  seek FILE, 0, 0;
-  my %taken = ();
-  while(<FILE>) {
-    chomp;
-    my ($id, $pid) = split / /;
-    $taken{$id} = $pid;
-    msg("taken: $id, $pid");
-    # Check if process with given pid is alive
-    if(!process_alive($pid)) {
-      print "Removing slot $id used by missing process $pid\n";
-      msg("Removing slot $id used by missing process $pid");
-      delete $taken{$id};
-      $changed++;
+    if(! -d $dir)
+    {
+      die "can't make directory $dir";
     }
   }
-  for(my $i=$min; $i<=$max; ++$i) {
-    if(! exists $taken{$i}) {
-      $ret = $i;
-      $taken{$i} = $$;
-      $changed++;
-      # Remember the id this process got
-      $mtr_unique_ids{$$}= $i;
-      msg(" got $i"); 
-      last;
+
+
+  my $fh;
+  for(my $id = $min; $id <= $max; $id++)
+  {
+    open( $fh, ">$dir/$id");
+    chmod 0666, "$dir/$id";
+    # Try to lock the file exclusively. If lock succeeds, we're done.
+    if (flock($fh, LOCK_EX|LOCK_NB))
+    {
+      # Store file handle - we would need it to release the ID (==unlock the file)
+      $mtr_unique_fh = $fh;
+      return $id;
     }
-  }
-  if($changed) {
-    seek FILE, 0, 0;
-    truncate FILE, 0 or die "can't truncate $file";
-    for my $k (keys %taken) {
-      print FILE $k . ' ' . $taken{$k} . "\n";
+    else
+    {
+      close $fh;
     }
   }
-  close FILE;
-
-  msg("RELEASING THE LOCK");
-  flock SEM, LOCK_UN or warn "can't unlock $file.sem";
-  close SEM;
-
-  return $ret;
+  return undef;
 }
 
 
 #
 # Release a unique ID.
 #
-sub mtr_release_unique_id($) {
-  my ($myid)= @_;
-
-  msg("release, $myid");
-
-
-  if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
-    die 'lock file is a symbolic link';
-  }
-
-  open SEM, ">", "$file.sem" or die "can't write to $file.sem";
-  flock SEM, LOCK_EX or die "can't lock $file.sem";
-
-  msg("HAVE THE LOCK");
-
-  if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
-    die 'lock file is a symbolic link';
-  }
-
-  if(! -e $file) {
-    open FILE, ">", $file or die "can't create $file";
-    close FILE;
-  }
-  open FILE, "+<", $file or die "can't open $file";
-  #select undef,undef,undef,0.2;
-  seek FILE, 0, 0;
-  my %taken = ();
-  while(<FILE>) {
-    chomp;
-    my ($id, $pid) = split / /;
-    msg(" taken, $id $pid");
-    $taken{$id} = $pid;
-  }
-
-  if ($taken{$myid} != $$)
+sub mtr_release_unique_id()
+{
+  msg("release $$");
+  if (defined $mtr_unique_fh)
   {
-    msg(" The unique id for this process does not match pid");
+    close $mtr_unique_fh;
+    $mtr_unique_fh = undef;
   }
-
-
-  msg(" removing $myid");
-  delete $taken{$myid};
-  seek FILE, 0, 0;
-  truncate FILE, 0 or die "can't truncate $file";
-  for my $k (keys %taken) {
-    print FILE $k . ' ' . $taken{$k} . "\n";
-  }
-  close FILE;
-
-  msg("RELEASE THE LOCK");
-
-  flock SEM, LOCK_UN or warn "can't unlock $file.sem";
-  close SEM;
-
-  delete $mtr_unique_ids{$$};
 }
 
 

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2009-04-27 10:03:32 +0000
+++ b/mysql-test/mysql-test-run.pl	2009-04-28 10:42:25 +0000
@@ -1346,16 +1346,19 @@ sub set_build_thread_ports($) {
 
   if ( lc($opt_build_thread) eq 'auto' ) {
     my $found_free = 0;
-    $build_thread = 250;	# Start attempts from here
+    $build_thread = 300;	# Start attempts from here
     while (! $found_free)
     {
-      $build_thread= mtr_get_unique_id($build_thread, 299);
+      $build_thread= mtr_get_unique_id($build_thread, 349);
       if ( !defined $build_thread ) {
-	mtr_error("Could not get a unique build thread id");
+        mtr_error("Could not get a unique build thread id");
       }
       $found_free= check_ports_free($build_thread);
       # If not free, release and try from next number
-      mtr_release_unique_id($build_thread++) unless $found_free;
+      if (! $found_free) {
+        mtr_release_unique_id();
+        $build_thread++;
+      }
     }
   }
   else


Attachment: [text/bzr-bundle] bzr/vvaintroub@mysql.com-20090428104225-hldobr22l9isg6fl.bundle
Thread
bzr push into mysql-6.0-mtr branch (vvaintroub:2763 to 2764)Vladislav Vaintroub28 Apr