List:Internals« Previous MessageNext Message »
From:sasha Date:October 1 2001 10:13pm
Subject:bk commit into 4.0 tree
View as plain text  
Below is the list of changes that have just been committed into a
4.0 repository of sasha. When sasha does a push, they will be propogated 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet@stripped, 2001-10-01 16:13:55-06:00, sasha@stripped
  mysqltest can now talk to manager and start/stop servers with 
  server_start/server_stop
  changed rpl000018 to use the new server restart feature instead of a
  hack

  client/mysqltest.c
    1.58 01/10/01 16:13:54 sasha@stripped +91 -2
    server_start/server_stop

  mysql-test/mysql-test-run.sh
    1.103 01/10/01 16:13:54 sasha@stripped +18 -4
    tell mysqltest about the manager

  mysql-test/r/rpl000018.result
    1.3 01/10/01 16:13:54 sasha@stripped +0 -1
    fixed bug

  mysql-test/t/rpl000018.test
    1.2 01/10/01 16:13:54 sasha@stripped +2 -0
    use server restart instead of fake binlog hack

  sql/log_event.cc
    1.59 01/10/01 16:13:54 sasha@stripped +1 -0
    so far useless change

  BitKeeper/deleted/.del-rpl000018-master.sh~bc8072e13b26b005
    1.3 01/10/01 10:23:24 sasha@stripped +0 -0
    Delete: mysql-test/t/rpl000018-master.sh

# 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-4.0

--- 1.102/mysql-test/mysql-test-run.sh	Thu Sep 27 23:05:47 2001
+++ 1.103/mysql-test/mysql-test-run.sh	Mon Oct  1 16:13:54 2001
@@ -336,7 +336,9 @@
 fi
 
 
-MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent -v --tmpdir=$MYSQL_TMP_DIR"
+MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
+ --user=$DBUSER --password=$DBPASSWD --silent -v \
+ --tmpdir=$MYSQL_TMP_DIR"
 MYSQL_TEST_BIN=$MYSQL_TEST
 MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
 GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
@@ -521,6 +523,13 @@
  $MYSQL_MANAGER --log=$MYSQL_MANAGER_LOG --port=$MYSQL_MANAGER_PORT \
   --password-file=$MYSQL_MANAGER_PW_FILE
   abort_if_failed "Could not start MySQL manager"
+  mysqltest_manager_args="--manager-user=$MYSQL_MANAGER_USER \
+  --manager-password=$MYSQL_MANAGER_PW \
+  --manager-port=$MYSQL_MANAGER_PORT \
+  --manager-wait-timeout=$START_WAIT_TIMEOUT"
+  MYSQL_TEST="$MYSQL_TEST $mysqltest_manager_args"
+  MYSQL_TEST_ARGS="$MYSQL_TEST_ARGS $mysqltest_manager_args"
+  
 }
 
 stop_manager()
@@ -552,7 +561,7 @@
   shift
   $MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \
    --password=$MYSQL_MANAGER_PW  --port=$MYSQL_MANAGER_PORT <<EOF
-stop_exec $ident $TERM_WAIT_TIMEOUT
+stop_exec $ident $STOP_WAIT_TIMEOUT
 EOF
  abort_if_failed "Could not execute manager command"
 }
