List:Internals« Previous MessageNext Message »
From:sasha Date:August 15 2001 9:41pm
Subject:bk commit into 3.23 tree
View as plain text  
Below is the list of changes that have just been commited into a local
3.23. repository of sasha. When sasha does a push, they will be
propogaged to the main repository and within 24 hours after the push into
the public repository. For information on how to access
the public repository see
http://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet@stripped, 2001-08-15 15:41:52-06:00, sasha@stripped
  improvements for stopping the slave in SLAVE STOP and on shutdown

  sql/mini_client.cc
    1.20 01/08/15 15:41:51 sasha@stripped +15 -1
    alarm around mc_mysql_connect()

  sql/mysqld.cc
    1.200 01/08/15 15:41:51 sasha@stripped +1 -1
    move end_slave() to the earlier part of shutdown

  sql/sql_repl.cc
    1.41 01/08/15 15:41:51 sasha@stripped +20 -2
    retry thr_alarm_kill() in case slave thread missed the signal in SLAVE STOP

# 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:	sasha
# Host:	mysql.sashanet.com
# Root:	/home/sasha/src/bk/mysql

--- 1.19/sql/mini_client.cc	Thu May  3 17:27:34 2001
+++ 1.20/sql/mini_client.cc	Wed Aug 15 15:41:51 2001
@@ -39,6 +39,8 @@
 #include "errmsg.h"
 #include <violite.h>
 
+extern ulong net_read_timeout;
+
 extern "C" {					// Because of SCO 3.2V4.2
 #include <sys/stat.h>
 #include <signal.h>
@@ -62,6 +64,7 @@
 #endif
 #if defined(THREAD) && !defined(__WIN__)
 #include <my_pthread.h>				/* because of signal()	*/
+#include <thr_alarm.h>
 #endif
 #ifndef INADDR_NONE
 #define INADDR_NONE	-1
@@ -479,18 +482,25 @@
   struct	sockaddr_in sock_addr;
   uint		pkt_length;
   NET		*net= &mysql->net;
+  thr_alarm_t   alarmed;
+#if !defined(__WIN__)
+  ALARM alarm_buff;
+#endif
+
 #ifdef __WIN__
   HANDLE	hPipe=INVALID_HANDLE_VALUE;
 #endif
 #ifdef HAVE_SYS_UN_H
   struct	sockaddr_un UNIXaddr;
 #endif
-  DBUG_ENTER("mysql_real_connect");
+  DBUG_ENTER("mc_mysql_connect");
 
   DBUG_PRINT("enter",("host: %s  db: %s  user: %s",
 		      host ? host : "(Null)",
 		      db ? db : "(Null)",
 		      user ? user : "(Null)"));
+  thr_alarm_init(&alarmed);
+  thr_alarm(&alarmed,(uint) net_read_timeout,&alarm_buff);
 
   bzero((char*) &mysql->options,sizeof(mysql->options));
   net->vio = 0;				/* If something goes wrong */
@@ -625,8 +635,12 @@
       DBUG_PRINT("error",("Got error %d on connect to '%s'",ERRNO,host));
       net->last_errno= CR_CONN_HOST_ERROR;
       sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, ERRNO);
+      if (thr_alarm_in_use(&alarmed))
+	thr_end_alarm(&alarmed);
       goto error;
     }
+    if (thr_alarm_in_use(&alarmed))
+      thr_end_alarm(&alarmed);
   }
 
   if (!net->vio || my_net_init(net, net->vio))

--- 1.199/sql/mysqld.cc	Mon Aug 13 20:09:20 2001
+++ 1.200/sql/mysqld.cc	Wed Aug 15 15:41:51 2001
@@ -487,6 +487,7 @@
   }
 #endif
   end_thr_alarm();			 // Don't allow alarms
+  end_slave();
 
   /* First signal all threads that it's time to die */
 
@@ -694,7 +695,6 @@
   x_free(opt_bin_logname);
   bitmap_free(&temp_pool);
   free_max_user_conn();
-  end_slave();
 #ifndef __WIN__
   if (!opt_bootstrap)
     (void) my_delete(pidfile_name,MYF(0));	// This may not always exist

--- 1.40/sql/sql_repl.cc	Wed Jul 11 19:29:14 2001
+++ 1.41/sql/sql_repl.cc	Wed Aug 15 15:41:51 2001
@@ -610,8 +610,26 @@
     // do not abort the slave in the middle of a query, so we do not set
     // thd->killed for the slave thread
     thd->proc_info = "waiting for slave to die";
-    while(slave_running) 
-      pthread_cond_wait(&COND_slave_stopped, &LOCK_slave);
+    while(slave_running)
+    {
+      /* there is a small change that slave thread might miss the first
+	 alarm. To protect againts it, resend the signal until it reacts
+      */
+	 
+      struct timespec abstime;
+#ifdef HAVE_TIMESPEC_TS_SEC
+      abstime.ts_sec=time(NULL)+2;		
+      abstime.ts_nsec=0;
+#else
+      struct timeval tv;
+      gettimeofday(&tv,0);
+      abstime.tv_sec=tv.tv_sec+2;
+      abstime.tv_nsec=tv.tv_usec*1000;
+#endif
+      pthread_cond_timedwait(&COND_slave_stopped, &LOCK_slave, &abstime);
+      if (slave_running)
+        thr_alarm_kill(slave_real_id);
+    }
   }
   else
     slave_errno = ER_SLAVE_NOT_RUNNING;
Thread
bk commit into 3.23 treesasha15 Aug