Commit 3c099551 authored by unknown's avatar unknown

Cleanups after review of WL#602

Fixed warnings from test suite
Some fixes in mysql-test-run script to catch more warnings


mysql-test/lib/mtr_report.pl:
  Catch more warnings
mysql-test/mysql-test-run.sh:
  Catch warnings from mysqld
mysql-test/t/mysqldump.test:
  Add key_block_size to catch future changes in information schema
mysys/errors.c:
  Ensure that mysql-test-run catches if we call my_close() too many times
sql/handler.cc:
  Initialize all elements
sql/log.cc:
  true -> TRUE
sql/sql_class.h:
  Review change: key_info -> key_create_info
sql/sql_lex.h:
  Review change: key_info -> key_create_info
sql/sql_table.cc:
  Review change: key_info -> key_create_info
  Don't call mysql_close() if init_ddl_log is not called.
  Better error handling in init_ddl_log
sql/sql_yacc.yy:
  Review change: key_info -> key_create_info
parent 8e2650ab
...@@ -217,7 +217,9 @@ sub mtr_report_stats ($) { ...@@ -217,7 +217,9 @@ sub mtr_report_stats ($) {
my $found_problems= 0; # Some warnings are errors... my $found_problems= 0; # Some warnings are errors...
# We report different types of problems in order # We report different types of problems in order
foreach my $pattern ( "^Warning:", "^Error:", "^==.* at 0x" ) foreach my $pattern ( "^Warning:", "^Error:", "^==.* at 0x",
"InnoDB: Warning", "missing DBUG_RETURN",
"mysqld: Warning")
{ {
foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") ) foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") )
{ {
......
...@@ -1079,7 +1079,7 @@ report_stats () { ...@@ -1079,7 +1079,7 @@ report_stats () {
found_error=0 found_error=0
# Find errors # Find errors
for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning" "missing DBUG_RETURN" for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning" "missing DBUG_RETURN" "mysqld: Warning"
do do
if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings
then then
......
...@@ -11,7 +11,7 @@ drop view if exists v1, v2, v3; ...@@ -11,7 +11,7 @@ drop view if exists v1, v2, v3;
# XML output # XML output
CREATE TABLE t1(a int); CREATE TABLE t1(a int, key (a)) key_block_size=1024;
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1 --exec $MYSQL_DUMP --skip-create --skip-comments -X test t1
DROP TABLE t1; DROP TABLE t1;
......
...@@ -39,7 +39,7 @@ const char * NEAR globerrs[GLOBERRS]= ...@@ -39,7 +39,7 @@ const char * NEAR globerrs[GLOBERRS]=
"Can't get working dirctory (Errcode: %d)", "Can't get working dirctory (Errcode: %d)",
"Can't change dir to '%s' (Errcode: %d)", "Can't change dir to '%s' (Errcode: %d)",
"Warning: '%s' had %d links", "Warning: '%s' had %d links",
"%d files and %d streams is left open\n", "Warning: %d files and %d streams is left open\n",
"Disk is full writing '%s' (Errcode: %d). Waiting for someone to free space... Retry in %d secs", "Disk is full writing '%s' (Errcode: %d). Waiting for someone to free space... Retry in %d secs",
"Can't create directory '%s' (Errcode: %d)", "Can't create directory '%s' (Errcode: %d)",
"Character set '%s' is not a compiled character set and is not specified in the '%s' file", "Character set '%s' is not a compiled character set and is not specified in the '%s' file",
...@@ -78,7 +78,7 @@ void init_glob_errs() ...@@ -78,7 +78,7 @@ void init_glob_errs()
EE(EE_GETWD) = "Can't get working dirctory (Errcode: %d)"; EE(EE_GETWD) = "Can't get working dirctory (Errcode: %d)";
EE(EE_SETWD) = "Can't change dir to '%s' (Errcode: %d)"; EE(EE_SETWD) = "Can't change dir to '%s' (Errcode: %d)";
EE(EE_LINK_WARNING) = "Warning: '%s' had %d links"; EE(EE_LINK_WARNING) = "Warning: '%s' had %d links";
EE(EE_OPEN_WARNING) = "%d files and %d streams is left open\n"; EE(EE_OPEN_WARNING) = "Warning: %d files and %d streams is left open\n";
EE(EE_DISK_FULL) = "Disk is full writing '%s'. Waiting for someone to free space..."; EE(EE_DISK_FULL) = "Disk is full writing '%s'. Waiting for someone to free space...";
EE(EE_CANT_MKDIR) ="Can't create directory '%s' (Errcode: %d)"; EE(EE_CANT_MKDIR) ="Can't create directory '%s' (Errcode: %d)";
EE(EE_UNKNOWN_CHARSET)= "Character set '%s' is not a compiled character set and is not specified in the %s file"; EE(EE_UNKNOWN_CHARSET)= "Character set '%s' is not a compiled character set and is not specified in the %s file";
......
...@@ -47,7 +47,7 @@ extern handlerton *sys_table_types[]; ...@@ -47,7 +47,7 @@ extern handlerton *sys_table_types[];
#define BITMAP_STACKBUF_SIZE (128/8) #define BITMAP_STACKBUF_SIZE (128/8)
KEY_CREATE_INFO default_key_create_info= { HA_KEY_ALG_UNDEF, 0 }; KEY_CREATE_INFO default_key_create_info= { HA_KEY_ALG_UNDEF, 0, {NullS,0} };
/* static functions defined in this file */ /* static functions defined in this file */
......
...@@ -1084,7 +1084,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, Log_event *end_ev) ...@@ -1084,7 +1084,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, Log_event *end_ev)
were, we would have to ensure that we're not ending a statement were, we would have to ensure that we're not ending a statement
inside a stored function. inside a stored function.
*/ */
thd->binlog_flush_pending_rows_event(true); thd->binlog_flush_pending_rows_event(TRUE);
error= mysql_bin_log.write(thd, trans_log, end_ev); error= mysql_bin_log.write(thd, trans_log, end_ev);
} }
else else
...@@ -1480,6 +1480,7 @@ const char *MYSQL_LOG::generate_name(const char *log_name, ...@@ -1480,6 +1480,7 @@ const char *MYSQL_LOG::generate_name(const char *log_name,
return log_name; return log_name;
} }
bool MYSQL_LOG::open_index_file(const char *index_file_name_arg, bool MYSQL_LOG::open_index_file(const char *index_file_name_arg,
const char *log_name) const char *log_name)
{ {
......
...@@ -112,7 +112,7 @@ class Key :public Sql_alloc { ...@@ -112,7 +112,7 @@ class Key :public Sql_alloc {
public: public:
enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FULLTEXT, SPATIAL, FOREIGN_KEY}; enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FULLTEXT, SPATIAL, FOREIGN_KEY};
enum Keytype type; enum Keytype type;
KEY_CREATE_INFO key_info; KEY_CREATE_INFO key_create_info;
List<key_part_spec> columns; List<key_part_spec> columns;
const char *name; const char *name;
bool generated; bool generated;
...@@ -120,8 +120,8 @@ public: ...@@ -120,8 +120,8 @@ public:
Key(enum Keytype type_par, const char *name_arg, Key(enum Keytype type_par, const char *name_arg,
KEY_CREATE_INFO *key_info_arg, KEY_CREATE_INFO *key_info_arg,
bool generated_arg, List<key_part_spec> &cols) bool generated_arg, List<key_part_spec> &cols)
:type(type_par), key_info(*key_info_arg), columns(cols), name(name_arg), :type(type_par), key_create_info(*key_info_arg), columns(cols),
generated(generated_arg) name(name_arg), generated(generated_arg)
{} {}
~Key() {} ~Key() {}
/* Equality comparison of keys (ignoring name) */ /* Equality comparison of keys (ignoring name) */
......
...@@ -840,7 +840,7 @@ typedef struct st_lex ...@@ -840,7 +840,7 @@ typedef struct st_lex
udf_func udf; udf_func udf;
HA_CHECK_OPT check_opt; // check/repair options HA_CHECK_OPT check_opt; // check/repair options
HA_CREATE_INFO create_info; HA_CREATE_INFO create_info;
KEY_CREATE_INFO key_info; KEY_CREATE_INFO key_create_info;
LEX_MASTER_INFO mi; // used by CHANGE MASTER LEX_MASTER_INFO mi; // used by CHANGE MASTER
USER_RESOURCES mqh; USER_RESOURCES mqh;
ulong type; ulong type;
......
...@@ -231,7 +231,7 @@ static int mysql_copy_key_list(List<Key> *orig_key, ...@@ -231,7 +231,7 @@ static int mysql_copy_key_list(List<Key> *orig_key,
} }
} }
if (!(temp_key= new Key(prep_key->type, prep_key->name, if (!(temp_key= new Key(prep_key->type, prep_key->name,
&prep_key->key_info, &prep_key->key_create_info,
prep_key->generated, prep_key->generated,
prep_columns))) prep_columns)))
{ {
...@@ -507,12 +507,14 @@ bool read_ddl_log_entry(uint read_entry, DDL_LOG_ENTRY *ddl_log_entry) ...@@ -507,12 +507,14 @@ bool read_ddl_log_entry(uint read_entry, DDL_LOG_ENTRY *ddl_log_entry)
Initialise ddl log Initialise ddl log
SYNOPSIS SYNOPSIS
init_ddl_log() init_ddl_log()
RETURN VALUES
TRUE Error
FALSE Success
DESCRIPTION DESCRIPTION
Write the header of the ddl log file and length of names. Also set Write the header of the ddl log file and length of names. Also set
number of entries to zero. number of entries to zero.
RETURN VALUES
TRUE Error
FALSE Success
*/ */
static bool init_ddl_log() static bool init_ddl_log()
...@@ -522,9 +524,8 @@ static bool init_ddl_log() ...@@ -522,9 +524,8 @@ static bool init_ddl_log()
DBUG_ENTER("init_ddl_log"); DBUG_ENTER("init_ddl_log");
if (global_ddl_log.inited) if (global_ddl_log.inited)
{ goto end;
DBUG_RETURN(FALSE);
}
global_ddl_log.io_size= IO_SIZE; global_ddl_log.io_size= IO_SIZE;
create_ddl_log_file_name(file_name); create_ddl_log_file_name(file_name);
if ((global_ddl_log.file_id= my_create(file_name, if ((global_ddl_log.file_id= my_create(file_name,
...@@ -539,9 +540,12 @@ static bool init_ddl_log() ...@@ -539,9 +540,12 @@ static bool init_ddl_log()
global_ddl_log.inited= TRUE; global_ddl_log.inited= TRUE;
if (write_ddl_log_header()) if (write_ddl_log_header())
{ {
VOID(my_close(global_ddl_log.file_id, MYF(MY_WME)));
global_ddl_log.inited= FALSE; global_ddl_log.inited= FALSE;
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
end:
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
...@@ -1129,7 +1133,11 @@ void release_ddl_log() ...@@ -1129,7 +1133,11 @@ void release_ddl_log()
my_free((char*)free_list, MYF(0)); my_free((char*)free_list, MYF(0));
free_list= tmp; free_list= tmp;
} }
VOID(my_close(global_ddl_log.file_id, MYF(0))); if (global_ddl_log.inited)
{
global_ddl_log.inited= 0;
VOID(my_close(global_ddl_log.file_id, MYF(MY_WME)));
}
pthread_mutex_unlock(&LOCK_gdl); pthread_mutex_unlock(&LOCK_gdl);
VOID(pthread_mutex_destroy(&LOCK_gdl)); VOID(pthread_mutex_destroy(&LOCK_gdl));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -2500,7 +2508,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -2500,7 +2508,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
break; break;
case Key::FULLTEXT: case Key::FULLTEXT:
key_info->flags= HA_FULLTEXT; key_info->flags= HA_FULLTEXT;
if ((key_info->parser_name= &key->key_info.parser_name)->str) if ((key_info->parser_name= &key->key_create_info.parser_name)->str)
key_info->flags|= HA_USES_PARSER; key_info->flags|= HA_USES_PARSER;
else else
key_info->parser_name= 0; key_info->parser_name= 0;
...@@ -2527,7 +2535,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -2527,7 +2535,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
key_info->key_parts=(uint8) key->columns.elements; key_info->key_parts=(uint8) key->columns.elements;
key_info->key_part=key_part_info; key_info->key_part=key_part_info;
key_info->usable_key_parts= key_number; key_info->usable_key_parts= key_number;
key_info->algorithm= key->key_info.algorithm; key_info->algorithm= key->key_create_info.algorithm;
if (key->type == Key::FULLTEXT) if (key->type == Key::FULLTEXT)
{ {
...@@ -2578,8 +2586,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -2578,8 +2586,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
TODO: Add warning if block size changes. We can't do it here, as TODO: Add warning if block size changes. We can't do it here, as
this may depend on the size of the key this may depend on the size of the key
*/ */
key_info->block_size= (key->key_info.block_size ? key_info->block_size= (key->key_create_info.block_size ?
key->key_info.block_size : key->key_create_info.block_size :
create_info->key_block_size); create_info->key_block_size);
if (key_info->block_size) if (key_info->block_size)
...@@ -5476,7 +5484,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -5476,7 +5484,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
while ((prep_col= prep_col_it++)) while ((prep_col= prep_col_it++))
prep_columns.push_back(new key_part_spec(*prep_col)); prep_columns.push_back(new key_part_spec(*prep_col));
prepared_key_list.push_back(new Key(prep_key->type, prep_key->name, prepared_key_list.push_back(new Key(prep_key->type, prep_key->name,
&prep_key->key_info, &prep_key->key_create_info,
prep_key->generated, prep_columns)); prep_key->generated, prep_columns));
} }
......
...@@ -1239,12 +1239,12 @@ create: ...@@ -1239,12 +1239,12 @@ create:
'(' key_list ')' key_options '(' key_list ')' key_options
{ {
LEX *lex=Lex; LEX *lex=Lex;
if ($2 != Key::FULLTEXT && lex->key_info.parser_name.str) if ($2 != Key::FULLTEXT && lex->key_create_info.parser_name.str)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
lex->key_list.push_back(new Key($2, $4.str, &lex->key_info, 0, lex->key_list.push_back(new Key($2, $4.str, &lex->key_create_info, 0,
lex->col_list)); lex->col_list));
lex->col_list.empty(); lex->col_list.empty();
} }
...@@ -3996,12 +3996,12 @@ key_def: ...@@ -3996,12 +3996,12 @@ key_def:
key_type opt_ident key_alg '(' key_list ')' key_options key_type opt_ident key_alg '(' key_list ')' key_options
{ {
LEX *lex=Lex; LEX *lex=Lex;
if ($1 != Key::FULLTEXT && lex->key_info.parser_name.str) if ($1 != Key::FULLTEXT && lex->key_create_info.parser_name.str)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
lex->key_list.push_back(new Key($1,$2, &lex->key_info, 0, lex->key_list.push_back(new Key($1,$2, &lex->key_create_info, 0,
lex->col_list)); lex->col_list));
lex->col_list.empty(); /* Alloced by sql_alloc */ lex->col_list.empty(); /* Alloced by sql_alloc */
} }
...@@ -4010,7 +4010,7 @@ key_def: ...@@ -4010,7 +4010,7 @@ key_def:
{ {
LEX *lex=Lex; LEX *lex=Lex;
const char *key_name= $3 ? $3 : $1; const char *key_name= $3 ? $3 : $1;
lex->key_list.push_back(new Key($2, key_name, &lex->key_info, 0, lex->key_list.push_back(new Key($2, key_name, &lex->key_create_info, 0,
lex->col_list)); lex->col_list));
lex->col_list.empty(); /* Alloced by sql_alloc */ lex->col_list.empty(); /* Alloced by sql_alloc */
} }
...@@ -4516,12 +4516,12 @@ opt_unique_or_fulltext: ...@@ -4516,12 +4516,12 @@ opt_unique_or_fulltext:
init_key_options: init_key_options:
{ {
Lex->key_info= default_key_create_info; Lex->key_create_info= default_key_create_info;
} }
; ;
/* /*
For now, key_alg initializies lex->key_info. For now, key_alg initializies lex->key_create_info.
In the future, when all key options are after key definition, In the future, when all key options are after key definition,
we can remove key_alg and move init_key_options to key_options we can remove key_alg and move init_key_options to key_options
*/ */
...@@ -4542,14 +4542,14 @@ key_opts: ...@@ -4542,14 +4542,14 @@ key_opts:
; ;
key_opt: key_opt:
USING opt_btree_or_rtree { Lex->key_info.algorithm= $2; } USING opt_btree_or_rtree { Lex->key_create_info.algorithm= $2; }
| TYPE_SYM opt_btree_or_rtree { Lex->key_info.algorithm= $2; } | TYPE_SYM opt_btree_or_rtree { Lex->key_create_info.algorithm= $2; }
| KEY_BLOCK_SIZE opt_equal ulong_num | KEY_BLOCK_SIZE opt_equal ulong_num
{ Lex->key_info.block_size= $3; } { Lex->key_create_info.block_size= $3; }
| WITH PARSER_SYM IDENT_sys | WITH PARSER_SYM IDENT_sys
{ {
if (plugin_is_ready(&$3, MYSQL_FTPARSER_PLUGIN)) if (plugin_is_ready(&$3, MYSQL_FTPARSER_PLUGIN))
Lex->key_info.parser_name= $3; Lex->key_create_info.parser_name= $3;
else else
{ {
my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), $3.str); my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), $3.str);
......
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