List:Commits« Previous MessageNext Message »
From:sayantan.dutta Date:November 23 2012 10:59am
Subject:bzr push into mysql-5.1 branch (sayantan.dutta:3870 to 3871) Bug#14757120
View as plain text  
 3871 sayantan.dutta@stripped	2012-11-23
      Bug #14757120 - SAFE_PROCESS.CC/SAFE_PROCESS.PL SHOULD NOT KILL MYSQLD ON SIGSTOP/SIGCONT

    removed:
      mysql-test/lib/My/SafeProcess/safe_process.pl
    modified:
      mysql-test/lib/My/SafeProcess/safe_process.cc
 3870 Shivji Kumar Jha	2012-11-22
      BUG#12359942 - REPLICATION TEST FROM ENGINE SUITE RPL_ROW_UNTIL TIMES OUT
      
      === Problem ===
      
      The test is dependent on binlog positions and checks
      to see if the command 'START SLAVE' functions correctly
      with the 'UNTIL' clause added to it. The 'UNTIL' clause
      is added to specify that the slave should start and run
      until the SQL thread reaches a given point in the master
      binary log or in the slave relay log.
      
      The test uses hard coded values for MASTER_LOG_POS and
      RELAY_LOG_POS, instead of extracting it using
      query_get_value() function. There is a test
      'rpl.rpl_row_until' which does the similar thing but uses 
      query_get_value() function to set the values of
      MASTER_LOG_POS/ RELAY_LOG_POS. To be precise,
      rpl.rpl_row_until is a modified version of
      engines/func.rpl_row_until.test.
      
      The use of hard coded values may lead the slave to stop at a position
      which may differ from the expected position in the binlog file,
      an example being the failure of engines/funcs.rpl_row_until in 
      mysql-5.1 given as: 
      "query 'select * from t2' failed. Table 'test.t2' doesn't exist".
      In this case, the slave actually ran a couple of extra commands
      as a result of which the slave first deleted the table and then
      ran a select query on table, leading to the above mentioned failure.
      
      === Fix ===
      
      1) Fixed the code for failure seen in rpl.rpl_row_until.
         This test was also failing although the symptoms of
         failure were different.
      2) Copied the contents from rpl.rpl_row_until into
         into engines/funcs.rpl.rpl_row_until.
      3) Updated engines/funcs.rpl_row_until.result accordingly.
     @ mysql-test/suite/engines/funcs/r/rpl_row_until.result
        modified to accomodate the changes in corresponding
        test file.
     @ mysql-test/suite/engines/funcs/t/disabled.def
        removed from the list of disabled tests.
     @ mysql-test/suite/engines/funcs/t/rpl_row_until.test
        fixed rpl.rpl_row_until and copied its content to
        engines/funcs.rpl_row_until. The reason being both
        are same tests but rpl.rpl_row_until is an
        updated version.
     @ mysql-test/suite/rpl/t/disabled.def
        removed from the list of disabled tests.
     @ sql/sql_repl.cc
        Added a check to catch an improper combination
        of arguements passed to 'START SLAVE UNTIL'. Earlier,
        START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001',
        MASTER_LOG_POS=561, RELAY_LOG_POS=12;
        passed. It is now detected and an error is reported.

    modified:
      mysql-test/suite/engines/funcs/r/rpl_row_until.result
      mysql-test/suite/engines/funcs/t/disabled.def
      mysql-test/suite/engines/funcs/t/rpl_row_until.test
      mysql-test/suite/rpl/t/disabled.def
      sql/sql_repl.cc
=== modified file 'mysql-test/lib/My/SafeProcess/safe_process.cc'
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc	2011-06-30 15:37:13 +0000
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc	2012-11-23 10:27:04 +0000
@@ -153,12 +153,20 @@ int main(int argc, char* const argv[] )
   pid_t own_pid= getpid();
   pid_t parent_pid= getppid();
   bool nocore = false;
+  struct sigaction sa,sa_abort;
 
+
+  sa.sa_handler= handle_signal;
+  sa.sa_flags= SA_NOCLDSTOP;
+  sigemptyset(&sa.sa_mask);
+
+  sa_abort.sa_handler= handle_abort;
+  sigemptyset(&sa_abort.sa_mask);
   /* Install signal handlers */
-  signal(SIGTERM, handle_signal);
-  signal(SIGINT,  handle_signal);
-  signal(SIGCHLD, handle_signal);
-  signal(SIGABRT, handle_abort);
+  sigaction(SIGTERM, &sa,NULL);
+  sigaction(SIGINT, &sa,NULL);
+  sigaction(SIGCHLD, &sa,NULL);
+  sigaction(SIGABRT, &sa_abort,NULL);
 
   sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid);
 

