List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:June 19 2006 12:55pm
Subject:bk commit into 5.0 tree (anozdrin:1.2184)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of alik. When alik does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2184 06/06/19 16:55:50 anozdrin@stripped +2 -0
  Merge mysql.com:/home/alik/MySQL/devel/5.0-rt
  into  mysql.com:/home/alik/MySQL/devel/5.0-tree-merged

  sql/sql_insert.cc
    1.192 06/06/19 16:55:45 anozdrin@stripped +0 -0
    Auto merged

  mysql-test/mysql-test-run.pl
    1.101 06/06/19 16:55:44 anozdrin@stripped +0 -0
    Auto merged

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	anozdrin
# Host:	booka
# Root:	/home/alik/MySQL/devel/5.0-tree-merged/RESYNC

--- 1.191/sql/sql_insert.cc	2006-06-13 19:18:28 +04:00
+++ 1.192/sql/sql_insert.cc	2006-06-19 16:55:45 +04:00
@@ -1057,16 +1057,19 @@ int write_record(THD *thd, TABLE *table,
 	  to convert the latter operation internally to an UPDATE.
           We also should not perform this conversion if we have 
           timestamp field with ON UPDATE which is different from DEFAULT.
+          Another case when conversion should not be performed is when
+          we have ON DELETE trigger on table so user may notice that
+          we cheat here. Note that it is ok to do such conversion for
+          tables which have ON UPDATE but have no ON DELETE triggers,
+          we just should not expose this fact to users by invoking
+          ON UPDATE triggers.
 	*/
 	if (last_uniq_key(table,key_nr) &&
 	    !table->file->referenced_by_foreign_key() &&
             (table->timestamp_field_type == TIMESTAMP_NO_AUTO_SET ||
-             table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH))
+             table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH) &&
+            (!table->triggers || !table->triggers->has_delete_triggers()))
         {
-          if (table->triggers &&
-              table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
-                                                TRG_ACTION_BEFORE, TRUE))
-            goto before_trg_err;
           if (thd->clear_next_insert_id)
           {
             /* Reset auto-increment cacheing if we do an update */
@@ -1077,13 +1080,11 @@ int write_record(THD *thd, TABLE *table,
 					     table->record[0])))
             goto err;
           info->deleted++;
-          trg_error= (table->triggers &&
-                      table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
-                                                        TRG_ACTION_AFTER,
-                                                        TRUE));
-          /* Update logfile and count */
-          info->copied++;
-          goto ok_or_after_trg_err;
+          /*
+            Since we pretend that we have done insert we should call
+            its after triggers.
+          */
+          goto after_trg_n_copied_inc;
         }
         else
         {
@@ -1107,10 +1108,6 @@ int write_record(THD *thd, TABLE *table,
         }
       }
     }
-    info->copied++;
-    trg_error= (table->triggers &&
-                table->triggers->process_triggers(thd, TRG_EVENT_INSERT,
-                                                  TRG_ACTION_AFTER, TRUE));
   }
   else if ((error=table->file->write_row(table->record[0])))
   {
@@ -1118,14 +1115,14 @@ int write_record(THD *thd, TABLE *table,
 	(error != HA_ERR_FOUND_DUPP_KEY && error != HA_ERR_FOUND_DUPP_UNIQUE))
       goto err;
     table->file->restore_auto_increment();
+    goto ok_or_after_trg_err;
   }
-  else
-  {
-    info->copied++;
-    trg_error= (table->triggers &&
-                table->triggers->process_triggers(thd, TRG_EVENT_INSERT,
-                                                  TRG_ACTION_AFTER, TRUE));
-  }
+
+after_trg_n_copied_inc:
+  info->copied++;
+  trg_error= (table->triggers &&
+              table->triggers->process_triggers(thd, TRG_EVENT_INSERT,
+                                                TRG_ACTION_AFTER, TRUE));
 
 ok_or_after_trg_err:
   if (key)

--- 1.100/mysql-test/mysql-test-run.pl	2006-06-19 01:16:16 +04:00
+++ 1.101/mysql-test/mysql-test-run.pl	2006-06-19 16:55:44 +04:00
@@ -2860,22 +2860,58 @@ sub im_stop($) {
 
   # Try graceful shutdown.
 
+  mtr_debug("IM-main pid: $instance_manager->{'pid'}");
+  mtr_debug("Stopping IM-main...");
+
   mtr_kill_process($instance_manager->{'pid'}, 'TERM', 10, 1);
 
+  # If necessary, wait for angel process to die.
+
+  if (defined $instance_manager->{'angel_pid'})
+  {
+    mtr_debug("IM-angel pid: $instance_manager->{'angel_pid'}");
+    mtr_debug("Waiting for IM-angel to die...");
+
+    my $total_attempts= 10;
+
+    for (my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt)
+    {
+      unless (kill (0, $instance_manager->{'angel_pid'}))
+      {
+        mtr_debug("IM-angel died.");
+        last;
+      }
+
+      sleep(1);
+    }
+  }
+
   # Check that all processes died.
 
   my $clean_shutdown= 0;
 
   while (1)
   {
-    last if kill (0, $instance_manager->{'pid'});
+    if (kill (0, $instance_manager->{'pid'}))
+    {
+      mtr_debug("IM-main is still alive.");
+      last;
+    }
 
-    last if (defined $instance_manager->{'angel_pid'}) &&
-            kill (0, $instance_manager->{'angel_pid'});
+    if (defined $instance_manager->{'angel_pid'} &&
+        kill (0, $instance_manager->{'angel_pid'}))
+    {
+      mtr_debug("IM-angel is still alive.");
+      last;
+    }
 
     foreach my $pid (@mysqld_pids)
     {
-      last if kill (0, $pid);
+      if (kill (0, $pid))
+      {
+        mtr_debug("Guarded mysqld ($pid) is still alive.");
+        last;
+      }
     }
 
     $clean_shutdown= 1;
@@ -2886,15 +2922,21 @@ sub im_stop($) {
 
   unless ($clean_shutdown)
   {
-    mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1)
-      if defined $instance_manager->{'angel_pid'};
+
+    if (defined $instance_manager->{'angel_pid'})
+    {
+      mtr_debug("Killing IM-angel...");
+      mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1)
+    }
     
+    mtr_debug("Killing IM-main...");
     mtr_kill_process($instance_manager->{'pid'}, 'KILL', 10, 1);
 
     # Shutdown managed mysqld-processes. Some of them may be nonguarded, so IM
     # will not stop them on shutdown. So, we should firstly try to end them
     # legally.
 
+    mtr_debug("Killing guarded mysqld(s)...");
     mtr_kill_processes(\@mysqld_pids);
 
     # Complain in error log so that a warning will be shown.
Thread
bk commit into 5.0 tree (anozdrin:1.2184)Alexander Nozdrin19 Jun