List:Commits« Previous MessageNext Message »
From:Petr Chardin Date:February 9 2006 11:16pm
Subject:bk commit into 5.0 tree (petr:1.2000)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of cps. When cps 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.2000 06/02/10 02:15:55 petr@stripped +13 -0
  a bunch of IM fixes from the GUI team

  server-tools/instance-manager/priv.h
    1.9 06/02/10 02:15:52 petr@stripped +5 -0
    move platform-independent ifdefs here

  server-tools/instance-manager/priv.cc
    1.10 06/02/10 02:15:52 petr@stripped +2 -1
    increase net timeout. it should be equal to mysqld's

  server-tools/instance-manager/portability.h
    1.8 06/02/10 02:15:52 petr@stripped +1 -2
    add _snprintf define, move platfrom-independent
    ifdefs to priv.h

  server-tools/instance-manager/parse.cc
    1.11 06/02/10 02:15:52 petr@stripped +6 -4
    check for get_text_id return value

  server-tools/instance-manager/options.h
    1.14 06/02/10 02:15:52 petr@stripped +1 -0
    add an option

  server-tools/instance-manager/options.cc
    1.29 06/02/10 02:15:52 petr@stripped +4 -1
    add vars to allow relative paths in --defaults-file option

  server-tools/instance-manager/mysqlmanager.cc
    1.16 06/02/10 02:15:52 petr@stripped +2 -1
    fix windows warning

  server-tools/instance-manager/instance_map.cc
    1.25 06/02/10 02:15:52 petr@stripped +24 -2
    allow relative paths in --defaults-file option

  server-tools/instance-manager/instance.cc
    1.32 06/02/10 02:15:52 petr@stripped +4 -0
    fix monitoring capabilities, when no port was specified
    for an instance

  server-tools/instance-manager/commands.cc
    1.32 06/02/10 02:15:52 petr@stripped +1 -1
    fix warning

  server-tools/instance-manager/Makefile.am
    1.30 06/02/10 02:15:52 petr@stripped +2 -4
    always look for passwords in /etc/ on unixes

  mysql-test/t/im_life_cycle.imtest
    1.3 06/02/10 02:15:52 petr@stripped +9 -0
    check that wrong command is processed correctly

  mysql-test/r/im_life_cycle.result
    1.3 06/02/10 02:15:52 petr@stripped +2 -0
    correct result

# 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:	petr
# Host:	outpost.site
# Root:	/home/cps/mysql/devel/5.0-mike

--- 1.2/mysql-test/r/im_life_cycle.result	2005-10-18 00:48:22 +04:00
+++ 1.3/mysql-test/r/im_life_cycle.result	2006-02-10 02:15:52 +03:00
@@ -62,3 +62,5 @@
 instance_name	status
 mysqld1	online
 mysqld2	offline
+SHOW INSTANCE STATUS;
+ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use

--- 1.2/mysql-test/t/im_life_cycle.imtest	2005-10-18 00:48:22 +04:00
+++ 1.3/mysql-test/t/im_life_cycle.imtest	2006-02-10 02:15:52 +03:00
@@ -140,3 +140,12 @@
 --exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed
 
 SHOW INSTANCES;
+
+###########################################################################
+#
+# 1.1.8. Check that Instance Manager returns an error on
+# incomplete SHOW INSTANCE STATUS command.
+#
+###########################################################################
+--error 1149
+SHOW INSTANCE STATUS;

--- 1.29/server-tools/instance-manager/Makefile.am	2005-11-09 12:27:13 +03:00
+++ 1.30/server-tools/instance-manager/Makefile.am	2006-02-10 02:15:52 +03:00
@@ -30,11 +30,9 @@
 	-DDEFAULT_PID_FILE_NAME="$(localstatedir)/mysqlmanager.pid" \
 	-DDEFAULT_LOG_FILE_NAME="$(localstatedir)/mysqlmanager.log" \
 	-DDEFAULT_SOCKET_FILE_NAME="/tmp/mysqlmanager.sock" \
-	-DDEFAULT_PASSWORD_FILE_NAME="$(sysconfdir)/mysqlmanager.passwd" \
+	-DDEFAULT_PASSWORD_FILE_NAME="/etc/mysqlmanager.passwd" \
 	-DDEFAULT_MYSQLD_PATH="$(libexecdir)/mysqld$(EXEEXT)" \
