Commit c0564421 authored by unknown's avatar unknown

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/home/jonas/src/mysql-5.0

parents 93978350 b9520662
...@@ -540,7 +540,6 @@ static void free_used_memory() ...@@ -540,7 +540,6 @@ static void free_used_memory()
mysql_server_end(); mysql_server_end();
if (ps_protocol) if (ps_protocol)
ps_free_reg(); ps_free_reg();
my_end(MY_CHECK_ERROR);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -558,6 +557,7 @@ static void die(const char* fmt, ...) ...@@ -558,6 +557,7 @@ static void die(const char* fmt, ...)
} }
va_end(args); va_end(args);
free_used_memory(); free_used_memory();
my_end(MY_CHECK_ERROR);
exit(1); exit(1);
} }
...@@ -570,6 +570,7 @@ static void abort_not_supported_test() ...@@ -570,6 +570,7 @@ static void abort_not_supported_test()
if (!silent) if (!silent)
printf("skipped\n"); printf("skipped\n");
free_used_memory(); free_used_memory();
my_end(MY_CHECK_ERROR);
exit(2); exit(2);
} }
...@@ -668,6 +669,7 @@ static int check_result(DYNAMIC_STRING* ds, const char* fname, ...@@ -668,6 +669,7 @@ static int check_result(DYNAMIC_STRING* ds, const char* fname,
{ {
int error = 0; int error = 0;
int res=dyn_string_cmp(ds, fname); int res=dyn_string_cmp(ds, fname);
DBUG_ENTER("check_result");
if (res && require_option) if (res && require_option)
abort_not_supported_test(); abort_not_supported_test();
...@@ -687,7 +689,7 @@ static int check_result(DYNAMIC_STRING* ds, const char* fname, ...@@ -687,7 +689,7 @@ static int check_result(DYNAMIC_STRING* ds, const char* fname,
} }
if (error) if (error)
reject_dump(fname, ds->str, ds->length); reject_dump(fname, ds->str, ds->length);
return error; DBUG_RETURN(error);
} }
...@@ -1842,7 +1844,10 @@ int read_line(char* buf, int size) ...@@ -1842,7 +1844,10 @@ int read_line(char* buf, int size)
cur_file--; cur_file--;
lineno--; lineno--;
if (cur_file == file_stack) if (cur_file == file_stack)
{
DBUG_PRINT("info", ("end of file"));
DBUG_RETURN(1); DBUG_RETURN(1);
}
continue; continue;
} }
...@@ -2012,7 +2017,6 @@ int read_query(struct st_query** q_ptr) ...@@ -2012,7 +2017,6 @@ int read_query(struct st_query** q_ptr)
q->query_buf= q->query= 0; q->query_buf= q->query= 0;
if (read_line(read_query_buf, sizeof(read_query_buf))) if (read_line(read_query_buf, sizeof(read_query_buf)))
{ {
DBUG_PRINT("warning",("too long query"));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
DBUG_PRINT("info", ("query: %s", read_query_buf)); DBUG_PRINT("info", ("query: %s", read_query_buf));
...@@ -3367,8 +3371,6 @@ int main(int argc, char **argv) ...@@ -3367,8 +3371,6 @@ int main(int argc, char **argv)
my_bool require_file=0, q_send_flag=0, abort_flag= 0; my_bool require_file=0, q_send_flag=0, abort_flag= 0;
char save_file[FN_REFLEN]; char save_file[FN_REFLEN];
MY_INIT(argv[0]); MY_INIT(argv[0]);
{
DBUG_ENTER("main");
/* Use all time until exit if no explicit 'start_timer' */ /* Use all time until exit if no explicit 'start_timer' */
timer_start= timer_now(); timer_start= timer_now();
...@@ -3395,6 +3397,8 @@ int main(int argc, char **argv) ...@@ -3395,6 +3397,8 @@ int main(int argc, char **argv)
*block_ok = 1; *block_ok = 1;
init_dynamic_string(&ds_res, "", 0, 65536); init_dynamic_string(&ds_res, "", 0, 65536);
parse_args(argc, argv); parse_args(argc, argv);
DBUG_PRINT("info",("result_file: '%s'", result_file ? result_file : ""));
if (mysql_server_init(embedded_server_arg_count, if (mysql_server_init(embedded_server_arg_count,
embedded_server_args, embedded_server_args,
(char**) embedded_server_groups)) (char**) embedded_server_groups))
...@@ -3660,9 +3664,9 @@ int main(int argc, char **argv) ...@@ -3660,9 +3664,9 @@ int main(int argc, char **argv)
if (!got_end_timer) if (!got_end_timer)
timer_output(); /* No end_timer cmd, end it */ timer_output(); /* No end_timer cmd, end it */
free_used_memory(); free_used_memory();
my_end(MY_CHECK_ERROR);
exit(error ? 1 : 0); exit(error ? 1 : 0);
return error ? 1 : 0; /* Keep compiler happy */ return error ? 1 : 0; /* Keep compiler happy */
}
} }
......
...@@ -622,7 +622,7 @@ qq ...@@ -622,7 +622,7 @@ qq
*a *a*a * *a *a*a *
explain select * from t1 where v='a'; explain select * from t1 where v='a';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const 7 Using where 1 SIMPLE t1 ref v v 13 const # Using where
drop table t1; drop table t1;
create table t1 (a char(10), unique using btree (a)) engine=heap; create table t1 (a char(10), unique using btree (a)) engine=heap;
insert into t1 values ('a'); insert into t1 values ('a');
......
...@@ -1698,7 +1698,7 @@ t5 CREATE TABLE `t5` ( ...@@ -1698,7 +1698,7 @@ t5 CREATE TABLE `t5` (
`param03` double default NULL, `param03` double default NULL,
`const04` varchar(3) NOT NULL default '', `const04` varchar(3) NOT NULL default '',
`param04` longtext, `param04` longtext,
`const05` binary(3) NOT NULL default '', `const05` varbinary(3) NOT NULL default '',
`param05` longblob, `param05` longblob,
`const06` varchar(10) NOT NULL default '', `const06` varchar(10) NOT NULL default '',
`param06` longtext, `param06` longtext,
...@@ -4707,7 +4707,7 @@ t5 CREATE TABLE `t5` ( ...@@ -4707,7 +4707,7 @@ t5 CREATE TABLE `t5` (
`param03` double default NULL, `param03` double default NULL,
`const04` varchar(3) NOT NULL default '', `const04` varchar(3) NOT NULL default '',
`param04` longtext, `param04` longtext,
`const05` varchar(3) NOT NULL default '', `const05` varbinary(3) NOT NULL default '',
`param05` longblob, `param05` longblob,
`const06` varchar(10) NOT NULL default '', `const06` varchar(10) NOT NULL default '',
`param06` longtext, `param06` longtext,
......
...@@ -360,6 +360,8 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' ...@@ -360,6 +360,8 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
--error 1062 --error 1062
alter table t1 add unique(v); alter table t1 add unique(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*')); select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
# Number of rows is not constant for b-trees keys
--replace_column 9 #
explain select * from t1 where v='a'; explain select * from t1 where v='a';
drop table t1; drop table t1;
......
...@@ -9,6 +9,7 @@ use test; ...@@ -9,6 +9,7 @@ use test;
# create system tables as in mysql-3.20 # create system tables as in mysql-3.20
--disable_warnings
CREATE TABLE db ( CREATE TABLE db (
Host char(60) binary DEFAULT '' NOT NULL, Host char(60) binary DEFAULT '' NOT NULL,
Db char(32) binary DEFAULT '' NOT NULL, Db char(32) binary DEFAULT '' NOT NULL,
...@@ -23,10 +24,12 @@ CREATE TABLE db ( ...@@ -23,10 +24,12 @@ CREATE TABLE db (
KEY User (User) KEY User (User)
) )
type=ISAM; type=ISAM;
--enable-warnings
INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y'); INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y'); INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y');
--disable_warnings
CREATE TABLE host ( CREATE TABLE host (
Host char(60) binary DEFAULT '' NOT NULL, Host char(60) binary DEFAULT '' NOT NULL,
Db char(32) binary DEFAULT '' NOT NULL, Db char(32) binary DEFAULT '' NOT NULL,
...@@ -39,7 +42,9 @@ CREATE TABLE host ( ...@@ -39,7 +42,9 @@ CREATE TABLE host (
PRIMARY KEY Host (Host,Db) PRIMARY KEY Host (Host,Db)
) )
type=ISAM; type=ISAM;
--enable-warnings
--disable_warnings
CREATE TABLE user ( CREATE TABLE user (
Host char(60) binary DEFAULT '' NOT NULL, Host char(60) binary DEFAULT '' NOT NULL,
User char(16) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL,
...@@ -56,6 +61,7 @@ CREATE TABLE user ( ...@@ -56,6 +61,7 @@ CREATE TABLE user (
PRIMARY KEY Host (Host,User) PRIMARY KEY Host (Host,User)
) )
type=ISAM; type=ISAM;
--enable-warnings
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y'); INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N'); INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
......
...@@ -85,7 +85,7 @@ int Buffer::reserve(uint position, uint len_arg) ...@@ -85,7 +85,7 @@ int Buffer::reserve(uint position, uint len_arg)
min(MAX_BUFFER_SIZE, min(MAX_BUFFER_SIZE,
max((uint) (buffer_size*1.5), max((uint) (buffer_size*1.5),
position + len_arg))); position + len_arg)));
if (buffer= NULL) if (buffer == NULL)
goto err; goto err;
buffer_size= (uint) (buffer_size*1.5); buffer_size= (uint) (buffer_size*1.5);
} }
......
...@@ -63,7 +63,7 @@ int Show_instances::do_command(struct st_net *net) ...@@ -63,7 +63,7 @@ int Show_instances::do_command(struct st_net *net)
Instance_map::Iterator iterator(instance_map); Instance_map::Iterator iterator(instance_map);
instance_map->lock(); instance_map->lock();
while (instance= iterator.next()) while ((instance= iterator.next()))
{ {
position= 0; position= 0;
store_to_string(&send_buff, instance->options.instance_name, &position); store_to_string(&send_buff, instance->options.instance_name, &position);
...@@ -117,7 +117,7 @@ Show_instance_status::Show_instance_status(Instance_map *instance_map_arg, ...@@ -117,7 +117,7 @@ Show_instance_status::Show_instance_status(Instance_map *instance_map_arg,
Instance *instance; Instance *instance;
/* we make a search here, since we don't want t store the name */ /* we make a search here, since we don't want t store the name */
if (instance= instance_map->find(name, len)) if ((instance= instance_map->find(name, len)))
{ {
instance_name= instance->options.instance_name; instance_name= instance->options.instance_name;
} }
...@@ -222,7 +222,7 @@ Show_instance_options::Show_instance_options(Instance_map *instance_map_arg, ...@@ -222,7 +222,7 @@ Show_instance_options::Show_instance_options(Instance_map *instance_map_arg,
Instance *instance; Instance *instance;
/* we make a search here, since we don't want t store the name */ /* we make a search here, since we don't want t store the name */
if (instance= instance_map->find(name, len)) if ((instance= instance_map->find(name, len)))
{ {
instance_name= instance->options.instance_name; instance_name= instance->options.instance_name;
} }
...@@ -306,7 +306,7 @@ int Show_instance_options::do_command(struct st_net *net, ...@@ -306,7 +306,7 @@ int Show_instance_options::do_command(struct st_net *net,
} }
/* loop through the options stored in DYNAMIC_ARRAY */ /* loop through the options stored in DYNAMIC_ARRAY */
for (int i= 0; i < instance->options.options_array.elements; i++) for (uint i= 0; i < instance->options.options_array.elements; i++)
{ {
char *tmp_option, *option_value; char *tmp_option, *option_value;
get_dynamic(&(instance->options.options_array), (gptr) &tmp_option, i); get_dynamic(&(instance->options.options_array), (gptr) &tmp_option, i);
...@@ -355,7 +355,7 @@ Start_instance::Start_instance(Instance_map *instance_map_arg, ...@@ -355,7 +355,7 @@ Start_instance::Start_instance(Instance_map *instance_map_arg,
:Command(instance_map_arg) :Command(instance_map_arg)
{ {
/* we make a search here, since we don't want t store the name */ /* we make a search here, since we don't want t store the name */
if (instance= instance_map->find(name, len)) if ((instance= instance_map->find(name, len)))
instance_name= instance->options.instance_name; instance_name= instance->options.instance_name;
} }
...@@ -388,7 +388,7 @@ Stop_instance::Stop_instance(Instance_map *instance_map_arg, ...@@ -388,7 +388,7 @@ Stop_instance::Stop_instance(Instance_map *instance_map_arg,
:Command(instance_map_arg) :Command(instance_map_arg)
{ {
/* we make a search here, since we don't want t store the name */ /* we make a search here, since we don't want t store the name */
if (instance= instance_map->find(name, len)) if ((instance= instance_map->find(name, len)))
instance_name= instance->options.instance_name; instance_name= instance->options.instance_name;
} }
...@@ -406,7 +406,7 @@ int Stop_instance::execute(struct st_net *net, ulong connection_id) ...@@ -406,7 +406,7 @@ int Stop_instance::execute(struct st_net *net, ulong connection_id)
if (instance->options.is_guarded != NULL) if (instance->options.is_guarded != NULL)
instance_map->guardian-> instance_map->guardian->
stop_guard(instance); stop_guard(instance);
if (err_code= instance->stop()) if ((err_code= instance->stop()))
return err_code; return err_code;
printf("instance was stopped\n"); printf("instance was stopped\n");
net_send_ok(net, connection_id); net_send_ok(net, connection_id);
......
...@@ -110,7 +110,7 @@ int Guardian_thread::start() ...@@ -110,7 +110,7 @@ int Guardian_thread::start()
Instance_map::Iterator iterator(instance_map); Instance_map::Iterator iterator(instance_map);
instance_map->lock(); instance_map->lock();
while (instance= iterator.next()) while ((instance= iterator.next()))
{ {
if ((instance->options.is_guarded != NULL) && (instance->is_running())) if ((instance->options.is_guarded != NULL) && (instance->is_running()))
if (guard(instance)) if (guard(instance))
......
...@@ -88,8 +88,8 @@ Instance::~Instance() ...@@ -88,8 +88,8 @@ Instance::~Instance()
bool Instance::is_running() bool Instance::is_running()
{ {
uint port; uint port= 0;
const char *socket; const char *socket= NULL;
if (options.mysqld_port) if (options.mysqld_port)
port= atoi(strchr(options.mysqld_port, '=') + 1); port= atoi(strchr(options.mysqld_port, '=') + 1);
......
...@@ -203,9 +203,12 @@ int Instance_map::cleanup() ...@@ -203,9 +203,12 @@ int Instance_map::cleanup()
while (i < hash.records) while (i < hash.records)
{ {
instance= (Instance *) hash_element(&hash, i); instance= (Instance *) hash_element(&hash, i);
instance->cleanup(); if (instance->cleanup())
return 1;
i++; i++;
} }
return 0;
} }
...@@ -250,7 +253,7 @@ Instance *Instance_map::Iterator::next() ...@@ -250,7 +253,7 @@ Instance *Instance_map::Iterator::next()
{ {
if (current_instance < instance_map->hash.records) if (current_instance < instance_map->hash.records)
return (Instance *) hash_element(&instance_map->hash, current_instance++); return (Instance *) hash_element(&instance_map->hash, current_instance++);
else
return NULL; return NULL;
} }
...@@ -38,7 +38,6 @@ extern void free_groups(char **groups); ...@@ -38,7 +38,6 @@ extern void free_groups(char **groups);
class Instance_map class Instance_map
{ {
friend class Iterator;
public: public:
/* Instance_map iterator */ /* Instance_map iterator */
class Iterator class Iterator
...@@ -54,6 +53,7 @@ class Instance_map ...@@ -54,6 +53,7 @@ class Instance_map
void go_to_first(); void go_to_first();
Instance *next(); Instance *next();
}; };
friend class Iterator;
public: public:
/* returns a pointer to the instance or NULL, if there is no such instance */ /* returns a pointer to the instance or NULL, if there is no such instance */
Instance *find(const char *name, uint name_len); Instance *find(const char *name, uint name_len);
......
...@@ -2135,6 +2135,10 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -2135,6 +2135,10 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
} }
} }
} }
/*
If we have information schema its always the first table and only
the first table. Reset for other tables.
*/
with_i_schema= 0; with_i_schema= 0;
} }
} }
...@@ -2838,7 +2842,7 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables, ...@@ -2838,7 +2842,7 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
} }
void store_constarints(TABLE *table, const char*db, const char *tname, void store_constraints(TABLE *table, const char*db, const char *tname,
const char *key_name, uint key_len, const char *key_name, uint key_len,
const char *con_type, uint con_len) const char *con_type, uint con_len)
{ {
...@@ -2874,10 +2878,10 @@ static int get_schema_constarints_record(THD *thd, struct st_table_list *tables, ...@@ -2874,10 +2878,10 @@ static int get_schema_constarints_record(THD *thd, struct st_table_list *tables,
continue; continue;
if (i == primary_key && !strcmp(key_info->name, primary_key_name)) if (i == primary_key && !strcmp(key_info->name, primary_key_name))
store_constarints(table, base_name, file_name, key_info->name, store_constraints(table, base_name, file_name, key_info->name,
strlen(key_info->name), "PRIMARY KEY", 11); strlen(key_info->name), "PRIMARY KEY", 11);
else if (key_info->flags & HA_NOSAME) else if (key_info->flags & HA_NOSAME)
store_constarints(table, base_name, file_name, key_info->name, store_constraints(table, base_name, file_name, key_info->name,
strlen(key_info->name), "UNIQUE", 6); strlen(key_info->name), "UNIQUE", 6);
} }
...@@ -2886,7 +2890,7 @@ static int get_schema_constarints_record(THD *thd, struct st_table_list *tables, ...@@ -2886,7 +2890,7 @@ static int get_schema_constarints_record(THD *thd, struct st_table_list *tables,
List_iterator_fast<FOREIGN_KEY_INFO> it(f_key_list); List_iterator_fast<FOREIGN_KEY_INFO> it(f_key_list);
while ((f_key_info=it++)) while ((f_key_info=it++))
{ {
store_constarints(table, base_name, file_name, f_key_info->forein_id->str, store_constraints(table, base_name, file_name, f_key_info->forein_id->str,
strlen(f_key_info->forein_id->str), "FOREIGN KEY", 11); strlen(f_key_info->forein_id->str), "FOREIGN KEY", 11);
} }
} }
......
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