Commit c2593d33 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 903fa3c4
......@@ -217,7 +217,9 @@ sub mtr_report_stats ($) {
my $found_problems= 0; # Some warnings are errors...
# 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") )
{
......
......@@ -1079,7 +1079,7 @@ report_stats () {
found_error=0
# 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
if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings
then
......
......@@ -11,7 +11,7 @@ drop view if exists v1, v2, v3;
# XML output
CREATE TABLE t1(a int);
CREATE TABLE t1(a int, key (a)) key_block_size=1024;
INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1
DROP TABLE t1;
......
......@@ -39,7 +39,7 @@ const char * NEAR globerrs[GLOBERRS]=
"Can't get working dirctory (Errcode: %d)",
"Can't change dir to '%s' (Errcode: %d)",
"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",
"Can't create directory '%s' (Errcode: %d)",
"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()
EE(EE_GETWD) = "Can't get working dirctory (Errcode: %d)";
EE(EE_SETWD) = "Can't change dir to '%s' (Errcode: %d)";
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_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";
......
......@@ -47,7 +47,7 @@ extern handlerton *sys_table_types[];
#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 */
......
......@@ -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
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);
}
else
......@@ -1480,6 +1480,7 @@ const char *MYSQL_LOG::generate_name(const char *log_name,
return log_name;
}
bool MYSQL_LOG::open_index_file(const char *index_file_name_arg,
const char *log_name)
{
......
......@@ -112,7 +112,7 @@ class Key :public Sql_alloc {
public:
enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FULLTEXT, SPATIAL, FOREIGN_KEY};
enum Keytype type;
KEY_CREATE_INFO key_info;
KEY_CREATE_INFO key_create_info;
List<key_part_spec> columns;
const char *name;
bool generated;
......@@ -120,8 +120,8 @@ class Key :public Sql_alloc {
Key(enum Keytype type_par, const char *name_arg,
KEY_CREATE_INFO *key_info_arg,
bool generated_arg, List<key_part_spec> &cols)
:type(type_par), key_info(*key_info_arg), columns(cols), name(name_arg),
generated(generated_arg)
:type(type_par), key_create_info(*key_info_arg), columns(cols),
name(name_arg), generated(generated_arg)
{}
~Key() {}
/* Equality comparison of keys (ignoring name) */
......
......@@ -840,7 +840,7 @@ typedef struct st_lex
udf_func udf;
HA_CHECK_OPT check_opt; // check/repair options
HA_CREATE_INFO create_info;
KEY_CREATE_INFO key_info;
KEY_CREATE_INFO key_create_info;
LEX_MASTER_INFO mi; // used by CHANGE MASTER
USER_RESOURCES mqh;
ulong type;
......
......@@ -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,
&prep_key->key_info,
&prep_key->key_create_info,
prep_key->generated,
prep_columns)))
{
......@@ -507,12 +507,14 @@ bool read_ddl_log_entry(uint read_entry, DDL_LOG_ENTRY *ddl_log_entry)
Initialise ddl log
SYNOPSIS
init_ddl_log()
RETURN VALUES
TRUE Error
FALSE Success
DESCRIPTION
Write the header of the ddl log file and length of names. Also set
number of entries to zero.
RETURN VALUES
TRUE Error
FALSE Success
*/
static bool init_ddl_log()
......@@ -522,9 +524,8 @@ static bool init_ddl_log()
DBUG_ENTER("init_ddl_log");
if (global_ddl_log.inited)
{
DBUG_RETURN(FALSE);
}
goto end;
global_ddl_log.io_size= IO_SIZE;
create_ddl_log_file_name(file_name);
if ((global_ddl_log.file_id= my_create(file_name,
......@@ -539,9 +540,12 @@ static bool init_ddl_log()
global_ddl_log.inited= TRUE;
if (write_ddl_log_header())
{
VOID(my_close(global_ddl_log.file_id, MYF(MY_WME)));
global_ddl_log.inited= FALSE;
DBUG_RETURN(TRUE);
}
end:
DBUG_RETURN(FALSE);
}
......@@ -1129,7 +1133,11 @@ void release_ddl_log()
my_free((char*)free_list, MYF(0));
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);
VOID(pthread_mutex_destroy(&LOCK_gdl));
DBUG_VOID_RETURN;
......@@ -2500,7 +2508,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
break;
case Key::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;
else
key_info->parser_name= 0;
......@@ -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_part=key_part_info;
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)
{
......@@ -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
this may depend on the size of the key
*/
key_info->block_size= (key->key_info.block_size ?
key->key_info.block_size :
key_info->block_size= (key->key_create_info.block_size ?
key->key_create_info.block_size :
create_info->key_block_size);
if (key_info->block_size)
......@@ -5476,7 +5484,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
while ((prep_col= prep_col_it++))
prep_columns.push_back(new key_part_spec(*prep_col));
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));
}
......
......@@ -1239,12 +1239,12 @@ create:
'(' key_list ')' key_options
{
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));
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.empty();
}
......@@ -3996,12 +3996,12 @@ key_def:
key_type opt_ident key_alg '(' key_list ')' key_options
{
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));
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.empty(); /* Alloced by sql_alloc */
}
......@@ -4010,7 +4010,7 @@ key_def:
{
LEX *lex=Lex;
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.empty(); /* Alloced by sql_alloc */
}
......@@ -4516,12 +4516,12 @@ opt_unique_or_fulltext:
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,
we can remove key_alg and move init_key_options to key_options
*/
......@@ -4542,14 +4542,14 @@ key_opts:
;
key_opt:
USING opt_btree_or_rtree { Lex->key_info.algorithm= $2; }
| TYPE_SYM 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_create_info.algorithm= $2; }
| 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
{
if (plugin_is_ready(&$3, MYSQL_FTPARSER_PLUGIN))
Lex->key_info.parser_name= $3;
Lex->key_create_info.parser_name= $3;
else
{
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