-	-DDEFAULT_MONITORING_INTERVAL="20" \
-	-DDEFAULT_PORT="2273" \
-        -DDEFAULT_CONFIG_FILE="/etc/my.cnf" \
+	-DDEFAULT_CONFIG_FILE="/etc/my.cnf" \
 	-DPROTOCOL_VERSION=@PROTOCOL_VERSION@
 
 liboptions_a_SOURCES= options.h options.cc priv.h priv.cc

--- 1.15/server-tools/instance-manager/mysqlmanager.cc	2005-09-13 23:48:44 +04:00
+++ 1.16/server-tools/instance-manager/mysqlmanager.cc	2006-02-10 02:15:52 +03:00
@@ -82,12 +82,13 @@
   int return_value= 1;
   init_environment(argv[0]);
   Options options;
-  struct passwd *user_info;
 
   if (options.load(argc, argv))
     goto err;
 
 #ifndef __WIN__
+  struct passwd *user_info;
+
   if ((user_info= check_user(options.user)))
   {
       if (set_user(options.user, user_info))

--- 1.28/server-tools/instance-manager/options.cc	2005-09-23 22:28:48 +04:00
+++ 1.29/server-tools/instance-manager/options.cc	2006-02-10 02:15:52 +03:00
@@ -55,6 +55,8 @@
 uint Options::port_number= DEFAULT_PORT;
 /* just to declare */
 char **Options::saved_argv= NULL;
+/* Remember if the config file was forced */
+bool Options::is_forced_default_file= 0;
 
 /*
   List of options, accepted by the instance manager.
@@ -118,7 +120,7 @@
     " Server binary.",
     (gptr *) &Options::default_mysqld_path,
     (gptr *) &Options::default_mysqld_path,
-    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+    0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 },
 
   { "monitoring-interval", OPT_MONITORING_INTERVAL, "Interval to monitor"
     " instances in seconds.",
@@ -254,6 +256,7 @@
     if (is_prefix(argv[1], "--defaults-file="))
     {
       Options::config_file= strchr(argv[1], '=') + 1;
+      Options::is_forced_default_file= 1;
     }
     if (is_prefix(argv[1], "--defaults-extra-file=") ||
         is_prefix(argv[1], "--no-defaults"))

--- 1.13/server-tools/instance-manager/options.h	2005-10-19 00:30:50 +04:00
+++ 1.14/server-tools/instance-manager/options.h	2006-02-10 02:15:52 +03:00
@@ -36,6 +36,7 @@
   static char run_as_service;        /* handle_options doesn't support bool */
   static const char *user;
 #endif
+  static bool is_forced_default_file;
   static const char *log_file_name;
   static const char *pid_file_name;
   static const char *socket_file_name;

--- 1.31/server-tools/instance-manager/commands.cc	2005-09-20 03:14:00 +04:00
+++ 1.32/server-tools/instance-manager/commands.cc	2006-02-10 02:15:52 +03:00
@@ -483,7 +483,7 @@
       read_buff.reserve(0, buff_size);
 
       /* read in one chunk */
-      read_len= my_seek(fd, file_stat.st_size - size, MY_SEEK_SET, MYF(0));
+      read_len= (int)my_seek(fd, file_stat.st_size - size, MY_SEEK_SET, MYF(0));
 
       if ((read_len= my_read(fd, (byte*) read_buff.buffer,
                              buff_size, MYF(0))) < 0)

--- 1.31/server-tools/instance-manager/instance.cc	2005-12-23 22:50:09 +03:00
+++ 1.32/server-tools/instance-manager/instance.cc	2006-02-10 02:15:52 +03:00
@@ -418,6 +418,10 @@
   if (options.mysqld_socket)
     socket= strchr(options.mysqld_socket, '=') + 1;
 
+  /* no port was specified => instance falled back to default value */
+  if (!options.mysqld_port && !options.mysqld_socket)
+    port= SERVER_DEFAULT_PORT;
+
   pthread_mutex_lock(&LOCK_instance);
 
   mysql_init(&mysql);

--- 1.24/server-tools/instance-manager/instance_map.cc	2005-09-23 22:28:46 +04:00
+++ 1.25/server-tools/instance-manager/instance_map.cc	2006-02-10 02:15:52 +03:00
@@ -229,11 +229,33 @@
   uint args_used= 0;
   const char *argv_options[3];
   char **argv= (char **) &argv_options;
-
+  char defaults_file_arg[FN_REFLEN];
 
   /* the name of the program may be orbitrary here in fact */
   argv_options[0]= "mysqlmanager";
-  argv_options[1]= '\0';
+
+  /*
+    If the option file was forced by the user when starting
+    the IM with --defaults-file=xxxx, make sure it is also
+    passed as --defaults-file, not only as Options::config_file.
+    This is important for option files given with relative path:
+    e.g. --defaults-file=my.cnf.
+    Otherwise my_search_option_files will treat "my.cnf" as a group
+    name and start looking for files named "my.cnf.cnf" in all
+    default dirs. Which is not what we want.
+  */
+  if (Options::is_forced_default_file)
+  {
+    snprintf(defaults_file_arg, FN_REFLEN, "--defaults-file=%s",
+             Options::config_file);
+
+    argv_options[1]= defaults_file_arg;
+    argv_options[2]= '\0';
+
+    argc= 2;
+  }
+  else
+    argv_options[1]= '\0';
 
   /*
     If the routine failed, we'll simply fallback to defaults in

--- 1.10/server-tools/instance-manager/parse.cc	2006-01-03 19:54:34 +03:00
+++ 1.11/server-tools/instance-manager/parse.cc	2006-02-10 02:15:52 +03:00
@@ -166,7 +166,8 @@
     skip= true;
   case TOK_SET:
 
-    get_text_id(&text, &instance_name_len, &instance_name);
+    if (get_text_id(&text, &instance_name_len, &instance_name))
+      goto syntax_error;
     text+= instance_name_len;
 
    /* the next token should be a dot */
@@ -221,7 +222,8 @@
       switch (Token tok2= shift_token(&text, &word_len)) {
       case TOK_OPTIONS:
       case TOK_STATUS:
-        get_text_id(&text, &instance_name_len, &instance_name);
+        if (get_text_id(&text, &instance_name_len, &instance_name))
+          goto syntax_error;
         text+= instance_name_len;
         /* check that this is the end of the command */
         get_word(&text, &word_len);
@@ -273,7 +275,8 @@
               goto syntax_error;
             }
             /* get the size of the log we want to retrieve */
-            get_text_id(&text, &word_len, &log_size);
+            if (get_text_id(&text, &word_len, &log_size))
+              goto syntax_error;
             text+= word_len;
             /* this parameter is required */
             if (!word_len)
@@ -291,7 +294,6 @@
                                                instance_name_len, log_type,
                                                log_size, text);
 