@@ -561,14 +570,16 @@
 start_master()
 {
     [ x$MASTER_RUNNING = 1 ] && return
+    # Remove old berkeley db log files that can confuse the server
+    $RM -f $MASTER_MYDDIR/log.*
+    # Remove stale binary logs
+    $RM -f $MYSQL_TEST_DIR/var/log/master-bin.*
     #run master initialization shell script if one exists
     if [ -f "$master_init_script" ] ;
     then
         /bin/sh $master_init_script
     fi
     cd $BASEDIR # for gcov
-    # Remove old berkeley db log files that can confuse the server
-    $RM -f $MASTER_MYDDIR/log.*	
     #start master
     if [ -z "$DO_BENCH" ]
     then
@@ -629,6 +640,9 @@
 {
     [ x$SKIP_SLAVE = x1 ] && return
     [ x$SLAVE_RUNNING = 1 ] && return
+    
+    # Remove stale binary logs
+    $RM -f $MYSQL_TEST_DIR/var/log/slave-bin.*
     
     #run slave initialization shell script if one exists
     if [ -f "$slave_init_script" ] ;

--- 1.58/sql/log_event.cc	Thu Sep 20 18:38:34 2001
+++ 1.59/sql/log_event.cc	Mon Oct  1 16:13:54 2001
@@ -1646,6 +1646,7 @@
   if(mi->pos > 4) // stop event should be ignored after rotate event
   {
     close_temporary_tables(thd);
+    //clean_up_load_tmp_dir();
     mi->inc_pos(get_event_len(), log_seq);
     flush_master_info(mi);
   }

--- 1.57/client/mysqltest.c	Thu Sep 27 23:05:46 2001
+++ 1.58/client/mysqltest.c	Mon Oct  1 16:13:54 2001
@@ -80,12 +80,23 @@
 			   * the server - to solve the problem, we try again
 			   * after some sleep if connection fails the first
 			   * time */
+#ifndef MYSQL_MANAGER_PORT
+#define MYSQL_MANAGER_PORT 23546
+#endif
+
+enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
+ OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT};
 
 static int record = 0, verbose = 0, silent = 0, opt_sleep=0;
 static char *db = 0, *pass=0;
 const char* user = 0, *host = 0, *unix_sock = 0;
 static int port = 0, opt_big_test=0;
 static uint start_lineno, *lineno;
+const char* manager_user="root",*manager_host="localhost";
+char *manager_pass=0;
+int manager_port=MYSQL_MANAGER_PORT;
+int manager_wait_timeout=3;
+MYSQL_MANAGER* manager=0;
 
 static char **default_argv;
 static const char *load_default_groups[]= { "mysqltest","client",0 };
@@ -168,6 +179,7 @@
 Q_RPL_PROBE,        Q_ENABLE_RPL_PARSE,
 Q_DISABLE_RPL_PARSE, Q_EVAL_RESULT,
 Q_ENABLE_QUERY_LOG, Q_DISABLE_QUERY_LOG,
+Q_SERVER_START, Q_SERVER_STOP,
 Q_UNKNOWN,                             /* Unknown command.   */
 Q_COMMENT,                             /* Comments, ignored. */
 Q_COMMENT_WITH_COMMAND
@@ -200,6 +212,7 @@
   "rpl_probe",        "enable_rpl_parse",
   "disable_rpl_parse", "eval_result",
   "enable_query_log", "disable_query_log",
+  "server_start", "server_stop",
   0
 };
 
@@ -243,6 +256,7 @@
 static void free_replace_buffer(void);
 static void do_eval(DYNAMIC_STRING* query_eval, const char* query);
 void str_to_file(const char* fname, char* str, int size);
+int do_server_op(struct st_query* q,const char* op);
 
 struct st_replace *glob_replace;
 static char *out_buff;
@@ -321,6 +335,8 @@
 {
   uint i;
   DBUG_ENTER("free_used_memory");
+  if (manager)
+    mysql_manager_close(manager);
   close_cons();
   close_files();
   hash_free(&var_hash);
@@ -580,6 +596,44 @@
   return 0;
 }
 
+int do_server_start(struct st_query* q)
+{
+  return do_server_op(q,"start");
+}
+
+int do_server_stop(struct st_query* q)
+{
+  return do_server_op(q,"stop");
+}
+
+int do_server_op(struct st_query* q,const char* op)
+{
+  char* p=q->first_argument;
+  char com_buf[256],*com_p;
+  com_p=strmov(com_buf,op);
+  com_p=strmov(com_p,"_exec ");
+  if (!*p)
+    die("Missing server name in server_%s\n",op);
+  while (*p && !isspace(*p))
+  {
+   *com_p++=*p++;
+  }
+  *com_p++=' ';
+  com_p=int10_to_str(manager_wait_timeout,com_p,10);
+  *com_p++ = '\n';
+  *com_p=0;
+  if (mysql_manager_command(manager,com_buf,(int)(com_p-com_buf)))
+    die("Error in command: %s(%d)",manager->last_error,manager->last_errno);
+  while (!manager->eof)
+  {
+    if (mysql_manager_fetch_line(manager,com_buf,sizeof(com_buf)))
+      die("Error fetching result line: %s(%d)", manager->last_error,
+	  manager->last_errno);
+  }
+
+  return 0;
+}
+
 int do_source(struct st_query* q)
 {
   char* p=q->first_argument, *name;
@@ -1125,6 +1179,17 @@
   DBUG_RETURN(str);
 }
 
+void init_manager()
+{
+  if (!(manager=mysql_manager_init(0)))
+    die("Failed in mysql_manager_init()");
+  if (!mysql_manager_connect(manager,manager_host,manager_user,
+			     manager_pass,manager_port))
+    die("Could not connect to MySQL manager: %s(%d)",manager->last_error,
+	manager->last_errno);
+
+}
+
 int safe_connect(MYSQL* con, const char* host, const char* user,
 		 const char* pass,
 		 const char* db, int port, const char* sock)
@@ -1519,7 +1584,6 @@
   return 0;
 }
 
-
 struct option long_options[] =
 {
   {"debug",       optional_argument, 0, '#'},
@@ -1527,6 +1591,11 @@
   {"big-test",	  no_argument,	     0, 'B'},
   {"help",        no_argument,       0, '?'},
   {"host",        required_argument, 0, 'h'},
+  {"manager-user",required_argument, 0, OPT_MANAGER_USER},
+  {"manager-host",required_argument, 0, OPT_MANAGER_HOST},
+  {"manager-password",required_argument,0,OPT_MANAGER_PASSWD},
+  {"manager-port",required_argument,0,OPT_MANAGER_PORT},
+  {"manager-wait-timeout",required_argument,0,OPT_MANAGER_WAIT_TIMEOUT},
   {"password",    optional_argument, 0, 'p'},
   {"port",        required_argument, 0, 'P'},
   {"quiet",       no_argument,       0, 'q'},
@@ -1604,6 +1673,23 @@
       case 'r':
 	record = 1;
 	break;
+      case (int)OPT_MANAGER_WAIT_TIMEOUT:
+	manager_wait_timeout=atoi(optarg);
+	break;
+      case (int)OPT_MANAGER_PORT:
+	manager_port=atoi(optarg);
+	break;
+      case (int)OPT_MANAGER_HOST:
+	manager_host=optarg;
+	break;
+      case (int)OPT_MANAGER_USER:
+	manager_user=optarg;
+	break;
+      case (int)OPT_MANAGER_PASSWD:
+	my_free(manager_pass,MYF(MY_ALLOW_ZERO_PTR));
+	manager_pass=my_strdup(optarg,MYF(MY_FAE));
+        while (*optarg) *optarg++= 'x';		/* Destroy argument */
+	break;
       case 'u':
 	user = optarg;
 	break;
@@ -2010,13 +2096,14 @@
   if (!*cur_file)
     *cur_file = stdin;
   *lineno=1;
+  init_manager();
 
   if (!( mysql_init(&cur_con->mysql)))
     die("Failed in mysql_init()");
   cur_con->name = my_strdup("default", MYF(MY_WME));
   if (!cur_con->name)
     die("Out of memory");
-
+  
   if (safe_connect(&cur_con->mysql, host,
 			 user, pass, db, port, unix_sock))
     die("Failed in mysql_real_connect(): %s", mysql_error(&cur_con->mysql));
@@ -2042,6 +2129,8 @@
       case Q_DISABLE_QUERY_LOG: disable_query_log=1; break;
       case Q_SOURCE: do_source(q); break;
       case Q_SLEEP: do_sleep(q); break;
+      case Q_SERVER_START: do_server_start(q); break;
+      case Q_SERVER_STOP: do_server_stop(q); break;
       case Q_INC: do_inc(q); break;
       case Q_DEC: do_dec(q); break;
       case Q_ECHO: do_echo(q); break;

--- 1.2/mysql-test/r/rpl000018.result	Thu Sep 27 23:05:50 2001
+++ 1.3/mysql-test/r/rpl000018.result	Mon Oct  1 16:13:54 2001
@@ -4,7 +4,6 @@
 Log_name
 master-bin.001
 master-bin.002
-master-bin.003
 drop table if exists t1;
 create table t1(n int);
 insert into t1 values (3351);

--- 1.1/mysql-test/t/rpl000018.test	Sat Jan 27 15:33:31 2001
+++ 1.2/mysql-test/t/rpl000018.test	Mon Oct  1 16:13:54 2001
@@ -1,5 +1,7 @@
 connect (master,localhost,root,,test,0,mysql-master.sock);
 connect (slave,localhost,root,,test,0,mysql-slave.sock);
+server_stop master;
+server_start master;
 connection slave;
 reset slave;
 slave start;
Thread
bk commit into 4.0 treesasha2 Oct