=== removed file 'mysql-test/lib/My/SafeProcess/safe_process.pl'
--- a/mysql-test/lib/My/SafeProcess/safe_process.pl	2011-07-03 15:47:37 +0000
+++ b/mysql-test/lib/My/SafeProcess/safe_process.pl	1970-01-01 00:00:00 +0000
@@ -1,166 +0,0 @@
-#!/usr/bin/perl
-# -*- cperl -*-
-
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
-# 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-use strict;
-use warnings;
-
-use lib 'lib';
-use My::SafeProcess::Base;
-use POSIX qw(WNOHANG);
-
-###########################################################################
-# Util functions
-###########################################################################
-
-#
-#Print message to stderr
-#
-my $verbose= 0;
-sub message {
-  if ($verbose > 0){
-    use Time::localtime;
-    my $tm= localtime();
-    my $timestamp= sprintf("%02d%02d%02d %2d:%02d:%02d",
-			   $tm->year % 100, $tm->mon+1, $tm->mday,
-			   $tm->hour, $tm->min, $tm->sec);
-    print STDERR $timestamp, " monitor[$$]: ", @_, "\n";
-  }
-}
-
-
-###########################################################################
-# Main program
-###########################################################################
-
-my $terminated= 0;
-
-# Protect against being killed in the middle
-# of child creation, just set the terminated flag
-# to make sure the child will be killed off
-# when program is ready to do that
-$SIG{TERM}= sub { message("!Got signal @_"); $terminated= 1; };
-$SIG{INT}= sub { message("!Got signal @_"); $terminated= 1; };
-
-my $parent_pid= getppid();
-
-my $found_double_dash= 0;
-while (my $arg= shift(@ARGV)){
-
-  if ($arg =~ /^--$/){
-    $found_double_dash= 1;
-    last;
-  }
-  elsif ($arg =~ /^--verbose$/){
-    $verbose= 1;
-  }
-  else {
-    die "Unknown option: $arg";
-  }
-}
-
-my $path=       shift(@ARGV); # Executable
-
-die "usage:\n" .
-    " safe_process.pl [opts] -- <path> [<args> [...<args_n>]]"
-  unless defined $path || $found_double_dash;
-
-
-message("started");
-#message("path: '$path'");
-message("parent: $parent_pid");
-
-# Start process to monitor
-my $child_pid=
-  create_process(
-		 path     => $path,
-		 args     => \@ARGV,
-		 setpgrp  => 1,
-		);
-message("Started child $child_pid");
-
-eval {
-  sub handle_signal {
-    $terminated= 1;
-    message("Got signal @_");
-
-    # Ignore all signals
-    foreach my $name (keys %SIG){
-      $SIG{$name}= 'IGNORE';
-    }
-
-    die "signaled\n";
-  };
-  local $SIG{TERM}= \&handle_signal;
-  local $SIG{INT}=  \&handle_signal;
-  local $SIG{CHLD}= sub {
-    message("Got signal @_");
-    kill('KILL', -$child_pid);
-    my $ret= waitpid($child_pid, 0);
-    if ($? & 127){
-      exit(65); # Killed by signal
-    }
-    exit($? >> 8);
-  };
-
-  # Monitoring loop
-  while(!$terminated) {
-
-    # Check if parent is still alive
-    if (kill(0, $parent_pid) < 1){
-      message("Parent is not alive anymore");
-      last;
-    }
-
-    # Wait for child to terminate but wakeup every
-    # second to also check that parent is still alive
-    my $ret_pid;
-    $ret_pid= waitpid($child_pid, &WNOHANG);
-    if ($ret_pid == $child_pid) {
-      # Process has exited, collect return status
-      my $ret_code= $? >> 8;
-      message("Child exit: $ret_code");
-      # Exit with exit status of the child
-      exit ($ret_code);
-    }
-    sleep(1);
-  }
-};
-if ( $@ ) {
-  # The monitoring loop should have been
-  # broken by handle_signal
-  warn "Unexpected: $@" unless ( $@ =~ /signaled/ );
-}
-
-# Use negative pid in order to kill the whole
-# process group
-#
-my $ret= kill('KILL', -$child_pid);
-message("Killed child: $child_pid, ret: $ret");
-if ($ret > 0) {
-  message("Killed child: $child_pid");
-  # Wait blocking for the child to return
-  my $ret_pid= waitpid($child_pid, 0);
-  if ($ret_pid != $child_pid){
-    message("unexpected pid $ret_pid returned from waitpid($child_pid)");
-  }
-}
-
-message("DONE!");
-exit (1);
-
-

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1 branch (sayantan.dutta:3870 to 3871) Bug#14757120sayantan.dutta23 Nov