-                //get_text_id(&text, &log_size_len, &log_size);
                 break;
               case '\0':
                 command= new Show_instance_log(map, instance_name,

--- 1.9/server-tools/instance-manager/priv.cc	2005-11-10 16:24:48 +03:00
+++ 1.10/server-tools/instance-manager/priv.cc	2006-02-10 02:15:52 +03:00
@@ -15,6 +15,7 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 #include <my_global.h>
+#include <mysql_com.h>
 #include "priv.h"
 #include "portability.h"
 
@@ -52,7 +53,7 @@
 
 unsigned long max_allowed_packet= 16384;
 
-unsigned long net_read_timeout= 30;             // same as in mysqld
+unsigned long net_read_timeout= NET_WAIT_TIMEOUT;    // same as in mysqld
 
 unsigned long net_write_timeout= 60;            // same as in mysqld
 

--- 1.8/server-tools/instance-manager/priv.h	2005-11-02 18:28:48 +03:00
+++ 1.9/server-tools/instance-manager/priv.h	2006-02-10 02:15:52 +03:00
@@ -24,6 +24,11 @@
 #endif
 #include "my_pthread.h"
 
+/* IM-wide platform-independent defines */
+#define SERVER_DEFAULT_PORT 3306
+#define DEFAULT_MONITORING_INTERVAL 20
+#define DEFAULT_PORT 2273
+
 /* the pid of the manager process (of the signal thread on the LinuxThreads) */
 extern pid_t manager_pid;
 

--- 1.7/server-tools/instance-manager/portability.h	2005-09-29 21:34:40 +04:00
+++ 1.8/server-tools/instance-manager/portability.h	2006-02-10 02:15:52 +03:00
@@ -8,13 +8,12 @@
 #ifdef __WIN__
 
 #define vsnprintf _vsnprintf
+#define snprintf _snprintf
 
 #define SIGKILL 9
 #define SHUT_RDWR 0x2
 
 /*TODO:  fix this */
-#define DEFAULT_MONITORING_INTERVAL 20
-#define DEFAULT_PORT 2273
 #define PROTOCOL_VERSION 10
 
 typedef int pid_t;
Thread
bk commit into 5.0 tree (petr:1.2000)Petr Chardin10 Feb