List:Commits« Previous MessageNext Message »
From:Petr Chardin Date:February 10 2006 12:35am
Subject:bk commit into 5.1 tree (petr:1.2091)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 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.2091 06/02/10 03:35:07 petr@stripped +4 -0
  IM changes by GUI team: add a version_no column to the
  SHOW INSTANCE STATUS output

  server-tools/instance-manager/instance_options.cc
    1.30 06/02/10 03:35:04 petr@stripped +6 -3
    cleanup

  server-tools/instance-manager/commands.cc
    1.32 06/02/10 03:35:04 petr@stripped +44 -2
    add a version_no column to the SHOW INSTANCE STATUS output

  mysql-test/t/im_life_cycle.imtest
    1.3 06/02/10 03:35:04 petr@stripped +6 -6
    fix test to take into account the new column

  mysql-test/r/im_life_cycle.result
    1.3 06/02/10 03:35:04 petr@stripped +12 -12
    update 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.1-im-fixes

--- 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 03:35:04 +03:00
@@ -3,22 +3,22 @@
 mysqld1	online
 mysqld2	offline
 SHOW INSTANCE STATUS mysqld1;
-instance_name	status	version
-mysqld1	online	VERSION
+instance_name	status	version_number	version
+mysqld1	online	VERSION_NUMBER	VERSION
 SHOW INSTANCE STATUS mysqld2;
-instance_name	status	version
-mysqld2	offline	VERSION
+instance_name	status	version_number	version
+mysqld2	offline	VERSION_NUMBER	VERSION
 START INSTANCE mysqld2;
 SHOW INSTANCES;
 instance_name	status
 mysqld1	online
 mysqld2	online
 SHOW INSTANCE STATUS mysqld1;
-instance_name	status	version
-mysqld1	online	VERSION
+instance_name	status	version_number	version
+mysqld1	online	VERSION_NUMBER	VERSION
 SHOW INSTANCE STATUS mysqld2;
-instance_name	status	version
-mysqld2	online	VERSION
+instance_name	status	version_number	version
+mysqld2	online	VERSION_NUMBER	VERSION
 SHOW VARIABLES LIKE 'port';
 Variable_name	Value
 port	IM_MYSQLD1_PORT
@@ -28,11 +28,11 @@
 mysqld1	online
 mysqld2	offline
 SHOW INSTANCE STATUS mysqld1;
-instance_name	status	version
-mysqld1	online	VERSION
+instance_name	status	version_number	version
+mysqld1	online	VERSION_NUMBER	VERSION
 SHOW INSTANCE STATUS mysqld2;
-instance_name	status	version
-mysqld2	offline	VERSION
+instance_name	status	version_number	version
+mysqld2	offline	VERSION_NUMBER	VERSION
 START INSTANCE mysqld3;
 ERROR HY000: Bad instance name. Check that the instance with such a name exists
 START INSTANCE mysqld1;

--- 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 03:35:04 +03:00
@@ -18,9 +18,9 @@
 ###########################################################################
 
 SHOW INSTANCES;
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
 SHOW INSTANCE STATUS mysqld1;
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
 SHOW INSTANCE STATUS mysqld2;
 
 ###########################################################################
@@ -38,9 +38,9 @@
 --sleep 3
 
 SHOW INSTANCES;
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
 SHOW INSTANCE STATUS mysqld1;
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
 SHOW INSTANCE STATUS mysqld2;
 
 --connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
@@ -66,9 +66,9 @@
 --sleep 3
 
 SHOW INSTANCES;
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
 SHOW INSTANCE STATUS mysqld1;
---replace_column 3 VERSION
+--replace_column 3 VERSION_NUMBER 4 VERSION
 SHOW INSTANCE STATUS mysqld2;
 
 ###########################################################################

--- 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 03:35:04 +03:00
@@ -25,6 +25,7 @@
 #include "options.h"
 
 #include <m_string.h>
+#include <m_ctype.h>
 #include <mysql.h>
 #include <my_dir.h>
 
@@ -62,6 +63,31 @@
 }
 
 
+static int parse_version_number(const char *version_str, char *version,
+                                uint version_size)
+{
+  const char *start= version_str;
+  const char *end;
+
+  // skip garbage
+  while (!my_isdigit(default_charset_info, *start))
+    start++;
+
+  end= start;
+  // skip digits and dots
+  while (my_isdigit(default_charset_info, *end) || *end == '.')
+    end++;
+
+  if ((uint)(end - start) >= version_size)
+    return -1;
+
+  strncpy(version, start, end-start);
+  version[end-start]= '\0';
+
+  return 0;
+}
+
+
 /* implementation for Show_instances: */
 
 
@@ -174,9 +200,10 @@
 {
   enum { MAX_VERSION_LENGTH= 40 };
   Buffer send_buff;  /* buffer for packets */
-  LIST name, status, version;
+  LIST name, status, version, version_number;
   LIST *field_list;
-  NAME_WITH_LENGTH name_field, status_field, version_field;
+  NAME_WITH_LENGTH name_field, status_field, version_field,
+                   version_number_field;
   uint position=0;
 
   if (!instance_name)
@@ -192,7 +219,11 @@
   version_field.name= (char*) "version";
   version_field.length= MAX_VERSION_LENGTH;
   version.data= &version_field;
+  version_number_field.name= (char*) "version_number";
+  version_number_field.length= MAX_VERSION_LENGTH;
+  version_number.data= &version_number_field;
   field_list= list_add(NULL, &version);
+  field_list= list_add(field_list, &version_number);
   field_list= list_add(field_list, &status);
   field_list= list_add(field_list, &name);
 
@@ -210,10 +241,21 @@
       store_to_protocol_packet(&send_buff, (char*) "offline", &position);
 
     if (instance->options.mysqld_version)
+    {
+      char parsed_version[MAX_VERSION_LENGTH];
+
+      parse_version_number(instance->options.mysqld_version, parsed_version,
+                           sizeof(parsed_version));
+      store_to_protocol_packet(&send_buff, parsed_version, &position);
+
       store_to_protocol_packet(&send_buff, instance->options.mysqld_version,
                                &position);
+    }
     else
+    {
       store_to_protocol_packet(&send_buff, (char*) "unknown", &position);
+      store_to_protocol_packet(&send_buff, (char*) "unknown", &position);
+    }
 
 
     if (send_buff.is_error() ||

--- 1.29/server-tools/instance-manager/instance_options.cc	2005-11-02 18:28:47 +03:00
+++ 1.30/server-tools/instance-manager/instance_options.cc	2006-02-10 03:35:04 +03:00
@@ -138,9 +138,14 @@
 
   if (*result != '\0')
   {
+    char *start;
     /* chop the newline from the end of the version string */
     result[strlen(result) - NEWLINE_LEN]= '\0';
-    mysqld_version= strdup_root(&alloc, result);
+    /* trim leading whitespaces */
+    start= result;
+    while (my_isspace(default_charset_info, *start))
+      ++start;
+    mysqld_version= strdup_root(&alloc, start);
   }
 err:
   return rc;
@@ -167,8 +172,6 @@
 int Instance_options::fill_log_options()
 {
   Buffer buff;
-  uint position= 0;
-  char **tmp_argv= argv;
   enum { MAX_LOG_OPTION_LENGTH= 256 };
   char datadir[MAX_LOG_OPTION_LENGTH];
   char hostname[MAX_LOG_OPTION_LENGTH];
Thread
bk commit into 5.1 tree (petr:1.2091)Petr Chardin10 Feb