Commit f3d73e8c authored by petr@mysql.com's avatar petr@mysql.com

Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  mysql.com:/home/cps/mysql/devel/5.1-im-fixes
parents 5bb07f7e 84884985
......@@ -3,22 +3,22 @@ instance_name status
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 @@ instance_name status
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;
......
......@@ -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 @@ START INSTANCE mysqld2;
--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 @@ STOP INSTANCE mysqld2;
--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;
###########################################################################
......
......@@ -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 inline int put_to_buff(Buffer *buff, const char *str, uint *position)
}
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 @@ int Show_instance_status::execute(struct st_net *net,
{
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 @@ int Show_instance_status::execute(struct st_net *net,
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 @@ int Show_instance_status::execute(struct st_net *net,
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() ||
......
......@@ -138,9 +138,14 @@ int Instance_options::fill_instance_version()
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 @@ err:
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];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment